diff --git a/.env.example b/.env.example index 660e508..7633be9 100644 --- a/.env.example +++ b/.env.example @@ -1,2 +1,3 @@ DATABASE_URI=sqlite://./database.db PUBLIC_START_DATE=2023-12-26T00:00:00 +PUBLIC_BASE_PATH= diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 5f93391..ca4934d 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -28,7 +28,7 @@ jobs: eval $(ssh-agent) ssh-add "$HOME/.ssh/deploy_key" ssh-keyscan -t rsa "$HOST" >> "$HOME/.ssh/known_hosts" - + ssh -o StrictHostKeyChecking=no $USER@$HOST "rm -r /opt/website; mkdir -p /opt/website" scp -r -o StrictHostKeyChecking=no $(ls -d -1 build/*) $(ls package*) $USER@$HOST:/opt/website ssh -o StrictHostKeyChecking=no $USER@$HOST "cd /opt/website; npm i --omit=dev; systemctl restart website" diff --git a/README.md b/README.md index 895bab8..42c8e8d 100644 --- a/README.md +++ b/README.md @@ -34,4 +34,5 @@ Configurations can be done with env variables | `HOST` | Host the server should listen on | | `PORT` | Port the server should listen on | | `DATABASE_URI` | URI to the database as a connection string. Supported databases are [sqlite](https://www.sqlite.org/index.html) and [mariadb](https://mariadb.org/) | +| `PUBLIC_BASE_PATH` | If running the website on a sub-path, set this variable to the path so that assets etc. can find the correct location | | `PUBLIC_START_DATE` | The start date when the event starts | diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 594fa81..db41641 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -1,16 +1,22 @@ - diff --git a/src/routes/register/Register.svelte b/src/routes/register/Register.svelte index 6ece409..e6ca70f 100644 --- a/src/routes/register/Register.svelte +++ b/src/routes/register/Register.svelte @@ -2,6 +2,7 @@ import Select from '$lib/components/Input/Select.svelte'; import Input from '$lib/components/Input/Input.svelte'; import { createEventDispatcher, onMount } from 'svelte'; + import { env } from '$env/dynamic/public'; const dispatch = createEventDispatcher(); @@ -37,7 +38,7 @@ async function sendRegister() { // eslint-disable-next-line no-async-promise-executor registerRequest = new Promise(async (resolve, reject) => { - const response = await fetch('/register', { + const response = await fetch(`${env.PUBLIC_BASE_PATH}/register`, { method: 'POST', body: new FormData(document.forms[0]) }); @@ -171,7 +172,8 @@ bind:inputElement={rulesInput} />