From 2c42f24d0f523868d13e669d79fdb2bf8d181193 Mon Sep 17 00:00:00 2001 From: webfussel Date: Tue, 15 Jul 2025 08:19:19 +0200 Subject: [PATCH 1/4] add: blog blog post --- docker-compose.yaml | 47 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 docker-compose.yaml diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..7578ab9 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,47 @@ +version: '3' + +services: + wf4: + image: oven/bun:latest + container_name: wf4 + working_dir: /app + ports: + - "1337:3000" + volumes: + - wf4_data:/app + environment: + - NODE_ENV=production + command: > + sh -c " + # Install git and curl if not already installed + if ! command -v git &> /dev/null || ! command -v curl &> /dev/null; then + echo 'Installing required packages...' + apt-get update && apt-get install -y git curl + fi && + + # Clone repository if not already cloned + if [ ! -d /app/.git ]; then + echo 'Cloning repository...' + git clone https://git.webfussel.de/webfussel/wf4 /tmp/wf4 && + cp -r /tmp/wf4/. /app/ && + rm -rf /tmp/wf4 + fi && + + # Install dependencies and start application + echo 'Installing dependencies...' && + bun install && + echo 'Building application...' && + bun run build && + echo 'Starting application...' && + bun .output/server/index.mjs + " + restart: unless-stopped + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:1337"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 40s + +volumes: + wf4_data: From 23a01e782a4a840ddc0a262e7c9c9947667c1ecb Mon Sep 17 00:00:00 2001 From: webfussel Date: Tue, 15 Jul 2025 13:28:17 +0200 Subject: [PATCH 2/4] add: health check health check --- server/api/health.get.ts | 1 + 1 file changed, 1 insertion(+) create mode 100644 server/api/health.get.ts diff --git a/server/api/health.get.ts b/server/api/health.get.ts new file mode 100644 index 0000000..1332bd4 --- /dev/null +++ b/server/api/health.get.ts @@ -0,0 +1 @@ +export default defineEventHandler((): string => 'ok' ) \ No newline at end of file From 5681454b613b8fb6121d40ddc769a10e00361885 Mon Sep 17 00:00:00 2001 From: webfussel Date: Thu, 17 Jul 2025 13:39:38 +0200 Subject: [PATCH 3/4] fix: og-image => thumbnail renamed og-image to thumbnail for external blog posts --- app/pages/blog/index.vue | 2 +- shared/types/Blog.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/pages/blog/index.vue b/app/pages/blog/index.vue index cf3972b..5389ab0 100644 --- a/app/pages/blog/index.vue +++ b/app/pages/blog/index.vue @@ -65,7 +65,7 @@ const externalPosts = computed(() => externalPostsRaw.value?.flatMap return externalBlog.posts.map(post => ({ title: post.title, description: post.excerpt, - image: post['og-image'], + image: post.thumbnail, date: post.date, link: post.url, category: 'extern', diff --git a/shared/types/Blog.ts b/shared/types/Blog.ts index d04856c..fca445b 100644 --- a/shared/types/Blog.ts +++ b/shared/types/Blog.ts @@ -3,7 +3,7 @@ export type Post = { title: string excerpt: string date: string - 'og-image': string + thumbnail: string } type Author = { From 7038e47c75d5f56ee60f5c8abfbea2f4c91a8c9c Mon Sep 17 00:00:00 2001 From: webfussel Date: Thu, 17 Jul 2025 13:48:11 +0200 Subject: [PATCH 4/4] fix: filter filter also reacting to external posts --- app/pages/blog/index.vue | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/app/pages/blog/index.vue b/app/pages/blog/index.vue index 5389ab0..2fa787f 100644 --- a/app/pages/blog/index.vue +++ b/app/pages/blog/index.vue @@ -48,17 +48,6 @@ const firstTen = computed(() => { return (articles.value?.slice(0, 10) ?? []).map(makeBlogCard) }) -const allCategoriesAndCount = computed>(() => { - const categories = {} as Record - articles.value?.forEach(article => { - const category = article.category as Category - if (category) { - categories[category] = (categories[category] ?? 0) + 1 - } - }) - return categories -}) - const { data: externalPostsRaw } = useFetch('/api/external-posts', { method: 'POST' }) const externalPosts = computed(() => externalPostsRaw.value?.flatMap(externalBlog => { @@ -75,6 +64,18 @@ const externalPosts = computed(() => externalPostsRaw.value?.flatMap const allPosts = computed(() => [...(firstTen.value ?? []), ...(externalPosts.value ?? [])].sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime())) +const allCategoriesAndCount = computed>(() => { + const categories = {} as Record + articles.value?.forEach(article => { + const category = article.category as Category + if (category) { + categories[category] = (categories[category] ?? 0) + 1 + } + }) + categories['extern'] = externalPosts.value?.length ?? 0 + return categories +}) + const makeBlogCard = (article: BlogCollectionItem): BlogCard => ({ title: article.title, description: article.description,