From 961202adf94f0dc7d24ae7a2a727f461588b9b17 Mon Sep 17 00:00:00 2001 From: Barry Steyn Date: Wed, 5 Feb 2025 10:25:57 -0800 Subject: [PATCH] fixed firehose lexicon problem and allow for personal PDS --- package-lock.json | 97 +++++++++++++++++++++++------------------------ package.json | 2 +- src/routes.ts | 9 +++-- 3 files changed, 54 insertions(+), 54 deletions(-) diff --git a/package-lock.json b/package-lock.json index 64018e9..d63549b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,7 @@ "@atproto/oauth-client-node": "^0.2.2", "@atproto/sync": "^0.1.4", "@atproto/syntax": "^0.3.0", - "@atproto/xrpc-server": "^0.6.3", + "@atproto/xrpc-server": "^0.7.9", "better-sqlite3": "^11.1.2", "dotenv": "^16.4.5", "envalid": "^8.0.0", @@ -158,11 +158,12 @@ } }, "node_modules/@atproto/common": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/@atproto/common/-/common-0.4.4.tgz", - "integrity": "sha512-58tMbn6A1Zu296s/l3uIj8z9d7IRHpZvLOfsFRikaQaYrzhJpL2aPY4uFQ8GJcxnsxeUnxBCrQz9we5jVVJI5Q==", + "version": "0.4.7", + "resolved": "https://registry.npmjs.org/@atproto/common/-/common-0.4.7.tgz", + "integrity": "sha512-C844ILV66sqHjQCJDb8tN/yZB2MBaLpZ1qptDT8zWRMx0uw7j/B6/EuN9R9a57Nj99Hhi93QkvQxOujURqpPeA==", + "license": "MIT", "dependencies": { - "@atproto/common-web": "^0.3.1", + "@atproto/common-web": "^0.3.2", "@ipld/dag-cbor": "^7.0.3", "cbor-x": "^1.5.1", "iso-datestring-validator": "^2.2.2", @@ -171,9 +172,10 @@ } }, "node_modules/@atproto/common-web": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/@atproto/common-web/-/common-web-0.3.1.tgz", - "integrity": "sha512-N7wiTnus5vAr+lT//0y8m/FaHHLJ9LpGuEwkwDAeV3LCiPif4m/FS8x/QOYrx1PdZQwKso95RAPzCGWQBH5j6Q==", + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@atproto/common-web/-/common-web-0.3.2.tgz", + "integrity": "sha512-Vx0JtL1/CssJbFAb0UOdvTrkbUautsDfHNOXNTcX2vyPIxH9xOameSqLLunM1hZnOQbJwyjmQCt6TV+bhnanDg==", + "license": "MIT", "dependencies": { "graphemer": "^1.4.0", "multiformats": "^9.9.0", @@ -229,12 +231,13 @@ } }, "node_modules/@atproto/crypto": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/@atproto/crypto/-/crypto-0.4.1.tgz", - "integrity": "sha512-7pQNHWYyx8jGhYdPbmcuPD9W73nd/5v3mfBlncO0sBzxnPbmA6aXAWOz+fNVZwHwBJPeb/Gzf/FT/uDx7/eYFg==", + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@atproto/crypto/-/crypto-0.4.3.tgz", + "integrity": "sha512-YSSUAvkx+ldpXw97NXZWfLx/prgh5YJ2K0BCw51JCJmXSRp6KhhwvOm4J+K/s5hwpssyuDCVTXknyS4PHwaK5g==", + "license": "MIT", "dependencies": { - "@noble/curves": "^1.1.0", - "@noble/hashes": "^1.3.1", + "@noble/curves": "^1.7.0", + "@noble/hashes": "^1.6.1", "uint8arrays": "3.0.0" } }, @@ -304,12 +307,12 @@ } }, "node_modules/@atproto/lexicon": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/@atproto/lexicon/-/lexicon-0.4.3.tgz", - "integrity": "sha512-lFVZXe1S1pJP0dcxvJuHP3r/a+EAIBwwU7jUK+r8iLhIja+ml6NmYv8KeFHmIJATh03spEQ9s02duDmFVdCoXg==", + "version": "0.4.5", + "resolved": "https://registry.npmjs.org/@atproto/lexicon/-/lexicon-0.4.5.tgz", + "integrity": "sha512-fljWqMGKn+XWtTprBcS3F1hGBREnQYh6qYHv2sjENucc7REms1gtmZXSerB9N6pVeHVNOnXiILdukeAcic5OEw==", "license": "MIT", "dependencies": { - "@atproto/common-web": "^0.3.1", + "@atproto/common-web": "^0.3.2", "@atproto/syntax": "^0.3.1", "iso-datestring-validator": "^2.2.2", "multiformats": "^9.9.0", @@ -394,25 +397,6 @@ "p-queue": "^6.6.2" } }, - "node_modules/@atproto/sync/node_modules/@atproto/xrpc-server": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/@atproto/xrpc-server/-/xrpc-server-0.7.1.tgz", - "integrity": "sha512-6S3PiKmbdT2TwEEWmnKdEJkgBJtQHYNlAVB4PSNum50R2Xw3c1SV4NK6zLsxPqNpV2WhAlYEJUSTPAOTV3QMbw==", - "dependencies": { - "@atproto/common": "^0.4.4", - "@atproto/crypto": "^0.4.1", - "@atproto/lexicon": "^0.4.2", - "@atproto/xrpc": "^0.6.3", - "cbor-x": "^1.5.1", - "express": "^4.17.2", - "http-errors": "^2.0.0", - "mime-types": "^2.1.35", - "rate-limiter-flexible": "^2.4.1", - "uint8arrays": "3.0.0", - "ws": "^8.12.0", - "zod": "^3.23.8" - } - }, "node_modules/@atproto/syntax": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/@atproto/syntax/-/syntax-0.3.1.tgz", @@ -430,14 +414,15 @@ } }, "node_modules/@atproto/xrpc-server": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/@atproto/xrpc-server/-/xrpc-server-0.6.3.tgz", - "integrity": "sha512-0YXeBM9NjiIlR5eXWo8qzArRcBOKhwVimpH+ajKgZzlncPO53brVZ9+3BUnD5J1PG8mEQFRERi+Jt77QyF89qA==", + "version": "0.7.9", + "resolved": "https://registry.npmjs.org/@atproto/xrpc-server/-/xrpc-server-0.7.9.tgz", + "integrity": "sha512-x6CqV6KycIUyZs+J4V+wujc3R98QIkVRU4KmbUgAJ9AtJuTDnOOEbUFrNVVes45UfjJw4ztg021R0M2y0aI3fQ==", + "license": "MIT", "dependencies": { - "@atproto/common": "^0.4.1", - "@atproto/crypto": "^0.4.1", - "@atproto/lexicon": "^0.4.1", - "@atproto/xrpc": "^0.6.1", + "@atproto/common": "^0.4.7", + "@atproto/crypto": "^0.4.3", + "@atproto/lexicon": "^0.4.5", + "@atproto/xrpc": "^0.6.7", "cbor-x": "^1.5.1", "express": "^4.17.2", "http-errors": "^2.0.0", @@ -448,6 +433,16 @@ "zod": "^3.23.8" } }, + "node_modules/@atproto/xrpc-server/node_modules/@atproto/xrpc": { + "version": "0.6.7", + "resolved": "https://registry.npmjs.org/@atproto/xrpc/-/xrpc-0.6.7.tgz", + "integrity": "sha512-pbzZIONIskyGKxxG3s2wB7rQ2W1xu3ycfeYhKwk/E/ippeJFVxcof64iSC7f22+7JSKUJcxBeZ1piBB82vLj7g==", + "license": "MIT", + "dependencies": { + "@atproto/lexicon": "^0.4.5", + "zod": "^3.23.8" + } + }, "node_modules/@cbor-extract/cbor-extract-darwin-arm64": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/@cbor-extract/cbor-extract-darwin-arm64/-/cbor-extract-darwin-arm64-2.2.0.tgz", @@ -1011,11 +1006,12 @@ } }, "node_modules/@noble/curves": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.6.0.tgz", - "integrity": "sha512-TlaHRXDehJuRNR9TfZDNQ45mMEd5dwUwmicsafcIX4SsNiqnCHKjE/1alYPd/lDRVhxdhUAlv8uEhMCI5zjIJQ==", + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.8.1.tgz", + "integrity": "sha512-warwspo+UYUPep0Q+vtdVB4Ugn8GGQj8iyB3gnRWsztmUHTI3S1nhdiWNsPUGL0vud7JlRRk1XEu7Lq1KGTnMQ==", + "license": "MIT", "dependencies": { - "@noble/hashes": "1.5.0" + "@noble/hashes": "1.7.1" }, "engines": { "node": "^14.21.3 || >=16" @@ -1025,9 +1021,10 @@ } }, "node_modules/@noble/hashes": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.5.0.tgz", - "integrity": "sha512-1j6kQFb7QRru7eKN3ZDvRcP13rugwdxZqCjbiAVZfIJwgj2A65UmT4TgARXGlXgnRkORLTDTrO19ZErt7+QXgA==", + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.7.1.tgz", + "integrity": "sha512-B8XBPsn4vT/KJAGqDzbwztd+6Yte3P4V7iafm24bxgDe/mlRuK6xmWPuCNrKt2vDafZ8MfJLlchDG/vYafQEjQ==", + "license": "MIT", "engines": { "node": "^14.21.3 || >=16" }, diff --git a/package.json b/package.json index 9536737..341ff42 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "@atproto/oauth-client-node": "^0.2.2", "@atproto/sync": "^0.1.4", "@atproto/syntax": "^0.3.0", - "@atproto/xrpc-server": "^0.6.3", + "@atproto/xrpc-server": "^0.7.9", "better-sqlite3": "^11.1.2", "dotenv": "^16.4.5", "envalid": "^8.0.0", diff --git a/src/routes.ts b/src/routes.ts index c42cc78..4d0a94c 100644 --- a/src/routes.ts +++ b/src/routes.ts @@ -176,12 +176,15 @@ export const createRouter = (ctx: AppContext) => { } // Fetch additional information about the logged-in user - const { data: profileRecord } = await agent.com.atproto.repo.getRecord({ + const profileResponse = await agent.com.atproto.repo.getRecord({ repo: agent.assertDid, collection: 'app.bsky.actor.profile', rkey: 'self', - }) - const profile = + }).catch(() => undefined); + + const profileRecord = profileResponse?.data; + + const profile = profileRecord && Profile.isRecord(profileRecord.value) && Profile.validateRecord(profileRecord.value).success ? profileRecord.value -- 2.51.2