From 2080d21e286b1fcf06063d9efe431288393db345 Mon Sep 17 00:00:00 2001
From: dezhishen <26274059+dezhishen@users.noreply.github.com>
Date: Wed, 9 Jul 2025 13:53:39 +0800
Subject: [PATCH 1/4] =?UTF-8?q?fix:=20=E5=A2=9E=E5=8A=A0eo=E4=BE=9D?=
=?UTF-8?q?=E8=B5=96=E7=BC=BA=E5=A4=B1=E7=9A=84=E6=96=87=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
functions/[[default]].ts | 1 +
1 file changed, 1 insertion(+)
create mode 100644 functions/[[default]].ts
diff --git a/functions/[[default]].ts b/functions/[[default]].ts
new file mode 100644
index 0000000..6d3256f
--- /dev/null
+++ b/functions/[[default]].ts
@@ -0,0 +1 @@
+export { onRequest } from './index';
From ccb9534697f2bebe95e776456c9d0d650ec5c4ae Mon Sep 17 00:00:00 2001
From: dezhishen <26274059+dezhishen@users.noreply.github.com>
Date: Wed, 9 Jul 2025 16:20:54 +0800
Subject: [PATCH 2/4] =?UTF-8?q?ci:=20=E4=BF=AE=E6=94=B9edgeone=E9=83=A8?=
=?UTF-8?q?=E7=BD=B2=E7=9B=B8=E5=85=B3=E9=85=8D=E7=BD=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
edgeone.json | 16 ++++++
functions/index.ts | 136 ++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 151 insertions(+), 1 deletion(-)
create mode 100644 edgeone.json
diff --git a/edgeone.json b/edgeone.json
new file mode 100644
index 0000000..70fee32
--- /dev/null
+++ b/edgeone.json
@@ -0,0 +1,16 @@
+{
+ "rewrites": [
+ {
+ "source": "/static/*",
+ "destination": "/public/static/:splat"
+ },
+ {
+ "source": "/index.html",
+ "destination": "/public/index.html"
+ },
+ {
+ "source": "/",
+ "destination": "/public/index.html"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/functions/index.ts b/functions/index.ts
index d6da38f..175b478 100644
--- a/functions/index.ts
+++ b/functions/index.ts
@@ -1,5 +1,139 @@
-import {app} from '../src'
+import { app } from '../src'
+import { Context } from 'hono'
+const notFound = async (c: Context) => {
+ return c.html(
+ `
+
+
+
+
+
+ 404 - Page Not Found
+
+
+
+
+
404
+
Page Not Found
+
The page you are looking for might have been removed, had its name changed, or is temporarily unavailable.
+
← Go back to home
+
+
+
+ `,
+ 404
+ );
+};
+
+// Fallback to static directory
+app.notFound(async (c) => {
+ const url = new URL(c.req.url);
+
+ if (url.pathname === '/') {
+ url.pathname = '/public/index.html';
+ }
+
+ try {
+ const res = await fetch(url.toString(), {
+ headers: c.req.header()
+ });
+
+ if (res.ok) {
+ const contentType = res.headers.get('Content-Type')!;
+ const body = await res.arrayBuffer();
+
+ return new Response(body, {
+ status: res.status,
+ headers: {
+ 'Content-Type': contentType,
+ 'Cache-Control': 'public, max-age=3600',
+ },
+ });
+ }
+ } catch (error) {
+ return notFound(c);
+ }
+ return notFound(c);
+});
+
+app.onError((err, c) => {
+ return c.html(
+ `
+
+
+
+
+
+ 500 - Internal Server Error
+
+
+
+
+
500
+
Internal Server Error
+
Something went wrong on our server. Please try again later.
+
Error: ${err.message}
+
← Go back to home
+
+
+
+ `,
+ 500
+ );
+});
export function onRequest(context: {
request: Request;
params: Record;
From 16af80ea2c2531a5a74e188913e2f3ae024749d1 Mon Sep 17 00:00:00 2001
From: dezhishen <26274059+dezhishen@users.noreply.github.com>
Date: Wed, 9 Jul 2025 16:21:52 +0800
Subject: [PATCH 3/4] =?UTF-8?q?ci:=20=E5=A2=9E=E5=8A=A0eo=E6=9E=84?=
=?UTF-8?q?=E5=BB=BA=E6=8C=87=E4=BB=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
package.json | 1 +
1 file changed, 1 insertion(+)
diff --git a/package.json b/package.json
index 89efe1a..44e9850 100644
--- a/package.json
+++ b/package.json
@@ -3,6 +3,7 @@
"scripts": {
"dev-js": "tsx watch src/basic.ts",
"build-js": "webpack --mode production",
+ "build-eo": "edgeone pages build",
"dev-cf": "wrangler dev",
"deploy-cf": "wrangler deploy --minify",
"dev-eo": "edgeone pages dev",
From 8f82f45af38530203ae366a0ce966a433954e190 Mon Sep 17 00:00:00 2001
From: dezhishen <26274059+dezhishen@users.noreply.github.com>
Date: Wed, 9 Jul 2025 16:36:43 +0800
Subject: [PATCH 4/4] =?UTF-8?q?fix:=20=E9=80=82=E9=85=8Deo=20./public=20?=
=?UTF-8?q?=E8=BE=93=E5=87=BA=E8=B7=AF=E5=BE=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
edgeone.json | 10 +---------
functions/index.ts | 2 +-
2 files changed, 2 insertions(+), 10 deletions(-)
diff --git a/edgeone.json b/edgeone.json
index 70fee32..11830c7 100644
--- a/edgeone.json
+++ b/edgeone.json
@@ -1,16 +1,8 @@
{
"rewrites": [
- {
- "source": "/static/*",
- "destination": "/public/static/:splat"
- },
- {
- "source": "/index.html",
- "destination": "/public/index.html"
- },
{
"source": "/",
- "destination": "/public/index.html"
+ "destination": "/index.html"
}
]
}
\ No newline at end of file
diff --git a/functions/index.ts b/functions/index.ts
index 175b478..299e86d 100644
--- a/functions/index.ts
+++ b/functions/index.ts
@@ -57,7 +57,7 @@ app.notFound(async (c) => {
const url = new URL(c.req.url);
if (url.pathname === '/') {
- url.pathname = '/public/index.html';
+ url.pathname = '/index.html';
}
try {