diff --git a/.env.development b/.env.development index 300d261..d08a7b2 100644 --- a/.env.development +++ b/.env.development @@ -1,4 +1,4 @@ VITE_LOCAL_SERVER_URL=http://localhost:9696 VITE_LOCAL_SERVER_PORT=9696 -VITE_APP_VERSION='v4 R401' -VITE_APP_VERSION_CODE=401 \ No newline at end of file +VITE_APP_VERSION='v4 R400' +VITE_APP_VERSION_CODE=400 \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index 3162311..f985252 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -11,13 +11,14 @@ { "name": "Launch via NPM", "request": "launch", + "cwd": "${workspaceFolder}", "runtimeArgs": [ "run", "dev" ], "runtimeExecutable": "npm", "windows": { - "runtimeExecutable": "nvm4w" + "runtimeExecutable": "npm.cmd" }, "skipFiles": [ "/**" diff --git a/electron.vite.config.js b/electron.vite.config.js index b967db2..ae99ad2 100644 --- a/electron.vite.config.js +++ b/electron.vite.config.js @@ -19,33 +19,48 @@ * along with Xibo. If not, see . */ import {resolve} from 'path'; -import {defineConfig, externalizeDepsPlugin, bytecodePlugin} +import {defineConfig, externalizeDepsPlugin, bytecodePlugin, loadEnv} from 'electron-vite'; -export default defineConfig({ - main: { - plugins: [externalizeDepsPlugin()], - build: { - sourcemap: true, - minify: false, - rollupOptions: { - input: { - index: resolve(__dirname, 'src/main/index.ts'), - express: resolve(__dirname, 'src/main/express.ts'), +export default defineConfig(({mode}) => { + const env = loadEnv(mode, process.cwd(), ''); + + return { + main: { + plugins: [externalizeDepsPlugin()], + build: { + sourcemap: true, + minify: false, + rollupOptions: { + input: { + index: resolve(__dirname, 'src/main/index.ts'), + express: resolve(__dirname, 'src/main/express.ts'), + }, + external: ['better-sqlite3'], }, - external: ['better-sqlite3'], }, }, - }, - preload: { - plugins: [externalizeDepsPlugin(), bytecodePlugin()], - }, - renderer: { - resolve: { - alias: { - '@renderer': resolve('src/renderer/src'), - '@shared': resolve('./src/shared'), + preload: { + plugins: [externalizeDepsPlugin(), bytecodePlugin()], + }, + renderer: { + plugins: [ + { + name: 'html-transform', + transformIndexHtml(html) { + return html.replace( + /%VITE_APP_VERSION%/g, + env.VITE_APP_VERSION || '4.0.0', + ); + }, + }, + ], + resolve: { + alias: { + '@renderer': resolve('src/renderer/src'), + '@shared': resolve('./src/shared'), + }, }, }, - }, + }; }); diff --git a/src/main/xmds/xmds.ts b/src/main/xmds/xmds.ts index ea8510c..b33209a 100644 --- a/src/main/xmds/xmds.ts +++ b/src/main/xmds/xmds.ts @@ -160,7 +160,7 @@ export class Xmds { const soapXml = '\n' + ' \n' + ' \n' + - ' ' + this.config.cmsKey + '\n' + + ' \n' + ' ' + this.config.hardwareKey + '\n' + ' ' + this.config.displayName + '\n' + ' ' + this.config.getXmdsPlayerType() + '\n' + @@ -232,7 +232,7 @@ export class Xmds { const soapXml = '\n' + ' \n' + ' \n' + - ' ' + this.config.cmsKey + '\n' + + ' \n' + ' ' + this.config.hardwareKey + '\n' + ' \n' + ' \n' + @@ -262,7 +262,7 @@ export class Xmds { const soapXml = '\n' + ' \n' + ' \n' + - ' ' + this.config.cmsKey + '\n' + + ' \n' + ' ' + this.config.hardwareKey + '\n' + ' <files>' + files + '</files>\n' + ' \n' + @@ -290,7 +290,7 @@ export class Xmds { const soapXml = '\n' + ' \n' + ' \n' + - ' ' + this.config.cmsKey + '\n' + + ' \n' + ' ' + this.config.hardwareKey + '\n' + ' \n' + ' \n' + @@ -318,7 +318,7 @@ export class Xmds { const soapXml = '\n' + ' \n' + ' \n' + - ' ' + this.config.cmsKey + '\n' + + ' \n' + ' ' + this.config.hardwareKey + '\n' + ' iVBORw0KGgoAAAANSUhEUgAAAMgAAADIBAMAAABfdrOtAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAADUExURQAAAKd6PdoAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAArSURBVHja7cExAQAAAMKg9U9tCU8gAAAAAAAAAAAAAAAAAAAAAAAAALipAU7oAAG73DR2AAAAAElFTkSuQmCC\n' + ' \n' + @@ -366,7 +366,7 @@ export class Xmds { const soapXml = '\n' + ' \n' + ' \n' + - ' ' + this.config.cmsKey + '\n' + + ' \n' + ' ' + this.config.hardwareKey + '\n' + ' <logs>' + logsXmlStr + '</logs>\n' + ' \n' + @@ -436,7 +436,7 @@ export class Xmds { const soapXml = '\n' + ' \n' + ' \n' + - ' ' + this.config.cmsKey + '\n' + + ' \n' + ' ' + this.config.hardwareKey + '\n' + ' <records>' + statsXmlString + '</records>\n' + ' \n' + @@ -462,7 +462,7 @@ export class Xmds { const soapXml = '\n' + ' \n' + ' \n' + - ' ' + this.config.cmsKey + '\n' + + ' \n' + ' ' + this.config.hardwareKey + '\n' + ' ' + this.config.state.toJson() + '\n' + ' \n' + @@ -490,7 +490,7 @@ export class Xmds { // const soapXml = '\n' + // ' \n' + // ' \n' + - // ' ' + this.config.cmsKey + '\n' + + // ' \n' + // ' ' + this.config.hardwareKey + '\n' + // ' ' + faultsParam + '\n' + // ' \n' + @@ -511,7 +511,7 @@ export class Xmds { const soapXml = '\n' + ' \n' + ' \n' + - ' ' + this.config.cmsKey + '\n' + + ' \n' + ' ' + this.config.hardwareKey + '\n' + ' ' + file.layoutId + '\n' + ' ' + file.regionId + '\n' +