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:
@@ -11,7 +11,11 @@ import { fileURLToPath } from 'node:url';
|
||||
import { getDb } from '../db/index.js';
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
const ROOT = resolve(__dirname, '..', '..', 'data', 'images');
|
||||
// Where cover art lives. Overridable via env so Electron (packaged) can point
|
||||
// it at app.getPath('userData')/data/images instead of the read-only asar dir.
|
||||
const ROOT = process.env.ORADIO_IMAGE_ROOT
|
||||
? resolve(process.env.ORADIO_IMAGE_ROOT)
|
||||
: resolve(__dirname, '..', '..', 'data', 'images');
|
||||
const STATIONS_DIR = join(ROOT, 'stations');
|
||||
// A browser-like UA is required by Wikimedia and several CDNs; an opaque
|
||||
// UA like "OnlineRadioExplorer/0.1" gets HTTP 400/403 from upload.wikimedia.org.
|
||||
|
||||
Reference in New Issue
Block a user