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

Configure Feed

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

fix: atproto oauth redirect

+39 -8
+23 -7
src/components/output/raw/atproto/oauth.js
··· 1 + import QS from "query-string"; 1 2 import { configureOAuth } from "@atcute/oauth-browser-client"; 3 + 2 4 import metadata from "../../../../oauth-client-metadata.json" with { 3 5 type: "json", 4 6 }; ··· 31 33 // CONFIGURE 32 34 // ========= 33 35 34 - const redirect_uri = 35 - (globalThis.location.origin + globalThis.location.pathname + 36 - globalThis.location.search).replace( 37 - "://localhost", 38 - "://127.0.0.1", 39 - ); 36 + const location = globalThis.location; 37 + 38 + let redirect_uri = (location.origin + location.pathname + location.search) 39 + .replace( 40 + "://localhost", 41 + "://127.0.0.1", 42 + ); 43 + 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 = url.searchParams.entries(); 49 + 50 + redirect_uri = location.origin + "/oauth/redirect?" + QS.stringify({ 51 + ...params, 52 + redirect_path: location.pathname, 53 + variant: url.pathname.replace(/(^\/+|\/+$)/g, "").split("/")[0], 54 + }); 55 + } 40 56 41 57 configureOAuth({ 42 58 metadata: { 43 - client_id: redirect_uri.startsWith("http://127.0.0.1") 59 + client_id: isLocalDev 44 60 ? `http://localhost/?redirect_uri=${ 45 61 encodeURIComponent(redirect_uri) 46 62 }&scope=${encodeURIComponent(SCOPE)}`
+1 -1
src/oauth-client-metadata.json
··· 2 2 "client_id": "https://elements.diffuse.sh/oauth-client-metadata.json", 3 3 "client_name": "Diffuse", 4 4 "client_uri": "https://elements.diffuse.sh", 5 - "redirect_uris": ["https://elements.diffuse.sh/"], 5 + "redirect_uris": ["https://elements.diffuse.sh/oauth/redirect/"], 6 6 "scope": "atproto repo?collection=sh.diffuse.output.facet&collection=sh.diffuse.output.playlist&collection=sh.diffuse.output.theme&collection=sh.diffuse.output.track", 7 7 "grant_types": ["authorization_code", "refresh_token"], 8 8 "response_types": ["code"],
+8
src/oauth/redirect/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 + 6 + location.assign( 7 + `${redirect_path}?${url.searchParams.toString()}${url.hash}`, 8 + );
+7
src/oauth/redirect/index.vto
··· 1 + --- 2 + layout: layouts/diffuse.vto 3 + base: ../../ 4 + 5 + scripts: 6 + - oauth/redirect/index.js 7 + ---