From b31b7c794c0695933b57ee6f09e59c8316517f2a Mon Sep 17 00:00:00 2001 From: Cadence Ember Date: Tue, 19 Sep 2023 15:55:05 +1200 Subject: [PATCH] rearrange documentation into folder --- db/ooye-schema.sql | 16 ++++++--- notes.md => docs/notes.md | 14 +++++--- reply-line.svg => docs/reply-line.svg | 0 docs/simplified-homeserver-setup.md | 49 +++++++++++++++++++++++++++ 4 files changed, 69 insertions(+), 10 deletions(-) rename notes.md => docs/notes.md (95%) rename reply-line.svg => docs/reply-line.svg (100%) create mode 100644 docs/simplified-homeserver-setup.md diff --git a/db/ooye-schema.sql b/db/ooye-schema.sql index 1bf1700..2e1cb03 100644 --- a/db/ooye-schema.sql +++ b/db/ooye-schema.sql @@ -1,14 +1,14 @@ BEGIN TRANSACTION; CREATE TABLE IF NOT EXISTS "sim" ( - "discord_id" TEXT NOT NULL UNIQUE, + "discord_id" TEXT NOT NULL, "sim_name" TEXT NOT NULL UNIQUE, - "localpart" TEXT NOT NULL UNIQUE, - "mxid" TEXT NOT NULL UNIQUE, + "localpart" TEXT NOT NULL, + "mxid" TEXT NOT NULL, PRIMARY KEY("discord_id") ); CREATE TABLE IF NOT EXISTS "webhook" ( - "channel_id" TEXT NOT NULL UNIQUE, - "webhook_id" TEXT NOT NULL UNIQUE, + "channel_id" TEXT NOT NULL, + "webhook_id" TEXT NOT NULL, "webhook_token" TEXT NOT NULL, PRIMARY KEY("channel_id") ); @@ -63,4 +63,10 @@ CREATE TABLE IF NOT EXISTS "lottie" ( "mxc" TEXT NOT NULL, PRIMARY KEY("id") ) WITHOUT ROWID; +CREATE TABLE IF NOT EXISTS "emoji" ( + "emoji_id" TEXT NOT NULL, + "animated" INTEGER NOT NULL, + "mxc_url" TEXT NOT NULL, + PRIMARY KEY("emoji_id") +) WITHOUT ROWID; COMMIT; diff --git a/notes.md b/docs/notes.md similarity index 95% rename from notes.md rename to docs/notes.md index 397535a..1449c24 100644 --- a/notes.md +++ b/docs/notes.md @@ -157,7 +157,11 @@ Can use custom transaction ID (?) to send the original timestamps to Matrix. See 2. Create or replace state event for the bridged pack. (Can just use key "ooye" and display name "Discord", or something, for this pack.) 3. The emojis may now be sent by Matrix users! -TOSPEC: m2d emoji uploads?? +``` +pragma case_sensitive_like = 1; +insert into emoji select replace(substr(discord_url, 35), ".gif", "") as emoji_id, 1 as animated, mxc_url from file where discord_url like 'https://cdn.discordapp.com/emojis/%.gif'; +insert into emoji select replace(substr(discord_url, 35), ".png", "") as emoji_id, 0 as animated, mxc_url from file where discord_url like 'https://cdn.discordapp.com/emojis/%.png'; +``` # Various considerations @@ -171,10 +175,6 @@ TOSPEC: m2d emoji uploads?? - Sims will already be registered, registration will fail, all events from those sims will fail. -### sim_member table - -- Sims won't be invited because they are already joined, all events from those sims will fail. - ### guild_space table - channelToKState will fail, so channel data differences won't be calculated, so channel/thread creation and sync will fail. @@ -195,6 +195,10 @@ TOSPEC: m2d emoji uploads?? - Some duplicate webhooks may be created. +### sim_member table + +- Some sims will try to re-join the room, which is slow the first time. + ## Creating and notifying about new threads: Discord's gateway events when a thread is created off a message: diff --git a/reply-line.svg b/docs/reply-line.svg similarity index 100% rename from reply-line.svg rename to docs/reply-line.svg diff --git a/docs/simplified-homeserver-setup.md b/docs/simplified-homeserver-setup.md new file mode 100644 index 0000000..3368605 --- /dev/null +++ b/docs/simplified-homeserver-setup.md @@ -0,0 +1,49 @@ +# Simplified Homeserver Setup + +Full instructions are located around here: https://matrix-org.github.io/synapse/v1.37/setup/installation.html + +These instructions are for a quick setup you can use for local development of OOYE, if you don't have administrator access to an existing homeserver. + +## Windows prerequisites + +Enter an Ubuntu WSL. LOL + +## Install Synapse + +We'll install from the prebuilt packages provided by matrix.org. If you're not on Debian/Ubuntu then you can find more package names [in the official docs.](https://matrix-org.github.io/synapse/v1.37/setup/installation.html#prebuilt-packages) + +``` +sudo apt install -y lsb-release wget apt-transport-https +sudo wget -O /usr/share/keyrings/matrix-org-archive-keyring.gpg https://packages.matrix.org/debian/matrix-org-archive-keyring.gpg +echo "deb [signed-by=/usr/share/keyrings/matrix-org-archive-keyring.gpg] https://packages.matrix.org/debian/ $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/matrix-org.list +sudo apt update +sudo apt install matrix-synapse-py3 +``` + +After the final command finishes downloading, it will interactively prompt you for the homeserver's name for federation. Just enter `localhost`. +If you want to change this later, you can do so with `sudo dpkg-reconfigure matrix-synapse-py3`. + +## Not installing additional features + +We're going to stick with SQLite, which isn't as efficient as Postgres, but significantly eases setup. For this small test, SQLite should do just fine. + +We don't need TLS certificates for localhost. + +## Start it on Linux + +``` +sudo systemctl start matrix-synapse +``` + +## Start it on Windows + +Trying to start it with systemctl doesn't seem to like me, so I'll do it this way: + +``` +sudo /opt/venvs/matrix-synapse/bin/python -m synapse.app.homeserver --config-path=/etc/matrix-synapse/homeserver.yaml --config-path=/etc/matrix-synapse/conf.d/ --generate-keys +sudo /opt/venvs/matrix-synapse/bin/python -m synapse.app.homeserver --config-path=/etc/matrix-synapse/homeserver.yaml --config-path=/etc/matrix-synapse/conf.d/ +``` + +## Notes + +If you see `Config is missing macaroon_secret_key`, you can ignore this. The real log messages are in `/var/log/matrix-synapse/*.log`.