about summary refs log tree commit diff
path: root/modules
diff options
context:
space:
mode:
authorsefidel <contact@sefidel.net>2024-02-17 15:27:34 +0900
committersefidel <contact@sefidel.net>2024-02-17 15:27:43 +0900
commit4705b022723290a8e4402945f9cf4c75da2331a3 (patch)
treeab7ea22b1cfcd663a4925e2b9ffe781732514a31 /modules
parent8ceba8da3cec21da5f691a57187a321f591e075e (diff)
downloadinfra-4705b022723290a8e4402945f9cf4c75da2331a3.tar.gz
infra-4705b022723290a8e4402945f9cf4c75da2331a3.zip
feat(modules/matrix-bridge): use exotic.sh assets on matrix-appservice-discord
Diffstat (limited to 'modules')
-rw-r--r--modules/services/matrix-bridge/0001-use-exotic.sh-assets.patch54
-rw-r--r--modules/services/matrix-bridge/default.nix4
2 files changed, 58 insertions, 0 deletions
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 <contact@sefidel.net>
+Date: Sat, 17 Feb 2024 14:39:42 +0900
+Subject: [PATCH] use exotic.sh assets
+
+Signed-off-by: sefidel <contact@sefidel.net>
+---
+ 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<void> {
+     }
+ 
+     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