diff --git a/src/components/ProxyRegistrar.astro b/src/components/ProxyRegistrar.astro index 244f2fa..938c6d3 100644 --- a/src/components/ProxyRegistrar.astro +++ b/src/components/ProxyRegistrar.astro @@ -227,6 +227,7 @@ }, 200); } window.loadFormContent = loadContent; + window.loadSelectedTransport = loadSelectedTransportScript; function isUrl(val = "") { if (/^http(s?):\/\//.test(val) || (val.includes(".") && val.substr(0, 1) !== " ")) return true; diff --git a/src/components/ts/TransportManager.ts b/src/components/ts/TransportManager.ts index 08b8365..fbe26ce 100644 --- a/src/components/ts/TransportManager.ts +++ b/src/components/ts/TransportManager.ts @@ -10,6 +10,7 @@ declare global { decodeUrl: (url: string) => string; }; loadFormContent: Function | null; + loadSelectedTransport: Function | null; } } diff --git a/src/pages/[lang]/index.astro b/src/pages/[lang]/index.astro index 29ca13b..4b1ee5d 100644 --- a/src/pages/[lang]/index.astro +++ b/src/pages/[lang]/index.astro @@ -95,10 +95,10 @@ export function getStaticPaths() { suggestionElement.style.marginTop = "5px"; suggestionElement.innerText = suggestion.phrase; suggestionElement.addEventListener("click", async () => { - urlInput.value = suggestion.phrase; - // I can't be bothered to extend the window object, so I'm just going to use any - (window as any).loadFormContent(); - }); + urlInput.value = suggestion.phrase; + if (window.loadSelectedTransport) await window.loadSelectedTransport() + if (window.loadFormContent) window.loadFormContent(suggestion.phrase); + }); searchSuggestions.appendChild(suggestionElement); }); if (data.length === 0) { diff --git a/src/pages/[lang]/marketplace.astro b/src/pages/[lang]/marketplace.astro new file mode 100644 index 0000000..b74b029 --- /dev/null +++ b/src/pages/[lang]/marketplace.astro @@ -0,0 +1,223 @@ +--- +import { STATIC_PATHS } from "@i18n/utils"; +import Layout from "src/layouts/Layout.astro"; +import marketplace from "../../json/marketplace.json"; + +export const getStaticPaths = () => { + return STATIC_PATHS; +}; + +type MarketplaceItem = { + title: string; + version: string | number; + image: string; + script: string; +}; +--- + + +
+

Marketplace

+

Install custom userscripts and themes for Alu.

+
+ { + Object.keys(marketplace).map((mp_item) => { + const item = (marketplace as { [key: string]: MarketplaceItem })[mp_item]; + const slug = mp_item; + return ( +
+ {`${item.title} +
{item.title}
+ +
+ ); + }) + } +
+
+
+ + + + \ No newline at end of file