feat: integrate Electron for desktop application support
- Added Electron entry point in `electron/main.js` to run the Express server in-process and open the main application window. - Updated `package.json` to include Electron dependencies and scripts for building and running the application. - Refactored server startup logic into `server/start.js` for better modularity and to support both CLI and Electron usage. - Implemented environment variable handling for database and image paths to accommodate Electron's packaging. - Created a script `server/scripts/promote-morphix.js` to merge admin and morphix accounts into a single user. - Adjusted image root path resolution in `server/media/images.js` to allow for environment variable overrides. - Cleaned up `server/index.js` to delegate server initialization to the new `startServer` function.
This commit is contained in:
50
package.json
50
package.json
@@ -4,6 +4,7 @@
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"description": "Touchscreen kiosk + admin for exploring and playing internet radio.",
|
||||
"main": "electron/main.js",
|
||||
"scripts": {
|
||||
"dev": "concurrently -k -n web,api -c blue,green \"npm:dev:web\" \"npm:dev:api\"",
|
||||
"dev:web": "vite",
|
||||
@@ -11,7 +12,13 @@
|
||||
"build": "vite build",
|
||||
"start": "node server/index.js",
|
||||
"seed": "node server/scripts/seed.js",
|
||||
"images:fetch": "node server/scripts/download-images.js"
|
||||
"images:fetch": "node server/scripts/download-images.js",
|
||||
"electron": "electron .",
|
||||
"electron:dev": "npm run build && electron .",
|
||||
"postinstall": "electron-builder install-app-deps",
|
||||
"dist": "npm run build && electron-builder",
|
||||
"dist:win": "npm run build && electron-builder --win",
|
||||
"dist:linux": "npm run build && electron-builder --linux"
|
||||
},
|
||||
"dependencies": {
|
||||
"bcryptjs": "^2.4.3",
|
||||
@@ -24,7 +31,46 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"concurrently": "^9.0.1",
|
||||
"electron": "^32.3.3",
|
||||
"electron-builder": "^25.1.8",
|
||||
"hls.js": "^1.5.17",
|
||||
"vite": "^5.4.8"
|
||||
},
|
||||
"build": {
|
||||
"appId": "nl.oradio.app",
|
||||
"productName": "Online Radio Explorer",
|
||||
"asar": true,
|
||||
"asarUnpack": [
|
||||
"node_modules/better-sqlite3/**"
|
||||
],
|
||||
"files": [
|
||||
"electron/**",
|
||||
"server/**",
|
||||
"!server/scripts/**",
|
||||
"data/seed/**",
|
||||
"package.json"
|
||||
],
|
||||
"directories": {
|
||||
"output": "dist-electron",
|
||||
"buildResources": "build"
|
||||
},
|
||||
"win": {
|
||||
"target": [
|
||||
"nsis"
|
||||
]
|
||||
},
|
||||
"linux": {
|
||||
"target": [
|
||||
{
|
||||
"target": "AppImage",
|
||||
"arch": [
|
||||
"x64",
|
||||
"arm64",
|
||||
"armv7l"
|
||||
]
|
||||
}
|
||||
],
|
||||
"category": "AudioVideo"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user