summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorseth <[email protected]>2023-11-12 01:08:15 -0500
committerseth <[email protected]>2023-11-12 01:08:15 -0500
commitd65b6b2feb9c164da55ab7cfe377389be669888d (patch)
tree296246918312c9ce8b9b19eb67cc1e7a9d77d7e4
parentfe72f2701ae4a4338981fd19c39008985100ddb1 (diff)
chore: make teawie static dir a constant
-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}`,
});
});