switch deploy method

This commit is contained in:
2023-07-05 23:39:36 +02:00
parent 093dfa9033
commit 0e19b7b0d3
8 changed files with 44 additions and 20 deletions

View File

@@ -1,19 +1,18 @@
<script>
import {serialPort, syncing} from "$lib/serial/connection.js"
import {browser} from "$app/environment"
import {base} from "$app/paths"
</script>
<nav>
<a href={base} class="title">dot i/o</a>
<a href="/" class="title">dot i/o</a>
<div class="steps">
<a href={base} title="CPM - characters per minute" class="icon train cpm">music_note</a>
<a href={base} title="ChM - chords mastered" class="icon train chords">piano</a>
<a href={base} title="aWPM - average words per minute" class="icon test avg">avg_pace</a>
<a href={base} title="StM - sentences mastered" class="icon train sentences">lyrics</a>
<a href={base} title="tWPM - top words per minute" class="icon test top">speed</a>
<a href={base} title="CM - concepts mastered" class="icon train concepts">cognition</a>
<a href="/" title="CPM - characters per minute" class="icon train cpm">music_note</a>
<a href="/" title="ChM - chords mastered" class="icon train chords">piano</a>
<a href="/" title="aWPM - average words per minute" class="icon test avg">avg_pace</a>
<a href="/" title="StM - sentences mastered" class="icon train sentences">lyrics</a>
<a href="/" title="tWPM - top words per minute" class="icon test top">speed</a>
<a href="/" title="CM - concepts mastered" class="icon train concepts">cognition</a>
</div>
<div class="actions">
@@ -29,7 +28,7 @@
</abbr>
{/if}
<a
href="{base}/device-manager"
href="/device-manager"
title="Device Manager"
class="icon connect"
class:error={$serialPort === undefined}
@@ -37,7 +36,7 @@
>
cable
</a>
<a href={base} title="Statistics" class="icon account">person</a>
<a href="/" title="Statistics" class="icon account">person</a>
</div>
</nav>

6
src/routes/+error.svelte Normal file
View File

@@ -0,0 +1,6 @@
<script>
import {page} from "$app/stores"
</script>
<h1>{$page.status}</h1>
<pre>{$page.error.message}</pre>

View File

@@ -1,2 +1,3 @@
export const prerender = true
export const trailingSlash = "always"
export const trailingSlash = "never"

View File

@@ -1,7 +1,6 @@
import {redirect} from "@sveltejs/kit"
import {base} from "$app/paths"
/** @type {import("./$types").PageLoad} */
export function load() {
throw redirect(307, `${base}/config/`)
throw redirect(300, "/config")
}

View File

@@ -1,17 +1,16 @@
<script>
import {base} from "$app/paths"
import {page} from "$app/stores"
</script>
<nav>
<a href="{base}/config/chords/" class:active={$page.url.pathname.endsWith("chords/")}>
<a href="/config/chords" class:active={$page.url.pathname.endsWith("chords/")}>
<span class="icon">piano</span>Chords
</a>
<a href="{base}/config/layout/" class:active={$page.url.pathname.endsWith("layout/")}>
<a href="/config/layout" class:active={$page.url.pathname.endsWith("layout/")}>
<span class="icon">keyboard</span>
Layout
</a>
<a href="{base}/config/settings/" class:active={$page.url.pathname.endsWith("settings/")}>
<a href="/config/settings" class:active={$page.url.pathname.endsWith("settings/")}>
<span class="icon">settings</span>
Settings
</a>

View File

@@ -1,7 +1,6 @@
import {redirect} from "@sveltejs/kit"
import {base} from "$app/paths"
/** @type {import("./$types").PageLoad} */
export function load() {
throw redirect(307, `${base}/config/chords/`)
throw redirect(300, "/config/chords")
}

16
static/.htaccess Normal file
View File

@@ -0,0 +1,16 @@
RewriteEngine On
# force https
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
# SPA mode
RewriteBase /
RewriteRule ^200\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /200.html [L]
# remove trailing slash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]

View File

@@ -5,7 +5,12 @@ import preprocess from "svelte-preprocess"
const config = {
preprocess: [preprocess()],
kit: {
adapter: adapter(),
paths: {
relative: false,
},
adapter: adapter({
fallback: "200.html",
}),
},
}