feat(frontend): migrated old > new silo adjustments

moved the apps around so we can use 1 url for cors bs
This commit is contained in:
2025-10-25 17:22:51 -05:00
parent d46ef922f3
commit 425f8f5f71
179 changed files with 7511 additions and 2724 deletions

View File

@@ -4,6 +4,7 @@ import { serve } from "@hono/node-server";
import { serveStatic } from "@hono/node-server/serve-static";
import { OpenAPIHono } from "@hono/zod-openapi";
import { cors } from "hono/cors";
import { html } from "hono/html";
import { logger } from "hono/logger";
import os from "os";
import auth from "./services/auth/authService.js";
@@ -152,9 +153,66 @@ app.route("/ocme/", ocme);
// the catch all api route
app.all("/api/*", (c) => c.json({ error: "API route not found" }, 404));
const newPageDoc = `
<!doctype html>
<h1>Hello!</h1>
`;
app.all("*", (c) => {
const testServers = ["test1", "test2", "test3"];
const server = serverIntialized.filter((n: any) => n.name === "plantToken");
let url = "";
if (testServers.includes(server[0].value)) {
const dbServer = serverIntialized.filter((n: any) => n.name === "dbServer");
url = `https://${dbServer[0].value}.alpla.net/lst/app/old${c.req.path}`;
} else {
url = `https://${server[0].value}prod.alpla.net/lst/app/old${c.req.path}`;
}
const target = url;
const waitSeconds = 10;
return c.html(html`<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>Lst Moved</title>
<style>
body{font-family:sans-serif;display:flex;flex-direction:column;
align-items:center;justify-content:center;height:100vh;}
button{margin-top:1rem;padding:0.6rem 1.2rem;font-size:1rem;cursor:pointer;}
</style>
</head>
<body>
<h1>Weve moved!</h1>
<p>With new security and updating to mobile version the app had to be moved. You will be redirected to.</p>
<p><a href="${target}">${target}</a></p>
<p>Redirecting in <span id="countdown">${waitSeconds}</span> seconds…</p>
<button id="goNow">Go now</button>
<script>
let s = ${waitSeconds};
const el = document.getElementById('countdown');
const btn = document.getElementById('goNow');
const timer = setInterval(()=>{
s--;
el.textContent = s;
if(s <= 0){ clearInterval(timer); window.location.href='${target}'; }
},1000);
btn.addEventListener('click',()=>{
clearInterval(timer); window.location.href='${target}';
});
</script>
</body>
</html>`);
});
// app.all("/*", (c) => {
// console.log(c.req.path);
// return c.html(html`${newPageDoc}`);
// });
// front end static files
app.use("/*", serveStatic({ root: "./frontend/dist" }));
app.use("*", serveStatic({ path: "./frontend/dist/index.html" }));
//app.use("/*", serveStatic({ root: "./frontend/dist" }));
//app.use("*", serveStatic({ path: "./frontend/dist/index.html" }));
// Handle app exit signals
process.on("SIGINT", async () => {