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: use relative path for facets ppr

+20 -2
+20 -2
src/facets/common/ppr.js
··· 2 2 import * as Grid from "./grid.js"; 3 3 import * as You from "./you.js"; 4 4 5 + /** Base pathname of the app (e.g. "/" at root, "/diffuse/" in a subdirectory). */ 6 + const BASE_PATHNAME = new URL(document.baseURI).pathname; 7 + 8 + /** 9 + * Strips the app's base path prefix from an absolute pathname, 10 + * returning a root-relative path like "/facets/build". 11 + * 12 + * @param {string} pathname 13 + */ 14 + function relativePathname(pathname) { 15 + const stripped = pathname.replace(/\/$/, ""); 16 + const base = BASE_PATHNAME.replace(/\/$/, ""); 17 + return base.length > 0 && stripped.startsWith(base) 18 + ? stripped.slice(base.length) 19 + : stripped; 20 + } 21 + 5 22 /** 6 23 * @param {URL} url 7 24 */ 8 25 async function initJsBasedOnPage(url) { 9 - const path = url.pathname.replace(/(\/$)/, ""); 26 + const path = relativePathname(url.pathname); 10 27 11 28 Grid.insertToggleButtons(); 12 29 await Grid.monitorToggleButtonStates(); ··· 47 64 if (url.origin !== location.origin) return; 48 65 49 66 // Only intercept /facets/[section]/ paths (not deeper sub-paths like /facets/tools/*) 50 - const parts = url.pathname.split("/").filter(Boolean); 67 + const relative = relativePathname(url.pathname); 68 + const parts = relative.split("/").filter(Boolean); 51 69 if (parts[0] !== "facets") return; 52 70 if (parts.length > 2) return; 53 71