summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build.ts1
-rw-r--r--src/globals.d.ts1
-rw-r--r--src/index.ts4
3 files changed, 4 insertions, 2 deletions
diff --git a/build.ts b/build.ts
index 4937cf3..faa049b 100644
--- a/build.ts
+++ b/build.ts
@@ -32,6 +32,7 @@ for (const f of wies) {
const define = {
WIES: JSON.stringify(wies),
+ WIE_DIR: JSON.stringify("static/teawie"),
};
const options = {
diff --git a/src/globals.d.ts b/src/globals.d.ts
index 9b213f8..5e8373c 100644
--- a/src/globals.d.ts
+++ b/src/globals.d.ts
@@ -1 +1,2 @@
declare const WIES: string[];
+declare const WIE_DIR: string;
diff --git a/src/index.ts b/src/index.ts
index da1fa4a..5846a97 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -24,7 +24,7 @@ app.get("/list_teawies", zValidator("query", list), async (c) => {
return c.json(
WIES.slice(0, parseInt(limit ?? "5")).map((wie) => {
return {
- url: `${c.env.URL ?? "https://api.mydadleft.me"}/static/teawie/${wie}`,
+ url: `${c.env.URL ?? "https://api.mydadleft.me"}/${WIE_DIR}/${wie}`,
};
}),
);
@@ -34,7 +34,7 @@ app.get("/random_teawie", (c) => {
const wie = WIES[Math.floor(Math.random() * WIES.length)];
return c.json({
- url: `${c.env.URL ?? "https://api.mydadleft.me"}/static/${wie}`,
+ url: `${c.env.URL ?? "https://api.mydadleft.me"}/${WIE_DIR}/${wie}`,
});
});