Compare commits

..

6 Commits

13 changed files with 9216 additions and 12502 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -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"
} }
} }

View File

@@ -1,46 +1,49 @@
//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.onopen = () => console.log(">>> Connection opened!");
// es.onerror = (e) => console.log("ERROR!", e);
// es.onmessage = (e) => {
// console.log(">>>", JSON.stringify(e));
// };
// return () => es.close(); // es = new EventSource(url, {withCredentials: true});
// }, []); // Effect runs when `streaming` state changes // es.onopen = () => console.log(">>> Connection opened!");
// es.onerror = (e) => console.log("ERROR!", e);
// es.onmessage = (e) => {
// console.log(">>>", JSON.stringify(e));
// };
// const handleStartStreaming = () => { // return () => es.close();
// setStreaming(true); // Start streaming when button is clicked // }, []);
// };
return ( // // const handleStartStreaming = () => {
<LstCard className="w-48"> // // setStreaming(true); // Start streaming when button is clicked
<CardHeader className="flex justify-center"> // // };
<span>Cycle Count logs</span> // return (
</CardHeader> // <LstCard className="w-48">
<CardContent> // <CardHeader className="flex justify-center">
{Array(10) // <span>Cycle Count logs</span>
.fill(0) // </CardHeader>
.map((_, i) => ( // <CardContent>
<div key={i}> // {Array(10)
<Skeleton className="m-2 h-4" /> // .fill(0)
</div> // .map((_, i) => (
))} // <div key={i}>
</CardContent> // <Skeleton className="m-2 h-4" />
<Button onClick={() => toast.success("SOmething")}>Start Stream</Button> // </div>
</LstCard> // ))}
); // </CardContent>
} // <Button onClick={() => toast.success("SOmething")}>Start Stream</Button>
// </LstCard>
// );
// }

View File

@@ -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: {

View File

@@ -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,
},
}, },
}, },
}); });

