From 8da2d306c78725df933848255fde66e88cb34878 Mon Sep 17 00:00:00 2001 From: Thomas Camlong Date: Mon, 17 Nov 2025 10:38:10 +0100 Subject: [PATCH 1/5] chore: fix compilation --- web/pnpm-lock.yaml | 82 +++++++++---------- .../app/community/[icon]/opengraph-image.tsx | 1 - web/src/app/icons/[icon]/opengraph-image.tsx | 1 - web/src/lib/errors.ts | 2 + 4 files changed, 43 insertions(+), 43 deletions(-) diff --git a/web/pnpm-lock.yaml b/web/pnpm-lock.yaml index 29dab616..d6a68c03 100644 --- a/web/pnpm-lock.yaml +++ b/web/pnpm-lock.yaml @@ -141,8 +141,8 @@ importers: specifier: ^12.23.24 version: 12.23.24(react-dom@19.2.0(react@19.2.0))(react@19.2.0) next: - specifier: 16.0.3 - version: 16.0.3(react-dom@19.2.0(react@19.2.0))(react@19.2.0) + specifier: 16.0.1 + version: 16.0.1(react-dom@19.2.0(react@19.2.0))(react@19.2.0) next-themes: specifier: ^0.4.6 version: 0.4.6(react-dom@19.2.0(react@19.2.0))(react@19.2.0) @@ -769,53 +769,53 @@ packages: '@jridgewell/trace-mapping@0.3.9': resolution: {integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==} - '@next/env@16.0.3': - resolution: {integrity: sha512-IqgtY5Vwsm14mm/nmQaRMmywCU+yyMIYfk3/MHZ2ZTJvwVbBn3usZnjMi1GacrMVzVcAxJShTCpZlPs26EdEjQ==} + '@next/env@16.0.1': + resolution: {integrity: sha512-LFvlK0TG2L3fEOX77OC35KowL8D7DlFF45C0OvKMC4hy8c/md1RC4UMNDlUGJqfCoCS2VWrZ4dSE6OjaX5+8mw==} - '@next/swc-darwin-arm64@16.0.3': - resolution: {integrity: sha512-MOnbd92+OByu0p6QBAzq1ahVWzF6nyfiH07dQDez4/Nku7G249NjxDVyEfVhz8WkLiOEU+KFVnqtgcsfP2nLXg==} + '@next/swc-darwin-arm64@16.0.1': + resolution: {integrity: sha512-R0YxRp6/4W7yG1nKbfu41bp3d96a0EalonQXiMe+1H9GTHfKxGNCGFNWUho18avRBPsO8T3RmdWuzmfurlQPbg==} engines: {node: '>= 10'} cpu: [arm64] os: [darwin] - '@next/swc-darwin-x64@16.0.3': - resolution: {integrity: sha512-i70C4O1VmbTivYdRlk+5lj9xRc2BlK3oUikt3yJeHT1unL4LsNtN7UiOhVanFdc7vDAgZn1tV/9mQwMkWOJvHg==} + '@next/swc-darwin-x64@16.0.1': + resolution: {integrity: sha512-kETZBocRux3xITiZtOtVoVvXyQLB7VBxN7L6EPqgI5paZiUlnsgYv4q8diTNYeHmF9EiehydOBo20lTttCbHAg==} engines: {node: '>= 10'} cpu: [x64] os: [darwin] - '@next/swc-linux-arm64-gnu@16.0.3': - resolution: {integrity: sha512-O88gCZ95sScwD00mn/AtalyCoykhhlokxH/wi1huFK+rmiP5LAYVs/i2ruk7xST6SuXN4NI5y4Xf5vepb2jf6A==} + '@next/swc-linux-arm64-gnu@16.0.1': + resolution: {integrity: sha512-hWg3BtsxQuSKhfe0LunJoqxjO4NEpBmKkE+P2Sroos7yB//OOX3jD5ISP2wv8QdUwtRehMdwYz6VB50mY6hqAg==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] - '@next/swc-linux-arm64-musl@16.0.3': - resolution: {integrity: sha512-CEErFt78S/zYXzFIiv18iQCbRbLgBluS8z1TNDQoyPi8/Jr5qhR3e8XHAIxVxPBjDbEMITprqELVc5KTfFj0gg==} + '@next/swc-linux-arm64-musl@16.0.1': + resolution: {integrity: sha512-UPnOvYg+fjAhP3b1iQStcYPWeBFRLrugEyK/lDKGk7kLNua8t5/DvDbAEFotfV1YfcOY6bru76qN9qnjLoyHCQ==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] - '@next/swc-linux-x64-gnu@16.0.3': - resolution: {integrity: sha512-Tc3i+nwt6mQ+Dwzcri/WNDj56iWdycGVh5YwwklleClzPzz7UpfaMw1ci7bLl6GRYMXhWDBfe707EXNjKtiswQ==} + '@next/swc-linux-x64-gnu@16.0.1': + resolution: {integrity: sha512-Et81SdWkcRqAJziIgFtsFyJizHoWne4fzJkvjd6V4wEkWTB4MX6J0uByUb0peiJQ4WeAt6GGmMszE5KrXK6WKg==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - '@next/swc-linux-x64-musl@16.0.3': - resolution: {integrity: sha512-zTh03Z/5PBBPdTurgEtr6nY0vI9KR9Ifp/jZCcHlODzwVOEKcKRBtQIGrkc7izFgOMuXDEJBmirwpGqdM/ZixA==} + '@next/swc-linux-x64-musl@16.0.1': + resolution: {integrity: sha512-qBbgYEBRrC1egcG03FZaVfVxrJm8wBl7vr8UFKplnxNRprctdP26xEv9nJ07Ggq4y1adwa0nz2mz83CELY7N6Q==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - '@next/swc-win32-arm64-msvc@16.0.3': - resolution: {integrity: sha512-Jc1EHxtZovcJcg5zU43X3tuqzl/sS+CmLgjRP28ZT4vk869Ncm2NoF8qSTaL99gh6uOzgM99Shct06pSO6kA6g==} + '@next/swc-win32-arm64-msvc@16.0.1': + resolution: {integrity: sha512-cPuBjYP6I699/RdbHJonb3BiRNEDm5CKEBuJ6SD8k3oLam2fDRMKAvmrli4QMDgT2ixyRJ0+DTkiODbIQhRkeQ==} engines: {node: '>= 10'} cpu: [arm64] os: [win32] - '@next/swc-win32-x64-msvc@16.0.3': - resolution: {integrity: sha512-N7EJ6zbxgIYpI/sWNzpVKRMbfEGgsWuOIvzkML7wxAAZhPk1Msxuo/JDu1PKjWGrAoOLaZcIX5s+/pF5LIbBBg==} + '@next/swc-win32-x64-msvc@16.0.1': + resolution: {integrity: sha512-XeEUJsE4JYtfrXe/LaJn3z1pD19fK0Q6Er8Qoufi+HqvdO4LEPyCxLUt4rxA+4RfYo6S9gMlmzCMU2F+AatFqQ==} engines: {node: '>= 10'} cpu: [x64] os: [win32] @@ -2126,8 +2126,8 @@ packages: react: ^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc react-dom: ^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc - next@16.0.3: - resolution: {integrity: sha512-Ka0/iNBblPFcIubTA1Jjh6gvwqfjrGq1Y2MTI5lbjeLIAfmC+p5bQmojpRZqgHHVu5cG4+qdIiwXiBSm/8lZ3w==} + next@16.0.1: + resolution: {integrity: sha512-e9RLSssZwd35p7/vOa+hoDFggUZIUbZhIUSLZuETCwrCVvxOs87NamoUzT+vbcNAL8Ld9GobBnWOA6SbV/arOw==} engines: {node: '>=20.9.0'} hasBin: true peerDependencies: @@ -2847,30 +2847,30 @@ snapshots: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.5.5 - '@next/env@16.0.3': {} + '@next/env@16.0.1': {} - '@next/swc-darwin-arm64@16.0.3': + '@next/swc-darwin-arm64@16.0.1': optional: true - '@next/swc-darwin-x64@16.0.3': + '@next/swc-darwin-x64@16.0.1': optional: true - '@next/swc-linux-arm64-gnu@16.0.3': + '@next/swc-linux-arm64-gnu@16.0.1': optional: true - '@next/swc-linux-arm64-musl@16.0.3': + '@next/swc-linux-arm64-musl@16.0.1': optional: true - '@next/swc-linux-x64-gnu@16.0.3': + '@next/swc-linux-x64-gnu@16.0.1': optional: true - '@next/swc-linux-x64-musl@16.0.3': + '@next/swc-linux-x64-musl@16.0.1': optional: true - '@next/swc-win32-arm64-msvc@16.0.3': + '@next/swc-win32-arm64-msvc@16.0.1': optional: true - '@next/swc-win32-x64-msvc@16.0.3': + '@next/swc-win32-x64-msvc@16.0.1': optional: true '@poppinss/colors@4.1.5': @@ -4158,9 +4158,9 @@ snapshots: react: 19.2.0 react-dom: 19.2.0(react@19.2.0) - next@16.0.3(react-dom@19.2.0(react@19.2.0))(react@19.2.0): + next@16.0.1(react-dom@19.2.0(react@19.2.0))(react@19.2.0): dependencies: - '@next/env': 16.0.3 + '@next/env': 16.0.1 '@swc/helpers': 0.5.15 caniuse-lite: 1.0.30001726 postcss: 8.4.31 @@ -4168,14 +4168,14 @@ snapshots: react-dom: 19.2.0(react@19.2.0) styled-jsx: 5.1.6(react@19.2.0) optionalDependencies: - '@next/swc-darwin-arm64': 16.0.3 - '@next/swc-darwin-x64': 16.0.3 - '@next/swc-linux-arm64-gnu': 16.0.3 - '@next/swc-linux-arm64-musl': 16.0.3 - '@next/swc-linux-x64-gnu': 16.0.3 - '@next/swc-linux-x64-musl': 16.0.3 - '@next/swc-win32-arm64-msvc': 16.0.3 - '@next/swc-win32-x64-msvc': 16.0.3 + '@next/swc-darwin-arm64': 16.0.1 + '@next/swc-darwin-x64': 16.0.1 + '@next/swc-linux-arm64-gnu': 16.0.1 + '@next/swc-linux-arm64-musl': 16.0.1 + '@next/swc-linux-x64-gnu': 16.0.1 + '@next/swc-linux-x64-musl': 16.0.1 + '@next/swc-win32-arm64-msvc': 16.0.1 + '@next/swc-win32-x64-msvc': 16.0.1 sharp: 0.34.5 transitivePeerDependencies: - '@babel/core' diff --git a/web/src/app/community/[icon]/opengraph-image.tsx b/web/src/app/community/[icon]/opengraph-image.tsx index f96bb646..61da7c4c 100644 --- a/web/src/app/community/[icon]/opengraph-image.tsx +++ b/web/src/app/community/[icon]/opengraph-image.tsx @@ -3,7 +3,6 @@ import { ImageResponse } from "next/og" import { getCommunityGalleryRecord, getCommunitySubmissionByName, getCommunitySubmissions } from "@/lib/community" export const revalidate = 21600 // 6 hours -export const runtime = 'edge'; export async function generateStaticParams() { const icons = await getCommunitySubmissions() diff --git a/web/src/app/icons/[icon]/opengraph-image.tsx b/web/src/app/icons/[icon]/opengraph-image.tsx index f30dec11..e490b39d 100644 --- a/web/src/app/icons/[icon]/opengraph-image.tsx +++ b/web/src/app/icons/[icon]/opengraph-image.tsx @@ -3,7 +3,6 @@ import { join } from "node:path" import { ImageResponse } from "next/og" import { getAllIcons } from "@/lib/api" -export const runtime = 'edge'; export const revalidate = false export async function generateStaticParams() { diff --git a/web/src/lib/errors.ts b/web/src/lib/errors.ts index 28600798..7c7b203a 100644 --- a/web/src/lib/errors.ts +++ b/web/src/lib/errors.ts @@ -11,3 +11,5 @@ export class ApiError extends Error { } } + + From 88ad48b80e317cd2d9752d22f19506c61482dc60 Mon Sep 17 00:00:00 2001 From: Thomas Camlong Date: Mon, 17 Nov 2025 10:46:41 +0100 Subject: [PATCH 2/5] chore: update Next.js and related packages to version 16.0.3 --- web/pnpm-lock.yaml | 82 +++++++++++++++++++++++----------------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/web/pnpm-lock.yaml b/web/pnpm-lock.yaml index d6a68c03..29dab616 100644 --- a/web/pnpm-lock.yaml +++ b/web/pnpm-lock.yaml @@ -141,8 +141,8 @@ importers: specifier: ^12.23.24 version: 12.23.24(react-dom@19.2.0(react@19.2.0))(react@19.2.0) next: - specifier: 16.0.1 - version: 16.0.1(react-dom@19.2.0(react@19.2.0))(react@19.2.0) + specifier: 16.0.3 + version: 16.0.3(react-dom@19.2.0(react@19.2.0))(react@19.2.0) next-themes: specifier: ^0.4.6 version: 0.4.6(react-dom@19.2.0(react@19.2.0))(react@19.2.0) @@ -769,53 +769,53 @@ packages: '@jridgewell/trace-mapping@0.3.9': resolution: {integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==} - '@next/env@16.0.1': - resolution: {integrity: sha512-LFvlK0TG2L3fEOX77OC35KowL8D7DlFF45C0OvKMC4hy8c/md1RC4UMNDlUGJqfCoCS2VWrZ4dSE6OjaX5+8mw==} + '@next/env@16.0.3': + resolution: {integrity: sha512-IqgtY5Vwsm14mm/nmQaRMmywCU+yyMIYfk3/MHZ2ZTJvwVbBn3usZnjMi1GacrMVzVcAxJShTCpZlPs26EdEjQ==} - '@next/swc-darwin-arm64@16.0.1': - resolution: {integrity: sha512-R0YxRp6/4W7yG1nKbfu41bp3d96a0EalonQXiMe+1H9GTHfKxGNCGFNWUho18avRBPsO8T3RmdWuzmfurlQPbg==} + '@next/swc-darwin-arm64@16.0.3': + resolution: {integrity: sha512-MOnbd92+OByu0p6QBAzq1ahVWzF6nyfiH07dQDez4/Nku7G249NjxDVyEfVhz8WkLiOEU+KFVnqtgcsfP2nLXg==} engines: {node: '>= 10'} cpu: [arm64] os: [darwin] - '@next/swc-darwin-x64@16.0.1': - resolution: {integrity: sha512-kETZBocRux3xITiZtOtVoVvXyQLB7VBxN7L6EPqgI5paZiUlnsgYv4q8diTNYeHmF9EiehydOBo20lTttCbHAg==} + '@next/swc-darwin-x64@16.0.3': + resolution: {integrity: sha512-i70C4O1VmbTivYdRlk+5lj9xRc2BlK3oUikt3yJeHT1unL4LsNtN7UiOhVanFdc7vDAgZn1tV/9mQwMkWOJvHg==} engines: {node: '>= 10'} cpu: [x64] os: [darwin] - '@next/swc-linux-arm64-gnu@16.0.1': - resolution: {integrity: sha512-hWg3BtsxQuSKhfe0LunJoqxjO4NEpBmKkE+P2Sroos7yB//OOX3jD5ISP2wv8QdUwtRehMdwYz6VB50mY6hqAg==} + '@next/swc-linux-arm64-gnu@16.0.3': + resolution: {integrity: sha512-O88gCZ95sScwD00mn/AtalyCoykhhlokxH/wi1huFK+rmiP5LAYVs/i2ruk7xST6SuXN4NI5y4Xf5vepb2jf6A==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] - '@next/swc-linux-arm64-musl@16.0.1': - resolution: {integrity: sha512-UPnOvYg+fjAhP3b1iQStcYPWeBFRLrugEyK/lDKGk7kLNua8t5/DvDbAEFotfV1YfcOY6bru76qN9qnjLoyHCQ==} + '@next/swc-linux-arm64-musl@16.0.3': + resolution: {integrity: sha512-CEErFt78S/zYXzFIiv18iQCbRbLgBluS8z1TNDQoyPi8/Jr5qhR3e8XHAIxVxPBjDbEMITprqELVc5KTfFj0gg==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] - '@next/swc-linux-x64-gnu@16.0.1': - resolution: {integrity: sha512-Et81SdWkcRqAJziIgFtsFyJizHoWne4fzJkvjd6V4wEkWTB4MX6J0uByUb0peiJQ4WeAt6GGmMszE5KrXK6WKg==} + '@next/swc-linux-x64-gnu@16.0.3': + resolution: {integrity: sha512-Tc3i+nwt6mQ+Dwzcri/WNDj56iWdycGVh5YwwklleClzPzz7UpfaMw1ci7bLl6GRYMXhWDBfe707EXNjKtiswQ==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - '@next/swc-linux-x64-musl@16.0.1': - resolution: {integrity: sha512-qBbgYEBRrC1egcG03FZaVfVxrJm8wBl7vr8UFKplnxNRprctdP26xEv9nJ07Ggq4y1adwa0nz2mz83CELY7N6Q==} + '@next/swc-linux-x64-musl@16.0.3': + resolution: {integrity: sha512-zTh03Z/5PBBPdTurgEtr6nY0vI9KR9Ifp/jZCcHlODzwVOEKcKRBtQIGrkc7izFgOMuXDEJBmirwpGqdM/ZixA==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - '@next/swc-win32-arm64-msvc@16.0.1': - resolution: {integrity: sha512-cPuBjYP6I699/RdbHJonb3BiRNEDm5CKEBuJ6SD8k3oLam2fDRMKAvmrli4QMDgT2ixyRJ0+DTkiODbIQhRkeQ==} + '@next/swc-win32-arm64-msvc@16.0.3': + resolution: {integrity: sha512-Jc1EHxtZovcJcg5zU43X3tuqzl/sS+CmLgjRP28ZT4vk869Ncm2NoF8qSTaL99gh6uOzgM99Shct06pSO6kA6g==} engines: {node: '>= 10'} cpu: [arm64] os: [win32] - '@next/swc-win32-x64-msvc@16.0.1': - resolution: {integrity: sha512-XeEUJsE4JYtfrXe/LaJn3z1pD19fK0Q6Er8Qoufi+HqvdO4LEPyCxLUt4rxA+4RfYo6S9gMlmzCMU2F+AatFqQ==} + '@next/swc-win32-x64-msvc@16.0.3': + resolution: {integrity: sha512-N7EJ6zbxgIYpI/sWNzpVKRMbfEGgsWuOIvzkML7wxAAZhPk1Msxuo/JDu1PKjWGrAoOLaZcIX5s+/pF5LIbBBg==} engines: {node: '>= 10'} cpu: [x64] os: [win32] @@ -2126,8 +2126,8 @@ packages: react: ^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc react-dom: ^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc - next@16.0.1: - resolution: {integrity: sha512-e9RLSssZwd35p7/vOa+hoDFggUZIUbZhIUSLZuETCwrCVvxOs87NamoUzT+vbcNAL8Ld9GobBnWOA6SbV/arOw==} + next@16.0.3: + resolution: {integrity: sha512-Ka0/iNBblPFcIubTA1Jjh6gvwqfjrGq1Y2MTI5lbjeLIAfmC+p5bQmojpRZqgHHVu5cG4+qdIiwXiBSm/8lZ3w==} engines: {node: '>=20.9.0'} hasBin: true peerDependencies: @@ -2847,30 +2847,30 @@ snapshots: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.5.5 - '@next/env@16.0.1': {} + '@next/env@16.0.3': {} - '@next/swc-darwin-arm64@16.0.1': + '@next/swc-darwin-arm64@16.0.3': optional: true - '@next/swc-darwin-x64@16.0.1': + '@next/swc-darwin-x64@16.0.3': optional: true - '@next/swc-linux-arm64-gnu@16.0.1': + '@next/swc-linux-arm64-gnu@16.0.3': optional: true - '@next/swc-linux-arm64-musl@16.0.1': + '@next/swc-linux-arm64-musl@16.0.3': optional: true - '@next/swc-linux-x64-gnu@16.0.1': + '@next/swc-linux-x64-gnu@16.0.3': optional: true - '@next/swc-linux-x64-musl@16.0.1': + '@next/swc-linux-x64-musl@16.0.3': optional: true - '@next/swc-win32-arm64-msvc@16.0.1': + '@next/swc-win32-arm64-msvc@16.0.3': optional: true - '@next/swc-win32-x64-msvc@16.0.1': + '@next/swc-win32-x64-msvc@16.0.3': optional: true '@poppinss/colors@4.1.5': @@ -4158,9 +4158,9 @@ snapshots: react: 19.2.0 react-dom: 19.2.0(react@19.2.0) - next@16.0.1(react-dom@19.2.0(react@19.2.0))(react@19.2.0): + next@16.0.3(react-dom@19.2.0(react@19.2.0))(react@19.2.0): dependencies: - '@next/env': 16.0.1 + '@next/env': 16.0.3 '@swc/helpers': 0.5.15 caniuse-lite: 1.0.30001726 postcss: 8.4.31 @@ -4168,14 +4168,14 @@ snapshots: react-dom: 19.2.0(react@19.2.0) styled-jsx: 5.1.6(react@19.2.0) optionalDependencies: - '@next/swc-darwin-arm64': 16.0.1 - '@next/swc-darwin-x64': 16.0.1 - '@next/swc-linux-arm64-gnu': 16.0.1 - '@next/swc-linux-arm64-musl': 16.0.1 - '@next/swc-linux-x64-gnu': 16.0.1 - '@next/swc-linux-x64-musl': 16.0.1 - '@next/swc-win32-arm64-msvc': 16.0.1 - '@next/swc-win32-x64-msvc': 16.0.1 + '@next/swc-darwin-arm64': 16.0.3 + '@next/swc-darwin-x64': 16.0.3 + '@next/swc-linux-arm64-gnu': 16.0.3 + '@next/swc-linux-arm64-musl': 16.0.3 + '@next/swc-linux-x64-gnu': 16.0.3 + '@next/swc-linux-x64-musl': 16.0.3 + '@next/swc-win32-arm64-msvc': 16.0.3 + '@next/swc-win32-x64-msvc': 16.0.3 sharp: 0.34.5 transitivePeerDependencies: - '@babel/core' From 59b8391d035eea34bf2614b741bf7a3d32a912c5 Mon Sep 17 00:00:00 2001 From: Thomas Camlong Date: Mon, 17 Nov 2025 10:56:38 +0100 Subject: [PATCH 3/5] chore: trigger deployment with new env files From 81d01f8bba38984e744888995471e737d96e8627 Mon Sep 17 00:00:00 2001 From: Thomas Camlong Date: Mon, 17 Nov 2025 11:10:16 +0100 Subject: [PATCH 4/5] chore: try fixing compilation on cf --- .../app/community/[icon]/opengraph-image.tsx | 14 +--- web/src/app/icons/[icon]/opengraph-image.tsx | 82 +++++++++---------- web/src/lib/api.ts | 13 ++- 3 files changed, 49 insertions(+), 60 deletions(-) diff --git a/web/src/app/community/[icon]/opengraph-image.tsx b/web/src/app/community/[icon]/opengraph-image.tsx index 61da7c4c..3b922545 100644 --- a/web/src/app/community/[icon]/opengraph-image.tsx +++ b/web/src/app/community/[icon]/opengraph-image.tsx @@ -2,21 +2,9 @@ import { permanentRedirect, redirect } from "next/navigation" import { ImageResponse } from "next/og" import { getCommunityGalleryRecord, getCommunitySubmissionByName, getCommunitySubmissions } from "@/lib/community" +export const runtime = "edge"; export const revalidate = 21600 // 6 hours -export async function generateStaticParams() { - const icons = await getCommunitySubmissions() - const validIcons = icons.filter((icon) => icon.name) - if (process.env.CI_MODE === "false") { - return validIcons.slice(0, 5).map((icon) => ({ - icon: icon.name, - })) - } - return validIcons.map((icon) => ({ - icon: icon.name, - })) -} - export const size = { width: 1200, height: 630, diff --git a/web/src/app/icons/[icon]/opengraph-image.tsx b/web/src/app/icons/[icon]/opengraph-image.tsx index e490b39d..742e6f46 100644 --- a/web/src/app/icons/[icon]/opengraph-image.tsx +++ b/web/src/app/icons/[icon]/opengraph-image.tsx @@ -1,34 +1,23 @@ -import { readFile } from "node:fs/promises" -import { join } from "node:path" -import { ImageResponse } from "next/og" -import { getAllIcons } from "@/lib/api" +import { ImageResponse } from "next/og"; +import { BASE_URL } from "@/constants"; +import { getAllIcons } from "@/lib/api"; -export const revalidate = false - -export async function generateStaticParams() { - const iconsData = await getAllIcons() - if (process.env.CI_MODE === "false") { - // This is meant to speed up the build process in local development - return Object.keys(iconsData) - .slice(0, 5) - .map((icon) => ({ - icon, - })) - } - return Object.keys(iconsData).map((icon) => ({ - icon, - })) -} +export const runtime = "edge"; +export const revalidate = false; export const size = { width: 1200, height: 630, -} -export default async function Image({ params }: { params: Promise<{ icon: string }> }) { - const { icon } = await params +}; +export default async function Image({ + params, +}: { + params: Promise<{ icon: string }>; +}) { + const { icon } = await params; if (!icon) { - console.error(`[Opengraph Image] Icon not found for ${icon}`) + console.error(`[Opengraph Image] Icon not found for ${icon}`); return new ImageResponse(
, { ...size }, - ) + ); } - const iconsData = await getAllIcons() - const totalIcons = Object.keys(iconsData).length - const index = Object.keys(iconsData).indexOf(icon) + const iconsData = await getAllIcons(); + const totalIcons = Object.keys(iconsData).length; + const index = Object.keys(iconsData).indexOf(icon); // Format the icon name for display const formattedIconName = icon .split("-") .map((word) => word.charAt(0).toUpperCase() + word.slice(1)) - .join(" ") + .join(" "); - // Read the icon file from local filesystem - let iconData: Buffer | null = null + // Fetch the icon from CDN (Edge Runtime compatible) + let iconUrl: string | null = null; try { - const iconPath = join(process.cwd(), `../png/${icon}.png`) - console.log(`Generating opengraph image for ${icon} (${index + 1} / ${totalIcons}) from path ${iconPath}`) - iconData = await readFile(iconPath) + const iconCdnUrl = `${BASE_URL}/png/${icon}.png`; + const response = await fetch(iconCdnUrl); + if (response.ok) { + const arrayBuffer = await response.arrayBuffer(); + const base64 = Buffer.from(arrayBuffer).toString("base64"); + iconUrl = `data:image/png;base64,${base64}`; + } } catch (_error) { - console.error(`Icon ${icon} was not found locally`) + console.error(`Icon ${icon} was not found on CDN`); } - // Convert the image data to a data URL or use placeholder - const iconUrl = iconData ? `data:image/png;base64,${iconData.toString("base64")}` : null - return new ImageResponse(
{formattedIconName} = {}; + /** * Cached version of fetchAuthorData * Uses unstable_cache with tags for on-demand revalidation @@ -132,10 +134,13 @@ async function fetchAuthorData(authorId: number) { * across multiple page builds and requests. */ export async function getAuthorData(authorId: number): Promise { - return unstable_cache(async () => await fetchAuthorData(authorId), [`author-${authorId}`], { - revalidate: 86400, - tags: ["authors", `author-${authorId}`], - })() + if (authorDataCache[authorId]) { + return authorDataCache[authorId]; + } + + const data = await fetchAuthorData(authorId); + authorDataCache[authorId] = data; + return data; } /** From a0423ca132fe724511d98d7d65b6570e3e45a298 Mon Sep 17 00:00:00 2001 From: Thomas Camlong Date: Mon, 17 Nov 2025 11:32:20 +0100 Subject: [PATCH 5/5] revert changes to og-image --- .../app/community/[icon]/opengraph-image.tsx | 14 +++- web/src/app/icons/[icon]/opengraph-image.tsx | 82 ++++++++++--------- 2 files changed, 56 insertions(+), 40 deletions(-) diff --git a/web/src/app/community/[icon]/opengraph-image.tsx b/web/src/app/community/[icon]/opengraph-image.tsx index 3b922545..61da7c4c 100644 --- a/web/src/app/community/[icon]/opengraph-image.tsx +++ b/web/src/app/community/[icon]/opengraph-image.tsx @@ -2,9 +2,21 @@ import { permanentRedirect, redirect } from "next/navigation" import { ImageResponse } from "next/og" import { getCommunityGalleryRecord, getCommunitySubmissionByName, getCommunitySubmissions } from "@/lib/community" -export const runtime = "edge"; export const revalidate = 21600 // 6 hours +export async function generateStaticParams() { + const icons = await getCommunitySubmissions() + const validIcons = icons.filter((icon) => icon.name) + if (process.env.CI_MODE === "false") { + return validIcons.slice(0, 5).map((icon) => ({ + icon: icon.name, + })) + } + return validIcons.map((icon) => ({ + icon: icon.name, + })) +} + export const size = { width: 1200, height: 630, diff --git a/web/src/app/icons/[icon]/opengraph-image.tsx b/web/src/app/icons/[icon]/opengraph-image.tsx index 742e6f46..e490b39d 100644 --- a/web/src/app/icons/[icon]/opengraph-image.tsx +++ b/web/src/app/icons/[icon]/opengraph-image.tsx @@ -1,23 +1,34 @@ -import { ImageResponse } from "next/og"; -import { BASE_URL } from "@/constants"; -import { getAllIcons } from "@/lib/api"; +import { readFile } from "node:fs/promises" +import { join } from "node:path" +import { ImageResponse } from "next/og" +import { getAllIcons } from "@/lib/api" -export const runtime = "edge"; -export const revalidate = false; +export const revalidate = false + +export async function generateStaticParams() { + const iconsData = await getAllIcons() + if (process.env.CI_MODE === "false") { + // This is meant to speed up the build process in local development + return Object.keys(iconsData) + .slice(0, 5) + .map((icon) => ({ + icon, + })) + } + return Object.keys(iconsData).map((icon) => ({ + icon, + })) +} export const size = { width: 1200, height: 630, -}; -export default async function Image({ - params, -}: { - params: Promise<{ icon: string }>; -}) { - const { icon } = await params; +} +export default async function Image({ params }: { params: Promise<{ icon: string }> }) { + const { icon } = await params if (!icon) { - console.error(`[Opengraph Image] Icon not found for ${icon}`); + console.error(`[Opengraph Image] Icon not found for ${icon}`) return new ImageResponse(
, { ...size }, - ); + ) } - const iconsData = await getAllIcons(); - const totalIcons = Object.keys(iconsData).length; - const index = Object.keys(iconsData).indexOf(icon); + const iconsData = await getAllIcons() + const totalIcons = Object.keys(iconsData).length + const index = Object.keys(iconsData).indexOf(icon) // Format the icon name for display const formattedIconName = icon .split("-") .map((word) => word.charAt(0).toUpperCase() + word.slice(1)) - .join(" "); + .join(" ") - // Fetch the icon from CDN (Edge Runtime compatible) - let iconUrl: string | null = null; + // Read the icon file from local filesystem + let iconData: Buffer | null = null try { - const iconCdnUrl = `${BASE_URL}/png/${icon}.png`; - const response = await fetch(iconCdnUrl); - if (response.ok) { - const arrayBuffer = await response.arrayBuffer(); - const base64 = Buffer.from(arrayBuffer).toString("base64"); - iconUrl = `data:image/png;base64,${base64}`; - } + const iconPath = join(process.cwd(), `../png/${icon}.png`) + console.log(`Generating opengraph image for ${icon} (${index + 1} / ${totalIcons}) from path ${iconPath}`) + iconData = await readFile(iconPath) } catch (_error) { - console.error(`Icon ${icon} was not found on CDN`); + console.error(`Icon ${icon} was not found locally`) } + // Convert the image data to a data URL or use placeholder + const iconUrl = iconData ? `data:image/png;base64,${iconData.toString("base64")}` : null + return new ImageResponse(