fix showing the active link in the navbar
All checks were successful
Build the docker image for the API / build (push) Successful in 2m16s
Build the docker image for the frontend application / build (push) Successful in 40s

Signed-off-by: ngn <ngn@ngn.tf>
This commit is contained in:
ngn
2025-07-11 22:00:56 +03:00
parent 26d656896e
commit c287ffa086
15 changed files with 68 additions and 36 deletions

View File

@ -13,11 +13,14 @@ function api_urljoin(path = null, query = {}) {
}
function api_check_err(json) {
if (!("error" in json)) throw new Error('API response is missing the "error" key');
if (!("error" in json))
throw new Error('API response is missing the "error" key');
if (json["error"] != "") throw new Error(`API returned an error: ${json["error"]}`);
if (json["error"] != "")
throw new Error(`API returned an error: ${json["error"]}`);
if (!("result" in json)) throw new Error('API response is missing the "result" key');
if (!("result" in json))
throw new Error('API response is missing the "result" key');
}
async function api_http_get(fetch, url) {
@ -39,4 +42,10 @@ async function api_get_projects(fetch) {
return await api_http_get(fetch, api_urljoin("/projects"));
}
export { api_version, api_urljoin, api_get_metrics, api_get_services, api_get_projects };
export {
api_version,
api_urljoin,
api_get_metrics,
api_get_services,
api_get_projects,
};

View File

@ -5,7 +5,8 @@ function doc_urljoin(path = null, query = {}) {
}
function doc_check_err(json) {
if ("error" in json) throw new Error(`Documentation server returned an error: ${json["error"]}`);
if ("error" in json)
throw new Error(`Documentation server returned an error: ${json["error"]}`);
}
async function doc_http_get(fetch, url) {

View File

@ -18,7 +18,9 @@
<footer style="border-top: solid 2px var(--{color()});">
<div class="links">
<span>
<Link link={import.meta.env.WEBSITE_SOURCE_URL} bold={true}>{$_("footer.source")}</Link>
<Link link={import.meta.env.WEBSITE_SOURCE_URL} bold={true}
>{$_("footer.source")}</Link
>
</span>
<span>/</span>
<span>

View File

@ -28,7 +28,8 @@ function locale_from_browser() {
function locale_select(l = null) {
if (l === null) {
if (browser && null !== (l = localStorage.getItem("locale"))) locale_select(l);
if (browser && null !== (l = localStorage.getItem("locale")))
locale_select(l);
else locale_select(locale_from_browser());
return;
}

View File

@ -3,14 +3,13 @@
import { page } from "$app/stores";
export let link;
function is_active() {
return $page.url.pathname == link;
}
</script>
<a
style="text-decoration-color: var(--{color()}); {is_active() ? `color: var(--${color()})` : ''}"
style="
text-decoration-color: var(--{color()});
{$page.url.pathname === link ? `color: var(--${color()});` : ''}
"
data-sveltekit-preload-data
on:click={click}
href={link}

View File

@ -15,9 +15,13 @@
<p>{service.desc[$locale]}</p>
</div>
<div class="links">
<Link highlight={false} link={service.clear}><Icon icon="nf-oct-link" /></Link>
<Link highlight={false} link={service.clear}
><Icon icon="nf-oct-link" /></Link
>
{#if service.onion != ""}
<Link highlight={false} link={service.onion}><Icon icon="nf-linux-tor" /></Link>
<Link highlight={false} link={service.onion}
><Icon icon="nf-linux-tor" /></Link
>
{/if}
{#if service.i2p != ""}
<Link highlight={false} link={service.i2p}