20496
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,79 +1,81 @@
{ {
"name": "lstv2", "name": "lstv2",
"version": "2.8.0", "version": "2.8.0",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "concurrently -n \"server,frontend\" -c \"#007755,#2f6da3\" \"npm run dev:server\" \"cd frontend && npm run dev\"", "dev": "concurrently -n \"server,frontend\" -c \"#007755,#2f6da3\" \"npm run dev:server\" \"cd frontend && npm run dev\"",
"dev:server": "dotenvx run -f .env -- tsx watch server/index.ts", "dev:server": "dotenvx run -f .env -- tsx watch server/index.ts",
"dev:frontend": "cd frontend && npm run dev", "dev:frontend": "cd frontend && npm run dev",
"dev:dbgen": " drizzle-kit generate --config=drizzle-dev.config.ts", "dev:dbgen": " drizzle-kit generate --config=drizzle-dev.config.ts",
"dev:dbmigrate": " drizzle-kit migrate --config=drizzle-dev.config.ts", "dev:dbmigrate": " drizzle-kit migrate --config=drizzle-dev.config.ts",
"build": "npm run build:server && npm run build:frontend", "build": "npm run build:server && npm run build:frontend",
"build:server": "rimraf build && tsc --build && xcopy server\\scripts dist\\server\\scripts /E /I /Y && xcopy server\\services\\server\\utils\\serverData.json dist\\server\\services\\server\\utils /E /I /Y ", "build:server": "rimraf build && tsc --build && xcopy server\\scripts dist\\server\\scripts /E /I /Y && xcopy server\\services\\server\\utils\\serverData.json dist\\server\\services\\server\\utils /E /I /Y ",
"build:frontend": "cd frontend && npm run build", "build:frontend": "cd frontend && npm run build",
"start": "set NODE_ENV=production && npm run start:server", "start": "set NODE_ENV=production && npm run start:server",
"start:server": "dotenvx run -f .env -- node dist/server/index.js", "start:server": "dotenvx run -f .env -- node dist/server/index.js",
"db:generate": "npx drizzle-kit generate", "db:generate": "npx drizzle-kit generate",
"db:migrate": "npx drizzle-kit push", "db:migrate": "npx drizzle-kit push",
"db:dev": "npm run build && npm run db:generate && npm run db:migrate", "db:dev": "npm run build && npm run db:generate && npm run db:migrate",
"deploy": "standard-version --conventional-commits && npm run prodBuild", "deploy": "standard-version --conventional-commits && npm run prodBuild",
"zipServer": "dotenvx run -f .env -- tsx server/scripts/zipUpBuild.ts \"C:\\Users\\matthes01\\Documents\\lstv2\"", "zipServer": "dotenvx run -f .env -- tsx server/scripts/zipUpBuild.ts \"C:\\Users\\matthes01\\Documents\\lstv2\"",
"v1Build": "cd C:\\Users\\matthes01\\Documents\\logisticsSupportTool && npm run oldBuilder", "v1Build": "cd C:\\Users\\matthes01\\Documents\\logisticsSupportTool && npm run oldBuilder",
"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",
"adm-zip": "^0.5.16", "@types/jsonwebtoken": "^9.0.9",
"axios": "^1.7.9", "@types/ws": "^8.18.0",
"bcrypt": "^5.1.1", "adm-zip": "^0.5.16",
"compression": "^1.8.0", "axios": "^1.8.4",
"cookie": "^1.0.2", "bcrypt": "^5.1.1",
"date-fns": "^4.1.0", "compression": "^1.8.0",
"dotenv": "^16.4.7", "cookie": "^1.0.2",
"drizzle-kit": "^0.30.4", "date-fns": "^4.1.0",
"drizzle-orm": "^0.39.3", "dotenv": "^16.4.7",
"drizzle-zod": "^0.7.0", "drizzle-kit": "^0.30.5",
"fast-xml-parser": "^5.0.9", "drizzle-orm": "^0.41.0",
"jsonwebtoken": "^9.0.2", "drizzle-zod": "^0.7.0",
"mssql": "^11.0.1", "fast-xml-parser": "^5.0.9",
"nodemailer": "^6.10.0", "jsonwebtoken": "^9.0.2",
"nodemailer-express-handlebars": "^7.0.0", "mssql": "^11.0.1",
"pg": "^8.13.3", "nodemailer": "^6.10.0",
"pino": "^9.6.0", "nodemailer-express-handlebars": "^7.0.0",
"pino-abstract-transport": "^2.0.0", "pg": "^8.14.1",
"pino-pretty": "^13.0.0", "pino": "^9.6.0",
"postgres": "^3.4.5", "pino-abstract-transport": "^2.0.0",
"zod": "^3.24.2" "pino-pretty": "^13.0.0",
}, "postgres": "^3.4.5",
"devDependencies": { "zod": "^3.24.2"
"@types/adm-zip": "^0.5.7", },
"@types/bcrypt": "^5.0.2", "devDependencies": {
"@types/js-cookie": "^3.0.6", "@types/adm-zip": "^0.5.7",
"@types/mssql": "^9.1.7", "@types/bcrypt": "^5.0.2",
"@types/node": "^22.13.5", "@types/js-cookie": "^3.0.6",
"@types/pg": "^8.11.11", "@types/mssql": "^9.1.7",
"concurrently": "^8.2.0", "@types/node": "^22.13.11",
"cz-conventional-changelog": "^3.3.0", "@types/pg": "^8.11.11",
"dotenv": "^16.3.1", "concurrently": "^9.1.2",
"rimraf": "^6.0.1", "cz-conventional-changelog": "^3.3.0",
"standard-version": "^9.5.0", "dotenv": "^16.4.7",
"tsx": "^4.7.1", "rimraf": "^6.0.1",
"typescript": "~5.7.3" "standard-version": "^9.5.0",
}, "tsx": "^4.19.3",
"config": { "typescript": "~5.8.2"
"commitizen": { },
"path": "./node_modules/cz-conventional-changelog" "config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
},
"admConfig": {
"build": 47,
"oldBuild": "backend-0.1.3.zip"
} }
}, }
"admConfig": {
"build": 47,
"oldBuild": "backend-0.1.3.zip"
}
}

View File

@@ -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,15 +185,17 @@ 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;
serve( injectWebSocket(
{ serve(
fetch: app.fetch, {
port: Number(port), fetch: app.fetch,
hostname: "0.0.0.0", port: Number(port),
}, hostname: "0.0.0.0",
(info) => { },
createLog("info", "LST", "server", `Server is running on http://${info.address}:${info.port}`); (info) => {
} createLog("info", "LST", "server", `Server is running on http://${info.address}:${info.port}`);
}
)
); );
export type AppRoutes = typeof appRoutes; export type AppRoutes = typeof appRoutes;

View File

@@ -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"
@@ -310,13 +330,39 @@ COOKIE_EXPIRES_TIME = 60
RESET_TOKEN = 330 RESET_TOKEN = 330
"@ "@
try { try {
# Define the path where the .env file should be created $dbLink = "lstBackendDB"
$envFilePathd = $obslst + "\.env" $gatewayport = "4400"
$systemport = "4200"
# Write the content to the .env file $ocmeport = "4300"
$envContentTemplated | Out-File -FilePath $envFilePathd -Encoding UTF8 -Force $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
$envFilePathd = $obslst + "\.env"
# Write the content to the .env file
$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) {

View File

@@ -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: [
{ {

View File

@@ -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) {

View File

@@ -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);
} }
); );

View File

@@ -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\"}]",