CLI tool to sync your Markdown to Leaflet
leafletpub atproto cli markdown

doesn't work with non-Bluesky PDSes #6

closed
opened by mackuba.eu

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.

Yeah so bsky.social acts as a "reverse proxy" front for Bluesky PDSes and you can log in through there and then get to the real PDS, but that only works for Bluesky PDSes. If you're somewhere outside, bsky.social just says it doesn't know you. I'm not sure how atcute does it, but generally you need to get the PDS hostname from PLC directory or from did:web DID document, and then call createSession on that hostname and not on bsky.social.

Slingshot should handle that. I think I already use it somewhere, why not depend on it more.

sign up or login to add to the discussion
Labels

None yet.

assignee

None yet.

Participants 2
AT URI
at://did:plc:oio4hkxaop4ao4wz2pp3f4cr/sh.tangled.repo.issue/3m5p5h7yfrq22