diff --git a/hashes.json b/hashes.json index bd88454..8a91aea 100644 --- a/hashes.json +++ b/hashes.json @@ -1,3 +1,3 @@ { - "npmDepsHash": "sha256-DE6tv4oZgLSWMmKvS7BbrBB2kIJNzDViVbTDQukkyaQ=" + "npmDepsHash": "sha256-0SsHcwTnb17YAsbCIpZXZ/HEzcFBWMTQdIE4yySKXFE=" } diff --git a/package-lock.json b/package-lock.json index 25799e8..7c711b2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -42,6 +42,7 @@ "murmurhash-js": "^1.0.0", "node-2fa": "^2.0.3", "pg": "^8.16.3", + "pg-query-stream": "^4.10.3", "picocolors": "^1.1.1", "probe-image-size": "^7.2.3", "reflect-metadata": "^0.2.2", @@ -7919,6 +7920,15 @@ "integrity": "sha512-nkc6NpDcvPVpZXxrreI/FOtX3XemeLl8E0qFr6F2Lrm/I8WOnaWNhIPK2Z7OHpw7gh5XJThi6j6ppgNoaT1w4w==", "license": "MIT" }, + "node_modules/pg-cursor": { + "version": "2.15.3", + "resolved": "https://registry.npmjs.org/pg-cursor/-/pg-cursor-2.15.3.tgz", + "integrity": "sha512-eHw63TsiGtFEfAd7tOTZ+TLy+i/2ePKS20H84qCQ+aQ60pve05Okon9tKMC+YN3j6XyeFoHnaim7Lt9WVafQsA==", + "license": "MIT", + "peerDependencies": { + "pg": "^8" + } + }, "node_modules/pg-int8": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/pg-int8/-/pg-int8-1.0.1.tgz", @@ -7943,6 +7953,19 @@ "integrity": "sha512-6DIBgBQaTKDJyxnXaLiLR8wBpQQcGWuAESkRBX/t6OwA8YsqP+iVSiond2EDy6Y/dsGk8rh/jtax3js5NeV7JQ==", "license": "MIT" }, + "node_modules/pg-query-stream": { + "version": "4.10.3", + "resolved": "https://registry.npmjs.org/pg-query-stream/-/pg-query-stream-4.10.3.tgz", + "integrity": "sha512-h2utrzpOIzeT9JfaqfvBbVuvCfBjH86jNfVrGGTbyepKAIOyTfDew0lAt8bbJjs9n/I5bGDl7S2sx6h5hPyJxw==", + "license": "MIT", + "peer": true, + "dependencies": { + "pg-cursor": "^2.15.3" + }, + "peerDependencies": { + "pg": "^8" + } + }, "node_modules/pg-types": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/pg-types/-/pg-types-2.2.0.tgz", diff --git a/package.json b/package.json index c020f04..fc4edb4 100644 --- a/package.json +++ b/package.json @@ -105,6 +105,7 @@ "murmurhash-js": "^1.0.0", "node-2fa": "^2.0.3", "pg": "^8.16.3", + "pg-query-stream": "^4.10.3", "picocolors": "^1.1.1", "probe-image-size": "^7.2.3", "reflect-metadata": "^0.2.2", diff --git "a/src/api/routes/channels/\043channel_id/messages/index.ts" "b/src/api/routes/channels/\043channel_id/messages/index.ts" index 43c4984..1c3b5d8 100644 --- "a/src/api/routes/channels/\043channel_id/messages/index.ts" +++ "b/src/api/routes/channels/\043channel_id/messages/index.ts" @@ -391,7 +391,6 @@ const embeds = body.embeds || []; if (body.embed) embeds.push(body.embed); - console.log("messages/index.ts: attachments:", attachments); const message = await handleMessage({ ...body, type: 0, diff --git a/src/api/util/handlers/Instance.ts b/src/api/util/handlers/Instance.ts index d86f285..72b2e79 100644 --- a/src/api/util/handlers/Instance.ts +++ b/src/api/util/handlers/Instance.ts @@ -36,9 +36,9 @@ // TODO: do no clear sessions for instance cluster // await Session.clear(); // This is now used as part of authentication... - await Session.delete({ session_id: Like("TEMP_%") }); // ...but we can still clear out temporary sessions - // async enumerate sessions + // ... but we can still expire temporary sessions for legacy tokens for await (const session of await Session.createQueryBuilder("session").where("last_seen = '1970/01/01'").select().stream()) { - console.log("Instance:",session); + console.log("Instance[sessions]:",session); } + await Session.delete({ session_id: Like("TEMP_%") }); } diff --git a/src/util/util/Token.ts b/src/util/util/Token.ts index 1f4920d..2ea133c 100644 --- a/src/util/util/Token.ts +++ b/src/util/util/Token.ts @@ -138,7 +138,7 @@ tokenVersion: decoded.ver ?? legacyVersion ?? 2, }; - console.log("User", user.id, "logged in with token version", result.tokenVersion); + if (process.env.LOG_TOKEN_VERSION) console.log("User", user.id, "logged in with token version", result.tokenVersion); logAuth("validateUser success: " + JSON.stringify(result)); return resolve(result);