Compare commits
6 Commits
76bc0db3dd
...
4db4eea2d1
| Author | SHA1 | Date | |
|---|---|---|---|
| 4db4eea2d1 | |||
| edcfff6cc6 | |||
| 61860c759e | |||
| 08c9b3404f | |||
| 93ed2e9ee8 | |||
| fb9ee15bda |
775
frontend/package-lock.json
generated
775
frontend/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -12,7 +12,7 @@
|
|||||||
"checkupdates": "npm-check-updates"
|
"checkupdates": "npm-check-updates"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@hookform/resolvers": "^4.1.2",
|
"@hookform/resolvers": "^4.1.3",
|
||||||
"@radix-ui/react-avatar": "^1.1.3",
|
"@radix-ui/react-avatar": "^1.1.3",
|
||||||
"@radix-ui/react-checkbox": "^1.1.4",
|
"@radix-ui/react-checkbox": "^1.1.4",
|
||||||
"@radix-ui/react-collapsible": "^1.1.3",
|
"@radix-ui/react-collapsible": "^1.1.3",
|
||||||
@@ -25,46 +25,46 @@
|
|||||||
"@radix-ui/react-slot": "^1.1.2",
|
"@radix-ui/react-slot": "^1.1.2",
|
||||||
"@radix-ui/react-tabs": "^1.1.3",
|
"@radix-ui/react-tabs": "^1.1.3",
|
||||||
"@radix-ui/react-tooltip": "^1.1.8",
|
"@radix-ui/react-tooltip": "^1.1.8",
|
||||||
"@tailwindcss/vite": "^4.0.9",
|
"@tailwindcss/vite": "^4.0.15",
|
||||||
"@tanstack/react-query": "^5.66.9",
|
"@tanstack/react-query": "^5.69.0",
|
||||||
"@tanstack/react-router": "^1.111.11",
|
"@tanstack/react-router": "^1.114.27",
|
||||||
"@tanstack/react-table": "^8.21.2",
|
"@tanstack/react-table": "^8.21.2",
|
||||||
"class-variance-authority": "^0.7.1",
|
"class-variance-authority": "^0.7.1",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
"date-fns": "^4.1.0",
|
"date-fns": "^4.1.0",
|
||||||
"dotenv": "^16.4.7",
|
"dotenv": "^16.4.7",
|
||||||
"hono": "^4.7.2",
|
"hono": "^4.7.5",
|
||||||
"js-cookie": "^3.0.5",
|
"js-cookie": "^3.0.5",
|
||||||
"jsonwebtoken": "^9.0.2",
|
"jsonwebtoken": "^9.0.2",
|
||||||
"lucide-react": "^0.476.0",
|
"lucide-react": "^0.483.0",
|
||||||
"next-themes": "^0.4.4",
|
"next-themes": "^0.4.6",
|
||||||
"npm-check-updates": "^17.1.15",
|
"npm-check-updates": "^17.1.16",
|
||||||
"react": "^19.0.0",
|
"react": "^19.0.0",
|
||||||
"react-day-picker": "^8.10.1",
|
"react-day-picker": "^8.10.1",
|
||||||
"react-dom": "^19.0.0",
|
"react-dom": "^19.0.0",
|
||||||
"react-grid-layout": "^1.5.0",
|
"react-grid-layout": "^1.5.1",
|
||||||
"react-hook-form": "^7.54.2",
|
"react-hook-form": "^7.54.2",
|
||||||
"sonner": "^2.0.1",
|
"sonner": "^2.0.1",
|
||||||
"tailwind-merge": "^3.0.2",
|
"tailwind-merge": "^3.0.2",
|
||||||
"tailwindcss": "^4.0.9",
|
"tailwindcss": "^4.0.15",
|
||||||
"tailwindcss-animate": "^1.0.7",
|
"tailwindcss-animate": "^1.0.7",
|
||||||
"zod": "^3.24.2",
|
"zod": "^3.24.2",
|
||||||
"zustand": "^5.0.3"
|
"zustand": "^5.0.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/js": "^9.21.0",
|
"@eslint/js": "^9.23.0",
|
||||||
"@tanstack/router-devtools": "^1.106.0",
|
"@tanstack/router-devtools": "^1.114.27",
|
||||||
"@tanstack/router-plugin": "^1.106.0",
|
"@tanstack/router-plugin": "^1.114.27",
|
||||||
"@types/react": "^19.0.10",
|
"@types/react": "^19.0.12",
|
||||||
"@types/react-dom": "^19.0.4",
|
"@types/react-dom": "^19.0.4",
|
||||||
"@types/react-grid-layout": "^1.3.5",
|
"@types/react-grid-layout": "^1.3.5",
|
||||||
"@vitejs/plugin-react-swc": "^3.8.0",
|
"@vitejs/plugin-react-swc": "^3.8.1",
|
||||||
"eslint": "^9.21.0",
|
"eslint": "^9.23.0",
|
||||||
"eslint-plugin-react-hooks": "^5.0.0",
|
"eslint-plugin-react-hooks": "^5.2.0",
|
||||||
"eslint-plugin-react-refresh": "^0.4.19",
|
"eslint-plugin-react-refresh": "^0.4.19",
|
||||||
"globals": "^15.15.0",
|
"globals": "^16.0.0",
|
||||||
"typescript": "~5.7.2",
|
"typescript": "~5.8.2",
|
||||||
"typescript-eslint": "^8.24.1",
|
"typescript-eslint": "^8.27.0",
|
||||||
"vite": "^6.2.0"
|
"vite": "^6.2.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,22 @@
|
|||||||
//import {useEffect, useState} from "react";
|
// //import {useEffect, useState} from "react";
|
||||||
import {LstCard} from "../extendedUI/LstCard";
|
// import {LstCard} from "../extendedUI/LstCard";
|
||||||
import {CardContent, CardHeader} from "../ui/card";
|
// import {CardContent, CardHeader} from "../ui/card";
|
||||||
import {Skeleton} from "../ui/skeleton";
|
// import {Skeleton} from "../ui/skeleton";
|
||||||
import {Button} from "../ui/button";
|
// import {Button} from "../ui/button";
|
||||||
import {toast} from "sonner";
|
// import {toast} from "sonner";
|
||||||
|
// import {useEffect} from "react";
|
||||||
|
|
||||||
export default function CycleCountLog() {
|
// export default function CycleCountLog() {
|
||||||
//const [logs, setLogs] = useState([]);
|
// //const [logs, setLogs] = useState([]);
|
||||||
//const [streaming, setStreaming] = useState(false); // Track if streaming is active
|
// //const [streaming, setStreaming] = useState(false); // Track if streaming is active
|
||||||
|
|
||||||
// useEffect(() => {
|
// useEffect(() => {
|
||||||
// // Start streaming when the button is clicked
|
// // Start streaming when the button is clicked
|
||||||
// let es;
|
// let es;
|
||||||
|
|
||||||
// es = new EventSource("http://localhost:4000/api/logger/logs/stream?service=ocme-count&level=info");
|
// const url = `http://localhost:4000/api/log`;
|
||||||
|
|
||||||
|
// es = new EventSource(url, {withCredentials: true});
|
||||||
// es.onopen = () => console.log(">>> Connection opened!");
|
// es.onopen = () => console.log(">>> Connection opened!");
|
||||||
// es.onerror = (e) => console.log("ERROR!", e);
|
// es.onerror = (e) => console.log("ERROR!", e);
|
||||||
// es.onmessage = (e) => {
|
// es.onmessage = (e) => {
|
||||||
@@ -21,26 +24,26 @@ export default function CycleCountLog() {
|
|||||||
// };
|
// };
|
||||||
|
|
||||||
// return () => es.close();
|
// return () => es.close();
|
||||||
// }, []); // Effect runs when `streaming` state changes
|
// }, []);
|
||||||
|
|
||||||
// const handleStartStreaming = () => {
|
// // const handleStartStreaming = () => {
|
||||||
// setStreaming(true); // Start streaming when button is clicked
|
// // setStreaming(true); // Start streaming when button is clicked
|
||||||
// };
|
// // };
|
||||||
return (
|
// return (
|
||||||
<LstCard className="w-48">
|
// <LstCard className="w-48">
|
||||||
<CardHeader className="flex justify-center">
|
// <CardHeader className="flex justify-center">
|
||||||
<span>Cycle Count logs</span>
|
// <span>Cycle Count logs</span>
|
||||||
</CardHeader>
|
// </CardHeader>
|
||||||
<CardContent>
|
// <CardContent>
|
||||||
{Array(10)
|
// {Array(10)
|
||||||
.fill(0)
|
// .fill(0)
|
||||||
.map((_, i) => (
|
// .map((_, i) => (
|
||||||
<div key={i}>
|
// <div key={i}>
|
||||||
<Skeleton className="m-2 h-4" />
|
// <Skeleton className="m-2 h-4" />
|
||||||
</div>
|
// </div>
|
||||||
))}
|
// ))}
|
||||||
</CardContent>
|
// </CardContent>
|
||||||
<Button onClick={() => toast.success("SOmething")}>Start Stream</Button>
|
// <Button onClick={() => toast.success("SOmething")}>Start Stream</Button>
|
||||||
</LstCard>
|
// </LstCard>
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
|||||||
@@ -5,19 +5,20 @@ import { cva, type VariantProps } from "class-variance-authority"
|
|||||||
import { cn } from "@/lib/utils"
|
import { cn } from "@/lib/utils"
|
||||||
|
|
||||||
const buttonVariants = cva(
|
const buttonVariants = cva(
|
||||||
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-[color,box-shadow] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
||||||
{
|
{
|
||||||
variants: {
|
variants: {
|
||||||
variant: {
|
variant: {
|
||||||
default:
|
default:
|
||||||
"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
|
"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
|
||||||
destructive:
|
destructive:
|
||||||
"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40",
|
"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
||||||
outline:
|
outline:
|
||||||
"border border-input bg-background shadow-xs hover:bg-accent hover:text-accent-foreground",
|
"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
||||||
secondary:
|
secondary:
|
||||||
"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
|
"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
|
||||||
ghost: "hover:bg-accent hover:text-accent-foreground",
|
ghost:
|
||||||
|
"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
||||||
link: "text-primary underline-offset-4 hover:underline",
|
link: "text-primary underline-offset-4 hover:underline",
|
||||||
},
|
},
|
||||||
size: {
|
size: {
|
||||||
|
|||||||
@@ -18,8 +18,16 @@ export default defineConfig({
|
|||||||
},
|
},
|
||||||
server: {
|
server: {
|
||||||
proxy: {
|
proxy: {
|
||||||
"/api": {target: `http://localhost:${Number(process.env.VITE_SERVER_PORT || 4400)}`, changeOrigin: true},
|
"/api": {
|
||||||
"/ocme": {target: `http://localhost:${Number(process.env.VITE_SERVER_PORT || 4400)}`, changeOrigin: true},
|
target: `http://localhost:${Number(process.env.VITE_SERVER_PORT || 4400)}`,
|
||||||
|
changeOrigin: true,
|
||||||
|
secure: false,
|
||||||
|
},
|
||||||
|
"/ocme": {
|
||||||
|
target: `http://localhost:${Number(process.env.VITE_SERVER_PORT || 4400)}`,
|
||||||
|
changeOrigin: true,
|
||||||
|
secure: false,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
3736
package-lock.json
generated
3736
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
32
package.json
32
package.json
@@ -22,30 +22,32 @@
|
|||||||
"prodBuild": "npm run v1Build && powershell -ExecutionPolicy Bypass -File server/scripts/build.ps1 -dir \"C:\\Users\\matthes01\\Documents\\lstv2\" && npm run zipServer",
|
"prodBuild": "npm run v1Build && powershell -ExecutionPolicy Bypass -File server/scripts/build.ps1 -dir \"C:\\Users\\matthes01\\Documents\\lstv2\" && npm run zipServer",
|
||||||
"commit": "cz",
|
"commit": "cz",
|
||||||
"prodinstall": "npm i --omit=dev && npm run db:migrate",
|
"prodinstall": "npm i --omit=dev && npm run db:migrate",
|
||||||
"checkupdates": "npm-check-updates"
|
"checkupdates": "npx npm-check-updates"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@dotenvx/dotenvx": "^1.38.3",
|
"@dotenvx/dotenvx": "^1.39.0",
|
||||||
"@hono/node-server": "^1.13.8",
|
"@hono/node-server": "^1.14.0",
|
||||||
"@hono/zod-openapi": "^0.18.4",
|
"@hono/node-ws": "^1.1.0",
|
||||||
"@scalar/hono-api-reference": "^0.5.175",
|
"@hono/zod-openapi": "^0.19.2",
|
||||||
"@types/jsonwebtoken": "^9.0.8",
|
"@scalar/hono-api-reference": "^0.7.2",
|
||||||
|
"@types/jsonwebtoken": "^9.0.9",
|
||||||
|
"@types/ws": "^8.18.0",
|
||||||
"adm-zip": "^0.5.16",
|
"adm-zip": "^0.5.16",
|
||||||
"axios": "^1.7.9",
|
"axios": "^1.8.4",
|
||||||
"bcrypt": "^5.1.1",
|
"bcrypt": "^5.1.1",
|
||||||
"compression": "^1.8.0",
|
"compression": "^1.8.0",
|
||||||
"cookie": "^1.0.2",
|
"cookie": "^1.0.2",
|
||||||
"date-fns": "^4.1.0",
|
"date-fns": "^4.1.0",
|
||||||
"dotenv": "^16.4.7",
|
"dotenv": "^16.4.7",
|
||||||
"drizzle-kit": "^0.30.4",
|
"drizzle-kit": "^0.30.5",
|
||||||
"drizzle-orm": "^0.39.3",
|
"drizzle-orm": "^0.41.0",
|
||||||
"drizzle-zod": "^0.7.0",
|
"drizzle-zod": "^0.7.0",
|
||||||
"fast-xml-parser": "^5.0.9",
|
"fast-xml-parser": "^5.0.9",
|
||||||
"jsonwebtoken": "^9.0.2",
|
"jsonwebtoken": "^9.0.2",
|
||||||
"mssql": "^11.0.1",
|
"mssql": "^11.0.1",
|
||||||
"nodemailer": "^6.10.0",
|
"nodemailer": "^6.10.0",
|
||||||
"nodemailer-express-handlebars": "^7.0.0",
|
"nodemailer-express-handlebars": "^7.0.0",
|
||||||
"pg": "^8.13.3",
|
"pg": "^8.14.1",
|
||||||
"pino": "^9.6.0",
|
"pino": "^9.6.0",
|
||||||
"pino-abstract-transport": "^2.0.0",
|
"pino-abstract-transport": "^2.0.0",
|
||||||
"pino-pretty": "^13.0.0",
|
"pino-pretty": "^13.0.0",
|
||||||
@@ -57,15 +59,15 @@
|
|||||||
"@types/bcrypt": "^5.0.2",
|
"@types/bcrypt": "^5.0.2",
|
||||||
"@types/js-cookie": "^3.0.6",
|
"@types/js-cookie": "^3.0.6",
|
||||||
"@types/mssql": "^9.1.7",
|
"@types/mssql": "^9.1.7",
|
||||||
"@types/node": "^22.13.5",
|
"@types/node": "^22.13.11",
|
||||||
"@types/pg": "^8.11.11",
|
"@types/pg": "^8.11.11",
|
||||||
"concurrently": "^8.2.0",
|
"concurrently": "^9.1.2",
|
||||||
"cz-conventional-changelog": "^3.3.0",
|
"cz-conventional-changelog": "^3.3.0",
|
||||||
"dotenv": "^16.3.1",
|
"dotenv": "^16.4.7",
|
||||||
"rimraf": "^6.0.1",
|
"rimraf": "^6.0.1",
|
||||||
"standard-version": "^9.5.0",
|
"standard-version": "^9.5.0",
|
||||||
"tsx": "^4.7.1",
|
"tsx": "^4.19.3",
|
||||||
"typescript": "~5.7.3"
|
"typescript": "~5.8.2"
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"commitizen": {
|
"commitizen": {
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ import ocpService from "./services/ocp/ocpService.js";
|
|||||||
import {db} from "../database/dbclient.js";
|
import {db} from "../database/dbclient.js";
|
||||||
import {settings} from "../database/schema/settings.js";
|
import {settings} from "../database/schema/settings.js";
|
||||||
import {count, eq} from "drizzle-orm";
|
import {count, eq} from "drizzle-orm";
|
||||||
|
import {createNodeWebSocket} from "@hono/node-ws";
|
||||||
|
import {streamSSE} from "hono/streaming";
|
||||||
|
|
||||||
// create the main prodlogin here
|
// create the main prodlogin here
|
||||||
const username = "lst_user";
|
const username = "lst_user";
|
||||||
@@ -34,6 +36,7 @@ export const installed = serverIntialized[0].count === 0 && process.env.NODE_ENV
|
|||||||
createLog("info", "LST", "server", `Server is installed: ${installed}`);
|
createLog("info", "LST", "server", `Server is installed: ${installed}`);
|
||||||
|
|
||||||
const app = new OpenAPIHono({strict: false});
|
const app = new OpenAPIHono({strict: false});
|
||||||
|
export const {injectWebSocket, upgradeWebSocket} = createNodeWebSocket({app});
|
||||||
|
|
||||||
// middle ware
|
// middle ware
|
||||||
app.use("*", logger());
|
app.use("*", logger());
|
||||||
@@ -70,6 +73,39 @@ app.doc("/api/ref", {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
app.get(
|
||||||
|
"/api/log",
|
||||||
|
// upgradeWebSocket(() => {
|
||||||
|
// return {
|
||||||
|
// onMessage(event, ws) {
|
||||||
|
// console.log(`Message from client: ${event.data}`);
|
||||||
|
// ws.send("Hello from server!");
|
||||||
|
// },
|
||||||
|
// onClose: () => {
|
||||||
|
// console.log("Connection closed");
|
||||||
|
// },
|
||||||
|
// };
|
||||||
|
// })
|
||||||
|
async (c) => {
|
||||||
|
let id = 0;
|
||||||
|
let running = true;
|
||||||
|
return streamSSE(c, async (stream) => {
|
||||||
|
while (running) {
|
||||||
|
const message = `It is ${new Date().toISOString()}`;
|
||||||
|
await stream.writeSSE({
|
||||||
|
data: message,
|
||||||
|
event: "time-update",
|
||||||
|
id: String(id++),
|
||||||
|
});
|
||||||
|
await stream.sleep(1000);
|
||||||
|
if (id === 5) {
|
||||||
|
running = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
const routes = [
|
const routes = [
|
||||||
scalar,
|
scalar,
|
||||||
auth,
|
auth,
|
||||||
@@ -149,6 +185,7 @@ process.on("beforeExit", async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const port = process.env.NODE_ENV === "development" ? process.env.VITE_SERVER_PORT : process.env.PROD_PORT;
|
const port = process.env.NODE_ENV === "development" ? process.env.VITE_SERVER_PORT : process.env.PROD_PORT;
|
||||||
|
injectWebSocket(
|
||||||
serve(
|
serve(
|
||||||
{
|
{
|
||||||
fetch: app.fetch,
|
fetch: app.fetch,
|
||||||
@@ -158,6 +195,7 @@ serve(
|
|||||||
(info) => {
|
(info) => {
|
||||||
createLog("info", "LST", "server", `Server is running on http://${info.address}:${info.port}`);
|
createLog("info", "LST", "server", `Server is running on http://${info.address}:${info.port}`);
|
||||||
}
|
}
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
export type AppRoutes = typeof appRoutes;
|
export type AppRoutes = typeof appRoutes;
|
||||||
|
|||||||
@@ -254,16 +254,29 @@ API_KEY= "E3ECD3619A943B98C6F33E3322362"
|
|||||||
|
|
||||||
Write-Host "Creating the env file in the front end"
|
Write-Host "Creating the env file in the front end"
|
||||||
$envContentTemplateb = @"
|
$envContentTemplateb = @"
|
||||||
DATABASE_URL="file:E:\LST\db\lstBackendDB.db"
|
DATABASE_URL="file:E:\LST\db\{dbLink}.db"
|
||||||
"@
|
"@
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
$dbLink = "lstBackendDB"
|
||||||
|
|
||||||
|
if ($token -eq "usiow2") {
|
||||||
|
$dbLink = "lstBackendDB_2"
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($token -in @("test1", "test2", "test3")) {
|
||||||
|
$dbLink = "lstBackendDB"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Replace {url} with the actual $url
|
||||||
|
$envContentb = $envContentTemplateb -replace "{dbLink}", $dbLink
|
||||||
|
|
||||||
# Define the path where the .env file should be created
|
# Define the path where the .env file should be created
|
||||||
$envFilePathb = $obslst + "\packages\database\.env"
|
$envFilePathb = $obslst + "\packages\database\.env"
|
||||||
|
|
||||||
# Write the content to the .env file
|
# Write the content to the .env file
|
||||||
$envContentTemplateb | Out-File -FilePath $envFilePathb -Encoding UTF8 -Force
|
$envContentb | Out-File -FilePath $envFilePathb -Encoding UTF8 -Force
|
||||||
|
|
||||||
# Optional: Verify the file was created
|
# Optional: Verify the file was created
|
||||||
if (Test-Path $envFilePathb) {
|
if (Test-Path $envFilePathb) {
|
||||||
@@ -287,12 +300,19 @@ NODE_ENV = production
|
|||||||
# server apiKey
|
# server apiKey
|
||||||
API_KEY = E3ECD3619A943B98C6F33E3322362
|
API_KEY = E3ECD3619A943B98C6F33E3322362
|
||||||
# Prisma DB link
|
# Prisma DB link
|
||||||
DATABASE_URL="file:E:\LST\db\lstBackendDB.db"
|
DATABASE_URL="file:E:\LST\db\{dbLink}.db"
|
||||||
# if you still want the db in the same folder as the server install you need to do like the example below else use the relevent link
|
# if you still want the db in the same folder as the server install you need to do like the example below else use the relevent link
|
||||||
DATEBASE_LOC="E:\LST\db\lstBackendDB.db"
|
DATEBASE_LOC="E:\LST\db\{dbLink}.db"
|
||||||
DATABASE_BACKUP_LOC="E:\LST\backups"
|
DATABASE_BACKUP_LOC="E:\LST\backups"
|
||||||
# Server port
|
# Server port
|
||||||
SERVER_PORT = 4400
|
GATEWAY_PORT={gatewayport}
|
||||||
|
AUTH_PORT=4100
|
||||||
|
SYSTEM_APP_PORT={systemport}
|
||||||
|
OCME_PORT={ocme}
|
||||||
|
|
||||||
|
# This should me removed once we have the entire app broke out to its own apps
|
||||||
|
OLD_APP_PORT={appPort}
|
||||||
|
|
||||||
# Logging
|
# Logging
|
||||||
LOG_LEVEL = info
|
LOG_LEVEL = info
|
||||||
LOG_LOC ="E:\\LST\\logs"
|
LOG_LOC ="E:\\LST\\logs"
|
||||||
@@ -312,11 +332,37 @@ RESET_TOKEN = 330
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
$dbLink = "lstBackendDB"
|
||||||
|
$gatewayport = "4400"
|
||||||
|
$systemport = "4200"
|
||||||
|
$ocmeport = "4300"
|
||||||
|
$appport = "4900"
|
||||||
|
|
||||||
|
if ($token -eq "usiow2") {
|
||||||
|
$dbLink = "lstBackendDB_2"
|
||||||
|
$gatewayport = "4401"
|
||||||
|
$systemport = "4201"
|
||||||
|
$ocmeport = "4301"
|
||||||
|
$appport = "4901"
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($token -in @("test1", "test2", "test3")) {
|
||||||
|
$dbLink = "lstBackendDB"
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
$port1 = $envContentTemplated -replace "{gatewayport}", $gatewayport
|
||||||
|
$port2 = $port1 -replace "{systemport}", $systemport
|
||||||
|
$port3 = $port2 -replace "{ocme}", $ocmeport
|
||||||
|
$port4 = $port3 -replace "{appPort}", $appport
|
||||||
|
$envContentd = $port4 -replace "{dbLink}", $dbLink
|
||||||
|
|
||||||
|
|
||||||
# Define the path where the .env file should be created
|
# Define the path where the .env file should be created
|
||||||
$envFilePathd = $obslst + "\.env"
|
$envFilePathd = $obslst + "\.env"
|
||||||
|
|
||||||
# Write the content to the .env file
|
# Write the content to the .env file
|
||||||
$envContentTemplated | Out-File -FilePath $envFilePathd -Encoding UTF8 -Force
|
$envContentd | Out-File -FilePath $envFilePathd -Encoding UTF8 -Force
|
||||||
|
|
||||||
# Optional: Verify the file was created
|
# Optional: Verify the file was created
|
||||||
if (Test-Path $envFilePathd) {
|
if (Test-Path $envFilePathd) {
|
||||||
|
|||||||
@@ -55,9 +55,9 @@ app.get(
|
|||||||
"nsurlsession",
|
"nsurlsession",
|
||||||
"undici",
|
"undici",
|
||||||
],
|
],
|
||||||
spec: {
|
|
||||||
url: "/api/ref",
|
url: "/api/ref",
|
||||||
},
|
|
||||||
baseServerURL: "https://scalar.com",
|
baseServerURL: "https://scalar.com",
|
||||||
servers: [
|
servers: [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import type {Context} from "hono";
|
import type {Context} from "hono";
|
||||||
import {db} from "../../../../database/dbclient.js";
|
import {db} from "../../../../database/dbclient.js";
|
||||||
import {and, eq, gt} from "drizzle-orm";
|
import {and, eq, gt} from "drizzle-orm";
|
||||||
import {streamSSE} from "hono/streaming";
|
import {streamSSE, streamText} from "hono/streaming";
|
||||||
import {logs} from "../../../../database/schema/logs.js";
|
import {logs} from "../../../../database/schema/logs.js";
|
||||||
|
|
||||||
export async function streamLogs(c: Context) {
|
export async function streamLogs(c: Context) {
|
||||||
|
|||||||
@@ -29,6 +29,11 @@ app.openapi(
|
|||||||
}),
|
}),
|
||||||
async (c) => {
|
async (c) => {
|
||||||
apiHit(c, {endpoint: `api/logger/logs`});
|
apiHit(c, {endpoint: `api/logger/logs`});
|
||||||
|
c.header("Access-Control-Allow-Origin", "*"); // Or restrict to a specific origin
|
||||||
|
c.header("Access-Control-Allow-Headers", "Content-Type");
|
||||||
|
c.header("Content-Type", "text/event-stream");
|
||||||
|
c.header("Cache-Control", "no-cache");
|
||||||
|
c.header("Connection", "keep-alive");
|
||||||
return streamLogs(c);
|
return streamLogs(c);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"servers": [
|
"servers": [
|
||||||
{
|
{
|
||||||
"sName": "test",
|
"sName": "Test",
|
||||||
"serverDNS": "usmcd1vms036",
|
"serverDNS": "usmcd1vms036",
|
||||||
"plantToken": "test3",
|
"plantToken": "test3",
|
||||||
"idAdress": "10.193.0.56",
|
"idAdress": "10.193.0.56",
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
"contactPhone": "6366970253",
|
"contactPhone": "6366970253",
|
||||||
"customerTiAcc": "ALPL01BETHINT",
|
"customerTiAcc": "ALPL01BETHINT",
|
||||||
"lstServerPort": "4000",
|
"lstServerPort": "4000",
|
||||||
"active": false,
|
"active": true,
|
||||||
"serverLoc": "E:\\LST\\lstv2",
|
"serverLoc": "E:\\LST\\lstv2",
|
||||||
"oldVersion": "E:\\LST\\lst_backend",
|
"oldVersion": "E:\\LST\\lst_backend",
|
||||||
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
|
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
|
||||||
|
|||||||
Reference in New Issue
Block a user