MegaAntiCheat / client-backend

GNU General Public License v3.0
117 stars 24 forks source link

Add flag to serve files from a directory #138

Closed Seercat3160 closed 4 months ago

Seercat3160 commented 4 months ago

I've added the launch option --web-dir which takes a path as an argument. Using it, the client-backend will serve files for the Web UI from there, rather than using the files bundled into the executable at build time.

This, as well as providing better support for custom UIs chosen by users, lays the groundwork for having some external program manage the client-backend and webui versions separately, downloading the binary packages of each from GitHub releases, without having to recompile the client-backend each time the webui is updated. This is probably the best way to ship the client to non-technical users, as they would simply install the launcher and it would take care of all the components needed. (I'm already working on this in a private repo btw - dev team, we can talk more about this later if you want)

As always, feel free to talk to me here or on the Discord regarding this PR.

Seercat3160 commented 4 months ago

How does this look?

I've added conditional compilation (the include-ui Cargo feature) for whether we bundle UI files, but I've done it in a way that means no changes are needed to anyone's workflow. If ./ui/index.html exists, ./ui/ is automatically bundled. If not, it isn't. I feel this is a sensible way of doing it, so if there's no UI present at build time the client actually gives useful info about that. It also means that no changes are needed to get the best outcome in #139.