diff --git a/api-prox/src/config.json b/api-prox/src/config.json new file mode 100644 index 0000000..9904ca9 --- /dev/null +++ b/api-prox/src/config.json @@ -0,0 +1 @@ +{"appVersion": "0.0.1"} \ No newline at end of file diff --git a/api-prox/src/index.ts b/api-prox/src/index.ts index 3191383..d580133 100644 --- a/api-prox/src/index.ts +++ b/api-prox/src/index.ts @@ -1,9 +1,60 @@ -import { Hono } from 'hono' +import { Hono } from "hono"; +import { asciiHTML, separatorHTML } from "./utils/info.js"; +import config from "./config.json" with { type: "json" }; -const app = new Hono() +const app = new Hono(); -app.get('/', (c) => { - return c.text('Hello Hono!') -}) +app.get("/", (c) => { + return c.html(` + + +
+ + + + ${asciiHTML()} + ${separatorHTML()} +To get started, modify your apk to use unknown[endpoint] or deploy the AniX web client
+ ${separatorHTML()} +Status: OK
+Version: ${config.appVersion}
+ + +`); +}); + +app.get("/health/json", (c) => { + return c.json({"status": "OK", "version": config.appVersion}); +}); + +export default app; diff --git a/api-prox/src/utils/info.ts b/api-prox/src/utils/info.ts new file mode 100644 index 0000000..603108a --- /dev/null +++ b/api-prox/src/utils/info.ts @@ -0,0 +1,27 @@ +// ___ _ __ ___ ____ ____ ____ +// / | ____ (_) ______ ______/ /_ / | / __ \/ _/ / __ \_________ _ ____ __ +// / /| | / __ \/ / |/_/ __ `/ ___/ __/ / /| | / /_/ // / / /_/ / ___/ __ \| |/_/ / / / +// / ___ |/ / / / /> /_/ / / / /_ / ___ |/ ____// / / ____/ / / /_/ /> /_/ / +// /_/ |_/_/ /_/_/_/|_|\__,_/_/ \__/ /_/ |_/_/ /___/ /_/ /_/ \____/_/|_|\__, / +// /____/ + +export function asciiHTML() { + const stringBuilder = []; + stringBuilder.push(``); + stringBuilder.push(" ___ _ __ ___ ____ ____ ____ ") + stringBuilder.push(" / | ____ (_) ______ ______/ /_ / | / __ \\/ _/ / __ \\_________ _ ____ __") + stringBuilder.push(" / /| | / __ \\/ / |/_/ __ `/ ___/ __/ / /| | / /_/ // / / /_/ / ___/ __ \\| |/_/ / / /") + stringBuilder.push(" / ___ |/ / / / /> </ /_/ / / / /_ / ___ |/ ____// / / ____/ / / /_/ /> </ /_/ /") + stringBuilder.push("/_/ |_/_/ /_/_/_/|_|\\__,_/_/ \\__/ /_/ |_/_/ /___/ /_/ /_/ \\____/_/|_|\\__, /") + stringBuilder.push(" /____/") + stringBuilder.push(``); + return stringBuilder.join("\n"); +} + +export function separatorHTML() { + const stringBuilder = []; + stringBuilder.push(`
`); + stringBuilder.push("-".repeat(92)) + stringBuilder.push(``); + return stringBuilder.join("\n"); +} \ No newline at end of file diff --git a/api-prox/src/utils/tryCatch.ts b/api-prox/src/utils/tryCatch.ts new file mode 100644 index 0000000..7a81358 --- /dev/null +++ b/api-prox/src/utils/tryCatch.ts @@ -0,0 +1,61 @@ +type Success