feat: local-cpl-sim system
This commit is contained in:
@@ -6,6 +6,6 @@ NEXT_PUBLIC_USE_MOCK_BACKEND_LOOP_START=false
|
||||
NEXT_PUBLIC_EXPORT_STATIC=false
|
||||
NEXT_PUBLIC_USE_CGI=false
|
||||
# App-Versionsnummer
|
||||
NEXT_PUBLIC_APP_VERSION=1.6.836
|
||||
NEXT_PUBLIC_APP_VERSION=1.6.837
|
||||
NEXT_PUBLIC_CPL_MODE=json # json (Entwicklungsumgebung) oder jsSimulatedProd (CPL ->CGI-Interface-Simulator) oder production (CPL-> CGI-Interface Platzhalter)
|
||||
|
||||
|
||||
@@ -5,5 +5,5 @@ NEXT_PUBLIC_CPL_API_PATH=/CPL
|
||||
NEXT_PUBLIC_EXPORT_STATIC=true
|
||||
NEXT_PUBLIC_USE_CGI=true
|
||||
# App-Versionsnummer
|
||||
NEXT_PUBLIC_APP_VERSION=1.6.836
|
||||
NEXT_PUBLIC_APP_VERSION=1.6.837
|
||||
NEXT_PUBLIC_CPL_MODE=production
|
||||
@@ -1,3 +1,8 @@
|
||||
## [1.6.837] – 2025-09-04
|
||||
|
||||
- feat: local-cpl-sim meldungen/Berichte
|
||||
|
||||
---
|
||||
## [1.6.836] – 2025-09-04
|
||||
|
||||
- feat: local-cpl-sim.mjs kabelueberwachung
|
||||
|
||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "cpl-v4",
|
||||
"version": "1.6.836",
|
||||
"version": "1.6.837",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "cpl-v4",
|
||||
"version": "1.6.836",
|
||||
"version": "1.6.837",
|
||||
"dependencies": {
|
||||
"@fontsource/roboto": "^5.1.0",
|
||||
"@headlessui/react": "^2.2.4",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cpl-v4",
|
||||
"version": "1.6.836",
|
||||
"version": "1.6.837",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev -p 3000",
|
||||
|
||||
@@ -137,14 +137,21 @@ function tryServeSpecialMocks(res, relPath) {
|
||||
}
|
||||
}
|
||||
if (rp === "CPL/SERVICE/systemVoltTemp.js") {
|
||||
const mockPath = path.join(
|
||||
const base = path.join(
|
||||
process.cwd(),
|
||||
"mocks",
|
||||
"device-cgi-simulator",
|
||||
"SERVICE",
|
||||
"systemVoltTempMockData.js"
|
||||
"SERVICE"
|
||||
);
|
||||
if (exists(mockPath)) return streamRaw(res, mockPath);
|
||||
const preferred = path.join(base, "systemVoltTemp.js");
|
||||
if (exists(preferred)) return streamRaw(res, preferred);
|
||||
const mockPath = path.join(base, "systemVoltTempMockData.js");
|
||||
if (exists(mockPath)) {
|
||||
// Transform variable name to expected win_systemVoltTemp when streaming
|
||||
return streamTransform(res, mockPath, (txt) =>
|
||||
txt.replace(/win_systemVoltTempMockData/g, "win_systemVoltTemp")
|
||||
);
|
||||
}
|
||||
}
|
||||
if (rp === "CPL/SERVICE/last20Messages.js") {
|
||||
const mockPath = path.join(
|
||||
@@ -238,6 +245,21 @@ function streamRaw(res, filePath) {
|
||||
return true;
|
||||
}
|
||||
|
||||
function streamTransform(res, filePath, transformFn) {
|
||||
const ext = path.extname(filePath).toLowerCase();
|
||||
const type = contentTypeByExt(ext);
|
||||
const headers = { "Content-Type": type, "Cache-Control": "no-cache" };
|
||||
res.writeHead(200, headers);
|
||||
try {
|
||||
const txt = fs.readFileSync(filePath, "utf8");
|
||||
const out = transformFn(txt);
|
||||
res.end(out);
|
||||
} catch {
|
||||
res.end();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function resolvePlaceholders(filePath, content) {
|
||||
const rel = getRelFromRoot(filePath);
|
||||
const serviceSystem =
|
||||
|
||||
Reference in New Issue
Block a user