In sync-cmd.js, the app should look up user's assigned PDS to pass to CredentialManager from the DID document, instead of assuming it's bsky.social ๐
% bun leaflet-md sync
ERROR AuthenticationRequired > Invalid identifier or password
at ok (node_modules/@atcute/client/dist/client.js:175:11)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async CredentialManager.login (node_modules/@atcute/client/dist/credential-manager.js:150:25)
at async Object.run (node_modules/@sharpmars/leaflet-md/dist/cli.js:381:3)
at async runCommand (node_modules/citty/dist/index.mjs:316:16)
at async runCommand (node_modules/citty/dist/index.mjs:307:11)
at async runMain (node_modules/citty/dist/index.mjs:445:7)
Also, handler.session.pdsUri will be undefined for non-Bluesky PDSes, because in the response from createSession, the didDoc field is null, so that value should not be used as is to create a URL (the const carReq = line), but only taken if it's set, otherwise just use the previously used PDS hostname.
% bun leaflet-md sync
ERROR Failed to parse URL from undefined/xrpc/com.atproto.sync.getRepo?did=did:plc:oio4hkxaop4ao4wz2pp3f4cr
at node:internal/deps/undici/undici:15845:13
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async Object.run (node_modules/@sharpmars/leaflet-md/dist/cli.js:387:18)
at async runCommand (node_modules/citty/dist/index.mjs:316:16)
at async runCommand (node_modules/citty/dist/index.mjs:307:11)
at async runMain (node_modules/citty/dist/index.mjs:445:7)
[cause]: Invalid URL
at new URL (node:internal/url:828:25)
at new Request (node:internal/deps/undici/undici:10413:25)
at fetch (node:internal/deps/undici/undici:11325:25)
at fetch (node:internal/deps/undici/undici:15843:10)
at fetch (node:internal/bootstrap/web/exposed-window-or-worker:83:12)
at Object.run (node_modules/@sharpmars/leaflet-md/dist/cli.js:387:24)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async runCommand (node_modules/citty/dist/index.mjs:316:16)
at async runCommand (node_modules/citty/dist/index.mjs:307:11)
at async runMain (node_modules/citty/dist/index.mjs:445:7)
Didn't do much with app passwords, so wouldn't know. Also my assumption was that app passwords are somehow bsky dependent and it would resolve to the PDS? Idk feels kinda silly thinking that now. Thanks for letting me know.