From 1d7ec4315ed046cd6ba2f0215e8171a0dde42638 Mon Sep 17 00:00:00 2001 From: Cadence Ember Date: Mon, 16 Oct 2023 00:12:00 +1300 Subject: [PATCH] Support alternate Discord hosts --- d2m/discord-client.js | 6 +++++- registration.example.yaml | 2 ++ types.d.ts | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/d2m/discord-client.js b/d2m/discord-client.js index b1a1e81..6597889 100644 --- a/d2m/discord-client.js +++ b/d2m/discord-client.js @@ -1,8 +1,12 @@ // @ts-check -const { SnowTransfer } = require("snowtransfer") +const registration = require("../matrix/read-registration") +const { Endpoints, SnowTransfer } = require("snowtransfer") const { Client: CloudStorm } = require("cloudstorm") +// @ts-ignore +Endpoints.BASE_HOST = registration.ooye.discord_origin; Endpoints.CDN_URL = registration.ooye.discord_cdn_origin + const passthrough = require("../passthrough") const { sync } = passthrough diff --git a/registration.example.yaml b/registration.example.yaml index 9e7cd2c..879081d 100644 --- a/registration.example.yaml +++ b/registration.example.yaml @@ -18,6 +18,8 @@ ooye: max_file_size: 5000000 server_name: [the part after the colon in your matrix id, like cadence.moe] server_origin: [the full protocol and domain of your actual matrix server's location, with no trailing slash, like https://matrix.cadence.moe] + discord_origin: https://discord.com + discord_cdn_origin: https://cdn.discordapp.com invite: # uncomment this to auto-invite the named user to newly created spaces and mark them as admin (PL 100) everywhere # - @cadence:cadence.moe diff --git a/types.d.ts b/types.d.ts index e93f379..656c22a 100644 --- a/types.d.ts +++ b/types.d.ts @@ -21,6 +21,8 @@ export type AppServiceRegistrationConfig = { max_file_size: number server_name: string server_origin: string + discord_origin: string + discord_cdn_origin: string invite: string[] } old_bridge?: {