From e506764bbd81f87fa36ecb39b5cff7a77dd1ccf6 Mon Sep 17 00:00:00 2001 From: thiloho <123883702+thiloho@users.noreply.github.com> Date: Sun, 15 Sep 2024 17:54:54 +0200 Subject: [PATCH] Update navigation loading and NGINX try_file --- nix/dev-vm.nix | 4 ++-- nix/module.nix | 10 ++++------ web-app/src/routes/+layout.svelte | 13 ++----------- 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/nix/dev-vm.nix b/nix/dev-vm.nix index 48bacd4..33518f4 100644 --- a/nix/dev-vm.nix +++ b/nix/dev-vm.nix @@ -68,9 +68,9 @@ ]; locations = { "/" = { - root = "/var/www/archtika-websites/"; + root = "/var/www/archtika-websites"; index = "index.html"; - tryFiles = "$uri $uri/ $uri.html $uri/index.html index.html =404"; + tryFiles = "$uri $uri/ $uri.html =404"; extraConfig = '' autoindex on; ''; diff --git a/nix/module.nix b/nix/module.nix index 123a60e..8ca01aa 100644 --- a/nix/module.nix +++ b/nix/module.nix @@ -158,16 +158,14 @@ in proxyPass = "http://localhost:${toString cfg.webAppPort}"; }; "/previews/" = { - alias = "/var/www/archtika-websites/previews/"; + root = "/var/www/archtika-websites/previews"; index = "index.html"; - tryFiles = "$uri $uri/ $uri.html $uri/index.html index.html =404"; + tryFiles = "$uri $uri/ $uri.html =404" }; "/api/" = { proxyPass = "http://localhost:${toString cfg.apiPort}/"; extraConfig = '' default_type application/json; - proxy_hide_header Content-Location; - add_header Content-Location /api/$upstream_http_content_location; proxy_set_header Connection ""; proxy_http_version 1.1; ''; @@ -179,9 +177,9 @@ in forceSSL = true; locations = { "/" = { - alias = "/var/www/archtika-websites/$subdomain/"; + root = "/var/www/archtika-websites/$subdomain"; index = "index.html"; - tryFiles = "$uri $uri/ $uri.html $uri/index.html index.html =404"; + tryFiles = "$uri $uri/ $uri.html =404"; }; }; }; diff --git a/web-app/src/routes/+layout.svelte b/web-app/src/routes/+layout.svelte index 866a528..4843fcc 100644 --- a/web-app/src/routes/+layout.svelte +++ b/web-app/src/routes/+layout.svelte @@ -3,20 +3,11 @@ import { page } from "$app/stores"; import type { LayoutServerData } from "./$types"; import type { Snippet } from "svelte"; - import { beforeNavigate, afterNavigate } from "$app/navigation"; + import { navigating } from "$app/stores"; import LoadingSpinner from "$lib/components/LoadingSpinner.svelte"; const { data, children }: { data: LayoutServerData; children: Snippet } = $props(); - let loading = $state(false); - - beforeNavigate(() => { - loading = true; - }); - afterNavigate(() => { - loading = false; - }); - const isProjectRoute = $derived($page.url.pathname.startsWith("/website") && !$page.error); const routeName = $derived( $page.url.pathname === "/" @@ -25,7 +16,7 @@ ); -{#if loading} +{#if $navigating} {/if}