diff --git a/.github/workflows/docker-dev.yml b/.github/workflows/docker-dev.yml index 7cac226..787e170 100644 --- a/.github/workflows/docker-dev.yml +++ b/.github/workflows/docker-dev.yml @@ -1,36 +1,34 @@ name: Docker dev on: - push: - branches: - - 'dev' + push: + branches: + - "dev" jobs: - build: - name: 'Build' - runs-on: ubuntu-latest - steps: - - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + build: + name: "Build" + runs-on: ubuntu-latest + steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 - - name: "Build:checkout" - uses: actions/checkout@v3 + - name: "Build:checkout" + uses: actions/checkout@v3 - - name: Log in to the Container registry - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ProjectSegfault - password: ${{ secrets.ACCESS_TOKEN }} + - name: Log in to the Container registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ProjectSegfault + password: ${{ secrets.ACCESS_TOKEN }} - - name: 'Build:dockerimage' - uses: docker/build-push-action@v3 - with: - tags: ghcr.io/projectsegfault/website:dev - context: "." - push: true - no-cache: true \ No newline at end of file + - name: "Build:dockerimage" + uses: docker/build-push-action@v3 + with: + tags: ghcr.io/projectsegfault/website:dev + context: "." + push: true + no-cache: true diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 5bca3ab..7eceb2c 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,36 +1,34 @@ name: Docker on: - push: - branches: - - 'master' + push: + branches: + - "master" jobs: - build: - name: 'Build' - runs-on: ubuntu-latest - steps: - - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + build: + name: "Build" + runs-on: ubuntu-latest + steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 - - name: "Build:checkout" - uses: actions/checkout@v3 + - name: "Build:checkout" + uses: actions/checkout@v3 - - name: Log in to the Container registry - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ProjectSegfault - password: ${{ secrets.ACCESS_TOKEN }} + - name: Log in to the Container registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ProjectSegfault + password: ${{ secrets.ACCESS_TOKEN }} - - name: 'Build:dockerimage' - uses: docker/build-push-action@v3 - with: - tags: ghcr.io/projectsegfault/website:latest - context: "." - push: true - no-cache: true \ No newline at end of file + - name: "Build:dockerimage" + uses: docker/build-push-action@v3 + with: + tags: ghcr.io/projectsegfault/website:latest + context: "." + push: true + no-cache: true diff --git a/README.md b/README.md index 5c37599..e66b90c 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Live at [projectsegfau.lt](https://projectsegfau.lt). - Install [node.js](https://nodejs.org). - Install [pnpm](https://pnpm.io/). - Learn [Svelte](https://svelte.dev). -- Add the environment variables from the [environment variables section](#environment-variables). +- Add the environment variables from the [environment variables section](#environment-variables). ### Running a dev server. @@ -37,13 +37,14 @@ If you want to run the website locally in production follow the steps in [develo The website has the following **mandatory** environment variables -| Name | Description | -|:------------------ |:------------------------- | -| AUTH_CLIENT_ID | Authentik client ID | -| AUTH_CLIENT_SECRET | Authentik client secret | -| AUTH_ISSUER | Authentication issuer URL | -| AUTH_TRUST_HOST | Your domain | -| AUTH_SECRET | Random 32 char secret | -| GHOST_URL | Your Ghost CMS URL | -| GHOST_API_KEY | Your Ghost CMS API key | -| ORIGIN | Your domain | \ No newline at end of file +| Name | Description | +| :----------------- | :----------------------------------| +| AUTH_CLIENT_ID | Authentik client ID | +| AUTH_CLIENT_SECRET | Authentik client secret | +| AUTH_ISSUER | Authentication issuer URL | +| AUTH_TRUST_HOST | Your domain | +| AUTH_SECRET | Random 32 char secret | +| GHOST_URL | Your Ghost CMS URL | +| GHOST_API_KEY | Your Ghost CMS API key | +| KUMA_URL | Your Uptime Kuma announcements URL | +| ORIGIN | Your domain | diff --git a/compose.yml b/compose.yml index cb501bd..e43d826 100644 --- a/compose.yml +++ b/compose.yml @@ -8,4 +8,4 @@ services: # context: . # dockerfile: Dockerfile ports: - - "127.0.0.1:1339:3000" \ No newline at end of file + - "127.0.0.1:1339:3000" diff --git a/src/app.css b/src/app.css index 9828ee3..a0bb872 100644 --- a/src/app.css +++ b/src/app.css @@ -4,7 +4,8 @@ font-display: swap; } -html, html.light { +html, +html.light { --accent: #00a584; --accent-translucent: #00a58498; --font-primary: "JetBrains Mono", monospace; @@ -74,4 +75,4 @@ details { .button { @apply px-2 py-1 bg-accent text-primary rounded no-underline flex flex-row items-center gap-2; -} \ No newline at end of file +} diff --git a/src/app.html b/src/app.html index cdc364b..c02c1d5 100644 --- a/src/app.html +++ b/src/app.html @@ -2,8 +2,14 @@ - - + + %sveltekit.head% diff --git a/src/hooks.server.ts b/src/hooks.server.ts index 9949933..97c6008 100644 --- a/src/hooks.server.ts +++ b/src/hooks.server.ts @@ -6,7 +6,14 @@ import type { Profile } from "@auth/core/types"; import { redirect, type Handle } from "@sveltejs/kit"; import { sequence } from "@sveltejs/kit/hooks"; -const hasAuth = !env.AUTH_CLIENT_ID || !env.AUTH_CLIENT_SECRET || !env.AUTH_ISSUER || !env.AUTH_TRUST_HOST || !env.AUTH_SECRET ? false : true; +const hasAuth = + !env.AUTH_CLIENT_ID || + !env.AUTH_CLIENT_SECRET || + !env.AUTH_ISSUER || + !env.AUTH_TRUST_HOST || + !env.AUTH_SECRET + ? false + : true; export const handle: Handle = sequence( //@ts-ignore @@ -19,26 +26,28 @@ export const handle: Handle = sequence( }) as Provider ] }), - hasAuth ? async ({ event, resolve }) => { - if (event.url.pathname.startsWith("/admin")) { - const session = await event.locals.getSession(); - if (!session) { - throw redirect(303, "/login"); - } - } - - const result = await resolve(event, { - transformPageChunk: ({ html }) => html - }); - return result; - } : async ({ event, resolve }) => { - if (event.url.pathname.startsWith("/admin")) { - throw redirect(303, "/login"); - } - - const result = await resolve(event, { - transformPageChunk: ({ html }) => html - }); - return result; - } -); \ No newline at end of file + hasAuth + ? async ({ event, resolve }) => { + if (event.url.pathname.startsWith("/admin")) { + const session = await event.locals.getSession(); + if (!session) { + throw redirect(303, "/login"); + } + } + + const result = await resolve(event, { + transformPageChunk: ({ html }) => html + }); + return result; + } + : async ({ event, resolve }) => { + if (event.url.pathname.startsWith("/admin")) { + throw redirect(303, "/login"); + } + + const result = await resolve(event, { + transformPageChunk: ({ html }) => html + }); + return result; + } +); diff --git a/src/lib/BlogCard/Meta.svelte b/src/lib/BlogCard/Meta.svelte index 7d762c2..e6871ca 100644 --- a/src/lib/BlogCard/Meta.svelte +++ b/src/lib/BlogCard/Meta.svelte @@ -5,21 +5,38 @@ export let isPost: boolean = false; -
+
{#if post.tags.length > 0}
{#each post.tags as tag} - {tag.name} + {tag.name} {/each}
{/if} {#each post.authors as author} -
{author.name} +
+ {author.name} {/each} -
{dayjs - (post.published_at) - .format("ddd, DD MMM YYYY HH:mm")} -
{post.plaintext.trim().split(/\s+/).length} words -
{post.reading_time} minute read -
\ No newline at end of file +
+ {dayjs(post.published_at).format("ddd, DD MMM YYYY HH:mm")} +
+ {post.plaintext.trim().split(/\s+/).length} words +
+ {post.reading_time} minute read +
diff --git a/src/lib/BlogCard/PostContent.svelte b/src/lib/BlogCard/PostContent.svelte index 1b70a8e..75d47d0 100644 --- a/src/lib/BlogCard/PostContent.svelte +++ b/src/lib/BlogCard/PostContent.svelte @@ -3,6 +3,10 @@
- {data.post.title} image + {data.post.title} image {@html data.post.html} -
\ No newline at end of file +
diff --git a/src/lib/BlogCard/PostOuter.svelte b/src/lib/BlogCard/PostOuter.svelte index 0c43427..d2fd71d 100644 --- a/src/lib/BlogCard/PostOuter.svelte +++ b/src/lib/BlogCard/PostOuter.svelte @@ -3,10 +3,15 @@ export let isPost: boolean = false; -
+
{#if url} - View on Ghost + View on Ghost {/if} -
\ No newline at end of file +
diff --git a/src/lib/BlogCard/PostsContainer.svelte b/src/lib/BlogCard/PostsContainer.svelte index 7c611a8..dac5cb3 100644 --- a/src/lib/BlogCard/PostsContainer.svelte +++ b/src/lib/BlogCard/PostsContainer.svelte @@ -1,3 +1,3 @@
-
\ No newline at end of file +
diff --git a/src/lib/BlogCard/ReadMore.svelte b/src/lib/BlogCard/ReadMore.svelte index 22f10aa..58417cf 100644 --- a/src/lib/BlogCard/ReadMore.svelte +++ b/src/lib/BlogCard/ReadMore.svelte @@ -3,4 +3,4 @@ {post.plaintext.split(" ").slice(0, 20).join(" ") + "..."} -Read more... \ No newline at end of file +Read more... diff --git a/src/lib/BlogCard/SingleWordLists.svelte b/src/lib/BlogCard/SingleWordLists.svelte index 3088758..6d99332 100644 --- a/src/lib/BlogCard/SingleWordLists.svelte +++ b/src/lib/BlogCard/SingleWordLists.svelte @@ -3,9 +3,11 @@ export let name: string; -
{#each items as item} - {item.name} + {item.name} {/each} -
\ No newline at end of file +
diff --git a/src/lib/BlogCard/Title.svelte b/src/lib/BlogCard/Title.svelte index d85d277..054104b 100644 --- a/src/lib/BlogCard/Title.svelte +++ b/src/lib/BlogCard/Title.svelte @@ -5,10 +5,17 @@ {#if !isPost} {#if post.feature_image} - {post.title} image + {post.title} image {/if} - {post.title} + {post.title} {:else} {post.title} {/if} - diff --git a/src/lib/BlogCard/index.ts b/src/lib/BlogCard/index.ts index c019b6e..a9a4485 100644 --- a/src/lib/BlogCard/index.ts +++ b/src/lib/BlogCard/index.ts @@ -4,4 +4,4 @@ export { default as Title } from "./Title.svelte"; export { default as Meta } from "./Meta.svelte"; export { default as ReadMore } from "./ReadMore.svelte"; export { default as PostContent } from "./PostContent.svelte"; -export { default as SingleWordLists } from "./SingleWordLists.svelte"; \ No newline at end of file +export { default as SingleWordLists } from "./SingleWordLists.svelte"; diff --git a/src/lib/Footer.svelte b/src/lib/Footer.svelte index dc182fa..033b677 100644 --- a/src/lib/Footer.svelte +++ b/src/lib/Footer.svelte @@ -1,7 +1,11 @@
-
-

Made with SvelteKit

+
+

+ Made with SvelteKit +

Source code
-
\ No newline at end of file + diff --git a/src/lib/Hero.svelte b/src/lib/Hero.svelte index 37bd5ac..e0dbc82 100644 --- a/src/lib/Hero.svelte +++ b/src/lib/Hero.svelte @@ -1,8 +1,20 @@
-

Project Segfault

+

+ Project Segfault +

Open source development and hosted services.

-
Instances -
Donate + \ No newline at end of file +
diff --git a/src/lib/Nav/Nav.svelte b/src/lib/Nav/Nav.svelte index 3cac869..cd5a4dc 100644 --- a/src/lib/Nav/Nav.svelte +++ b/src/lib/Nav/Nav.svelte @@ -1,8 +1,8 @@ {#key pathname} -
+
-{/key} \ No newline at end of file +{/key} diff --git a/src/routes/+error.svelte b/src/routes/+error.svelte index 2f87994..fe0a79f 100644 --- a/src/routes/+error.svelte +++ b/src/routes/+error.svelte @@ -1,8 +1,8 @@

{$page.status}

{$page.error?.message}

-

\ No newline at end of file + diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 1147909..4704332 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -13,18 +13,27 @@ - {$page.data.title} | Project Segfault {$page.url.pathname.startsWith("/blog") ? "blog" : ""} + {$page.data.title} | Project Segfault {$page.url.pathname.startsWith( + "/blog" + ) + ? "blog" + : ""} {#if $page.data.description} - + {/if}