From d69b488fb0db38fd2513723b2a87e04200ac16ad Mon Sep 17 00:00:00 2001 From: Gcat101 Date: Tue, 18 Jul 2023 17:23:41 +0300 Subject: [PATCH] script dump support --- src/Router.svelte | 8 ++++++-- src/pages/info.svelte | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Router.svelte b/src/Router.svelte index 1343477..92f1c6c 100644 --- a/src/Router.svelte +++ b/src/Router.svelte @@ -9,6 +9,7 @@ let pkgname = "" let pkginfo let branch + let path let regname let search = false @@ -40,12 +41,15 @@ pkgname = window.location.hash.substring(1); if (!Object.keys(packages).includes(pkgname)) pkginfo = "404"; else { - regname = packages[pkgname].split("@")[0]; + regname = packages[pkgname].split("@")[0].split("$")[0]; branch = packages[pkgname].includes("@") ? packages[pkgname].split("@").at(-1) : "main"; + path = packages[pkgname].includes("$") + ? packages[pkgname].split("@")[0].split("$").at(-1) + : null fetch( - `https://raw.githubusercontent.com/${regname}/${branch}/.kjspkg` + `https://raw.githubusercontent.com/${regname}/${branch}${path!=null ? "/"+path : ""}/.kjspkg` ).then((i) => { i.json().then((info) => { pkginfo = info; diff --git a/src/pages/info.svelte b/src/pages/info.svelte index 3559950..8fbf121 100644 --- a/src/pages/info.svelte +++ b/src/pages/info.svelte @@ -37,8 +37,8 @@ let getdepsandincompats = arr => { let newarr = [] arr.forEach(i => { - if (i.includes(":")) newarr.push(prettify(`${i.split(":").at(-1)} (${i.split(":")[0]})`)) - else newarr.push(prettify(i)) + if (i.includes(":")) newarr.push(prettify(`${i.split(":").at(-1).replaceAll("-", " ").replaceAll("_", " ")} (${i.split(":")[0]})`)) + else newarr.push(prettify(i.replaceAll("-", " ").replaceAll("_", " "))) }) return newarr.join(", ") }