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

@ -11,4 +11,7 @@ run:
format: format:
gofmt -s -w . gofmt -s -w .
.PHONY: test format clean:
rm -f *.elf
.PHONY: test format clean

View File

@ -1,6 +1,6 @@
module github.com/ngn13/website/api module github.com/ngn13/website/api
go 1.24.0 go 1.24.5
require ( require (
github.com/gofiber/fiber/v2 v2.52.8 github.com/gofiber/fiber/v2 v2.52.8

View File

@ -1,7 +1,5 @@
github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M= github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M=
github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY= github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY=
github.com/gofiber/fiber/v2 v2.52.6 h1:Rfp+ILPiYSvvVuIPvxrBns+HJp8qGLDnLJawAu27XVI=
github.com/gofiber/fiber/v2 v2.52.6/go.mod h1:YEcBbO/FB+5M1IZNBP9FO3J9281zgPAreiI1oqg8nDw=
github.com/gofiber/fiber/v2 v2.52.8 h1:xl4jJQ0BV5EJTA2aWiKw/VddRpHrKeZLF0QPUxqn0x4= github.com/gofiber/fiber/v2 v2.52.8 h1:xl4jJQ0BV5EJTA2aWiKw/VddRpHrKeZLF0QPUxqn0x4=
github.com/gofiber/fiber/v2 v2.52.8/go.mod h1:YEcBbO/FB+5M1IZNBP9FO3J9281zgPAreiI1oqg8nDw= github.com/gofiber/fiber/v2 v2.52.8/go.mod h1:YEcBbO/FB+5M1IZNBP9FO3J9281zgPAreiI1oqg8nDw=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
@ -15,12 +13,8 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mattn/go-sqlite3 v1.14.27 h1:drZCnuvf37yPfs95E5jd9s3XhdVWLal+6BOK6qrv6IU=
github.com/mattn/go-sqlite3 v1.14.27/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
github.com/mattn/go-sqlite3 v1.14.28 h1:ThEiQrnbtumT+QMknw63Befp/ce/nUPgBPMlRFEum7A= github.com/mattn/go-sqlite3 v1.14.28 h1:ThEiQrnbtumT+QMknw63Befp/ce/nUPgBPMlRFEum7A=
github.com/mattn/go-sqlite3 v1.14.28/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/mattn/go-sqlite3 v1.14.28/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
github.com/ngn13/ortam v0.0.0-20250412195317-e76e62a7a305 h1:1YxtSMwR14PklXNlZxIqcmfpiq2+G98YNmhSuz7GKCQ=
github.com/ngn13/ortam v0.0.0-20250412195317-e76e62a7a305/go.mod h1:MSJZ4ZstrLvVEvivbp9hhup+iL8rvtpgKcYaF3DSOKk=
github.com/ngn13/ortam v0.0.0-20250421004351-8dea81680817 h1:WkHM4w51N5jCsWcDVcPsXz3zhi/kCfNp/VGh2uPjwsk= github.com/ngn13/ortam v0.0.0-20250421004351-8dea81680817 h1:WkHM4w51N5jCsWcDVcPsXz3zhi/kCfNp/VGh2uPjwsk=
github.com/ngn13/ortam v0.0.0-20250421004351-8dea81680817/go.mod h1:MSJZ4ZstrLvVEvivbp9hhup+iL8rvtpgKcYaF3DSOKk= github.com/ngn13/ortam v0.0.0-20250421004351-8dea81680817/go.mod h1:MSJZ4ZstrLvVEvivbp9hhup+iL8rvtpgKcYaF3DSOKk=
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=

View File

@ -1,2 +1 @@
engine-strict=true engine-strict=true
resolution-mode=highest

View File

@ -3,7 +3,7 @@
"tabWidth": 2, "tabWidth": 2,
"singleQuote": false, "singleQuote": false,
"trailingComma": "es5", "trailingComma": "es5",
"printWidth": 100, "printWidth": 80,
"plugins": ["prettier-plugin-svelte"], "plugins": ["prettier-plugin-svelte"],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }] "overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
} }

View File

