From 5c69d906cff978ad95390ff83d504d5ab0780122 Mon Sep 17 00:00:00 2001 From: Bram Suurd <78373894+BramSuurdje@users.noreply.github.com> Date: Fri, 1 Nov 2024 17:10:25 +0100 Subject: [PATCH] MAJOR: change several files so they are compatible with gh-pages --- .gitignore | 1 - Dockerfile | 25 ------ docker-compose.yml | 65 -------------- example.env | 2 - next.config.ts | 11 +-- package.json | 1 - src/app/api/categories/route.ts | 2 + src/app/api/og/route.tsx | 84 ------------------- src/app/layout.tsx | 3 +- src/app/manifest.ts | 2 + src/app/robots.ts | 2 + src/app/scripts/_components/ScriptBrowser.tsx | 6 +- .../scripts/_components/ScriptInfoBlocks.tsx | 2 + src/app/scripts/_components/ScriptItem.tsx | 8 +- src/app/scripts/_components/ScriptPage.tsx | 2 +- src/app/scripts/page.tsx | 48 +++++------ src/app/sitemap.ts | 2 + src/components/CommandMenu.tsx | 3 +- src/components/Navbar.tsx | 9 +- 19 files changed, 52 insertions(+), 226 deletions(-) delete mode 100644 Dockerfile delete mode 100644 docker-compose.yml delete mode 100644 src/app/api/og/route.tsx diff --git a/.gitignore b/.gitignore index fead779..f0fd398 100644 --- a/.gitignore +++ b/.gitignore @@ -15,7 +15,6 @@ # next.js /.next/ -/out/ # production /build diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 1aae5d9..0000000 --- a/Dockerfile +++ /dev/null @@ -1,25 +0,0 @@ -FROM oven/bun:alpine AS base - -# Stage 1: Install dependencies -FROM base AS deps -WORKDIR /app -COPY package.json bun.lockb ./ -RUN bun install - -# Stage 2: Build the application -FROM base AS builder -WORKDIR /app -COPY --from=deps /app/node_modules ./node_modules -COPY . . -RUN bun run build - -# Stage 3: Production server -FROM base AS runner -WORKDIR /app -ENV NODE_ENV=production -COPY --from=builder /app/public ./public -COPY --from=builder /app/.next/standalone ./ -COPY --from=builder /app/.next/static ./.next/static - -EXPOSE 3000 -CMD ["bun", "run", "server.js"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 326b80a..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,65 +0,0 @@ -services: - pocketbase: - image: ghcr.io/muchobien/pocketbase:latest - restart: unless-stopped - command: - - --encryptionEnv #optional - - ENCRYPTION #optional - environment: - ENCRYPTION: ${ENCRYPTION_SECRET} - ports: - - "3002:8090" - volumes: - - ./data/pb/data:/pb_data - - ./data/pb/public:/pb_public #optional - - ./data/pb/hooks:/pb_hooks #optional - healthcheck: #optional (recommended) since v0.10.0 - test: wget --no-verbose --tries=1 --spider http://localhost:8090/api/health || exit 1 - interval: 5s - timeout: 5s - retries: 5 - - umami: - image: ghcr.io/umami-software/umami:postgresql-latest - ports: - - "3001:3000" - environment: - DATABASE_URL: postgresql://umami:umami@umami-db:5432/umami - DATABASE_TYPE: postgresql - APP_SECRET: ${APP_SECRET} - depends_on: - umami-db: - condition: service_healthy - restart: unless-stopped - healthcheck: - test: ["CMD-SHELL", "curl http://localhost:3000/api/heartbeat"] - interval: 5s - timeout: 5s - retries: 5 - - app: - build: . - ports: - - '3000:3000' - environment: - - NODE_ENV=production - - NEXT_PUBLIC_UMAMI_URL=${NEXT_PUBLIC_UMAMI_URL} - - NEXT_PUBLIC_UMAMI_TOKEN=${NEXT_PUBLIC_UMAMI_TOKEN} - - NEXT_PUBLIC_POCKETBASE_URL=${NEXT_PUBLIC_POCKETBASE_URL} - restart: unless-stopped - - umami-db: - image: postgres:15-alpine - environment: - POSTGRES_DB: umami - POSTGRES_USER: umami - POSTGRES_PASSWORD: umami - volumes: - - ./data/umami/data:/var/lib/postgresql/data - restart: unless-stopped - healthcheck: - test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"] - interval: 5s - timeout: 5s - retries: 5 - diff --git a/example.env b/example.env index 91c930b..fcdd456 100644 --- a/example.env +++ b/example.env @@ -1,6 +1,4 @@ NEXT_PUBLIC_POCKETBASE_URL=https://pocketbase.proxmoxve-scripts.com NEXT_PUBLIC_ANALYTICS_URL=https://analytics.proxmoxve-scripts.com NEXT_PUBLIC_ANALYTICS_TOKEN=b60d130323-1a11-4244-a1010-81d263c5c49a7 -APP_SECRET=faeziwezrdgsjibjahyusndwwpiwykgfhdjhysaidmtwywivmh -ENCRYPTION_SECRET=idtrkpcthrnirnqxkafbivyditqnxsnymrfpeqqsookzjyuvmz NODE_ENV=production diff --git a/next.config.ts b/next.config.ts index df6c635..e70ea5f 100644 --- a/next.config.ts +++ b/next.config.ts @@ -15,16 +15,7 @@ const nextConfig = { }, output: "export", - basePath: "/proxmox-helper-scripts", - - async rewrites() { - return [ - { - source: "/analytics/:path*", - destination: `https://${process.env.NEXT_PUBLIC_ANALYTICS_URL}/:path*`, - }, - ]; - }, + // basePath: "/proxmox-helper-scripts", }; export default nextConfig; diff --git a/package.json b/package.json index ac0364a..672c947 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,6 @@ "@radix-ui/react-tabs": "^1.1.0", "@radix-ui/react-tooltip": "^1.1.2", "@vercel/analytics": "^1.2.2", - "@vercel/speed-insights": "^1.0.12", "class-variance-authority": "^0.7.0", "clsx": "^2.1.1", "cmdk": "^1.0.0", diff --git a/src/app/api/categories/route.ts b/src/app/api/categories/route.ts index a16e76e..a4a7cdb 100644 --- a/src/app/api/categories/route.ts +++ b/src/app/api/categories/route.ts @@ -2,6 +2,8 @@ import { pb } from "@/lib/pocketbase"; import { Category } from "@/lib/types"; import { NextResponse } from "next/server"; +export const dynamic = "force-static"; + export async function GET() { try { const response = await pb.collection("categories").getFullList({ diff --git a/src/app/api/og/route.tsx b/src/app/api/og/route.tsx deleted file mode 100644 index d6b0366..0000000 --- a/src/app/api/og/route.tsx +++ /dev/null @@ -1,84 +0,0 @@ -import { pb } from "@/lib/pocketbase"; -import { Script } from "@/lib/types"; -import Image from "next/image"; -import { ImageResponse } from "next/og"; -import { NextRequest } from "next/server"; -import { ClientResponseError } from "pocketbase"; - -export async function GET(req: NextRequest) { - const { searchParams } = new URL(req.url); - const title = searchParams.get("title"); - - if (!title) { - return new Response("Missing title parameter", { status: 400 }); - } - - try { - const script: Script = await pb - .collection("proxmox_scripts") - .getFirstListItem(`title="${title}"`, { - fields: "logo,id", - }); - - const imageResponse = new ImageResponse( - ( -
- {title} -

- {title} -

-
- ), - { - width: 1200, - height: 630, - }, - ); - - // Set Cache-Control headers - const response = new Response(imageResponse.body, { - headers: { - "Content-Type": "image/png", - "Cache-Control": "public, max-age=31536000, immutable", // Cache for one year - }, - }); - - return response; - } catch (error) { - console.error("Error fetching script or generating image:", error); - - if (error instanceof ClientResponseError && error.status === 404) { - return new Response("Script not found", { status: 404 }); - } - - return new Response("Error generating image", { status: 500 }); - } -} diff --git a/src/app/layout.tsx b/src/app/layout.tsx index f578445..6e2df9d 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -60,7 +60,7 @@ export default function RootLayout({ @@ -75,7 +75,6 @@ export default function RootLayout({
{children} -