diff --git a/.yarn/patches/doipjs-npm-1.0.0-942d2e0840.patch b/.yarn/patches/doipjs-npm-1.0.0-942d2e0840.patch deleted file mode 100644 index c2c7ba0..0000000 --- a/.yarn/patches/doipjs-npm-1.0.0-942d2e0840.patch +++ /dev/null @@ -1,92 +0,0 @@ -diff --git a/dist/doip.core.js b/dist/doip.core.js -index e019a48b8136941fd8e21091a7d323d5cfbf83e7..368e9b0b7ea0b5dde987ea3805a69d82c724536d 100644 ---- a/dist/doip.core.js -+++ b/dist/doip.core.js -@@ -5263,6 +5263,7 @@ var doip = (function (exports, fetcher, openpgp$1) { - * @property {string|null} claims.activitypub.privateKey - The private key to sign the request - * @property {object} claims.irc - Options related to the verification of IRC claims - * @property {string|null} claims.irc.nick - The nick that the library uses to connect to the IRC server -+ * @property {string|null} claims.irc.password - The password that the library uses to connect to the IRC server - * @property {object} claims.matrix - Options related to the verification of Matrix claims - * @property {string|null} claims.matrix.instance - The server hostname on which the library can log in - * @property {string|null} claims.matrix.accessToken - The access token required to identify the library ({@link https://www.matrix.org/docs/guides/client-server-api|Matrix docs}) -@@ -5284,7 +5285,8 @@ var doip = (function (exports, fetcher, openpgp$1) { - privateKey: null - }, - irc: { -- nick: null -+ nick: null, -+ password: null - }, - matrix: { - instance: null, -diff --git a/dist/doip.fetchers.js b/dist/doip.fetchers.js -index acef0d990b81eba01e78404e726766e81bf46ddd..e056d695a3aabe16ce5312e42b733fb930110b59 100644 ---- a/dist/doip.fetchers.js -+++ b/dist/doip.fetchers.js -@@ -23603,6 +23603,7 @@ var doipFetchers = (function (exports) { - * @param {object} opts.claims - * @param {object} opts.claims.irc - * @param {string} opts.claims.irc.nick - The nick to be used by the library to log in -+ * @param {string} opts.claims.irc.password - The password to be used by the library to log in - * @returns {Promise} - */ - async function fn$3 (data, opts) { -@@ -23627,7 +23628,10 @@ var doipFetchers = (function (exports) { - secure: true, - channels: [], - showErrors: false, -- debug: false -+ debug: false, -+ sasl: opts.claims.irc.password !== null ? true : false, -+ userName: opts.claims.irc.nick, -+ password: opts.claims.irc.password - }); - const reKey = /[a-zA-Z0-9\-_]+\s+:\s(openpgp4fpr:.*)/; - const reEnd = /End\sof\s.*\staxonomy./; -diff --git a/src/defaults.js b/src/defaults.js -index 024cc19612bba1e55f5233e61f78e0f00bc9aa92..2ab81779576f4eb2a7ebc46544a7992d0b1fb7e9 100644 ---- a/src/defaults.js -+++ b/src/defaults.js -@@ -32,6 +32,7 @@ import { ProxyPolicy } from './enums.js' - * @property {string|null} claims.activitypub.privateKey - The private key to sign the request - * @property {object} claims.irc - Options related to the verification of IRC claims - * @property {string|null} claims.irc.nick - The nick that the library uses to connect to the IRC server -+ * @property {string|null} claims.irc.password - The password that the library uses to connect to the IRC server - * @property {object} claims.matrix - Options related to the verification of Matrix claims - * @property {string|null} claims.matrix.instance - The server hostname on which the library can log in - * @property {string|null} claims.matrix.accessToken - The access token required to identify the library ({@link https://www.matrix.org/docs/guides/client-server-api|Matrix docs}) -@@ -53,7 +54,8 @@ export const opts = { - privateKey: null - }, - irc: { -- nick: null -+ nick: null, -+ password: null - }, - matrix: { - instance: null, -diff --git a/src/fetcher/irc.js b/src/fetcher/irc.js -index f07a32a7c54a9489dbab27b32b1b1d8246485ec1..c3c953257431a50f826c24d2a9ba7f638860fda5 100644 ---- a/src/fetcher/irc.js -+++ b/src/fetcher/irc.js -@@ -30,6 +30,7 @@ export const timeout = 20000 - * @param {object} opts.claims - * @param {object} opts.claims.irc - * @param {string} opts.claims.irc.nick - The nick to be used by the library to log in -+ * @param {string} opts.claims.irc.password - The password to be used by the library to log in - * @returns {Promise} - */ - export async function fn (data, opts) { -@@ -54,7 +55,10 @@ export async function fn (data, opts) { - secure: true, - channels: [], - showErrors: false, -- debug: false -+ debug: false, -+ sasl: opts.claims.irc.password !== null ? true : false, -+ userName: opts.claims.irc.nick, -+ password: opts.claims.irc.password - }) - const reKey = /[a-zA-Z0-9\-_]+\s+:\s(openpgp4fpr:.*)/ - const reEnd = /End\sof\s.*\staxonomy./ diff --git a/.yarnrc.yml b/.yarnrc.yml index 3186f3f..64357d9 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -1 +1,4 @@ nodeLinker: node-modules +npmScopes: + myriation: + npmRegistryServer: https://git.myriation.xyz/api/packages/myriation/npm/ \ No newline at end of file diff --git a/package.json b/package.json index 1da5b94..978cdec 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "bent": "^7.3.12", "body-parser": "^1.19.0", "colorjs.io": "^0.4.5", - "doipjs": "^1.2.9", + "doipjs": "npm:@myriation/doipjs@1.2.9+myriation.1", "dotenv": "^16.0.3", "express": "^4.17.1", "express-http-context2": "^1.0.0", @@ -78,8 +78,5 @@ "identity" ], "author": "Yarmo Mackenbach (https://yarmo.eu)", - "license": "AGPL-3.0-or-later", - "resolutions": { - "doipjs@^1.0.0": "patch:doipjs@npm%3A1.0.0#./.yarn/patches/doipjs-npm-1.0.0-942d2e0840.patch" - } + "license": "AGPL-3.0-or-later" } diff --git a/src/api/v3/proxy_get.js b/src/api/v3/proxy_get.js index b8fa9b5..e7956a4 100644 --- a/src/api/v3/proxy_get.js +++ b/src/api/v3/proxy_get.js @@ -43,7 +43,11 @@ const opts = { }, irc: { nick: process.env.IRC_NICK || null, - password: process.env.IRC_PASSWORD || null, + sasl: Object.keys(process.env).filter(k => k.startsWith('IRC_SASL_USERNAME_')).map(k => ({ + username: process.env[k], + password: process.env[`IRC_SASL_PASSWORD_${k.substring('IRC_SASL_USERNAME_'.length)}`], + domainRegex: process.env[`IRC_SASL_DOMAIN_REGEX_${k.substring('IRC_SASL_USERNAME_'.length)}`] + })) }, matrix: { instance: process.env.MATRIX_INSTANCE || null, diff --git a/yarn.lock b/yarn.lock index 2210b6d..98f1778 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2683,9 +2683,9 @@ __metadata: languageName: node linkType: hard -"doipjs@npm:^1.2.9": - version: 1.2.9 - resolution: "doipjs@npm:1.2.9" +"doipjs@npm:@myriation/doipjs@1.2.9+myriation.1": + version: 1.2.9+myriaiton.1 + resolution: "@myriation/doipjs@npm:1.2.9+myriaiton.1::__archiveUrl=https%3A%2F%2Fgit.myriation.xyz%2Fapi%2Fpackages%2Fmyriation%2Fnpm%2F%2540myriation%252Fdoipjs%2F-%2F1.2.9%2Bmyriaiton.1%2Fdoipjs-1.2.9%2Bmyriaiton.1.tgz" dependencies: "@openpgp/hkp-client": ^0.0.3 "@openpgp/wkd-client": ^0.0.4 @@ -2702,7 +2702,7 @@ __metadata: rfc4648: ^1.5.2 valid-url: ^1.0.9 validator: ^13.9.0 - checksum: 0d7b2cbd076ba0f6bbed653fcedb9bd68d25d5081ae7ed4bd589f09c866307d9d7ab2ffcc879a616fc081c37f5016da021a622ed37c65bd68eb3d999a877ab0f + checksum: fc6de590729576247b379397ead2ef15203e16e0e5898b9aca0e0381726931f57d794c9ca84309d3cf1e2e7f487dccc6b42d90bd443ee904202cb030163b8cd2 languageName: node linkType: hard @@ -4834,7 +4834,7 @@ __metadata: colorjs.io: ^0.4.5 copy-webpack-plugin: ^11.0.0 css-loader: ^6.6.0 - doipjs: ^1.2.9 + doipjs: "npm:@myriation/doipjs@1.2.9+myriation.1" dotenv: ^16.0.3 esmock: ^2.5.0 express: ^4.17.1