@ -13,11 +13,14 @@ function api_urljoin(path = null, query = {}) {
} }
function api_check_err(json) { 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) { 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")); 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) { 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) { async function doc_http_get(fetch, url) {

View File

@ -18,7 +18,9 @@
<footer style="border-top: solid 2px var(--{color()});"> <footer style="border-top: solid 2px var(--{color()});">
<div class="links"> <div class="links">
<span> <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> <span>/</span>
<span> <span>

View File

@ -28,7 +28,8 @@ function locale_from_browser() {
function locale_select(l = null) { function locale_select(l = null) {
if (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()); else locale_select(locale_from_browser());
return; return;
} }

View File

@ -3,14 +3,13 @@
import { page } from "$app/stores"; import { page } from "$app/stores";
export let link; export let link;
function is_active() {
return $page.url.pathname == link;
}
</script> </script>
<a <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 data-sveltekit-preload-data
on:click={click} on:click={click}
href={link} href={link}

View File

@ -15,9 +15,13 @@
<p>{service.desc[$locale]}</p> <p>{service.desc[$locale]}</p>
</div> </div>
<div class="links"> <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 != ""} {#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}
{#if service.i2p != ""} {#if service.i2p != ""}
<Link highlight={false} link={service.i2p} <Link highlight={false} link={service.i2p}

View File

@ -59,7 +59,9 @@
<Link icon="nf-md-email" link="mailto:ngn@ngn.tf">Email</Link> <Link icon="nf-md-email" link="mailto:ngn@ngn.tf">Email</Link>
</li> </li>
<li> <li>
<Link icon="nf-md-mastodon" link="https://defcon.social/@ngn">Mastodon</Link> <Link icon="nf-md-mastodon" link="https://defcon.social/@ngn"
>Mastodon</Link
>
</li> </li>
</ul> </ul>
<span> <span>
@ -72,7 +74,8 @@
</span> </span>
<ul> <ul>
<li> <li>
<i style="color: var(--{color()});" class="nf nf-md-speedometer_slow"></i> <i style="color: var(--{color()});" class="nf nf-md-speedometer_slow"
></i>
{$_("home.services.speed")} {$_("home.services.speed")}
</li> </li>
<li> <li>
@ -80,7 +83,8 @@
{$_("home.services.security")} {$_("home.services.security")}
</li> </li>
<li> <li>
<i style="color: var(--{color()});" class="nf nf-fa-network_wired"></i> <i style="color: var(--{color()});" class="nf nf-fa-network_wired"
></i>
{$_("home.services.privacy")} {$_("home.services.privacy")}
</li> </li>
<li> <li>

View File

@ -30,7 +30,11 @@
function get_services() { function get_services() {
return services.filter((s) => { return services.filter((s) => {
return s.desc[$locale] !== "" && s.desc[$locale] !== null && s.desc[$locale] !== undefined; return (
s.desc[$locale] !== "" &&
s.desc[$locale] !== null &&
s.desc[$locale] !== undefined
);
}); });
} }
@ -48,10 +52,16 @@
<main> <main>
<div class="title"> <div class="title">
{#if show_input} {#if show_input}
<input oninput={change} type="text" placeholder={$_("services.search")} /> <input
oninput={change}
type="text"
placeholder={$_("services.search")}
/>
{/if} {/if}
<div> <div>
<Link icon="nf-fa-feed" link={api_urljoin("/news/" + $locale)}>{$_("services.feed")}</Link> <Link icon="nf-fa-feed" link={api_urljoin("/news/" + $locale)}
>{$_("services.feed")}</Link
>
</div> </div>
</div> </div>
<div class="services"> <div class="services">

View File

@ -34,12 +34,15 @@
--size-5: 24px; --size-5: 24px;
--size-6: 30px; --size-6: 30px;
--box-shadow-1: rgba(20, 20, 20, 0.19) 0px 10px 20px, rgba(30, 30, 30, 0.23) 0px 6px 6px; --box-shadow-1:
--box-shadow-2: rgba(0, 0, 0, 0.35) 0px 30px 60px -12px inset, rgba(20, 20, 20, 0.19) 0px 10px 20px, rgba(30, 30, 30, 0.23) 0px 6px 6px;
--box-shadow-2:
rgba(0, 0, 0, 0.35) 0px 30px 60px -12px inset,
rgba(20, 20, 20, 0.3) 0px 18px 36px -18px inset; rgba(20, 20, 20, 0.3) 0px 18px 36px -18px inset;
--text-shadow: 3px 2px 8px rgba(50, 50, 50, 0.8); --text-shadow: 3px 2px 8px rgba(50, 50, 50, 0.8);
--background: linear-gradient(rgba(11, 11, 11, 0.808), rgba(1, 1, 1, 0.96)), --background:
linear-gradient(rgba(11, 11, 11, 0.808), rgba(1, 1, 1, 0.96)),
url("/assets/banner.png"); url("/assets/banner.png");
--profile-size: 220px; --profile-size: 220px;
} }

View File

@ -5,8 +5,9 @@
margin: 0; margin: 0;
color: #c9d1d9; color: #c9d1d9;
background-color: #000; background-color: #000;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, font-family:
sans-serif, "Apple Color Emoji", "Segoe UI Emoji"; -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica,
Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
font-size: 16px; font-size: 16px;
line-height: 1.5; line-height: 1.5;
word-wrap: break-word; word-wrap: break-word;
@ -1026,7 +1027,9 @@
} }
.markdown-body .contains-task-list:hover .task-list-item-convert-container, .markdown-body .contains-task-list:hover .task-list-item-convert-container,
.markdown-body .contains-task-list:focus-within .task-list-item-convert-container { .markdown-body
.contains-task-list:focus-within
.task-list-item-convert-container {
display: block; display: block;
width: auto; width: auto;
height: 24px; height: 24px;