From fc4e0d195857d65bd6eba2cf6a55f972fd43d9a3 Mon Sep 17 00:00:00 2001 From: Jesse Wierzbinski Date: Tue, 16 Apr 2024 11:34:21 -1000 Subject: [PATCH] docs(frontend): :memo: Add docs on how to enable the use of the glitch-soc --- .gitignore | 3 ++- docs/glitch-soc.md | 38 ++++++++++++++++++++++++++++++++++++++ docs/installation.md | 5 +++++ 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 docs/glitch-soc.md diff --git a/.gitignore b/.gitignore index 0a63da8b..be181615 100644 --- a/.gitignore +++ b/.gitignore @@ -177,4 +177,5 @@ build config/extended_description_test.md glitch-old glitch -glitch.tar.gz \ No newline at end of file +glitch.tar.gz +glitch-dev \ No newline at end of file diff --git a/docs/glitch-soc.md b/docs/glitch-soc.md new file mode 100644 index 00000000..0614999c --- /dev/null +++ b/docs/glitch-soc.md @@ -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. \ No newline at end of file diff --git a/docs/installation.md b/docs/installation.md index 3b257197..85d42d03 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -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. +> [!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 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.