From 4705b022723290a8e4402945f9cf4c75da2331a3 Mon Sep 17 00:00:00 2001 From: sefidel Date: Sat, 17 Feb 2024 15:27:34 +0900 Subject: feat(modules/matrix-bridge): use exotic.sh assets on matrix-appservice-discord --- .../matrix-bridge/0001-use-exotic.sh-assets.patch | 54 ++++++++++++++++++++++ modules/services/matrix-bridge/default.nix | 4 ++ 2 files changed, 58 insertions(+) create mode 100644 modules/services/matrix-bridge/0001-use-exotic.sh-assets.patch (limited to 'modules/services/matrix-bridge') diff --git a/modules/services/matrix-bridge/0001-use-exotic.sh-assets.patch b/modules/services/matrix-bridge/0001-use-exotic.sh-assets.patch new file mode 100644 index 0000000..abc4652 --- /dev/null +++ b/modules/services/matrix-bridge/0001-use-exotic.sh-assets.patch @@ -0,0 +1,54 @@ +From 4ef64295d3db3e4390a09ad25b2d3fba2372e570 Mon Sep 17 00:00:00 2001 +From: sefidel +Date: Sat, 17 Feb 2024 14:39:42 +0900 +Subject: [PATCH] use exotic.sh assets + +Signed-off-by: sefidel +--- + src/bot.ts | 2 +- + src/discordas.ts | 2 ++ + src/matrixroomhandler.ts | 2 +- + 3 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/src/bot.ts b/src/bot.ts +index fc575cd..04b2a53 100644 +--- a/src/bot.ts ++++ b/src/bot.ts +@@ -49,7 +49,7 @@ const INITIAL_FALLOFF_SECONDS = 5; + const MAX_FALLOFF_SECONDS = 5 * 60; // 5 minutes + + // TODO: This is bad. We should be serving the icon from the own homeserver. +-const MATRIX_ICON_URL = "https://matrix.org/_matrix/media/r0/download/matrix.org/mlxoESwIsTbJrfXyAAogrNxA"; ++const MATRIX_ICON_URL = "https://matrix.exotic.sh/_matrix/media/r0/download/matrix.org/mlxoESwIsTbJrfXyAAogrNxA"; + class ChannelLookupResult { + public channel: Discord.TextChannel; + public botUser: boolean; +diff --git a/src/discordas.ts b/src/discordas.ts +index baebd98..fc9bcce 100644 +--- a/src/discordas.ts ++++ b/src/discordas.ts +@@ -226,6 +226,8 @@ async function run(): Promise { + } + + await appservice.begin(); ++ await appservice.botClient.setDisplayName("Discord Bridge"); ++ await appservice.botClient.setAvatarUrl("mxc://exotic.sh/ludtHHPdrAzjckEyUNCWSdHC"); + log.info(`Started listening on port ${port}`); + + } +diff --git a/src/matrixroomhandler.ts b/src/matrixroomhandler.ts +index 1febaba..e20bfa6 100644 +--- a/src/matrixroomhandler.ts ++++ b/src/matrixroomhandler.ts +@@ -24,7 +24,7 @@ const log = new Log("MatrixRoomHandler"); + import { DbRoomStore, MatrixStoreRoom, RemoteStoreRoom } from "./db/roomstore"; + import { Appservice, Intent, IApplicationServiceProtocol } from "matrix-bot-sdk"; + +-const ICON_URL = "https://matrix.org/_matrix/media/r0/download/matrix.org/mlxoESwIsTbJrfXyAAogrNxA"; ++const ICON_URL = "https://matrix.exotic.sh/_matrix/media/r0/download/matrix.org/mlxoESwIsTbJrfXyAAogrNxA"; + const ROOM_NAME_PARTS = 2; + + // Note: The schedule must not have duplicate values to avoid problems in positioning. +-- +2.43.0 + diff --git a/modules/services/matrix-bridge/default.nix b/modules/services/matrix-bridge/default.nix index 8843e6a..3c645e6 100644 --- a/modules/services/matrix-bridge/default.nix +++ b/modules/services/matrix-bridge/default.nix @@ -334,6 +334,10 @@ in services.matrix-appservice-discord = { enable = true; + package = pkgs.matrix-appservice-discord.overrideAttrs { + patches = [ ./0001-use-exotic.sh-assets.patch ]; + }; + port = 29322; # NOTE: broken -- cgit 1.4.1