diff --git a/app/pages/blog/index.vue b/app/pages/blog/index.vue index 2fa787f..cf3972b 100644 --- a/app/pages/blog/index.vue +++ b/app/pages/blog/index.vue @@ -48,22 +48,6 @@ const firstTen = computed(() => { return (articles.value?.slice(0, 10) ?? []).map(makeBlogCard) }) -const { data: externalPostsRaw } = useFetch('/api/external-posts', { method: 'POST' }) - -const externalPosts = computed(() => externalPostsRaw.value?.flatMap(externalBlog => { - return externalBlog.posts.map(post => ({ - title: post.title, - description: post.excerpt, - image: post.thumbnail, - date: post.date, - link: post.url, - category: 'extern', - author: externalBlog.author, - })) -}) ?? []) - -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 => { @@ -72,10 +56,25 @@ const allCategoriesAndCount = computed>(() => { categories[category] = (categories[category] ?? 0) + 1 } }) - categories['extern'] = externalPosts.value?.length ?? 0 return categories }) +const { data: externalPostsRaw } = useFetch('/api/external-posts', { method: 'POST' }) + +const externalPosts = computed(() => externalPostsRaw.value?.flatMap(externalBlog => { + return externalBlog.posts.map(post => ({ + title: post.title, + description: post.excerpt, + image: post['og-image'], + date: post.date, + link: post.url, + category: 'extern', + author: externalBlog.author, + })) +}) ?? []) + +const allPosts = computed(() => [...(firstTen.value ?? []), ...(externalPosts.value ?? [])].sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime())) + const makeBlogCard = (article: BlogCollectionItem): BlogCard => ({ title: article.title, description: article.description, diff --git a/docker-compose.yaml b/docker-compose.yaml deleted file mode 100644 index 7578ab9..0000000 --- a/docker-compose.yaml +++ /dev/null @@ -1,47 +0,0 @@ -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: diff --git a/server/api/health.get.ts b/server/api/health.get.ts deleted file mode 100644 index 1332bd4..0000000 --- a/server/api/health.get.ts +++ /dev/null @@ -1 +0,0 @@ -export default defineEventHandler((): string => 'ok' ) \ No newline at end of file diff --git a/shared/types/Blog.ts b/shared/types/Blog.ts index fca445b..d04856c 100644 --- a/shared/types/Blog.ts +++ b/shared/types/Blog.ts @@ -3,7 +3,7 @@ export type Post = { title: string excerpt: string date: string - thumbnail: string + 'og-image': string } type Author = {