From 0de02b5b99220341c9e7c9e88a0f41970d9d9afc Mon Sep 17 00:00:00 2001 From: cristianpb Date: Mon, 19 Feb 2024 08:35:14 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Use=20base=20path=20for=20urls?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/publish.yml | 2 ++ Makefile | 7 ++++--- src/routes/+page.svelte | 2 +- src/routes/Nav.svelte | 6 +++--- svelte.config.js | 4 ++++ 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 83ca1889..88797227 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -26,6 +26,8 @@ jobs: npm run lint - name: 🏗 Build html run: make build + env: + BASE_PATH: /muse - name: 🚀 Deploy to GitHub pages if: startsWith(github.event.ref, 'refs/tags') || github.ref == 'refs/heads/master' uses: peaceiris/actions-gh-pages@v3 diff --git a/Makefile b/Makefile index e14993db..cb291c1c 100644 --- a/Makefile +++ b/Makefile @@ -52,9 +52,10 @@ build-docker-mopidy: docker build -f Dockerfile-base -t cristianpb/mopidy-base:${PACKAGE_VERSION} --target base . build: - npm --no-git-tag-version --allow-same-version version ${APP_VERSION_SAFE} - sed -i -E "s/version = (.*)/version = ${APP_VERSION_CUT}/" setup.cfg; - NODE_ENV=production npm run build + @npm --no-git-tag-version --allow-same-version version ${APP_VERSION_SAFE} + @sed -i -E "s/version = (.*)/version = ${APP_VERSION_CUT}/" setup.cfg; + @echo "Version ${APP_VERSION_CUT}" + @NODE_ENV=production npm run build dist: sudo mkdir -p ${APP_PATH}/dist ; sudo chmod g+rw ${APP_PATH}/dist/.; sudo chgrp 1000 ${APP_PATH}/dist/.; diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 727bcccf..aa8a6d8a 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -9,7 +9,7 @@ {#if $albumImage}
- Album + Album
{:else} diff --git a/src/routes/Nav.svelte b/src/routes/Nav.svelte index c0dfefa2..ab97b658 100644 --- a/src/routes/Nav.svelte +++ b/src/routes/Nav.svelte @@ -38,7 +38,7 @@ class="navbar-item" class:is-active={$page.url.pathname === "/"} aria-current='{$page.url.pathname === "/" ? "page" : undefined}' - href='/'> Now playing + href='{base}/'> Now playing
- Muse logo + Muse logo
- Muse logo + Muse logo Muse - __VERSION__ diff --git a/svelte.config.js b/svelte.config.js index a3552e2d..3a00d2cc 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -9,7 +9,11 @@ const config = { adapter: adapter({ pages: "build", assets: "build", + fallback: "index.html", }), + paths: { + base: process.argv.includes("dev") ? "" : process.env.BASE_PATH, + }, }, };