aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPinapelz <yukais@pinapelz.com>2025-07-01 10:10:23 -0700
committerPinapelz <yukais@pinapelz.com>2025-07-01 10:10:23 -0700
commitfdebd69904e3b225dde1182de2fe9938344abbf2 (patch)
tree9862990fcc68323a5366ef2e058d218ede49a04b
parentfdbf92c95c5355136c38e958f6add37a8d242aa7 (diff)
add not-found page
-rw-r--r--middleware/src/app/[gameName]/page.tsx2
-rw-r--r--middleware/src/app/not-found.tsx22
-rw-r--r--middleware/src/middleware.ts42
3 files changed, 23 insertions, 43 deletions
diff --git a/middleware/src/app/[gameName]/page.tsx b/middleware/src/app/[gameName]/page.tsx
index 76d883b..d4e7b51 100644
--- a/middleware/src/app/[gameName]/page.tsx
+++ b/middleware/src/app/[gameName]/page.tsx
@@ -89,7 +89,7 @@ export default async function GamePage({
}
const redirectUrl =
- postId && mainNewsUrl ? `${mainNewsUrl}/game/${gameName}#${postId}` : null;
+ postId && mainNewsUrl ? `${mainNewsUrl}/game/${gameName}#${postId}` : mainNewsUrl;
return (
<main className="main">
diff --git a/middleware/src/app/not-found.tsx b/middleware/src/app/not-found.tsx
new file mode 100644
index 0000000..cbe480e
--- /dev/null
+++ b/middleware/src/app/not-found.tsx
@@ -0,0 +1,22 @@
+import kairosImage from './kairos.png'
+
+export default function NotFound() {
+ return (
+ <main className="main">
+ <div className="content-wrapper">
+ <h1 className="title">573 UPDATES</h1>
+ <img
+ src={kairosImage.src}
+ alt="Updates image"
+ className="updates-image"
+ />
+ <>
+ <br/>
+ <a href="https://arcade.moekyun.me" className="redirect-link">
+ you seem lost... lets go back home
+ </a>
+ </>
+ </div>
+ </main>
+ );
+}
diff --git a/middleware/src/middleware.ts b/middleware/src/middleware.ts
deleted file mode 100644
index 78aa3f4..0000000
--- a/middleware/src/middleware.ts
+++ /dev/null
@@ -1,42 +0,0 @@
-import { NextRequest, NextResponse } from 'next/server'
-
-export async function middleware(request: NextRequest) {
- const url = request.nextUrl
- const pathname = url.pathname
- if(pathname.startsWith("/_") || pathname.startsWith("/favicon")){
- return;
- }
- const searchParams = url.searchParams
- const gameName = pathname.split('/')[1] || 'news'
- const postId = searchParams.get('post')
- const apiUrlBase = process.env.NEXT_PUBLIC_API_URL
- if (postId) {
- try {
- console.log(`Game: ${gameName}, Post ID: ${postId}`)
- const newsDataUrl = apiUrlBase+"/"+gameName+"_news.json";
- const res = await fetch(newsDataUrl)
- if (res.ok) {
- const data = await res.json()
- const newsPosts = data["news_posts"];
- const matchingPost = newsPosts.find((news: any) => {
- const contentHash = news.content.split('').reduce((hash: number, char: string) => ((hash << 5) + hash) + char.charCodeAt(0), 5381) >>> 0;
- const newsId = `${news.identifier}-${news.timestamp}-${contentHash.toString(16)}-${news.headline}`;
- return newsId === postId;
- });
- const response = NextResponse.next()
- if(matchingPost.headline){
- response.headers.set('x-post-headline', encodeURIComponent(matchingPost.headline));
- }
- if(matchingPost.images && matchingPost.images.length >= 1 ){
- response.headers.set('x-post-heroImage', matchingPost.images[0].image);
- }
- response.headers.set('x-post-content', encodeURIComponent(matchingPost.content));
- response.headers.set('x-post-timestamp', matchingPost.timestamp);
- return response
- }
- } catch (e) {
- console.warn('Failed to fetch post metadata:', e)
- }
- }
- return NextResponse.next()
-}
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage