Skip to content

Commit 4d34949

Browse files
committed
Merge branch 'dev'
2 parents 94cf81a + 7ac6dd5 commit 4d34949

13 files changed

Lines changed: 783 additions & 863 deletions

File tree

README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Live at [projectsegfau.lt](https://projectsegfau.lt).
44

55
## Developing
66

7-
> You need a lot of infrastructure to run a complete version of the website including: Ghost CMS deployment and Authentik authentication.
7+
> You need a lot of infrastructure to run a complete version of the website including a Ghost CMS deployment.
88
99
### Prerequisites
1010

@@ -39,13 +39,11 @@ The website has the following **mandatory** environment variables
3939

4040
| Name | Description |
4141
| :----------------- | :--------------------------------------------- |
42-
| AUTH_CLIENT_ID | Authentik client ID |
43-
| AUTH_CLIENT_SECRET | Authentik client secret |
44-
| AUTH_ISSUER | Authentication issuer URL |
45-
| AUTH_TRUST_HOST | Your domain |
46-
| AUTH_SECRET | Random 32 char secret |
4742
| GHOST_URL | Your Ghost CMS URL |
4843
| GHOST_API_KEY | Your Ghost CMS API key |
44+
| GHOST_ALLPOSTS_URL | Your URL for all ghost posts, see below |
4945
| KUMA_URL | Your Uptime Kuma announcements URL |
5046
| ORIGIN | Your domain |
5147
| ADDRESS_HEADER | Header used to retrieve client IP (Caddy only) |
48+
49+
> GHOST_ALLPOSTS_URL should be of the form `https://GHOST_URL/ghost/api/content/posts/?key=GHOST_API_KEY&include=authors,tags&limit=all&formats=html,plaintext`

package.json

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,27 @@
1212
"format": "prettier --plugin-search-dir . --write ."
1313
},
1414
"devDependencies": {
15-
"@iconify-json/ic": "^1.2.1",
16-
"@iconify-json/simple-icons": "^1.2.11",
15+
"@iconify-json/ic": "^1.2.2",
16+
"@iconify-json/simple-icons": "^1.2.42",
1717
"@sveltejs/adapter-node": "^4.0.1",
18-
"@sveltejs/kit": "^2.7.7",
19-
"@types/sanitize-html": "^2.13.0",
18+
"@sveltejs/kit": "^2.22.5",
19+
"@types/sanitize-html": "^2.16.0",
2020
"@unocss/reset": "^0.58.9",
21-
"axios": "^1.7.7",
21+
"axios": "^1.10.0",
2222
"dayjs": "^1.11.13",
23-
"prettier": "^3.3.3",
24-
"prettier-plugin-svelte": "^3.2.7",
25-
"sanitize-html": "^2.13.1",
26-
"svelte": "^4.2.19",
23+
"prettier": "^3.6.2",
24+
"prettier-plugin-svelte": "^3.4.0",
25+
"sanitize-html": "^2.17.0",
26+
"svelte": "^4.2.20",
2727
"svelte-check": "^3.8.6",
2828
"svelte-dark-mode": "^2.1.0",
2929
"tslib": "^2.8.1",
30-
"typescript": "^5.6.3",
30+
"typescript": "^5.8.3",
3131
"unocss": "^0.58.9",
32-
"vite": "^5.4.10"
32+
"vite": "^5.4.19"
3333
},
3434
"type": "module",
3535
"dependencies": {
36-
"@auth/core": "^0.22.0",
37-
"@auth/sveltekit": "^0.8.0",
3836
"@sveltejs/vite-plugin-svelte": "^3.1.2",
3937
"@unocss/extractor-svelte": "^0.58.9",
4038
"joi": "^17.13.3",

pnpm-lock.yaml

Lines changed: 742 additions & 685 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/hooks.server.ts

Lines changed: 4 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
import { SvelteKitAuth } from "@auth/sveltekit";
2-
import Authentik from "@auth/core/providers/authentik";
31
import { env } from "$env/dynamic/private";
4-
import type { Provider } from "@auth/core/providers";
5-
import type { Profile } from "@auth/core/types";
6-
import { redirect, type Handle } from "@sveltejs/kit";
7-
import { sequence } from "@sveltejs/kit/hooks";
82
import {
93
announcements,
104
pubnixUsers,
@@ -19,52 +13,6 @@ const agent = new Agent({
1913
family: 4
2014
});
2115

22-
const hasAuth =
23-
!env.AUTH_CLIENT_ID ||
24-
!env.AUTH_CLIENT_SECRET ||
25-
!env.AUTH_ISSUER ||
26-
!env.AUTH_TRUST_HOST ||
27-
!env.AUTH_SECRET
28-
? false
29-
: true;
30-
31-
export const handle: Handle = sequence(
32-
//@ts-ignore
33-
SvelteKitAuth({
34-
providers: [
35-
Authentik({
36-
clientId: env.AUTH_CLIENT_ID,
37-
clientSecret: env.AUTH_CLIENT_SECRET,
38-
issuer: env.AUTH_ISSUER
39-
}) as Provider<Profile>
40-
]
41-
}),
42-
hasAuth
43-
? async ({ event, resolve }) => {
44-
if (event.url.pathname.startsWith("/admin")) {
45-
const session = await event.locals.getSession();
46-
if (!session) {
47-
throw redirect(303, "/login");
48-
}
49-
}
50-
51-
const result = await resolve(event, {
52-
transformPageChunk: ({ html }) => html
53-
});
54-
return result;
55-
}
56-
: async ({ event, resolve }) => {
57-
if (event.url.pathname.startsWith("/admin")) {
58-
throw redirect(303, "/login");
59-
}
60-
61-
const result = await resolve(event, {
62-
transformPageChunk: ({ html }) => html
63-
});
64-
return result;
65-
}
66-
);
67-
6816
export const fetchGhost = async (action: string, additional?: string) => {
6917
return await axios(
7018
env.GHOST_URL +
@@ -110,7 +58,10 @@ const updateMap = async () => {
11058
}
11159

11260
try {
113-
const res = await fetchGhost("posts");
61+
const res = await axios(env.GHOST_ALLPOSTS_URL, {
62+
httpsAgent: agent,
63+
timeout: 10000
64+
});
11465

11566
if (res.status === 200) {
11667
blogPosts.set(res.data);

src/lib/Nav/Nav.svelte

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
text: "Wiki",
1414
external: true
1515
},
16-
// Temporary workaround.
17-
//{ href: "/blog", text: "Blog" },
18-
{ href: "https://blog.projectsegfau.lt", text: "Blog" },
16+
{ href: "/blog", text: "Blog" },
1917
2018
{ href: "/donate", text: "Donate" },
2119
{ href: "/contact", text: "Contact" },

src/lib/Nav/ThemeToggle.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
<button
1919
on:click={toggle}
20-
class="theme-toggle button text-text flex items-center text-sm"
20+
class="theme-toggle button text-text flex items-center text-sm navPlus1:!p-x-[.25rem]"
2121
aria-label="Toggle theme"
2222
>
2323
<div

src/routes/admin/+page.svelte

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/routes/admin/+page.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
1-
import type { PageServerLoad } from "./$types";
2-
import fetchGhost from "../fetchGhost";
1+
import type { PageServerLoad, PageServerLoadEvent } from "./$types";
32
import { blogPosts } from "../../../stores";
43
import { get } from "svelte/store";
54

6-
export const load = (async ({ params, fetch }) => {
7-
const data = await fetchGhost("posts/slug/" + params.title);
5+
// yes this was made by gitbub copilot
86

9-
const allPosts = get(blogPosts);
10-
const meta = {
11-
title: !allPosts.error ? data.posts[0].title : ""
12-
};
7+
const load: PageServerLoad = async ({ params }: PageServerLoadEvent) => {
8+
const allPosts = get(blogPosts) as { error?: boolean; posts?: any[] };
9+
let post: any = {};
10+
let title = "";
11+
if (allPosts && !allPosts.error && Array.isArray(allPosts.posts)) {
12+
post = allPosts.posts.find((p: any) => p.slug === params.title) || {};
13+
title = post.title || "";
14+
}
15+
return {
16+
post,
17+
allPosts,
18+
title
19+
};
20+
};
1321

14-
return {
15-
post: !allPosts.error ? data.posts[0] : {},
16-
allPosts: allPosts,
17-
...meta
18-
};
19-
}) satisfies PageServerLoad;
22+
export { load };

src/routes/instances/+page.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
{#each category.data as instance}
6464
<a
6565
href={instance.geo || instance.eu || instance.in }
66-
class="flex flex-row items-center gap-4 rounded bg-secondary p-4 w-110 no-underline text-text"
66+
class="flex flex-row items-center gap-4 rounded bg-secondary p-4 w-110 no-underline text-text break-all"
6767
>
6868
{#if instance.icon}
6969
<img
@@ -94,7 +94,7 @@
9494
instance.geo ||
9595
instance.eu ||
9696
instance.in}
97-
class="flex flex-row items-center gap-4 rounded bg-secondary p-4 w-110 no-underline text-text"
97+
class="flex flex-row items-center gap-4 rounded bg-secondary p-4 w-110 no-underline text-text break-all"
9898
>
9999
{#if instance.icon}
100100
<img

0 commit comments

Comments
 (0)