this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

tweak oauth + fix some astral things

+25 -92
+12 -10
src/consts/astral.ts
··· 41 41 ] as const; 42 42 43 43 export type powerId = (typeof powers)[keyof typeof powers]; 44 + export const isPowerId = (power: unknown): power is powerId => 45 + Object.values(powers).includes(power as powerId); 44 46 45 47 export interface Power { 46 48 name: string; ··· 83 85 description: 84 86 "You may cast Comprehend Languages. This does not cost V, S, or M components. If you use all 3 uses you may cast it using spell slots as a normal spell.", 85 87 image: { 86 - src: "rune_seeker.webp", 88 + src: "/astral/rune_seeker.webp", 87 89 alt: "", 88 90 }, 89 91 meta: [ ··· 319 321 ], 320 322 }, 321 323 [powers.INVALID]: { 322 - name: "", 323 - description: "", 324 + name: "Invalid Power", 325 + description: "Illegal state", 324 326 image: { 325 - src: "", 326 - alt: "", 327 + src: "/astral/locked.webp", 328 + alt: "Locked power", 327 329 }, 328 330 meta: [], 329 331 }, 330 332 [powers.LOCKED]: { 331 - name: "", 332 - description: "", 333 + name: "Locked Power", 334 + description: "Locked", 333 335 image: { 334 - src: "", 335 - alt: "", 336 + src: "/astral/locked.webp", 337 + alt: "Locked power", 336 338 }, 337 339 meta: [], 338 340 }, ··· 505 507 .map((x) => ({ id: x.id, parents: [power.id, ...x.parents] })); 506 508 507 509 export const parentPowers = Object.fromEntries( 508 - flatten(powerTree).map((x) => [x.id, x.parents]) 510 + flatten(powerTree).map((x) => [x.id, x.parents]), 509 511 );
+10 -5
src/lib/auth.ts
··· 1 + /** 2 + * configures oauth and provides getAuth to retrive the auth for the user 3 + */ 1 4 import { Client } from "@atcute/client"; 2 5 import { getSession, OAuthUserAgent } from "@atcute/oauth-browser-client"; 3 6 import { configureOAuth } from "@atcute/oauth-browser-client"; ··· 18 21 redirect_uri: metadata.redirect_uris[0], 19 22 } 20 23 : { 21 - client_id: `http://localhost?${new URLSearchParams({ 22 - redirect_uri: "http://127.0.0.1/atproto/callback", 23 - scope: "atproto transition:generic", 24 - }).toString()}`, 25 - redirect_uri: "http://127.0.0.1/atproto/callback", 24 + client_id: 25 + "https://cimd.vielle.dev/oauth-client-metadata.json?" + 26 + new URLSearchParams({ 27 + scopes: "atproto transition:generic", 28 + callback: "/atproto/callback", 29 + }), 30 + redirect_uri: "https://cimd.vielle.dev/atproto/callback", 26 31 }, 27 32 identityResolver: new LocalActorResolver({ 28 33 handleResolver: new XrpcHandleResolver({
+1 -38
src/pages/atproto/callback.astro
··· 29 29 } 30 30 </style> 31 31 <script> 32 - import { 33 - configureOAuth, 34 - finalizeAuthorization, 35 - } from "@atcute/oauth-browser-client"; 36 - import { 37 - CompositeDidDocumentResolver, 38 - LocalActorResolver, 39 - PlcDidDocumentResolver, 40 - WebDidDocumentResolver, 41 - XrpcHandleResolver, 42 - } from "@atcute/identity-resolver"; 43 - import metadata from "../../oauth-client-metadata.json" with { type: "json" }; 32 + import { finalizeAuthorization } from "@atcute/oauth-browser-client"; 44 33 import { getAuth } from "../../lib/auth"; 45 - 46 - configureOAuth({ 47 - metadata: import.meta.env.PROD 48 - ? { 49 - client_id: metadata.client_id, 50 - redirect_uri: metadata.redirect_uris[0], 51 - } 52 - : { 53 - client_id: `http://localhost?${new URLSearchParams({ 54 - redirect_uri: "http://127.0.0.1/atproto/callback", 55 - scope: "atproto transition:generic", 56 - }).toString()}`, 57 - redirect_uri: "http://127.0.0.1/atproto/callback", 58 - }, 59 - identityResolver: new LocalActorResolver({ 60 - handleResolver: new XrpcHandleResolver({ 61 - serviceUrl: "https://public.api.bsky.app", 62 - }), 63 - didDocumentResolver: new CompositeDidDocumentResolver({ 64 - methods: { 65 - plc: new PlcDidDocumentResolver(), 66 - web: new WebDidDocumentResolver(), 67 - }, 68 - }), 69 - }), 70 - }); 71 34 72 35 const params = new URLSearchParams(location.hash.slice(1)); 73 36 history.replaceState(null, "", window.location.pathname);
+2 -39
src/pages/atproto/login.astro
··· 5 5 <Base title="D&D Utils"> 6 6 <script> 7 7 import "actor-typeahead"; 8 - import { 9 - configureOAuth, 10 - createAuthorizationUrl, 11 - } from "@atcute/oauth-browser-client"; 12 - import { 13 - CompositeDidDocumentResolver, 14 - LocalActorResolver, 15 - PlcDidDocumentResolver, 16 - WebDidDocumentResolver, 17 - XrpcHandleResolver, 18 - } from "@atcute/identity-resolver"; 19 - import metadata from "../../oauth-client-metadata.json" with { type: "json" }; 8 + import { createAuthorizationUrl } from "@atcute/oauth-browser-client"; 20 9 import { getAuth } from "../../lib/auth"; 21 10 22 - configureOAuth({ 23 - metadata: import.meta.env.PROD 24 - ? { 25 - client_id: metadata.client_id, 26 - redirect_uri: metadata.redirect_uris[0], 27 - } 28 - : { 29 - client_id: `http://localhost?${new URLSearchParams({ 30 - redirect_uri: "http://127.0.0.1/atproto/callback", 31 - scope: "atproto transition:generic", 32 - }).toString()}`, 33 - redirect_uri: "http://127.0.0.1/atproto/callback", 34 - }, 35 - identityResolver: new LocalActorResolver({ 36 - handleResolver: new XrpcHandleResolver({ 37 - serviceUrl: "https://public.api.bsky.app", 38 - }), 39 - didDocumentResolver: new CompositeDidDocumentResolver({ 40 - methods: { 41 - plc: new PlcDidDocumentResolver(), 42 - web: new WebDidDocumentResolver(), 43 - }, 44 - }), 45 - }), 46 - }); 47 - 48 11 // if theres a did in storage and it restores, go to / 49 12 if (localStorage.getItem("did") && (await getAuth().then((x) => !!x[0]))) 50 13 window.location.assign("/"); 51 14 52 15 const submit = document.getElementById( 53 - "submit", 16 + "submit" 54 17 ) as HTMLButtonElement | null; 55 18 if (!submit) throw null; 56 19 submit.addEventListener("click", async (ev) => {