mirror of
https://gitlab.com/vyla-entertainment/home.git
synced 2026-11-14 14:17:25 -05:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
35087d24e8 | ||
| 2435ee51e6 | |||
| 59f4d9855f |
69
main.js
69
main.js
@@ -434,58 +434,33 @@ async function start() {
|
|||||||
sendToTauri('status', { message: 'Loading encrypted credentials...' });
|
sendToTauri('status', { message: 'Loading encrypted credentials...' });
|
||||||
serviceManager.credentialManager.loadCredentials();
|
serviceManager.credentialManager.loadCredentials();
|
||||||
|
|
||||||
sendToTauri('status', { message: 'Starting background services (player)...' });
|
sendToTauri('status', { message: 'Installing dependencies...' });
|
||||||
|
const npmCmd = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
||||||
|
const frontendDir = path.join(APPDATA_DIR, 'frontend');
|
||||||
|
if (fs.existsSync(path.join(frontendDir, 'package.json'))) {
|
||||||
|
const { spawnSync } = require('child_process');
|
||||||
|
spawnSync(npmCmd, ['install'], {
|
||||||
|
cwd: frontendDir,
|
||||||
|
stdio: 'ignore',
|
||||||
|
windowsHide: true,
|
||||||
|
shell: process.platform === 'win32'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
sendToTauri('status', { message: 'Starting services (player, frontend)...' });
|
||||||
await serviceManager.startServices([
|
await serviceManager.startServices([
|
||||||
{ name: 'player', relativeDir: 'player', startScript: 'server.js' }
|
{ name: 'player', relativeDir: 'player', startScript: 'server.js' },
|
||||||
|
{ name: 'frontend', relativeDir: 'frontend', startScript: 'server.js' }
|
||||||
]);
|
]);
|
||||||
debugLog("Backend services spawn requested.");
|
debugLog("Backend services spawn requested.");
|
||||||
|
|
||||||
sendToTauri('status', { message: 'Waiting for microservices to bind port 3000...' });
|
sendToTauri('status', { message: 'Waiting for microservices to bind...' });
|
||||||
await serviceManager.waitForPorts([3000]);
|
await serviceManager.waitForPorts([3000, 4890]);
|
||||||
debugLog("Port 3000 is ready.");
|
debugLog("Ports 3000 and 4890 are ready.");
|
||||||
|
|
||||||
sendToTauri('status', { message: 'Binding UI server on port 4890...' });
|
sendToTauri('status', { message: 'All backend services running and healthy.' });
|
||||||
const frontendDir = path.join(APPDATA_DIR, 'frontend');
|
debugLog("Sending READY to Tauri.");
|
||||||
expressApp = express();
|
sendToTauri('ready', { url: 'http://127.0.0.1:4890' });
|
||||||
expressApp.use((req, res, next) => {
|
|
||||||
res.header('Access-Control-Allow-Origin', '*');
|
|
||||||
res.header('Access-Control-Allow-Methods', 'GET,POST,OPTIONS');
|
|
||||||
res.header('Access-Control-Allow-Headers', '*');
|
|
||||||
if (req.method === 'OPTIONS') return res.sendStatus(200);
|
|
||||||
next();
|
|
||||||
});
|
|
||||||
expressApp.get('/__tauri_cmd/:cmd', (req, res) => {
|
|
||||||
debugLog(`[FRONTEND-SERVER:4890] Command received: ${req.params.cmd} (window: ${req.query.window || 'main'})`);
|
|
||||||
sendToTauri('tauri-cmd', { cmd: req.params.cmd, url: req.query.url, window: req.query.window });
|
|
||||||
res.sendStatus(200);
|
|
||||||
});
|
|
||||||
|
|
||||||
expressApp.use(sameTabNavMiddleware(frontendDir));
|
|
||||||
expressApp.use(express.static(frontendDir, {
|
|
||||||
etag: false,
|
|
||||||
setHeaders: (res) => {
|
|
||||||
res.set('Cache-Control', 'no-store, no-cache, must-revalidate, private');
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
expressApp.use(express.static(path.join(frontendDir, 'src'), {
|
|
||||||
etag: false,
|
|
||||||
setHeaders: (res) => {
|
|
||||||
res.set('Cache-Control', 'no-store, no-cache, must-revalidate, private');
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
expressApp.get('*', (req, res) => {
|
|
||||||
res.set('Cache-Control', 'no-store, no-cache, must-revalidate, private');
|
|
||||||
res.sendFile(path.join(frontendDir, 'index.html'));
|
|
||||||
});
|
|
||||||
|
|
||||||
const FRONTEND_PORT = 4890;
|
|
||||||
expressApp.use('/build', express.static(path.join(__dirname, 'build')));
|
|
||||||
|
|
||||||
expressServer = expressApp.listen(FRONTEND_PORT, '127.0.0.1', () => {
|
|
||||||
sendToTauri('status', { message: 'All backend services running and healthy.' });
|
|
||||||
debugLog("Frontend Express running on 4890. Sending READY to Tauri.");
|
|
||||||
sendToTauri('ready', { url: `http://127.0.0.1:${FRONTEND_PORT}` });
|
|
||||||
});
|
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
debugLog(`Fatal Start Error: ${error.message}`);
|
debugLog(`Fatal Start Error: ${error.message}`);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "vyla-home",
|
"name": "vyla-home",
|
||||||
"version": "1.1.42",
|
"version": "1.1.43",
|
||||||
"description": "Vyla Home Desktop App Launcher",
|
"description": "Vyla Home Desktop App Launcher",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
"@tauri-apps/plugin-opener": "^2.7.0",
|
"@tauri-apps/plugin-opener": "^2.7.0",
|
||||||
"@tauri-apps/plugin-process": "^2.4.0",
|
"@tauri-apps/plugin-process": "^2.4.0",
|
||||||
"@tauri-apps/plugin-shell": "^2.4.0",
|
"@tauri-apps/plugin-shell": "^2.4.0",
|
||||||
"@vyla-entertainment/sdk": "^1.16.0",
|
"@vyla-entertainment/sdk": "^1.18.0",
|
||||||
"adm-zip": "^0.6.0",
|
"adm-zip": "^0.6.0",
|
||||||
"express": "^4.19.2"
|
"express": "^4.19.2"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ class Patcher {
|
|||||||
|
|
||||||
verifyExtraction() {
|
verifyExtraction() {
|
||||||
const requiredFiles = [
|
const requiredFiles = [
|
||||||
'frontend/index.html',
|
'frontend/server.js',
|
||||||
'player/server.js'
|
'player/server.js'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -47,8 +47,14 @@ class ServiceManager {
|
|||||||
this.credentialManager.setCredential('player', 'TOKEN_SECRET', tokenSecret);
|
this.credentialManager.setCredential('player', 'TOKEN_SECRET', tokenSecret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const defaultPorts = {
|
||||||
|
player: 3000,
|
||||||
|
frontend: 4890
|
||||||
|
};
|
||||||
|
|
||||||
const env = {
|
const env = {
|
||||||
...process.env,
|
...process.env,
|
||||||
|
PORT: (this.envConfig[name] && this.envConfig[name].PORT) || defaultPorts[name] || process.env.PORT || 3000,
|
||||||
TOKEN_SECRET: tokenSecret,
|
TOKEN_SECRET: tokenSecret,
|
||||||
...(this.envConfig[name] || {}),
|
...(this.envConfig[name] || {}),
|
||||||
...(this.credentialManager.getServiceCredentials(name) || {})
|
...(this.credentialManager.getServiceCredentials(name) || {})
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "vyla-home"
|
name = "vyla-home"
|
||||||
version = "1.1.42"
|
version = "1.1.43"
|
||||||
description = "Vyla Home Desktop App Launcher"
|
description = "Vyla Home Desktop App Launcher"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
|
|||||||
@@ -433,7 +433,7 @@ const LINK_HANDLER_SCRIPT: &str =
|
|||||||
nav.id = 'vyla-floating-nav';
|
nav.id = 'vyla-floating-nav';
|
||||||
nav.innerHTML = `
|
nav.innerHTML = `
|
||||||
<div class="vyla-nav-logo-wrap" title="Go to Home">
|
<div class="vyla-nav-logo-wrap" title="Go to Home">
|
||||||
<img src="https://gitlab.com/vyla-entertainment/home-frontend/-/raw/main/assets/images/icons/logo_white.png" alt="Logo" />
|
<img src="https://gitlab.com/vyla-entertainment/go/-/raw/main/assets/logos/white_logo.png" alt="Logo" />
|
||||||
</div>
|
</div>
|
||||||
<div class="vyla-nav-links">
|
<div class="vyla-nav-links">
|
||||||
<button class="vyla-nav-btn" id="vyla-btn-discord" title="Discord Community">
|
<button class="vyla-nav-btn" id="vyla-btn-discord" title="Discord Community">
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://schema.tauri.app/config/2",
|
"$schema": "https://schema.tauri.app/config/2",
|
||||||
"productName": "Vyla Home",
|
"productName": "Vyla Home",
|
||||||
"version": "1.1.42",
|
"version": "1.1.43",
|
||||||
"identifier": "com.vyla.home",
|
"identifier": "com.vyla.home",
|
||||||
"build": {
|
"build": {
|
||||||
"frontendDist": "../ui"
|
"frontendDist": "../ui"
|
||||||
@@ -45,4 +45,4 @@
|
|||||||
"../node_modules/**/*"
|
"../node_modules/**/*"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user