docs(frontend): 📝 Add docs on how to enable the use of the glitch-soc

This commit is contained in:
Jesse Wierzbinski 2024-04-16 11:34:21 -10:00
parent d441fca1a1
commit fc4e0d1958
No known key found for this signature in database
3 changed files with 45 additions and 1 deletions

1
.gitignore vendored
View file

@ -178,3 +178,4 @@ config/extended_description_test.md
glitch-old glitch-old
glitch glitch
glitch.tar.gz glitch.tar.gz
glitch-dev

38
docs/glitch-soc.md Normal file
View file

@ -0,0 +1,38 @@
# Enabling Glitch-Soc
Lysand supports the use of the Glitch-Soc fork of Mastodon's frontend. Here's how to do it:
1. Download the latest Glitch FE package from [the releases page](https://github.com/lysand-org/lysand/releases) (it should be named `glitch.tar.gz` and be inside the assets of a normal Lysand release).
2. Extract the contents of the package into a folder, which you can name `glitch` for simplicity. (if using Docker, now is the time to mount that folder into the container, for example with `-v /path/to/glitch:/app/dist/glitch`)
3. Change the config to enable Glitch-FE:
```toml
[frontend]
# Enable custom frontends (warning: not enabling this or Glitch will make Lysand only accessible via the Mastodon API)
enabled = false
# The URL to reach the frontend at (should be on a local network)
url = "http://localhost:3000"
[frontend.glitch]
# Enable the Glitch frontend integration
enabled = true
# Glitch assets folder
assets = "glitch"
# Server the assets were ripped from (and any eventual CDNs)
server = ["https://tech.lgbt"]
```
(you can disable the normal frontend option as it will not be used anymore)
The `server` option can be left as-is, unless you have downloaded your own `index.html` file from a different Glitch instance.
4. Start Lysand and navigate to `/` to see the Glitch frontend in action.
## How is this package created?
Glitch-FE is a React single-page app, which dynamically creates an `index.html` file on every request and builds all the other assets at build time.
The package static files were taken from a build of Glitch-Soc, while the index.html file was taken from [the tech.lgbt instance](https://tech.lgbt) with `cURL`.
Then, the paths in the `index.html` file were replaced with the correct paths for the static files (as they have different hashes in their names from the ones in the Glitch-Soc build).
At runtime, Lysand dynamically edits the index.html file to replace the content with correct data, as well as disabling `integrity` checks on the script/link tags.
In the future, I'll find a way to make this less hacky and more user-friendly, but for now, this is the best I can do.

View file

@ -75,6 +75,11 @@ You may use the environment variables `NO_COLORS=true` and `NO_FANCY_DATES=true`
Please see the [CLI documentation](cli.md) for more information on how to use the CLI. Please see the [CLI documentation](cli.md) for more information on how to use the CLI.
> [!NOTE]
> You might be interested in running the [Glitch-Soc](glitch-soc.md) frontend, which is a fork of Mastodon's frontend with additional features.
>
> This is possible by following the instructions in [this file](glitch-soc.md).
### Updating the server ### Updating the server
Updating the server is as simple as pulling the latest changes from the repository and running `bun prod-build` again. You may need to run `bun install` again if there are new dependencies. Updating the server is as simple as pulling the latest changes from the repository and running `bun prod-build` again. You may need to run `bun install` again if there are new dependencies.