@getcirrus/pds 0.10.2 → 0.10.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +12 -2
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +130 -25
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -611,7 +611,7 @@ var PDSClient = class PDSClient {
|
|
|
611
611
|
* Get account status including migration progress
|
|
612
612
|
*/
|
|
613
613
|
async getAccountStatus() {
|
|
614
|
-
const url = new URL("/xrpc/com.atproto.server.
|
|
614
|
+
const url = new URL("/xrpc/com.atproto.server.checkAccountStatus", this.baseUrl);
|
|
615
615
|
const headers = {};
|
|
616
616
|
if (this.authToken) headers["Authorization"] = `Bearer ${this.authToken}`;
|
|
617
617
|
const res = await fetch(url.toString(), {
|
|
@@ -2113,6 +2113,15 @@ const initCommand = defineCommand({
|
|
|
2113
2113
|
spinner.stop("Password hashed");
|
|
2114
2114
|
return hash;
|
|
2115
2115
|
});
|
|
2116
|
+
const email = await promptText({
|
|
2117
|
+
message: "Email address (optional, some clients expect it - press Enter to skip)",
|
|
2118
|
+
placeholder: "you@example.com",
|
|
2119
|
+
defaultValue: "",
|
|
2120
|
+
validate: (value) => {
|
|
2121
|
+
if (!value) return;
|
|
2122
|
+
if (!value.includes("@")) return "Must be a valid email address";
|
|
2123
|
+
}
|
|
2124
|
+
});
|
|
2116
2125
|
spinner.start("Updating wrangler.jsonc...");
|
|
2117
2126
|
setWorkerName(workerName);
|
|
2118
2127
|
setVars({
|
|
@@ -2121,7 +2130,8 @@ const initCommand = defineCommand({
|
|
|
2121
2130
|
HANDLE: handle,
|
|
2122
2131
|
SIGNING_KEY_PUBLIC: signingKeyPublic,
|
|
2123
2132
|
INITIAL_ACTIVE: initialActive,
|
|
2124
|
-
DATA_LOCATION: dataLocation
|
|
2133
|
+
DATA_LOCATION: dataLocation,
|
|
2134
|
+
...email ? { EMAIL: email } : {}
|
|
2125
2135
|
});
|
|
2126
2136
|
setCustomDomains([hostname]);
|
|
2127
2137
|
spinner.stop("wrangler.jsonc updated");
|
package/dist/index.d.ts
CHANGED
|
@@ -97,6 +97,26 @@ declare class SqliteRepoStorage extends ReadableBlockstore implements RepoStorag
|
|
|
97
97
|
* Set the activation state of the account.
|
|
98
98
|
*/
|
|
99
99
|
setActive(active: boolean): Promise<void>;
|
|
100
|
+
/**
|
|
101
|
+
* Get the stored email address.
|
|
102
|
+
*/
|
|
103
|
+
getEmail(): string | null;
|
|
104
|
+
/**
|
|
105
|
+
* Set the email address.
|
|
106
|
+
*/
|
|
107
|
+
setEmail(email: string): void;
|
|
108
|
+
/**
|
|
109
|
+
* Get all cached collection names.
|
|
110
|
+
*/
|
|
111
|
+
getCollections(): string[];
|
|
112
|
+
/**
|
|
113
|
+
* Add a collection name to the cache (no-op if already present).
|
|
114
|
+
*/
|
|
115
|
+
addCollection(collection: string): void;
|
|
116
|
+
/**
|
|
117
|
+
* Check if the collections cache has been populated.
|
|
118
|
+
*/
|
|
119
|
+
hasCollections(): boolean;
|
|
100
120
|
/**
|
|
101
121
|
* Add a blob reference from a record.
|
|
102
122
|
*/
|
|
@@ -296,6 +316,8 @@ interface PDSEnv {
|
|
|
296
316
|
ACCOUNT: DurableObjectNamespace<AccountDurableObject>;
|
|
297
317
|
/** R2 bucket for blob storage (optional) */
|
|
298
318
|
BLOBS?: R2Bucket;
|
|
319
|
+
/** Account email address (optional, used by some clients) */
|
|
320
|
+
EMAIL?: string;
|
|
299
321
|
/** Initial activation state for new accounts (default: true) */
|
|
300
322
|
INITIAL_ACTIVE?: string;
|
|
301
323
|
/**
|
|
@@ -553,6 +575,16 @@ declare class AccountDurableObject extends DurableObject<PDSEnv> {
|
|
|
553
575
|
* RPC method: Put user preferences
|
|
554
576
|
*/
|
|
555
577
|
rpcPutPreferences(preferences: unknown[]): Promise<void>;
|
|
578
|
+
/**
|
|
579
|
+
* RPC method: Get stored email
|
|
580
|
+
*/
|
|
581
|
+
rpcGetEmail(): Promise<{
|
|
582
|
+
email: string | null;
|
|
583
|
+
}>;
|
|
584
|
+
/**
|
|
585
|
+
* RPC method: Update stored email
|
|
586
|
+
*/
|
|
587
|
+
rpcUpdateEmail(email: string): Promise<void>;
|
|
556
588
|
/**
|
|
557
589
|
* RPC method: Get account activation state
|
|
558
590
|
*/
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/storage.ts","../src/oauth-storage.ts","../src/blobs.ts","../src/types.ts","../src/account-do.ts","../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;cAUa,iBAAA,SACJ,kBAAA,YACG;EAFC,QAAA,GAAA;EAIa,WAAA,CAAA,GAAA,EAAA,UAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/storage.ts","../src/oauth-storage.ts","../src/blobs.ts","../src/types.ts","../src/account-do.ts","../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;cAUa,iBAAA,SACJ,kBAAA,YACG;EAFC,QAAA,GAAA;EAIa,WAAA,CAAA,GAAA,EAAA,UAAA;EAwGA;;;;EAiCR,UAAA,CAAA,aAAA,CAAA,EAAA,OAAA,CAAA,EAAA,IAAA;EAQG;;;EAcL,OAAA,CAAA,CAAA,EAvDE,OAuDF,CAvDU,GAuDV,GAAA,IAAA,CAAA;EAAM;;;EAU8C,MAAA,CAAA,CAAA,EApDnD,OAoDmD,CAAA,MAAA,GAAA,IAAA,CAAA;EAArC;;;EAmB4B,MAAA,CAAA,CAAA,EA7D1C,OA6D0C,CAAA,MAAA,CAAA;EAYpC;;;EAoBmB,OAAA,CAAA,CAAA,EAnFxB,OAmFwB,CAAA,MAAA,CAAA;EAWf;;;EA6CT,QAAA,CAAA,GAAA,EAnIG,GAmIH,CAAA,EAnIS,OAmIT,CAnIiB,UAmIjB,G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;;;;;iBASxB,UAAU,QAAQ;;;;cC/7C3C,KAAG;YAAwB;GAAM,WAAA,CAAA,WAAA"}
|
package/dist/index.js
CHANGED
|
@@ -128,7 +128,8 @@ var SqliteRepoStorage = class extends ReadableBlockstore {
|
|
|
128
128
|
root_cid TEXT,
|
|
129
129
|
rev TEXT,
|
|
130
130
|
seq INTEGER NOT NULL DEFAULT 0,
|
|
131
|
-
active INTEGER NOT NULL DEFAULT 1
|
|
131
|
+
active INTEGER NOT NULL DEFAULT 1,
|
|
132
|
+
email TEXT
|
|
132
133
|
);
|
|
133
134
|
|
|
134
135
|
-- Initialize with empty state if not exists
|
|
@@ -171,6 +172,11 @@ var SqliteRepoStorage = class extends ReadableBlockstore {
|
|
|
171
172
|
createdAt TEXT NOT NULL DEFAULT (datetime('now'))
|
|
172
173
|
);
|
|
173
174
|
|
|
175
|
+
-- Collection name cache (for describeRepo)
|
|
176
|
+
CREATE TABLE IF NOT EXISTS collections (
|
|
177
|
+
collection TEXT PRIMARY KEY
|
|
178
|
+
);
|
|
179
|
+
|
|
174
180
|
-- Passkey credentials (WebAuthn)
|
|
175
181
|
CREATE TABLE IF NOT EXISTS passkeys (
|
|
176
182
|
credential_id TEXT PRIMARY KEY,
|
|
@@ -189,6 +195,9 @@ var SqliteRepoStorage = class extends ReadableBlockstore {
|
|
|
189
195
|
name TEXT
|
|
190
196
|
);
|
|
191
197
|
`);
|
|
198
|
+
try {
|
|
199
|
+
this.sql.exec("ALTER TABLE repo_state ADD COLUMN email TEXT");
|
|
200
|
+
} catch {}
|
|
192
201
|
}
|
|
193
202
|
/**
|
|
194
203
|
* Get the current root CID of the repository.
|
|
@@ -333,6 +342,37 @@ var SqliteRepoStorage = class extends ReadableBlockstore {
|
|
|
333
342
|
this.sql.exec("UPDATE repo_state SET active = ? WHERE id = 1", active ? 1 : 0);
|
|
334
343
|
}
|
|
335
344
|
/**
|
|
345
|
+
* Get the stored email address.
|
|
346
|
+
*/
|
|
347
|
+
getEmail() {
|
|
348
|
+
const rows = this.sql.exec("SELECT email FROM repo_state WHERE id = 1").toArray();
|
|
349
|
+
return rows.length > 0 ? rows[0].email ?? null : null;
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Set the email address.
|
|
353
|
+
*/
|
|
354
|
+
setEmail(email) {
|
|
355
|
+
this.sql.exec("UPDATE repo_state SET email = ? WHERE id = 1", email);
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Get all cached collection names.
|
|
359
|
+
*/
|
|
360
|
+
getCollections() {
|
|
361
|
+
return this.sql.exec("SELECT collection FROM collections ORDER BY collection").toArray().map((row) => row.collection);
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Add a collection name to the cache (no-op if already present).
|
|
365
|
+
*/
|
|
366
|
+
addCollection(collection) {
|
|
367
|
+
this.sql.exec("INSERT OR IGNORE INTO collections (collection) VALUES (?)", collection);
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Check if the collections cache has been populated.
|
|
371
|
+
*/
|
|
372
|
+
hasCollections() {
|
|
373
|
+
return this.sql.exec("SELECT 1 FROM collections LIMIT 1").toArray().length > 0;
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
336
376
|
* Add a blob reference from a record.
|
|
337
377
|
*/
|
|
338
378
|
addRecordBlob(recordUri, blobCid) {
|
|
@@ -1016,15 +1056,17 @@ var AccountDurableObject = class extends DurableObject {
|
|
|
1016
1056
|
*/
|
|
1017
1057
|
async rpcDescribeRepo() {
|
|
1018
1058
|
const repo = await this.getRepo();
|
|
1019
|
-
const
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1059
|
+
const storage = await this.getStorage();
|
|
1060
|
+
if (!storage.hasCollections() && await storage.getRoot()) {
|
|
1061
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1062
|
+
for await (const record of repo.walkRecords()) if (!seen.has(record.collection)) {
|
|
1063
|
+
seen.add(record.collection);
|
|
1064
|
+
storage.addCollection(record.collection);
|
|
1065
|
+
}
|
|
1024
1066
|
}
|
|
1025
1067
|
return {
|
|
1026
1068
|
did: repo.did,
|
|
1027
|
-
collections,
|
|
1069
|
+
collections: storage.getCollections(),
|
|
1028
1070
|
cid: repo.cid.toString()
|
|
1029
1071
|
};
|
|
1030
1072
|
}
|
|
@@ -1089,6 +1131,7 @@ var AccountDurableObject = class extends DurableObject {
|
|
|
1089
1131
|
const dataKey = `${collection}/${actualRkey}`;
|
|
1090
1132
|
const recordCid = await this.repo.data.get(dataKey);
|
|
1091
1133
|
if (!recordCid) throw new Error(`Failed to create record: ${collection}/${actualRkey}`);
|
|
1134
|
+
this.storage.addCollection(collection);
|
|
1092
1135
|
if (this.sequencer) {
|
|
1093
1136
|
const newBlocks = new BlockMap();
|
|
1094
1137
|
const rows = this.ctx.storage.sql.exec("SELECT cid, bytes FROM blocks WHERE rev = ?", this.repo.commit.rev).toArray();
|
|
@@ -1186,6 +1229,7 @@ var AccountDurableObject = class extends DurableObject {
|
|
|
1186
1229
|
const dataKey = `${collection}/${rkey}`;
|
|
1187
1230
|
const recordCid = await this.repo.data.get(dataKey);
|
|
1188
1231
|
if (!recordCid) throw new Error(`Failed to put record: ${collection}/${rkey}`);
|
|
1232
|
+
this.storage.addCollection(collection);
|
|
1189
1233
|
if (this.sequencer) {
|
|
1190
1234
|
const newBlocks = new BlockMap();
|
|
1191
1235
|
const rows = this.ctx.storage.sql.exec("SELECT cid, bytes FROM blocks WHERE rev = ?", this.repo.commit.rev).toArray();
|
|
@@ -1275,6 +1319,7 @@ var AccountDurableObject = class extends DurableObject {
|
|
|
1275
1319
|
} else throw new Error(`Unknown write type: ${write.$type}`);
|
|
1276
1320
|
const prevRev = repo.commit.rev;
|
|
1277
1321
|
this.repo = await repo.applyWrites(ops, keypair);
|
|
1322
|
+
for (const op of ops) if (op.action !== WriteOpAction.Delete) this.storage.addCollection(op.collection);
|
|
1278
1323
|
const finalResults = [];
|
|
1279
1324
|
const opsWithCids = [];
|
|
1280
1325
|
for (let i = 0; i < results.length; i++) {
|
|
@@ -1417,7 +1462,12 @@ var AccountDurableObject = class extends DurableObject {
|
|
|
1417
1462
|
throw new Error(`DID mismatch: CAR file contains DID ${this.repo.did}, but expected ${this.env.DID}`);
|
|
1418
1463
|
}
|
|
1419
1464
|
this.repoInitialized = true;
|
|
1465
|
+
const seenCollections = /* @__PURE__ */ new Set();
|
|
1420
1466
|
for await (const record of this.repo.walkRecords()) {
|
|
1467
|
+
if (!seenCollections.has(record.collection)) {
|
|
1468
|
+
seenCollections.add(record.collection);
|
|
1469
|
+
this.storage.addCollection(record.collection);
|
|
1470
|
+
}
|
|
1421
1471
|
const blobCids = extractBlobCids(record.record);
|
|
1422
1472
|
if (blobCids.length > 0) {
|
|
1423
1473
|
const uri = `at://${this.repo.did}/${record.collection}/${record.rkey}`;
|
|
@@ -1582,6 +1632,18 @@ var AccountDurableObject = class extends DurableObject {
|
|
|
1582
1632
|
await (await this.getStorage()).putPreferences(preferences);
|
|
1583
1633
|
}
|
|
1584
1634
|
/**
|
|
1635
|
+
* RPC method: Get stored email
|
|
1636
|
+
*/
|
|
1637
|
+
async rpcGetEmail() {
|
|
1638
|
+
return { email: (await this.getStorage()).getEmail() };
|
|
1639
|
+
}
|
|
1640
|
+
/**
|
|
1641
|
+
* RPC method: Update stored email
|
|
1642
|
+
*/
|
|
1643
|
+
async rpcUpdateEmail(email) {
|
|
1644
|
+
(await this.getStorage()).setEmail(email);
|
|
1645
|
+
}
|
|
1646
|
+
/**
|
|
1585
1647
|
* RPC method: Get account activation state
|
|
1586
1648
|
*/
|
|
1587
1649
|
async rpcGetActive() {
|
|
@@ -3299,7 +3361,7 @@ async function describeServer(c) {
|
|
|
3299
3361
|
/**
|
|
3300
3362
|
* Create a new session (login)
|
|
3301
3363
|
*/
|
|
3302
|
-
async function createSession(c) {
|
|
3364
|
+
async function createSession(c, accountDO) {
|
|
3303
3365
|
const { identifier, password } = await c.req.json();
|
|
3304
3366
|
if (!identifier || !password) return c.json({
|
|
3305
3367
|
error: "InvalidRequest",
|
|
@@ -3316,19 +3378,22 @@ async function createSession(c) {
|
|
|
3316
3378
|
const serviceDid = `did:web:${c.env.PDS_HOSTNAME}`;
|
|
3317
3379
|
const accessJwt = await createAccessToken(c.env.JWT_SECRET, c.env.DID, serviceDid);
|
|
3318
3380
|
const refreshJwt = await createRefreshToken(c.env.JWT_SECRET, c.env.DID, serviceDid);
|
|
3381
|
+
const { email: storedEmail } = await accountDO.rpcGetEmail();
|
|
3382
|
+
const email = storedEmail || c.env.EMAIL;
|
|
3319
3383
|
return c.json({
|
|
3320
3384
|
accessJwt,
|
|
3321
3385
|
refreshJwt,
|
|
3322
3386
|
handle: c.env.HANDLE,
|
|
3323
3387
|
did: c.env.DID,
|
|
3324
|
-
|
|
3388
|
+
...email ? { email } : {},
|
|
3389
|
+
emailConfirmed: true,
|
|
3325
3390
|
active: true
|
|
3326
3391
|
});
|
|
3327
3392
|
}
|
|
3328
3393
|
/**
|
|
3329
3394
|
* Refresh a session
|
|
3330
3395
|
*/
|
|
3331
|
-
async function refreshSession(c) {
|
|
3396
|
+
async function refreshSession(c, accountDO) {
|
|
3332
3397
|
const authHeader = c.req.header("Authorization");
|
|
3333
3398
|
if (!authHeader?.startsWith("Bearer ")) return c.json({
|
|
3334
3399
|
error: "AuthenticationRequired",
|
|
@@ -3343,12 +3408,15 @@ async function refreshSession(c) {
|
|
|
3343
3408
|
}, 401);
|
|
3344
3409
|
const accessJwt = await createAccessToken(c.env.JWT_SECRET, c.env.DID, serviceDid);
|
|
3345
3410
|
const refreshJwt = await createRefreshToken(c.env.JWT_SECRET, c.env.DID, serviceDid);
|
|
3411
|
+
const { email: storedEmail } = await accountDO.rpcGetEmail();
|
|
3412
|
+
const email = storedEmail || c.env.EMAIL;
|
|
3346
3413
|
return c.json({
|
|
3347
3414
|
accessJwt,
|
|
3348
3415
|
refreshJwt,
|
|
3349
3416
|
handle: c.env.HANDLE,
|
|
3350
3417
|
did: c.env.DID,
|
|
3351
|
-
|
|
3418
|
+
...email ? { email } : {},
|
|
3419
|
+
emailConfirmed: true,
|
|
3352
3420
|
active: true
|
|
3353
3421
|
});
|
|
3354
3422
|
} catch (err) {
|
|
@@ -3365,7 +3433,7 @@ async function refreshSession(c) {
|
|
|
3365
3433
|
/**
|
|
3366
3434
|
* Get current session info
|
|
3367
3435
|
*/
|
|
3368
|
-
async function getSession(c) {
|
|
3436
|
+
async function getSession(c, accountDO) {
|
|
3369
3437
|
const authHeader = c.req.header("Authorization");
|
|
3370
3438
|
if (!authHeader?.startsWith("Bearer ")) return c.json({
|
|
3371
3439
|
error: "AuthenticationRequired",
|
|
@@ -3373,21 +3441,29 @@ async function getSession(c) {
|
|
|
3373
3441
|
}, 401);
|
|
3374
3442
|
const token = authHeader.slice(7);
|
|
3375
3443
|
const serviceDid = `did:web:${c.env.PDS_HOSTNAME}`;
|
|
3376
|
-
if (token === c.env.AUTH_TOKEN)
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3444
|
+
if (token === c.env.AUTH_TOKEN) {
|
|
3445
|
+
const { email: storedEmail } = await accountDO.rpcGetEmail();
|
|
3446
|
+
const email = storedEmail || c.env.EMAIL;
|
|
3447
|
+
return c.json({
|
|
3448
|
+
handle: c.env.HANDLE,
|
|
3449
|
+
did: c.env.DID,
|
|
3450
|
+
...email ? { email } : {},
|
|
3451
|
+
emailConfirmed: true,
|
|
3452
|
+
active: true
|
|
3453
|
+
});
|
|
3454
|
+
}
|
|
3382
3455
|
try {
|
|
3383
3456
|
if ((await verifyAccessToken(token, c.env.JWT_SECRET, serviceDid)).sub !== c.env.DID) return c.json({
|
|
3384
3457
|
error: "AuthenticationRequired",
|
|
3385
3458
|
message: "Invalid access token"
|
|
3386
3459
|
}, 401);
|
|
3460
|
+
const { email: storedEmail } = await accountDO.rpcGetEmail();
|
|
3461
|
+
const email = storedEmail || c.env.EMAIL;
|
|
3387
3462
|
return c.json({
|
|
3388
3463
|
handle: c.env.HANDLE,
|
|
3389
3464
|
did: c.env.DID,
|
|
3390
|
-
|
|
3465
|
+
...email ? { email } : {},
|
|
3466
|
+
emailConfirmed: true,
|
|
3391
3467
|
active: true
|
|
3392
3468
|
});
|
|
3393
3469
|
} catch (err) {
|
|
@@ -3410,7 +3486,7 @@ async function deleteSession(c) {
|
|
|
3410
3486
|
/**
|
|
3411
3487
|
* Get account status - used for migration checks and progress tracking
|
|
3412
3488
|
*/
|
|
3413
|
-
async function
|
|
3489
|
+
async function checkAccountStatus(c, accountDO) {
|
|
3414
3490
|
try {
|
|
3415
3491
|
const status = await accountDO.rpcGetRepoStatus();
|
|
3416
3492
|
const active = await accountDO.rpcGetActive();
|
|
@@ -3497,6 +3573,32 @@ async function deactivateAccount(c, accountDO) {
|
|
|
3497
3573
|
}
|
|
3498
3574
|
}
|
|
3499
3575
|
/**
|
|
3576
|
+
* Request a token to update the account email.
|
|
3577
|
+
* Single-user PDS: no token needed, always returns tokenRequired: false.
|
|
3578
|
+
*/
|
|
3579
|
+
async function requestEmailUpdate(c) {
|
|
3580
|
+
return c.json({ tokenRequired: false });
|
|
3581
|
+
}
|
|
3582
|
+
/**
|
|
3583
|
+
* Request email confirmation.
|
|
3584
|
+
* Single-user PDS: email is always confirmed, nothing to do.
|
|
3585
|
+
*/
|
|
3586
|
+
async function requestEmailConfirmation(c) {
|
|
3587
|
+
return c.json({});
|
|
3588
|
+
}
|
|
3589
|
+
/**
|
|
3590
|
+
* Update the account email address
|
|
3591
|
+
*/
|
|
3592
|
+
async function updateEmail(c, accountDO) {
|
|
3593
|
+
const body = await c.req.json();
|
|
3594
|
+
if (!body.email) return c.json({
|
|
3595
|
+
error: "InvalidRequest",
|
|
3596
|
+
message: "Missing required field: email"
|
|
3597
|
+
}, 400);
|
|
3598
|
+
await accountDO.rpcUpdateEmail(body.email);
|
|
3599
|
+
return c.json({});
|
|
3600
|
+
}
|
|
3601
|
+
/**
|
|
3500
3602
|
* Reset migration state - clears imported repo and blob tracking.
|
|
3501
3603
|
* Only works on deactivated accounts.
|
|
3502
3604
|
*/
|
|
@@ -4108,7 +4210,7 @@ function renderPasskeyErrorPage(error, description) {
|
|
|
4108
4210
|
|
|
4109
4211
|
//#endregion
|
|
4110
4212
|
//#region package.json
|
|
4111
|
-
var version = "0.10.
|
|
4213
|
+
var version = "0.10.4";
|
|
4112
4214
|
|
|
4113
4215
|
//#endregion
|
|
4114
4216
|
//#region src/index.ts
|
|
@@ -4283,14 +4385,17 @@ app.use("/xrpc/com.atproto.identity.resolveHandle", async (c, next) => {
|
|
|
4283
4385
|
app.post("/xrpc/com.atproto.identity.requestPlcOperationSignature", requireAuth, requestPlcOperationSignature);
|
|
4284
4386
|
app.post("/xrpc/com.atproto.identity.signPlcOperation", requireAuth, signPlcOperation);
|
|
4285
4387
|
app.get("/xrpc/gg.mk.experimental.getMigrationToken", requireAuth, getMigrationToken);
|
|
4286
|
-
app.post("/xrpc/com.atproto.server.createSession", createSession);
|
|
4287
|
-
app.post("/xrpc/com.atproto.server.refreshSession", refreshSession);
|
|
4288
|
-
app.get("/xrpc/com.atproto.server.getSession", getSession);
|
|
4388
|
+
app.post("/xrpc/com.atproto.server.createSession", (c) => createSession(c, getAccountDO(c.env)));
|
|
4389
|
+
app.post("/xrpc/com.atproto.server.refreshSession", (c) => refreshSession(c, getAccountDO(c.env)));
|
|
4390
|
+
app.get("/xrpc/com.atproto.server.getSession", (c) => getSession(c, getAccountDO(c.env)));
|
|
4289
4391
|
app.post("/xrpc/com.atproto.server.deleteSession", deleteSession);
|
|
4290
|
-
app.get("/xrpc/com.atproto.server.
|
|
4392
|
+
app.get("/xrpc/com.atproto.server.checkAccountStatus", requireAuth, (c) => checkAccountStatus(c, getAccountDO(c.env)));
|
|
4291
4393
|
app.post("/xrpc/com.atproto.server.activateAccount", requireAuth, (c) => activateAccount(c, getAccountDO(c.env)));
|
|
4292
4394
|
app.post("/xrpc/com.atproto.server.deactivateAccount", requireAuth, (c) => deactivateAccount(c, getAccountDO(c.env)));
|
|
4293
4395
|
app.post("/xrpc/gg.mk.experimental.resetMigration", requireAuth, (c) => resetMigration(c, getAccountDO(c.env)));
|
|
4396
|
+
app.post("/xrpc/com.atproto.server.requestEmailUpdate", requireAuth, requestEmailUpdate);
|
|
4397
|
+
app.post("/xrpc/com.atproto.server.requestEmailConfirmation", requireAuth, requestEmailConfirmation);
|
|
4398
|
+
app.post("/xrpc/com.atproto.server.updateEmail", requireAuth, (c) => updateEmail(c, getAccountDO(c.env)));
|
|
4294
4399
|
app.get("/xrpc/com.atproto.server.getServiceAuth", requireAuth, getServiceAuth);
|
|
4295
4400
|
app.get("/xrpc/app.bsky.actor.getPreferences", requireAuth, async (c) => {
|
|
4296
4401
|
const result = await getAccountDO(c.env).rpcGetPreferences();
|