
# Disclaimers
The information presented by the authors of this documentation were either background knowledge, knowledge provided by community members, or knowledge learned from works published by community members.

The authors try to make sure that the information presented is correct. However, there might be incorrect info, or outdated info.

The authors try to acknowledge and credit the community members who share knowledge, develop tools, host resources, or helped in any other way, but there might be some missing credit. If that were the case, please know that it is not intended by the authors, and please contact the authors for proper credit.

The knowledge, tools, resources used by this documentation are acquired and presented with a good faith basis. While the authors try to ask creators for permission to use or feature their works, some works was used or featured without explicit permission. If you have problem with your works being mentioned / features, or your name being credited, please contact the authors to sort things out.

# Intents
This documentation will go somewhat in depth to the technical side, so for experienced audience, it can serve as a quick introduction to the working of the game and server. Do note that the provided packages might not work for you, however, the details explanation should give you want you need to get things working. Regardless, feel free to reach out to the community, both to help resolve your situation and to help make the documentation better.

This documentation will be about hosting and playing your own SIFAS server, more precisely, how to do so in general. For specific implementations of private server, we will only provide link to them or their documentation. This documentation will also discuss only the GL (Global) and JP (Japanese) version, although there exist private server for CN (Chinese) version as well.

<!-- This documentation assume that you have some background knowledge related to the topic discussed, however, if this is your first time doing something like this, or you just want to learn more, you can also checkout the [Random knowledge](#random-knowledge) section. Various things that are common knowledge, things that are related and interesting (but not totally relevant to the discussion) are discussed. -->
This documentation assume that you have some background knowledge related to the topic discussed. If this is your first time doing something like this, you will have to search up relevant information, or reach out to the community for help. 

# Convention
As there are multiple platforms for both client and server, we use the following terms to refer to them:

- Client: The game/app itself. This is what you will use to play the game.
- Server: The program that serve the necessary data for client(s) to function. This was Klab/MYNET/Bushiroad responsibility, but we will have to run our own server now that they have stoped supporting the game. The server often run in another machine, but there are setup that run the client and server on the same machine for android.
- Android/iOS/android/ios: The platform that the client run on. You should know what your platform is.
- Window/Linux/MacOS/Android: The platform that the server will run on.

# Preparing the client
## Clients version
We will be using the 3.12 clients:

- If you can't recall, these are released after the game is dead.
- The only functionality is to show a "SIFAS EoS, thanks for playing SIFAS" message, or so it seems.
- The truth is that, none of the original functionality was deleted, but the crack-proof is removed.
- Which mean that if we patch the starting screen away, we have access to a superior version of the app.
- You can learn how to do so [here](apk-patching.md).

## Premade clients
### Android
You can download the apks from [here](https://github.com/arina999999997/elichika/releases/tag/clients). This should work with both 32 bit and 64 bit devices.

These clients connect to http://127.0.0.1:8080, and is mainly designed to work for [elichika](https://github.com/arina999999997/elichika/). However, you can modified them to work for other servers if necessary (see [patching apks](apk-patching.md) for details).

### Patching ios client to new address
The `.ipa` files do not need to be patched thanks to tri.angle in the discord server. You can just sideload the app and change the server url in setting.

You can download the `ipa` files from [here](https://mega.nz/folder/klACSZzC#Lxv3m-Gq8_7FF_4pcr4X8A).
These `.ipa` files do not enable http servers by default, you will need to modify `Info.plist` using [ProperTree](https://github.com/corpnewt/ProperTree) and enable `NSAllowsArbitraryLoads`, or for your convinience a pre-patched `ipa` with http support enabled can be downloaded [here](https://ethanthesleepy.one/public/lovelive/jp_allstars_3_12_0.ipa).

Note: currently the global version indefinitely loads for no apparent reason. It may not work.

# Preparing the server
You need to pick an implemtentation or make your own.

## Elichika servers
[elichika](https://github.com/YumeMichi/elichika) is a SIFAS private server written by `YumeMichi` (`.yumemichi` on discord).

However, it's recommended to use the [forked elichika](https://github.com/arina999999997/elichika/) that are much easier to setup and has more features and more to come. Refer to the github repository for server-specific details.

## Other servers
Currently there are no public "non-elichika" private server implementation that we know of. If you are working on your own implementation and want to share it, please reach out to the LL Hax discord.

# Operating the server
These are some knowledge necessary to operate the server.

## Patching the database
The client will download the database directly from your server after it successfully connected.

The details on how to patch them is complicated and contains weird cryptography stuff.

The [forked elichika](https://github.com/arina999999997/elichika/) handle this automatically, you can look into how it does that for details.

## Providing a CDN server
A CDN (content distribution network) server is where the game(app) will download the necessary files (i.e. songs, stories). No matter what server implementation you use, you will need a CDN host.

More precisely, the client will request the link to download assets at `/asset/getPackUrl`, and you will have to response with the correct link to download them. There is no restriction to where the client will download the file from, so you can link to any server.

### Online CDN
Thanks to `sarah` (`sarayalth`) from the LL Hax discord, there is a CDN that we can use to avoid hosting our own files.

The server is at [https://llsifas.catfolk.party/static](https://llsifas.catfolk.party/static) or [https://llsifas.imsofucking.gay/static](https://llsifas.imsofucking.gay/static).

You can get the files in `static/2d61e7b4e89961c7` for GL files or `static/b66ec2295e9a00aa` for JP files.

### Self hosted CDN
If you don't want to use the online CDN, you can download the data and host it yourself.

The data is around 20GB for both GL and JP server (around 40GB for both).

One way to get them is from [archive.org](https://archive.org/details/ll-sifas-cdn-data). The direct downloading speed is not that great, so be prepared to leave your machine on for a very long time. If you don't want that, download using the `.torrent`, it would be much appreciated if you also host the files once downloaded. Do note that there are risks associated with torrenting, but that topic will not be discussed here.

Another way to get them is from extracting the downloaded game files or download the files yourself from the online CDN.

You can also try to extract the relevant files from a client where you have the file downloaded. To extract the files, use [this youtube tutorial](https://youtu.be/j4oh3qrCrfw), or any other methods you know.
