A music player that connects to your cloud/distributed storage.

fix: one more oauth attempt

+10 -17
+6 -9
src/components/output/raw/atproto/oauth.js
··· 1 - import QS from "query-string"; 2 import { configureOAuth } from "@atcute/oauth-browser-client"; 3 4 import metadata from "../../../../oauth-client-metadata.json" with { ··· 44 const isLocalDev = redirect_uri.startsWith("http://127.0.0.1"); 45 46 if (!isLocalDev) { 47 - const url = new URL(location.href); 48 - const params = Object.fromEntries(Array.from(url.searchParams.entries())); 49 - 50 - redirect_uri = location.origin + "/oauth/callback?" + QS.stringify({ 51 - ...params, 52 - redirect_path: location.pathname, 53 - variant: url.pathname.replace(/(^\/+|\/+$)/g, "").split("/")[0], 54 - }); 55 } 56 57 configureOAuth({ ··· 94 location.href.replace("http://localhost:", "http://127.0.0.1:"), 95 ); 96 } 97 98 const authUrl = await createAuthorizationUrl({ 99 target: { type: "account", identifier: /** @type {any} */ (handle) },
··· 1 import { configureOAuth } from "@atcute/oauth-browser-client"; 2 3 import metadata from "../../../../oauth-client-metadata.json" with { ··· 43 const isLocalDev = redirect_uri.startsWith("http://127.0.0.1"); 44 45 if (!isLocalDev) { 46 + redirect_uri = location.origin + "/oauth/callback"; 47 } 48 49 configureOAuth({ ··· 86 location.href.replace("http://localhost:", "http://127.0.0.1:"), 87 ); 88 } 89 + 90 + sessionStorage.setItem( 91 + "diffuse/output/raw/atproto/oauth/redirect_path", 92 + location.pathname + location.search, 93 + ); 94 95 const authUrl = await createAuthorizationUrl({ 96 target: { type: "account", identifier: /** @type {any} */ (handle) },
+4 -8
src/oauth/callback/index.js
··· 1 - const url = new URL(document.location.href); 2 - const redirect_path = url.searchParams.get("redirect_path") ?? ""; 3 - 4 - url.searchParams.delete("redirect_path"); 5 - url.searchParams.delete("variant"); 6 7 - location.assign( 8 - `${redirect_path}?${url.searchParams.toString()}${url.hash}`, 9 - );
··· 1 + const prefix = "diffuse/output/raw/atproto/oauth"; 2 + const redirect_path = sessionStorage.getItem(`${prefix}/redirect_path`) ?? "/"; 3 4 + sessionStorage.removeItem(`${prefix}/redirect_path`); 5 + location.assign(`${redirect_path}${location.hash}`);