aboutsummaryrefslogtreecommitdiffstats
path: root/middleware
diff options
context:
space:
mode:
authorPinapelz <yukais@pinapelz.com>2025-06-30 23:52:06 -0700
committerPinapelz <yukais@pinapelz.com>2025-06-30 23:52:06 -0700
commit89550dc39da5ccdb7e729c1dc2b68e5075980bd4 (patch)
tree661358270b8bded2c2f9a620d43e3e7278db87ee /middleware
parentfc98ffbe8feb184ba88fb805a4c3b9ad018a6167 (diff)
adjust newsId to map non-ascii characters
vercel limitation
Diffstat (limited to 'middleware')
-rw-r--r--middleware/src/app/[gameName]/page.tsx4
-rw-r--r--middleware/src/app/page.tsx13
2 files changed, 15 insertions, 2 deletions
diff --git a/middleware/src/app/[gameName]/page.tsx b/middleware/src/app/[gameName]/page.tsx
index 4df7efb..8bf9c0b 100644
--- a/middleware/src/app/[gameName]/page.tsx
+++ b/middleware/src/app/[gameName]/page.tsx
@@ -35,8 +35,8 @@ export async function generateMetadata({
news.content.split("").reduce((hash: number, char: string) => {
return (hash << 5) + hash + char.charCodeAt(0);
}, 5381) >>> 0;
-
- const newsId = `${news.identifier}-${news.timestamp}-${contentHash.toString(16)}-${news.headline}`;
+ const headlineHash = (news.headline || 'null').split('').reduce((hash: number, char: string) => ((hash << 5) + hash) + char.charCodeAt(0), 5381) >>> 0;
+ const newsId = `${news.identifier}-${news.timestamp}-${contentHash.toString(16)}-${headlineHash.toString(16)}`;
return newsId === postId;
});
if (!matchingPost) {
diff --git a/middleware/src/app/page.tsx b/middleware/src/app/page.tsx
new file mode 100644
index 0000000..21fd19b
--- /dev/null
+++ b/middleware/src/app/page.tsx
@@ -0,0 +1,13 @@
+"use client";
+import { useEffect } from 'react';
+
+export default function RedirectPage() {
+ useEffect(() => {
+ const mainNewsUrl = process.env.NEXT_PUBLIC_MAIN_NEWS_URL;
+ if (mainNewsUrl) {
+ window.location.href = mainNewsUrl;
+ }
+ }, []);
+
+ return null;
+}
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage