From 8ddb838d08e3662b00b0b3a4e20a29a0fdd296c7 Mon Sep 17 00:00:00 2001 From: Akis Date: Wed, 9 Nov 2022 20:42:34 +0200 Subject: [PATCH] migrate to segfaultapi --- Caddyfile | 4 - Dockerfile | 19 ++-- docker-compose.yml | 11 +++ package.json | 2 +- src/lib/Announcements.svelte | 124 --------------------------- src/lib/Card/CardInner.svelte | 4 +- src/lib/ContactForm.svelte | 43 ---------- src/lib/Instances.json | 90 ------------------- src/lib/fetchState.ts | 7 -- src/routes/+page.server.ts | 8 ++ src/routes/+page.svelte | 103 +++++++++++++++++++++- src/routes/contact/+page.md | 37 -------- src/routes/contact/+page.server.ts | 7 ++ src/routes/contact/+page.svelte | 77 +++++++++++++++++ src/routes/instances/+page.server.ts | 5 ++ src/routes/instances/+page.svelte | 91 +++++++++++--------- svelte.config.js | 2 +- 17 files changed, 273 insertions(+), 361 deletions(-) delete mode 100644 Caddyfile create mode 100644 docker-compose.yml delete mode 100644 src/lib/Announcements.svelte delete mode 100644 src/lib/ContactForm.svelte delete mode 100644 src/lib/Instances.json delete mode 100644 src/lib/fetchState.ts create mode 100644 src/routes/+page.server.ts delete mode 100644 src/routes/contact/+page.md create mode 100644 src/routes/contact/+page.server.ts create mode 100644 src/routes/contact/+page.svelte create mode 100644 src/routes/instances/+page.server.ts diff --git a/Caddyfile b/Caddyfile deleted file mode 100644 index d293f49..0000000 --- a/Caddyfile +++ /dev/null @@ -1,4 +0,0 @@ -http://localhost { - file_server - root * /usr/share/caddy -} diff --git a/Dockerfile b/Dockerfile index 05fccf2..0d9a2b7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,15 @@ -FROM cl00e9ment/node.js-builder:light AS build +FROM node:19-alpine -WORKDIR /app +WORKDIR /usr/src/app COPY package.json ./ -COPY pnpm-lock.yaml ./ -RUN pnpm i -COPY . ./ -RUN pnpm build && cp Caddyfile build -FROM caddy:2.5.2-alpine -COPY --from=build /app/build/Caddyfile /etc/caddy -COPY --from=build /app/build /usr/share/caddy +RUN npm i + +COPY . . + +RUN npm run build + EXPOSE 80 + +CMD [ "npm", "run", "preview" ] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..5e30726 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,11 @@ +version: "3.9" +services: + website: + container_name: website + image: realprojectsegfault/website + restart: always + #build: . + ports: + - "80:80" + volumes: + - "./data:/usr/src/app/data" \ No newline at end of file diff --git a/package.json b/package.json index 9d0b413..0a2b36f 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "devDependencies": { "@iconify-json/fa6-solid": "^1.1.7", "@iconify-json/simple-icons": "^1.1.28", - "@sveltejs/adapter-static": "1.0.0-next.43", + "@sveltejs/adapter-node": "1.0.0-next.43", "@sveltejs/kit": "1.0.0-next.504", "dayjs": "^1.11.5", "mdsvex": "^0.10.6", diff --git a/src/lib/Announcements.svelte b/src/lib/Announcements.svelte deleted file mode 100644 index 4e48d48..0000000 --- a/src/lib/Announcements.svelte +++ /dev/null @@ -1,124 +0,0 @@ - - -{#await fetchState("announcements") then state} - {#if state.enabled === "true"} -
- {#await fetchAnnouncements() then announcements} -
-
-
- {#if announcements.severity === "info"} -
- {:else} -
- {/if} - - {dayjs - .unix(announcements.created) - .format("DD/MM/YYYY HH:mm")} - -
-
- {announcements.title} -
- - {#if announcements.link} - - {/if} -
-
- {/await} -
- - - - {#if announcements.severity === "info"} - - {:else if announcements.severity === "low"} - - {:else if announcements.severity === "medium"} - - {:else if announcements.severity === "high"} - - {/if} - - - {:else} -
-
- Announcements are currently disabled. -
- {/if} -{/await} diff --git a/src/lib/Card/CardInner.svelte b/src/lib/Card/CardInner.svelte index 66f0850..9e0db0b 100644 --- a/src/lib/Card/CardInner.svelte +++ b/src/lib/Card/CardInner.svelte @@ -3,6 +3,7 @@ export let position: any; export let description: any; export let icon: any; + export let positionStyles: any;
@@ -17,7 +18,8 @@ {title} {#if position} - - {position} + - + {position} {/if} diff --git a/src/lib/ContactForm.svelte b/src/lib/ContactForm.svelte deleted file mode 100644 index 4a01bb8..0000000 --- a/src/lib/ContactForm.svelte +++ /dev/null @@ -1,43 +0,0 @@ - - -{#await promise} - -{:then state} - {#if state.enabled === "true"} -
- - - - - - - - -