simple atproto oauth for static svelte apps flo-bit.dev/svelte-atproto-client-oauth/

getting there

+159 -1089
+3 -912
package-lock.json
··· 8 8 "name": "svelte-atproto-client-oauth", 9 9 "version": "0.0.1", 10 10 "dependencies": { 11 - "@atcute/oauth-browser-client": "^1.0.13", 12 - "@atproto/api": "^0.14.4", 13 - "@atproto/oauth-client-browser": "^0.3.10", 14 - "@sveltejs/adapter-static": "^3.0.8", 15 - "@tailwindcss/forms": "^0.5.10" 11 + "@atcute/oauth-browser-client": "^1.0.13" 16 12 }, 17 13 "devDependencies": { 18 14 "@eslint/compat": "^1.2.5", 19 15 "@eslint/js": "^9.18.0", 20 16 "@sveltejs/adapter-auto": "^4.0.0", 17 + "@sveltejs/adapter-static": "^3.0.8", 21 18 "@sveltejs/kit": "^2.16.0", 22 19 "@sveltejs/vite-plugin-svelte": "^5.0.0", 20 + "@tailwindcss/forms": "^0.5.10", 23 21 "@tailwindcss/vite": "^4.0.0", 24 22 "eslint": "^9.18.0", 25 23 "eslint-config-prettier": "^10.0.1", ··· 256 254 "zod": "^3.23.8" 257 255 } 258 256 }, 259 - "node_modules/@esbuild/aix-ppc64": { 260 - "version": "0.24.2", 261 - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.24.2.tgz", 262 - "integrity": "sha512-thpVCb/rhxE/BnMLQ7GReQLLN8q9qbHmI55F4489/ByVg2aQaQ6kbcLb6FHkocZzQhxc4gx0sCk0tJkKBFzDhA==", 263 - "cpu": [ 264 - "ppc64" 265 - ], 266 - "optional": true, 267 - "os": [ 268 - "aix" 269 - ], 270 - "engines": { 271 - "node": ">=18" 272 - } 273 - }, 274 - "node_modules/@esbuild/android-arm": { 275 - "version": "0.24.2", 276 - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.24.2.tgz", 277 - "integrity": "sha512-tmwl4hJkCfNHwFB3nBa8z1Uy3ypZpxqxfTQOcHX+xRByyYgunVbZ9MzUUfb0RxaHIMnbHagwAxuTL+tnNM+1/Q==", 278 - "cpu": [ 279 - "arm" 280 - ], 281 - "optional": true, 282 - "os": [ 283 - "android" 284 - ], 285 - "engines": { 286 - "node": ">=18" 287 - } 288 - }, 289 - "node_modules/@esbuild/android-arm64": { 290 - "version": "0.24.2", 291 - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.24.2.tgz", 292 - "integrity": "sha512-cNLgeqCqV8WxfcTIOeL4OAtSmL8JjcN6m09XIgro1Wi7cF4t/THaWEa7eL5CMoMBdjoHOTh/vwTO/o2TRXIyzg==", 293 - "cpu": [ 294 - "arm64" 295 - ], 296 - "optional": true, 297 - "os": [ 298 - "android" 299 - ], 300 - "engines": { 301 - "node": ">=18" 302 - } 303 - }, 304 - "node_modules/@esbuild/android-x64": { 305 - "version": "0.24.2", 306 - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.24.2.tgz", 307 - "integrity": "sha512-B6Q0YQDqMx9D7rvIcsXfmJfvUYLoP722bgfBlO5cGvNVb5V/+Y7nhBE3mHV9OpxBf4eAS2S68KZztiPaWq4XYw==", 308 - "cpu": [ 309 - "x64" 310 - ], 311 - "optional": true, 312 - "os": [ 313 - "android" 314 - ], 315 - "engines": { 316 - "node": ">=18" 317 - } 318 - }, 319 257 "node_modules/@esbuild/darwin-arm64": { 320 258 "version": "0.24.2", 321 259 "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.24.2.tgz", ··· 331 269 "node": ">=18" 332 270 } 333 271 }, 334 - "node_modules/@esbuild/darwin-x64": { 335 - "version": "0.24.2", 336 - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.24.2.tgz", 337 - "integrity": "sha512-WeSrmwwHaPkNR5H3yYfowhZcbriGqooyu3zI/3GGpF8AyUdsrrP0X6KumITGA9WOyiJavnGZUwPGvxvwfWPHIA==", 338 - "cpu": [ 339 - "x64" 340 - ], 341 - "optional": true, 342 - "os": [ 343 - "darwin" 344 - ], 345 - "engines": { 346 - "node": ">=18" 347 - } 348 - }, 349 - "node_modules/@esbuild/freebsd-arm64": { 350 - "version": "0.24.2", 351 - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.24.2.tgz", 352 - "integrity": "sha512-UN8HXjtJ0k/Mj6a9+5u6+2eZ2ERD7Edt1Q9IZiB5UZAIdPnVKDoG7mdTVGhHJIeEml60JteamR3qhsr1r8gXvg==", 353 - "cpu": [ 354 - "arm64" 355 - ], 356 - "optional": true, 357 - "os": [ 358 - "freebsd" 359 - ], 360 - "engines": { 361 - "node": ">=18" 362 - } 363 - }, 364 - "node_modules/@esbuild/freebsd-x64": { 365 - "version": "0.24.2", 366 - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.24.2.tgz", 367 - "integrity": "sha512-TvW7wE/89PYW+IevEJXZ5sF6gJRDY/14hyIGFXdIucxCsbRmLUcjseQu1SyTko+2idmCw94TgyaEZi9HUSOe3Q==", 368 - "cpu": [ 369 - "x64" 370 - ], 371 - "optional": true, 372 - "os": [ 373 - "freebsd" 374 - ], 375 - "engines": { 376 - "node": ">=18" 377 - } 378 - }, 379 - "node_modules/@esbuild/linux-arm": { 380 - "version": "0.24.2", 381 - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.24.2.tgz", 382 - "integrity": "sha512-n0WRM/gWIdU29J57hJyUdIsk0WarGd6To0s+Y+LwvlC55wt+GT/OgkwoXCXvIue1i1sSNWblHEig00GBWiJgfA==", 383 - "cpu": [ 384 - "arm" 385 - ], 386 - "optional": true, 387 - "os": [ 388 - "linux" 389 - ], 390 - "engines": { 391 - "node": ">=18" 392 - } 393 - }, 394 - "node_modules/@esbuild/linux-arm64": { 395 - "version": "0.24.2", 396 - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.24.2.tgz", 397 - "integrity": "sha512-7HnAD6074BW43YvvUmE/35Id9/NB7BeX5EoNkK9obndmZBUk8xmJJeU7DwmUeN7tkysslb2eSl6CTrYz6oEMQg==", 398 - "cpu": [ 399 - "arm64" 400 - ], 401 - "optional": true, 402 - "os": [ 403 - "linux" 404 - ], 405 - "engines": { 406 - "node": ">=18" 407 - } 408 - }, 409 - "node_modules/@esbuild/linux-ia32": { 410 - "version": "0.24.2", 411 - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.24.2.tgz", 412 - "integrity": "sha512-sfv0tGPQhcZOgTKO3oBE9xpHuUqguHvSo4jl+wjnKwFpapx+vUDcawbwPNuBIAYdRAvIDBfZVvXprIj3HA+Ugw==", 413 - "cpu": [ 414 - "ia32" 415 - ], 416 - "optional": true, 417 - "os": [ 418 - "linux" 419 - ], 420 - "engines": { 421 - "node": ">=18" 422 - } 423 - }, 424 - "node_modules/@esbuild/linux-loong64": { 425 - "version": "0.24.2", 426 - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.24.2.tgz", 427 - "integrity": "sha512-CN9AZr8kEndGooS35ntToZLTQLHEjtVB5n7dl8ZcTZMonJ7CCfStrYhrzF97eAecqVbVJ7APOEe18RPI4KLhwQ==", 428 - "cpu": [ 429 - "loong64" 430 - ], 431 - "optional": true, 432 - "os": [ 433 - "linux" 434 - ], 435 - "engines": { 436 - "node": ">=18" 437 - } 438 - }, 439 - "node_modules/@esbuild/linux-mips64el": { 440 - "version": "0.24.2", 441 - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.24.2.tgz", 442 - "integrity": "sha512-iMkk7qr/wl3exJATwkISxI7kTcmHKE+BlymIAbHO8xanq/TjHaaVThFF6ipWzPHryoFsesNQJPE/3wFJw4+huw==", 443 - "cpu": [ 444 - "mips64el" 445 - ], 446 - "optional": true, 447 - "os": [ 448 - "linux" 449 - ], 450 - "engines": { 451 - "node": ">=18" 452 - } 453 - }, 454 - "node_modules/@esbuild/linux-ppc64": { 455 - "version": "0.24.2", 456 - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.24.2.tgz", 457 - "integrity": "sha512-shsVrgCZ57Vr2L8mm39kO5PPIb+843FStGt7sGGoqiiWYconSxwTiuswC1VJZLCjNiMLAMh34jg4VSEQb+iEbw==", 458 - "cpu": [ 459 - "ppc64" 460 - ], 461 - "optional": true, 462 - "os": [ 463 - "linux" 464 - ], 465 - "engines": { 466 - "node": ">=18" 467 - } 468 - }, 469 - "node_modules/@esbuild/linux-riscv64": { 470 - "version": "0.24.2", 471 - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.24.2.tgz", 472 - "integrity": "sha512-4eSFWnU9Hhd68fW16GD0TINewo1L6dRrB+oLNNbYyMUAeOD2yCK5KXGK1GH4qD/kT+bTEXjsyTCiJGHPZ3eM9Q==", 473 - "cpu": [ 474 - "riscv64" 475 - ], 476 - "optional": true, 477 - "os": [ 478 - "linux" 479 - ], 480 - "engines": { 481 - "node": ">=18" 482 - } 483 - }, 484 - "node_modules/@esbuild/linux-s390x": { 485 - "version": "0.24.2", 486 - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.24.2.tgz", 487 - "integrity": "sha512-S0Bh0A53b0YHL2XEXC20bHLuGMOhFDO6GN4b3YjRLK//Ep3ql3erpNcPlEFed93hsQAjAQDNsvcK+hV90FubSw==", 488 - "cpu": [ 489 - "s390x" 490 - ], 491 - "optional": true, 492 - "os": [ 493 - "linux" 494 - ], 495 - "engines": { 496 - "node": ">=18" 497 - } 498 - }, 499 - "node_modules/@esbuild/linux-x64": { 500 - "version": "0.24.2", 501 - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.24.2.tgz", 502 - "integrity": "sha512-8Qi4nQcCTbLnK9WoMjdC9NiTG6/E38RNICU6sUNqK0QFxCYgoARqVqxdFmWkdonVsvGqWhmm7MO0jyTqLqwj0Q==", 503 - "cpu": [ 504 - "x64" 505 - ], 506 - "optional": true, 507 - "os": [ 508 - "linux" 509 - ], 510 - "engines": { 511 - "node": ">=18" 512 - } 513 - }, 514 - "node_modules/@esbuild/netbsd-arm64": { 515 - "version": "0.24.2", 516 - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.24.2.tgz", 517 - "integrity": "sha512-wuLK/VztRRpMt9zyHSazyCVdCXlpHkKm34WUyinD2lzK07FAHTq0KQvZZlXikNWkDGoT6x3TD51jKQ7gMVpopw==", 518 - "cpu": [ 519 - "arm64" 520 - ], 521 - "optional": true, 522 - "os": [ 523 - "netbsd" 524 - ], 525 - "engines": { 526 - "node": ">=18" 527 - } 528 - }, 529 - "node_modules/@esbuild/netbsd-x64": { 530 - "version": "0.24.2", 531 - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.24.2.tgz", 532 - "integrity": "sha512-VefFaQUc4FMmJuAxmIHgUmfNiLXY438XrL4GDNV1Y1H/RW3qow68xTwjZKfj/+Plp9NANmzbH5R40Meudu8mmw==", 533 - "cpu": [ 534 - "x64" 535 - ], 536 - "optional": true, 537 - "os": [ 538 - "netbsd" 539 - ], 540 - "engines": { 541 - "node": ">=18" 542 - } 543 - }, 544 - "node_modules/@esbuild/openbsd-arm64": { 545 - "version": "0.24.2", 546 - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.24.2.tgz", 547 - "integrity": "sha512-YQbi46SBct6iKnszhSvdluqDmxCJA+Pu280Av9WICNwQmMxV7nLRHZfjQzwbPs3jeWnuAhE9Jy0NrnJ12Oz+0A==", 548 - "cpu": [ 549 - "arm64" 550 - ], 551 - "optional": true, 552 - "os": [ 553 - "openbsd" 554 - ], 555 - "engines": { 556 - "node": ">=18" 557 - } 558 - }, 559 - "node_modules/@esbuild/openbsd-x64": { 560 - "version": "0.24.2", 561 - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.24.2.tgz", 562 - "integrity": "sha512-+iDS6zpNM6EnJyWv0bMGLWSWeXGN/HTaF/LXHXHwejGsVi+ooqDfMCCTerNFxEkM3wYVcExkeGXNqshc9iMaOA==", 563 - "cpu": [ 564 - "x64" 565 - ], 566 - "optional": true, 567 - "os": [ 568 - "openbsd" 569 - ], 570 - "engines": { 571 - "node": ">=18" 572 - } 573 - }, 574 - "node_modules/@esbuild/sunos-x64": { 575 - "version": "0.24.2", 576 - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.24.2.tgz", 577 - "integrity": "sha512-hTdsW27jcktEvpwNHJU4ZwWFGkz2zRJUz8pvddmXPtXDzVKTTINmlmga3ZzwcuMpUvLw7JkLy9QLKyGpD2Yxig==", 578 - "cpu": [ 579 - "x64" 580 - ], 581 - "optional": true, 582 - "os": [ 583 - "sunos" 584 - ], 585 - "engines": { 586 - "node": ">=18" 587 - } 588 - }, 589 - "node_modules/@esbuild/win32-arm64": { 590 - "version": "0.24.2", 591 - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.24.2.tgz", 592 - "integrity": "sha512-LihEQ2BBKVFLOC9ZItT9iFprsE9tqjDjnbulhHoFxYQtQfai7qfluVODIYxt1PgdoyQkz23+01rzwNwYfutxUQ==", 593 - "cpu": [ 594 - "arm64" 595 - ], 596 - "optional": true, 597 - "os": [ 598 - "win32" 599 - ], 600 - "engines": { 601 - "node": ">=18" 602 - } 603 - }, 604 - "node_modules/@esbuild/win32-ia32": { 605 - "version": "0.24.2", 606 - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.24.2.tgz", 607 - "integrity": "sha512-q+iGUwfs8tncmFC9pcnD5IvRHAzmbwQ3GPS5/ceCyHdjXubwQWI12MKWSNSMYLJMq23/IUCvJMS76PDqXe1fxA==", 608 - "cpu": [ 609 - "ia32" 610 - ], 611 - "optional": true, 612 - "os": [ 613 - "win32" 614 - ], 615 - "engines": { 616 - "node": ">=18" 617 - } 618 - }, 619 - "node_modules/@esbuild/win32-x64": { 620 - "version": "0.24.2", 621 - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.24.2.tgz", 622 - "integrity": "sha512-7VTgWzgMGvup6aSqDPLiW5zHaxYJGTO4OokMjIlrCtf+VpEL+cXKtCvg723iguPYI5oaUNdS+/V7OU2gvXVWEg==", 623 - "cpu": [ 624 - "x64" 625 - ], 626 - "optional": true, 627 - "os": [ 628 - "win32" 629 - ], 630 - "engines": { 631 - "node": ">=18" 632 - } 633 - }, 634 272 "node_modules/@eslint-community/eslint-utils": { 635 273 "version": "4.4.1", 636 274 "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.1.tgz", ··· 923 561 "resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.28.tgz", 924 562 "integrity": "sha512-8LduaNlMZGwdZ6qWrKlfa+2M4gahzFkprZiAt2TF8uS0qQgBizKXpXURqvTJ4WtmupWxaLqjRb2UCTe72mu+Aw==" 925 563 }, 926 - "node_modules/@rollup/rollup-android-arm-eabi": { 927 - "version": "4.34.8", 928 - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.34.8.tgz", 929 - "integrity": "sha512-q217OSE8DTp8AFHuNHXo0Y86e1wtlfVrXiAlwkIvGRQv9zbc6mE3sjIVfwI8sYUyNxwOg0j/Vm1RKM04JcWLJw==", 930 - "cpu": [ 931 - "arm" 932 - ], 933 - "optional": true, 934 - "os": [ 935 - "android" 936 - ] 937 - }, 938 - "node_modules/@rollup/rollup-android-arm64": { 939 - "version": "4.34.8", 940 - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.34.8.tgz", 941 - "integrity": "sha512-Gigjz7mNWaOL9wCggvoK3jEIUUbGul656opstjaUSGC3eT0BM7PofdAJaBfPFWWkXNVAXbaQtC99OCg4sJv70Q==", 942 - "cpu": [ 943 - "arm64" 944 - ], 945 - "optional": true, 946 - "os": [ 947 - "android" 948 - ] 949 - }, 950 564 "node_modules/@rollup/rollup-darwin-arm64": { 951 565 "version": "4.34.8", 952 566 "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.34.8.tgz", ··· 959 573 "darwin" 960 574 ] 961 575 }, 962 - "node_modules/@rollup/rollup-darwin-x64": { 963 - "version": "4.34.8", 964 - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.34.8.tgz", 965 - "integrity": "sha512-qIP/elwR/tq/dYRx3lgwK31jkZvMiD6qUtOycLhTzCvrjbZ3LjQnEM9rNhSGpbLXVJYQ3rq39A6Re0h9tU2ynw==", 966 - "cpu": [ 967 - "x64" 968 - ], 969 - "optional": true, 970 - "os": [ 971 - "darwin" 972 - ] 973 - }, 974 - "node_modules/@rollup/rollup-freebsd-arm64": { 975 - "version": "4.34.8", 976 - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.34.8.tgz", 977 - "integrity": "sha512-IQNVXL9iY6NniYbTaOKdrlVP3XIqazBgJOVkddzJlqnCpRi/yAeSOa8PLcECFSQochzqApIOE1GHNu3pCz+BDA==", 978 - "cpu": [ 979 - "arm64" 980 - ], 981 - "optional": true, 982 - "os": [ 983 - "freebsd" 984 - ] 985 - }, 986 - "node_modules/@rollup/rollup-freebsd-x64": { 987 - "version": "4.34.8", 988 - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.34.8.tgz", 989 - "integrity": "sha512-TYXcHghgnCqYFiE3FT5QwXtOZqDj5GmaFNTNt3jNC+vh22dc/ukG2cG+pi75QO4kACohZzidsq7yKTKwq/Jq7Q==", 990 - "cpu": [ 991 - "x64" 992 - ], 993 - "optional": true, 994 - "os": [ 995 - "freebsd" 996 - ] 997 - }, 998 - "node_modules/@rollup/rollup-linux-arm-gnueabihf": { 999 - "version": "4.34.8", 1000 - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.34.8.tgz", 1001 - "integrity": "sha512-A4iphFGNkWRd+5m3VIGuqHnG3MVnqKe7Al57u9mwgbyZ2/xF9Jio72MaY7xxh+Y87VAHmGQr73qoKL9HPbXj1g==", 1002 - "cpu": [ 1003 - "arm" 1004 - ], 1005 - "optional": true, 1006 - "os": [ 1007 - "linux" 1008 - ] 1009 - }, 1010 - "node_modules/@rollup/rollup-linux-arm-musleabihf": { 1011 - "version": "4.34.8", 1012 - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.34.8.tgz", 1013 - "integrity": "sha512-S0lqKLfTm5u+QTxlFiAnb2J/2dgQqRy/XvziPtDd1rKZFXHTyYLoVL58M/XFwDI01AQCDIevGLbQrMAtdyanpA==", 1014 - "cpu": [ 1015 - "arm" 1016 - ], 1017 - "optional": true, 1018 - "os": [ 1019 - "linux" 1020 - ] 1021 - }, 1022 - "node_modules/@rollup/rollup-linux-arm64-gnu": { 1023 - "version": "4.34.8", 1024 - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.34.8.tgz", 1025 - "integrity": "sha512-jpz9YOuPiSkL4G4pqKrus0pn9aYwpImGkosRKwNi+sJSkz+WU3anZe6hi73StLOQdfXYXC7hUfsQlTnjMd3s1A==", 1026 - "cpu": [ 1027 - "arm64" 1028 - ], 1029 - "optional": true, 1030 - "os": [ 1031 - "linux" 1032 - ] 1033 - }, 1034 - "node_modules/@rollup/rollup-linux-arm64-musl": { 1035 - "version": "4.34.8", 1036 - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.34.8.tgz", 1037 - "integrity": "sha512-KdSfaROOUJXgTVxJNAZ3KwkRc5nggDk+06P6lgi1HLv1hskgvxHUKZ4xtwHkVYJ1Rep4GNo+uEfycCRRxht7+Q==", 1038 - "cpu": [ 1039 - "arm64" 1040 - ], 1041 - "optional": true, 1042 - "os": [ 1043 - "linux" 1044 - ] 1045 - }, 1046 - "node_modules/@rollup/rollup-linux-loongarch64-gnu": { 1047 - "version": "4.34.8", 1048 - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.34.8.tgz", 1049 - "integrity": "sha512-NyF4gcxwkMFRjgXBM6g2lkT58OWztZvw5KkV2K0qqSnUEqCVcqdh2jN4gQrTn/YUpAcNKyFHfoOZEer9nwo6uQ==", 1050 - "cpu": [ 1051 - "loong64" 1052 - ], 1053 - "optional": true, 1054 - "os": [ 1055 - "linux" 1056 - ] 1057 - }, 1058 - "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { 1059 - "version": "4.34.8", 1060 - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.34.8.tgz", 1061 - "integrity": "sha512-LMJc999GkhGvktHU85zNTDImZVUCJ1z/MbAJTnviiWmmjyckP5aQsHtcujMjpNdMZPT2rQEDBlJfubhs3jsMfw==", 1062 - "cpu": [ 1063 - "ppc64" 1064 - ], 1065 - "optional": true, 1066 - "os": [ 1067 - "linux" 1068 - ] 1069 - }, 1070 - "node_modules/@rollup/rollup-linux-riscv64-gnu": { 1071 - "version": "4.34.8", 1072 - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.34.8.tgz", 1073 - "integrity": "sha512-xAQCAHPj8nJq1PI3z8CIZzXuXCstquz7cIOL73HHdXiRcKk8Ywwqtx2wrIy23EcTn4aZ2fLJNBB8d0tQENPCmw==", 1074 - "cpu": [ 1075 - "riscv64" 1076 - ], 1077 - "optional": true, 1078 - "os": [ 1079 - "linux" 1080 - ] 1081 - }, 1082 - "node_modules/@rollup/rollup-linux-s390x-gnu": { 1083 - "version": "4.34.8", 1084 - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.34.8.tgz", 1085 - "integrity": "sha512-DdePVk1NDEuc3fOe3dPPTb+rjMtuFw89gw6gVWxQFAuEqqSdDKnrwzZHrUYdac7A7dXl9Q2Vflxpme15gUWQFA==", 1086 - "cpu": [ 1087 - "s390x" 1088 - ], 1089 - "optional": true, 1090 - "os": [ 1091 - "linux" 1092 - ] 1093 - }, 1094 - "node_modules/@rollup/rollup-linux-x64-gnu": { 1095 - "version": "4.34.8", 1096 - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.34.8.tgz", 1097 - "integrity": "sha512-8y7ED8gjxITUltTUEJLQdgpbPh1sUQ0kMTmufRF/Ns5tI9TNMNlhWtmPKKHCU0SilX+3MJkZ0zERYYGIVBYHIA==", 1098 - "cpu": [ 1099 - "x64" 1100 - ], 1101 - "optional": true, 1102 - "os": [ 1103 - "linux" 1104 - ] 1105 - }, 1106 - "node_modules/@rollup/rollup-linux-x64-musl": { 1107 - "version": "4.34.8", 1108 - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.34.8.tgz", 1109 - "integrity": "sha512-SCXcP0ZpGFIe7Ge+McxY5zKxiEI5ra+GT3QRxL0pMMtxPfpyLAKleZODi1zdRHkz5/BhueUrYtYVgubqe9JBNQ==", 1110 - "cpu": [ 1111 - "x64" 1112 - ], 1113 - "optional": true, 1114 - "os": [ 1115 - "linux" 1116 - ] 1117 - }, 1118 - "node_modules/@rollup/rollup-win32-arm64-msvc": { 1119 - "version": "4.34.8", 1120 - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.34.8.tgz", 1121 - "integrity": "sha512-YHYsgzZgFJzTRbth4h7Or0m5O74Yda+hLin0irAIobkLQFRQd1qWmnoVfwmKm9TXIZVAD0nZ+GEb2ICicLyCnQ==", 1122 - "cpu": [ 1123 - "arm64" 1124 - ], 1125 - "optional": true, 1126 - "os": [ 1127 - "win32" 1128 - ] 1129 - }, 1130 - "node_modules/@rollup/rollup-win32-ia32-msvc": { 1131 - "version": "4.34.8", 1132 - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.34.8.tgz", 1133 - "integrity": "sha512-r3NRQrXkHr4uWy5TOjTpTYojR9XmF0j/RYgKCef+Ag46FWUTltm5ziticv8LdNsDMehjJ543x/+TJAek/xBA2w==", 1134 - "cpu": [ 1135 - "ia32" 1136 - ], 1137 - "optional": true, 1138 - "os": [ 1139 - "win32" 1140 - ] 1141 - }, 1142 - "node_modules/@rollup/rollup-win32-x64-msvc": { 1143 - "version": "4.34.8", 1144 - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.34.8.tgz", 1145 - "integrity": "sha512-U0FaE5O1BCpZSeE6gBl3c5ObhePQSfk9vDRToMmTkbhCOgW4jqvtS5LGyQ76L1fH8sM0keRp4uDTsbjiUyjk0g==", 1146 - "cpu": [ 1147 - "x64" 1148 - ], 1149 - "optional": true, 1150 - "os": [ 1151 - "win32" 1152 - ] 1153 - }, 1154 576 "node_modules/@sveltejs/adapter-auto": { 1155 577 "version": "4.0.0", 1156 578 "resolved": "https://registry.npmjs.org/@sveltejs/adapter-auto/-/adapter-auto-4.0.0.tgz", ··· 1280 702 "@tailwindcss/oxide-win32-x64-msvc": "4.0.8" 1281 703 } 1282 704 }, 1283 - "node_modules/@tailwindcss/oxide-android-arm64": { 1284 - "version": "4.0.8", 1285 - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-android-arm64/-/oxide-android-arm64-4.0.8.tgz", 1286 - "integrity": "sha512-We7K79+Sm4mwJHk26Yzu/GAj7C7myemm7PeXvpgMxyxO70SSFSL3uCcqFbz9JA5M5UPkrl7N9fkBe/Y0iazqpA==", 1287 - "cpu": [ 1288 - "arm64" 1289 - ], 1290 - "dev": true, 1291 - "optional": true, 1292 - "os": [ 1293 - "android" 1294 - ], 1295 - "engines": { 1296 - "node": ">= 10" 1297 - } 1298 - }, 1299 705 "node_modules/@tailwindcss/oxide-darwin-arm64": { 1300 706 "version": "4.0.8", 1301 707 "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-arm64/-/oxide-darwin-arm64-4.0.8.tgz", ··· 1307 713 "optional": true, 1308 714 "os": [ 1309 715 "darwin" 1310 - ], 1311 - "engines": { 1312 - "node": ">= 10" 1313 - } 1314 - }, 1315 - "node_modules/@tailwindcss/oxide-darwin-x64": { 1316 - "version": "4.0.8", 1317 - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-x64/-/oxide-darwin-x64-4.0.8.tgz", 1318 - "integrity": "sha512-fWfywfYIlSWtKoqWTjukTHLWV3ARaBRjXCC2Eo0l6KVpaqGY4c2y8snUjp1xpxUtpqwMvCvFWFaleMoz1Vhzlw==", 1319 - "cpu": [ 1320 - "x64" 1321 - ], 1322 - "dev": true, 1323 - "optional": true, 1324 - "os": [ 1325 - "darwin" 1326 - ], 1327 - "engines": { 1328 - "node": ">= 10" 1329 - } 1330 - }, 1331 - "node_modules/@tailwindcss/oxide-freebsd-x64": { 1332 - "version": "4.0.8", 1333 - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-freebsd-x64/-/oxide-freebsd-x64-4.0.8.tgz", 1334 - "integrity": "sha512-SO+dyvjJV9G94bnmq2288Ke0BIdvrbSbvtPLaQdqjqHR83v5L2fWADyFO+1oecHo9Owsk8MxcXh1agGVPIKIqw==", 1335 - "cpu": [ 1336 - "x64" 1337 - ], 1338 - "dev": true, 1339 - "optional": true, 1340 - "os": [ 1341 - "freebsd" 1342 - ], 1343 - "engines": { 1344 - "node": ">= 10" 1345 - } 1346 - }, 1347 - "node_modules/@tailwindcss/oxide-linux-arm-gnueabihf": { 1348 - "version": "4.0.8", 1349 - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm-gnueabihf/-/oxide-linux-arm-gnueabihf-4.0.8.tgz", 1350 - "integrity": "sha512-ZSHggWiEblQNV69V0qUK5vuAtHP+I+S2eGrKGJ5lPgwgJeAd6GjLsVBN+Mqn2SPVfYM3BOpS9jX/zVg9RWQVDQ==", 1351 - "cpu": [ 1352 - "arm" 1353 - ], 1354 - "dev": true, 1355 - "optional": true, 1356 - "os": [ 1357 - "linux" 1358 - ], 1359 - "engines": { 1360 - "node": ">= 10" 1361 - } 1362 - }, 1363 - "node_modules/@tailwindcss/oxide-linux-arm64-gnu": { 1364 - "version": "4.0.8", 1365 - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm64-gnu/-/oxide-linux-arm64-gnu-4.0.8.tgz", 1366 - "integrity": "sha512-xWpr6M0OZLDNsr7+bQz+3X7zcnDJZJ1N9gtBWCtfhkEtDjjxYEp+Lr5L5nc/yXlL4MyCHnn0uonGVXy3fhxaVA==", 1367 - "cpu": [ 1368 - "arm64" 1369 - ], 1370 - "dev": true, 1371 - "optional": true, 1372 - "os": [ 1373 - "linux" 1374 - ], 1375 - "engines": { 1376 - "node": ">= 10" 1377 - } 1378 - }, 1379 - "node_modules/@tailwindcss/oxide-linux-arm64-musl": { 1380 - "version": "4.0.8", 1381 - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm64-musl/-/oxide-linux-arm64-musl-4.0.8.tgz", 1382 - "integrity": "sha512-5tz2IL7LN58ssGEq7h/staD7pu/izF/KeMWdlJ86WDe2Ah46LF3ET6ZGKTr5eZMrnEA0M9cVFuSPprKRHNgjeg==", 1383 - "cpu": [ 1384 - "arm64" 1385 - ], 1386 - "dev": true, 1387 - "optional": true, 1388 - "os": [ 1389 - "linux" 1390 - ], 1391 - "engines": { 1392 - "node": ">= 10" 1393 - } 1394 - }, 1395 - "node_modules/@tailwindcss/oxide-linux-x64-gnu": { 1396 - "version": "4.0.8", 1397 - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-x64-gnu/-/oxide-linux-x64-gnu-4.0.8.tgz", 1398 - "integrity": "sha512-KSzMkhyrxAQyY2o194NKVKU9j/c+NFSoMvnHWFaNHKi3P1lb+Vq1UC19tLHrmxSkKapcMMu69D7+G1+FVGNDXQ==", 1399 - "cpu": [ 1400 - "x64" 1401 - ], 1402 - "dev": true, 1403 - "optional": true, 1404 - "os": [ 1405 - "linux" 1406 - ], 1407 - "engines": { 1408 - "node": ">= 10" 1409 - } 1410 - }, 1411 - "node_modules/@tailwindcss/oxide-linux-x64-musl": { 1412 - "version": "4.0.8", 1413 - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-x64-musl/-/oxide-linux-x64-musl-4.0.8.tgz", 1414 - "integrity": "sha512-yFYKG5UtHTRimjtqxUWXBgI4Tc6NJe3USjRIVdlTczpLRxq/SFwgzGl5JbatCxgSRDPBFwRrNPxq+ukfQFGdrw==", 1415 - "cpu": [ 1416 - "x64" 1417 - ], 1418 - "dev": true, 1419 - "optional": true, 1420 - "os": [ 1421 - "linux" 1422 - ], 1423 - "engines": { 1424 - "node": ">= 10" 1425 - } 1426 - }, 1427 - "node_modules/@tailwindcss/oxide-win32-arm64-msvc": { 1428 - "version": "4.0.8", 1429 - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-arm64-msvc/-/oxide-win32-arm64-msvc-4.0.8.tgz", 1430 - "integrity": "sha512-tndGujmCSba85cRCnQzXgpA2jx5gXimyspsUYae5jlPyLRG0RjXbDshFKOheVXU4TLflo7FSG8EHCBJ0EHTKdQ==", 1431 - "cpu": [ 1432 - "arm64" 1433 - ], 1434 - "dev": true, 1435 - "optional": true, 1436 - "os": [ 1437 - "win32" 1438 - ], 1439 - "engines": { 1440 - "node": ">= 10" 1441 - } 1442 - }, 1443 - "node_modules/@tailwindcss/oxide-win32-x64-msvc": { 1444 - "version": "4.0.8", 1445 - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-x64-msvc/-/oxide-win32-x64-msvc-4.0.8.tgz", 1446 - "integrity": "sha512-T77jroAc0p4EHVVgTUiNeFn6Nj3jtD3IeNId2X+0k+N1XxfNipy81BEkYErpKLiOkNhpNFjPee8/ZVas29b2OQ==", 1447 - "cpu": [ 1448 - "x64" 1449 - ], 1450 - "dev": true, 1451 - "optional": true, 1452 - "os": [ 1453 - "win32" 1454 716 ], 1455 717 "engines": { 1456 718 "node": ">= 10" ··· 2632 1894 "optional": true, 2633 1895 "os": [ 2634 1896 "darwin" 2635 - ], 2636 - "engines": { 2637 - "node": ">= 12.0.0" 2638 - }, 2639 - "funding": { 2640 - "type": "opencollective", 2641 - "url": "https://opencollective.com/parcel" 2642 - } 2643 - }, 2644 - "node_modules/lightningcss-darwin-x64": { 2645 - "version": "1.29.1", 2646 - "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.29.1.tgz", 2647 - "integrity": "sha512-k33G9IzKUpHy/J/3+9MCO4e+PzaFblsgBjSGlpAaFikeBFm8B/CkO3cKU9oI4g+fjS2KlkLM/Bza9K/aw8wsNA==", 2648 - "cpu": [ 2649 - "x64" 2650 - ], 2651 - "optional": true, 2652 - "os": [ 2653 - "darwin" 2654 - ], 2655 - "engines": { 2656 - "node": ">= 12.0.0" 2657 - }, 2658 - "funding": { 2659 - "type": "opencollective", 2660 - "url": "https://opencollective.com/parcel" 2661 - } 2662 - }, 2663 - "node_modules/lightningcss-freebsd-x64": { 2664 - "version": "1.29.1", 2665 - "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.29.1.tgz", 2666 - "integrity": "sha512-0SUW22fv/8kln2LnIdOCmSuXnxgxVC276W5KLTwoehiO0hxkacBxjHOL5EtHD8BAXg2BvuhsJPmVMasvby3LiQ==", 2667 - "cpu": [ 2668 - "x64" 2669 - ], 2670 - "optional": true, 2671 - "os": [ 2672 - "freebsd" 2673 - ], 2674 - "engines": { 2675 - "node": ">= 12.0.0" 2676 - }, 2677 - "funding": { 2678 - "type": "opencollective", 2679 - "url": "https://opencollective.com/parcel" 2680 - } 2681 - }, 2682 - "node_modules/lightningcss-linux-arm-gnueabihf": { 2683 - "version": "1.29.1", 2684 - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.29.1.tgz", 2685 - "integrity": "sha512-sD32pFvlR0kDlqsOZmYqH/68SqUMPNj+0pucGxToXZi4XZgZmqeX/NkxNKCPsswAXU3UeYgDSpGhu05eAufjDg==", 2686 - "cpu": [ 2687 - "arm" 2688 - ], 2689 - "optional": true, 2690 - "os": [ 2691 - "linux" 2692 - ], 2693 - "engines": { 2694 - "node": ">= 12.0.0" 2695 - }, 2696 - "funding": { 2697 - "type": "opencollective", 2698 - "url": "https://opencollective.com/parcel" 2699 - } 2700 - }, 2701 - "node_modules/lightningcss-linux-arm64-gnu": { 2702 - "version": "1.29.1", 2703 - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.29.1.tgz", 2704 - "integrity": "sha512-0+vClRIZ6mmJl/dxGuRsE197o1HDEeeRk6nzycSy2GofC2JsY4ifCRnvUWf/CUBQmlrvMzt6SMQNMSEu22csWQ==", 2705 - "cpu": [ 2706 - "arm64" 2707 - ], 2708 - "optional": true, 2709 - "os": [ 2710 - "linux" 2711 - ], 2712 - "engines": { 2713 - "node": ">= 12.0.0" 2714 - }, 2715 - "funding": { 2716 - "type": "opencollective", 2717 - "url": "https://opencollective.com/parcel" 2718 - } 2719 - }, 2720 - "node_modules/lightningcss-linux-arm64-musl": { 2721 - "version": "1.29.1", 2722 - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.29.1.tgz", 2723 - "integrity": "sha512-UKMFrG4rL/uHNgelBsDwJcBqVpzNJbzsKkbI3Ja5fg00sgQnHw/VrzUTEc4jhZ+AN2BvQYz/tkHu4vt1kLuJyw==", 2724 - "cpu": [ 2725 - "arm64" 2726 - ], 2727 - "optional": true, 2728 - "os": [ 2729 - "linux" 2730 - ], 2731 - "engines": { 2732 - "node": ">= 12.0.0" 2733 - }, 2734 - "funding": { 2735 - "type": "opencollective", 2736 - "url": "https://opencollective.com/parcel" 2737 - } 2738 - }, 2739 - "node_modules/lightningcss-linux-x64-gnu": { 2740 - "version": "1.29.1", 2741 - "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.29.1.tgz", 2742 - "integrity": "sha512-u1S+xdODy/eEtjADqirA774y3jLcm8RPtYztwReEXoZKdzgsHYPl0s5V52Tst+GKzqjebkULT86XMSxejzfISw==", 2743 - "cpu": [ 2744 - "x64" 2745 - ], 2746 - "optional": true, 2747 - "os": [ 2748 - "linux" 2749 - ], 2750 - "engines": { 2751 - "node": ">= 12.0.0" 2752 - }, 2753 - "funding": { 2754 - "type": "opencollective", 2755 - "url": "https://opencollective.com/parcel" 2756 - } 2757 - }, 2758 - "node_modules/lightningcss-linux-x64-musl": { 2759 - "version": "1.29.1", 2760 - "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.29.1.tgz", 2761 - "integrity": "sha512-L0Tx0DtaNUTzXv0lbGCLB/c/qEADanHbu4QdcNOXLIe1i8i22rZRpbT3gpWYsCh9aSL9zFujY/WmEXIatWvXbw==", 2762 - "cpu": [ 2763 - "x64" 2764 - ], 2765 - "optional": true, 2766 - "os": [ 2767 - "linux" 2768 - ], 2769 - "engines": { 2770 - "node": ">= 12.0.0" 2771 - }, 2772 - "funding": { 2773 - "type": "opencollective", 2774 - "url": "https://opencollective.com/parcel" 2775 - } 2776 - }, 2777 - "node_modules/lightningcss-win32-arm64-msvc": { 2778 - "version": "1.29.1", 2779 - "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.29.1.tgz", 2780 - "integrity": "sha512-QoOVnkIEFfbW4xPi+dpdft/zAKmgLgsRHfJalEPYuJDOWf7cLQzYg0DEh8/sn737FaeMJxHZRc1oBreiwZCjog==", 2781 - "cpu": [ 2782 - "arm64" 2783 - ], 2784 - "optional": true, 2785 - "os": [ 2786 - "win32" 2787 - ], 2788 - "engines": { 2789 - "node": ">= 12.0.0" 2790 - }, 2791 - "funding": { 2792 - "type": "opencollective", 2793 - "url": "https://opencollective.com/parcel" 2794 - } 2795 - }, 2796 - "node_modules/lightningcss-win32-x64-msvc": { 2797 - "version": "1.29.1", 2798 - "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.29.1.tgz", 2799 - "integrity": "sha512-NygcbThNBe4JElP+olyTI/doBNGJvLs3bFCRPdvuCcxZCcCZ71B858IHpdm7L1btZex0FvCmM17FK98Y9MRy1Q==", 2800 - "cpu": [ 2801 - "x64" 2802 - ], 2803 - "optional": true, 2804 - "os": [ 2805 - "win32" 2806 1897 ], 2807 1898 "engines": { 2808 1899 "node": ">= 12.0.0"
+4 -6
package.json
··· 32 32 "tailwindcss": "^4.0.0", 33 33 "typescript": "^5.0.0", 34 34 "typescript-eslint": "^8.20.0", 35 - "vite": "^6.0.0" 36 - }, 37 - "dependencies": { 38 - "@atcute/oauth-browser-client": "^1.0.13", 39 - "@atproto/api": "^0.14.4", 40 - "@atproto/oauth-client-browser": "^0.3.10", 35 + "vite": "^6.0.0", 41 36 "@sveltejs/adapter-static": "^3.0.8", 42 37 "@tailwindcss/forms": "^0.5.10" 38 + }, 39 + "dependencies": { 40 + "@atcute/oauth-browser-client": "^1.0.13" 43 41 } 44 42 }
+95 -35
src/lib/auth.svelte.ts
··· 1 1 import type { BrowserOAuthClient } from '@atproto/oauth-client-browser'; 2 - 3 - export const HANDLE_RESOLVER_URL = 'https://bsky.social'; 4 - export const PLC_DIRECTORY_URL = undefined; 5 - 6 - export const BASE_PATH = '/svelte-atproto-client-oauth'; 7 - 8 - export const data = $state({ 9 - agent: null as OAuthUserAgent | null, 10 - session: null as Session | null, 11 - client: null as BrowserOAuthClient | null, 12 - isInitializing: true 13 - }); 14 - 15 2 import { 16 3 configureOAuth, 17 4 createAuthorizationUrl, ··· 21 8 OAuthUserAgent, 22 9 getSession 23 10 } from '@atcute/oauth-browser-client'; 11 + import { dev } from '$app/environment'; 12 + import { XRPC } from '@atcute/client'; 13 + import { base } from '$app/paths'; 14 + 15 + export const URL = 'https://flo-bit.dev'; 16 + 17 + export const data = $state({ 18 + agent: null as OAuthUserAgent | null, 19 + session: null as Session | null, 20 + client: null as BrowserOAuthClient | null, 21 + rpc: null as XRPC | null, 22 + profile: null as { 23 + handle: string; 24 + did: string; 25 + createdAt: string; 26 + description?: string; 27 + displayName?: string; 28 + banner?: string; 29 + avatar?: string; 30 + followersCount?: number; 31 + followsCount?: number; 32 + postsCount?: number; 33 + } | null, 34 + isInitializing: true 35 + }); 24 36 25 37 export async function initOAuthClient() { 26 38 data.isInitializing = true; 27 39 28 - const clientId = `${window.location.origin}/svelte-atproto-client-oauth/client-metadata.json`; 40 + const clientId = dev 41 + ? `http://localhost` + 42 + `?redirect_uri=${encodeURIComponent('http://127.0.0.1:5179')}` + 43 + `&scope=${encodeURIComponent('atproto transition:generic')}` 44 + : `${window.location.origin}${base}/client-metadata.json`; 29 45 30 46 configureOAuth({ 31 47 metadata: { 32 48 client_id: clientId, 33 - redirect_uri: `${window.location.origin}/svelte-atproto-client-oauth` 49 + redirect_uri: `${dev ? 'http://127.0.0.1:5179' : window.location.origin}` 34 50 } 35 51 }); 36 52 37 53 const params = new URLSearchParams(location.hash.slice(1)); 38 54 39 - const did = localStorage.getItem('last-login'); 55 + const did = localStorage.getItem('last-login') ?? undefined; 40 56 41 57 if (params.size > 0) { 58 + await finalizeLogin(params, did); 59 + } else if (did) { 60 + await resumeSession(did); 61 + } 62 + 63 + data.isInitializing = false; 64 + } 65 + 66 + async function finalizeLogin(params: URLSearchParams, did?: string) { 67 + try { 42 68 history.replaceState(null, '', location.pathname + location.search); 43 69 44 - // you'd be given a session object that you can then pass to OAuthUserAgent! 45 70 const session = await finalizeAuthorization(params); 46 - 47 71 data.session = session; 48 - console.log(session); 49 72 50 - data.agent = new OAuthUserAgent(session); 73 + setAgentAndXRPC(session); 51 74 52 - // save did to local storage 75 + await loadProfile(session.info.sub); 53 76 localStorage.setItem('last-login', session.info.sub); 54 - } else if (did) { 55 - try { 56 - const session = await getSession(did as `did:${string}`, { allowStale: true }); 57 - data.session = session; 77 + } catch (error) { 78 + console.error('error finalizing login', error); 79 + if (did) { 80 + await resumeSession(did); 81 + } 82 + } 83 + } 84 + 85 + async function resumeSession(did: string) { 86 + try { 87 + const session = await getSession(did as `did:${string}`, { allowStale: true }); 88 + data.session = session; 89 + 90 + setAgentAndXRPC(session); 91 + 92 + await loadProfile(session.info.sub); 93 + } catch (error) { 94 + console.error('error resuming session', error); 95 + } 96 + } 58 97 59 - data.agent = new OAuthUserAgent(session); 98 + function setAgentAndXRPC(session: Session) { 99 + data.agent = new OAuthUserAgent(session); 60 100 61 - console.log('resuming session', session); 62 - } catch (error) { 63 - console.error('error resuming session', error); 64 - } 101 + data.rpc = new XRPC({ handler: data.agent }); 102 + } 103 + 104 + async function loadProfile(actor: string) { 105 + // check if profile is already loaded in local storage 106 + const profile = localStorage.getItem(`profile-${actor}`); 107 + if (profile) { 108 + console.log('loading profile from local storage'); 109 + data.profile = JSON.parse(profile); 110 + return; 65 111 } 66 112 67 - data.isInitializing = false; 113 + console.log('loading profile from server'); 114 + const response = await data.rpc?.request({ 115 + type: 'get', 116 + nsid: 'app.bsky.actor.getProfile', 117 + params: { actor } 118 + }); 119 + 120 + if (response) { 121 + data.profile = response.data; 122 + localStorage.setItem(`profile-${actor}`, JSON.stringify(response.data)); 123 + } 68 124 } 69 125 70 126 export async function trySignIn(value: string) { ··· 92 148 scope: 'atproto transition:generic' 93 149 }); 94 150 95 - // recommended to wait for the browser to persist local storage before proceeding 96 151 await new Promise((resolve) => setTimeout(resolve, 200)); 97 152 98 - // redirect the user to sign in and authorize the app 99 153 window.location.assign(authUrl); 100 154 101 155 await new Promise((_resolve, reject) => { ··· 110 164 export async function signOut() { 111 165 const currentAgent = data.agent; 112 166 if (currentAgent) { 167 + const did = currentAgent.session.info.sub; 168 + 169 + localStorage.removeItem('last-login'); 170 + localStorage.removeItem(`profile-${did}`); 171 + 113 172 await currentAgent.signOut(); 114 173 data.session = null; 115 174 data.agent = null; 116 - 117 - localStorage.removeItem('last-login'); 175 + data.profile = null; 176 + } else { 177 + throw new Error('Not signed in'); 118 178 } 119 179 }
+4 -5
src/lib/client-metadata.ts
··· 1 - const url = 'https://flo-bit.dev/svelte-atproto-client-oauth'; 1 + import { base } from '$app/paths'; 2 + import { URL } from './auth.svelte'; 2 3 3 4 export const metadata = { 4 - client_id: `${url}/client-metadata.json`, 5 + client_id: `${URL}${base}/client-metadata.json`, 5 6 6 - client_name: 'Svelte Atproto Client OAuth', 7 - 8 - redirect_uris: [url], 7 + redirect_uris: [URL + base], 9 8 10 9 scope: 'atproto transition:generic', 11 10 grant_types: ['authorization_code', 'refresh_token'],
+3 -11
src/routes/+layout.svelte
··· 1 1 <script lang="ts"> 2 + import '../app.css'; 3 + 2 4 import { onMount } from 'svelte'; 3 - import '../app.css'; 4 - import { data, initOAuthClient } from '$lib/auth.svelte'; 5 + import { initOAuthClient } from '$lib/auth.svelte'; 5 6 import LoginModal from '$lib/UI/LoginModal.svelte'; 6 7 let { children } = $props(); 7 8 8 9 onMount(() => { 9 10 initOAuthClient(); 10 11 }); 11 - 12 - // $effect(async () => { 13 - // if (data.agent) { 14 - // const likes = await data.agent.getActorLikes({ actor: data.agent.did }); 15 - // console.log(likes); 16 - // } 17 - // }); 18 - 19 - $inspect(data.agent); 20 12 </script> 21 13 22 14 {@render children()}
+44 -38
src/routes/+page.svelte
··· 1 - <script> 1 + <script lang="ts"> 2 2 import { data, signOut } from '$lib/auth.svelte'; 3 3 import Button from '$lib/UI/Button.svelte'; 4 4 import { showLoginModal } from '$lib/state.svelte'; 5 - import { onMount } from 'svelte'; 6 5 7 - onMount(() => { 8 - console.log(data.agent); 9 - }); 6 + let likes: { 7 + post: { 8 + record: { 9 + text: string; 10 + }; 11 + }; 12 + }[] = $state([]); 10 13 11 - let likes = $state([]); 14 + async function getLikes() { 15 + if (!data.profile?.did) return; 12 16 13 - async function getLikes() { 14 - if (data.agent?.session.info.sub) { 15 - const response = await data.agent.handle( 16 - '/xrpc/app.bsky.feed.getActorLikes?actor=' + data.agent.session.info.sub + '&limit=10' 17 - ); 17 + const response = await data.rpc?.request({ 18 + type: 'get', 19 + nsid: 'app.bsky.feed.getActorLikes', 20 + params: { 21 + actor: data.profile.did, 22 + limit: 10 23 + } 24 + }); 18 25 19 - const json = await response.json(); 20 - console.log(json); 21 - likes = json.feed; 22 - } 26 + likes = response?.data.feed; 23 27 } 24 - 25 - import { XRPC } from '@atcute/client'; 26 28 27 29 async function putRecord() { 28 - if (data.agent?.session.info.sub) { 29 - try { 30 - 31 - const rpc = new XRPC({ handler: data.agent }); 30 + if (!data.agent?.session.info.sub) return; 32 31 33 - const hello = await rpc.call('com.atproto.repo.createRecord', { 34 - data: { 35 - collection: 'com.atproto.test', 36 - repo: data.agent.session.info.sub, 37 - record: { 38 - text: 'hello there' 39 - } 32 + try { 33 + const hello = await data.rpc?.call('com.atproto.repo.createRecord', { 34 + data: { 35 + collection: 'com.atproto.test', 36 + repo: data.agent.session.info.sub, 37 + record: { 38 + text: 'hello there' 40 39 } 41 - }); 42 - console.log(hello); 43 - } catch (error) { 44 - console.log('hello', error); 45 - } 40 + } 41 + }); 42 + console.log(hello); 43 + } catch (error) { 44 + console.log('hello', error); 46 45 } 47 46 } 48 47 </script> 49 48 50 - <div class="mx-auto my-16 max-w-3xl px-2"> 49 + <div class="mx-auto my-8 max-w-3xl px-2 md:my-32"> 51 50 <h1 class="text-3xl font-bold">svelte atproto client oauth demo</h1> 52 51 53 52 {#if data.isInitializing} ··· 60 59 {/if} 61 60 62 61 {#if data.agent} 63 - <div class="mt-8 text-sm">signed in with {data.agent.session.info.sub}</div> 62 + <div class="mt-8 text-sm">signed in as</div> 63 + 64 + <div class="mt-2 flex gap-1 font-semibold"> 65 + <img 66 + src={data.profile?.avatar} 67 + class="h-6 w-6 rounded-full" 68 + alt="avatar of {data.profile?.handle}" 69 + /> 70 + <span>{data.profile?.handle}</span> 71 + </div> 64 72 65 73 <Button class="mt-4" onclick={() => signOut()}>Sign Out</Button> 66 74 ··· 77 85 </ul> 78 86 {/if} 79 87 {/if} 80 - 81 - <a href="/svelte-atproto-client-oauth/test">test</a> 82 - </div> 88 + </div>
-80
src/routes/test/+page.svelte
··· 1 - <script> 2 - import { data, signOut } from '$lib/auth.svelte'; 3 - import Button from '$lib/UI/Button.svelte'; 4 - import { showLoginModal } from '$lib/state.svelte'; 5 - import { onMount } from 'svelte'; 6 - 7 - onMount(() => { 8 - console.log(data.agent); 9 - }); 10 - 11 - let likes = $state([]); 12 - 13 - async function getLikes() { 14 - if (data.agent?.session.info.sub) { 15 - const response = await data.agent.handle( 16 - '/xrpc/app.bsky.feed.getActorLikes?actor=' + data.agent.session.info.sub + '&limit=10' 17 - ); 18 - 19 - const json = await response.json(); 20 - console.log(json); 21 - likes = json.feed; 22 - } 23 - } 24 - 25 - import { XRPC } from '@atcute/client'; 26 - 27 - async function putRecord() { 28 - if (data.agent?.session.info.sub) { 29 - try { 30 - 31 - const rpc = new XRPC({ handler: data.agent }); 32 - 33 - const hello = await rpc.call('com.atproto.repo.createRecord', { 34 - data: { 35 - collection: 'com.atproto.test', 36 - repo: data.agent.session.info.sub, 37 - record: { 38 - text: 'hello there' 39 - } 40 - } 41 - }); 42 - console.log(hello); 43 - } catch (error) { 44 - console.log('hello', error); 45 - } 46 - } 47 - } 48 - </script> 49 - 50 - <div class="mx-auto my-16 max-w-3xl px-2"> 51 - <h1 class="text-3xl font-bold">svelte atproto client oauth demo</h1> 52 - 53 - {#if data.isInitializing} 54 - <div class="mt-8 text-sm">loading...</div> 55 - {/if} 56 - 57 - {#if !data.isInitializing && !data.agent} 58 - <div class="mt-8 text-sm">not signed in</div> 59 - <Button class="mt-4" onclick={() => (showLoginModal.visible = true)}>Sign In</Button> 60 - {/if} 61 - 62 - {#if data.agent} 63 - <div class="mt-8 text-sm">signed in with {data.agent.session.info.sub}</div> 64 - 65 - <Button class="mt-4" onclick={() => signOut()}>Sign Out</Button> 66 - 67 - <Button class="mt-4" onclick={getLikes}>Get recent likes</Button> 68 - 69 - <Button class="mt-4" onclick={putRecord}>Put record</Button> 70 - 71 - {#if likes.length > 0} 72 - <div class="mt-8 text-sm">recent likes</div> 73 - <ul class="mt-4 flex flex-col gap-2 text-sm"> 74 - {#each likes as like} 75 - <li>{like.post.record.text}</li> 76 - {/each} 77 - </ul> 78 - {/if} 79 - {/if} 80 - </div>
+1 -1
svelte.config.js
··· 13 13 // See https://svelte.dev/docs/kit/adapters for more information about adapters. 14 14 adapter: adapter(), 15 15 paths: { 16 - base: '/svelte-atproto-client-oauth' 16 + base: process.env.NODE_ENV === 'development' ? '' : '/svelte-atproto-client-oauth' 17 17 } 18 18 } 19 19 };
+5 -1
vite.config.ts
··· 3 3 import { defineConfig } from 'vite'; 4 4 5 5 export default defineConfig({ 6 - plugins: [sveltekit(), tailwindcss()] 6 + plugins: [sveltekit(), tailwindcss()], 7 + server: { 8 + host: '127.0.0.1', 9 + port: 5179 10 + } 7 11 });