From 97425e2edf1c6027db76f2162d8c5b7f60e713d0 Mon Sep 17 00:00:00 2001 From: Catalan Lover Date: Fri, 17 Jan 2025 18:07:09 +0100 Subject: [PATCH 1/4] Pantalaimon Damnatio Memoriae Stage 1 --- config/default.yaml | 12 ++++-------- src/config.ts | 18 ++++++++++++------ 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/config/default.yaml b/config/default.yaml index 8a2b2958..f2263a06 100644 --- a/config/default.yaml +++ b/config/default.yaml @@ -1,5 +1,4 @@ # Endpoint URL that Draupnir uses to interact with the matrix homeserver (client-server API), -# set this to the pantalaimon URL if you're using that. homeserverUrl: "https://matrix.org" # Endpoint URL that Draupnir could use to fetch events related to reports (client-server API and /_synapse/), @@ -11,12 +10,9 @@ rawHomeserverUrl: "https://matrix.org" # which would allow using secret management systems such as systemd's service credentials. accessToken: "YOUR_TOKEN_HERE" -# Options related to Pantalaimon (https://github.com/matrix-org/pantalaimon) +# Options related to having the bot login itself. pantalaimon: - # Whether or not Draupnir will use pantalaimon to access the matrix homeserver, - # set to `true` if you're using pantalaimon. - # - # Be sure to point homeserverUrl to the pantalaimon instance. + # Set to `true` when the bot is to login and fetch the access token on its own. # # Draupnir will log in using the given username and password once, # then store the resulting access token in a file under dataPath. @@ -28,13 +24,13 @@ pantalaimon: # The password Draupnir will login with. # # After successfully logging in once, this will be ignored, so this value can be blanked after first startup. - # This option can be loaded from a file by passing "--pantalaimon-password-path " at the command line, + # This option can be loaded from a file by passing "--password-path " at the command line, # which would allow using secret management systems such as systemd's service credentials. password: your_password # Experimental usage of the matrix-bot-sdk rust crypto. # This can not be used with Pantalaimon. -# Make sure to setup the bot as if you are not using pantalaimon for this. +# Make sure Pantalaimon is disabled in Draupnir's configuration. # # Warning: At this time this is not considered production safe. experimentalRustCrypto: false diff --git a/src/config.ts b/src/config.ts index 1fdd8853..cacc5f88 100644 --- a/src/config.ts +++ b/src/config.ts @@ -302,6 +302,9 @@ function getConfigMeta(): NonNullable { isPasswordPathOptionUsed: isCommandLineOptionPresent( process.argv, "--pantalaimon-password-path" + ) ?? isCommandLineOptionPresent( + process.argv, + "--password-path" ), }; } @@ -347,16 +350,19 @@ export function configRead(): IConfig { process.argv, "--access-token-path" ); - const explicitPantalaimonPasswordPath = getCommandLineOption( - process.argv, - "--pantalaimon-password-path" - ); if (explicitAccessTokenPath !== undefined) { config.accessToken = fs.readFileSync(explicitAccessTokenPath, "utf8"); } - if (explicitPantalaimonPasswordPath) { + const explicitPasswordPath = getCommandLineOption( + process.argv, + "--pantalaimon-password-path" + )?? getCommandLineOption( + process.argv, + "--password-path" + ); + if (explicitPasswordPath) { config.pantalaimon.password = fs.readFileSync( - explicitPantalaimonPasswordPath, + explicitPasswordPath, "utf8" ); } From 87daf9e1bf711107e1ec749ef271dd8f07f68cb2 Mon Sep 17 00:00:00 2001 From: Catalan Lover <48515417+FSG-Cat@users.noreply.github.com> Date: Fri, 17 Jan 2025 18:53:32 +0100 Subject: [PATCH 2/4] Fix Silly Misstake by Kitty Co-authored-by: Gnuxie <50846879+Gnuxie@users.noreply.github.com> --- config/default.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/default.yaml b/config/default.yaml index f2263a06..1f20975c 100644 --- a/config/default.yaml +++ b/config/default.yaml @@ -10,7 +10,7 @@ rawHomeserverUrl: "https://matrix.org" # which would allow using secret management systems such as systemd's service credentials. accessToken: "YOUR_TOKEN_HERE" -# Options related to having the bot login itself. +# Options related to having Draupnir login itself. pantalaimon: # Set to `true` when the bot is to login and fetch the access token on its own. # From f7d9a8a4c3fb6621b7efb85a07f4cadbbecfec70 Mon Sep 17 00:00:00 2001 From: Catalan Lover Date: Fri, 17 Jan 2025 23:11:43 +0100 Subject: [PATCH 3/4] Fix Silly Linting Error --- src/config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config.ts b/src/config.ts index cacc5f88..942b3e23 100644 --- a/src/config.ts +++ b/src/config.ts @@ -302,7 +302,7 @@ function getConfigMeta(): NonNullable { isPasswordPathOptionUsed: isCommandLineOptionPresent( process.argv, "--pantalaimon-password-path" - ) ?? isCommandLineOptionPresent( + ) || isCommandLineOptionPresent( process.argv, "--password-path" ), From cfc69ed60fbe52cfd48a54f559516a28887d3da2 Mon Sep 17 00:00:00 2001 From: Catalan Lover Date: Fri, 17 Jan 2025 23:27:55 +0100 Subject: [PATCH 4/4] Run Prettier to please CI --- src/config.ts | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/src/config.ts b/src/config.ts index 942b3e23..0847ea5c 100644 --- a/src/config.ts +++ b/src/config.ts @@ -299,13 +299,9 @@ function getConfigMeta(): NonNullable { process.argv, "--access-token-path" ), - isPasswordPathOptionUsed: isCommandLineOptionPresent( - process.argv, - "--pantalaimon-password-path" - ) || isCommandLineOptionPresent( - process.argv, - "--password-path" - ), + isPasswordPathOptionUsed: + isCommandLineOptionPresent(process.argv, "--pantalaimon-password-path") || + isCommandLineOptionPresent(process.argv, "--password-path"), }; } @@ -353,18 +349,11 @@ export function configRead(): IConfig { if (explicitAccessTokenPath !== undefined) { config.accessToken = fs.readFileSync(explicitAccessTokenPath, "utf8"); } - const explicitPasswordPath = getCommandLineOption( - process.argv, - "--pantalaimon-password-path" - )?? getCommandLineOption( - process.argv, - "--password-path" - ); + const explicitPasswordPath = + getCommandLineOption(process.argv, "--pantalaimon-password-path") ?? + getCommandLineOption(process.argv, "--password-path"); if (explicitPasswordPath) { - config.pantalaimon.password = fs.readFileSync( - explicitPasswordPath, - "utf8" - ); + config.pantalaimon.password = fs.readFileSync(explicitPasswordPath, "utf8"); } return config; }