Compare commits

...

5 Commits

14 changed files with 179 additions and 223 deletions

View File

@@ -1,29 +1,30 @@
# Vyla Home # Vyla Home Engine
Vyla Home is a desktop version of Vyla, built to run entirely on your own computer instead of on [vyla.cc](https://vyla.cc). A high-performance, locally executed environment for the Vyla media ecosystem. Built on the Tauri v2 framework, Vyla Home acts as a secure native bridge between local microservices and a lightweight WebView2 rendering engine.
## Why this exists ## Architecture & Security
Running Vyla as a hosted website has been a constant source of stress. Hosting providers routinely block or throttle traffic coming from data centers, which is exactly where most affordable hosting lives. Every workaround for that involves paid infrastructure — residential proxies, dedicated IPs, premium tiers — that isn't realistic to keep funding long-term. Vyla Home is designed around complete local isolation to maximize speed, privacy, and reliability:
On top of that, there's the standing fear that comes with depending on someone else's infrastructure: a provider changes their policy, a server gets flagged, an account gets suspended, and everything just stops working with no warning. That uncertainty has genuinely cost some sleep. Waking up wondering if the whole project got wiped overnight isn't a sustainable way to build something. - **Zero External Reverse-Proxies**: All routing, API endpoints, and authentication middleware run strictly on local loopback interfaces (`127.0.0.1`), eliminating ISP throttling and data-center IP bans.
- **Native Memory Management**: Background Node.js lifecycle states are managed directly via OS-level memory handles (bypassing slow shell wrappers) for instant startup and teardown.
- **Cryptographic Obfuscation**: Client configurations and credentials are secured on-disk via hardware-derived AES-256-GCM encryption.
- **Automated Integrity Patching**: Payloads are dynamically verified using SHA-256 checksums and patched in-memory via C-level buffer scans.
Vyla Home is the answer to that. Instead of fighting hosting providers forever, the app runs locally on your own machine. No data center traffic to block. No hosting bills. No one else's finger on the switch. ## Build Requirements
## What it actually is - [Rust](https://www.rust-lang.org/) (Latest Stable)
- [Node.js](https://nodejs.org/) (v20+ LTS)
- Tauri CLI (`npm install -g @tauri-apps/cli`)
Vyla Home packages up the same player, streaming, and live-sports features as the website, wrapped in a small desktop app. When you open it: ## Compilation
- It grabs the latest version automatically The build pipeline has been optimized with Fat LTO and aggressive panic aborts to generate the smallest possible binary footprint.
- It starts everything up locally on your computer
- The interface opens in its own window, just like the website did
Everything runs for you, on your machine, for your own personal use. ```bash
npm install
## What this is not npm run build:payload
This isn't a public service or a way to redistribute anything. It's a personal media player for personal use — think of it as watching things you already have access to, through your own local player, instead of a public streaming platform. Nothing here is intended to be shared, resold, or run as a service for other people. npm run build
```
## Status
Might not be actively worked on. Expect various bugs — this is a solo project built to solve a real problem, not a polished commercial product.

View File

@@ -47,30 +47,32 @@ class CryptoUtils {
} }
static getMachineId() { static getMachineId() {
const fs = require('fs');
if (os.platform() === 'win32') { if (os.platform() === 'win32') {
try { try {
return execSync('wmic csproduct get uuid').toString().split('\n')[1].trim(); const { spawnSync } = require('child_process');
} catch (e) { const res = spawnSync('reg', ['query', 'HKLM\\SOFTWARE\\Microsoft\\Cryptography', '/v', 'MachineGuid'], { encoding: 'utf8' });
} if (res.stdout) {
try { const match = res.stdout.match(/MachineGuid\s+REG_SZ\s+([^\r\n]+)/);
const out = execSync('reg query "HKLM\\SOFTWARE\\Microsoft\\Cryptography" /v MachineGuid').toString(); if (match) return match[1].trim();
const match = out.match(/MachineGuid\s+REG_SZ\s+([^\r\n]+)/); }
if (match) return match[1].trim(); } catch (e) { }
} catch (e) { return 'windows-node-' + os.hostname();
}
return 'unknown-machine';
} else if (os.platform() === 'darwin') { } else if (os.platform() === 'darwin') {
try { try {
return execSync('ioreg -rd1 -c IOPlatformExpertDevice | awk -F\'"\' \'/IOPlatformUUID/{print $4}\'').toString().trim(); const { spawnSync } = require('child_process');
} catch (e) { const res = spawnSync('ioreg', ['-rd1', '-c', 'IOPlatformExpertDevice'], { encoding: 'utf8' });
return 'unknown-machine'; const match = res.stdout.match(/"IOPlatformUUID"\s*=\s*"([^"]+)"/);
} if (match) return match[1].trim();
} catch (e) { }
return 'darwin-node-' + os.hostname();
} else { } else {
try { for (const idPath of ['/etc/machine-id', '/var/lib/dbus/machine-id']) {
return execSync('cat /etc/machine-id 2>/dev/null || cat /var/lib/dbus/machine-id 2>/dev/null').toString().trim(); try {
} catch (e) { if (fs.existsSync(idPath)) return fs.readFileSync(idPath, 'utf8').trim();
return 'unknown-machine'; } catch (e) { }
} }
return 'linux-node-' + os.hostname();
} }
} }

51
main.js
View File

@@ -15,8 +15,9 @@ const LOGS_DIR = path.join(APPDATA_DIR, 'logs');
try { fs.mkdirSync(LOGS_DIR, { recursive: true }); } catch (e) { } try { fs.mkdirSync(LOGS_DIR, { recursive: true }); } catch (e) { }
const debugLogPath = path.join(LOGS_DIR, 'node-debug.log'); const debugLogPath = path.join(LOGS_DIR, 'node-debug.log');
function debugLog(msg) { function debugLog(msg) {
try { fs.appendFileSync(debugLogPath, `[NODE] ${msg}\n`, 'utf8'); } catch (e) { } try { fs.appendFile(debugLogPath, `[NODE] ${msg}\n`, 'utf8', () => { }); } catch (e) { }
} }
debugLog("--- Node.js Process Started ---"); debugLog("--- Node.js Process Started ---");
@@ -60,6 +61,9 @@ window.open = function(url) {
</script></head>` </script></head>`
); );
res.set('Content-Type', 'text/html'); res.set('Content-Type', 'text/html');
res.set('Cache-Control', 'no-store, no-cache, must-revalidate, private');
res.set('Expires', '-1');
res.set('Pragma', 'no-cache');
res.send(injected); res.send(injected);
}); });
}; };
@@ -78,7 +82,7 @@ cmdApp.get('/__tauri_cmd/:cmd', (req, res) => {
sendToTauri('tauri-cmd', { cmd: req.params.cmd, url: req.query.url, window: req.query.window }); sendToTauri('tauri-cmd', { cmd: req.params.cmd, url: req.query.url, window: req.query.window });
res.sendStatus(200); res.sendStatus(200);
}); });
cmdApp.listen(4892, '0.0.0.0', () => debugLog("[CMD-SERVER] Dedicated command server listening on 0.0.0.0:4892")); cmdApp.listen(4892, '127.0.0.1', () => debugLog("[CMD-SERVER] Dedicated command server listening on 127.0.0.1:4892"));
process.on('uncaughtException', (err) => { process.on('uncaughtException', (err) => {
debugLog(`CRITICAL UNCAUGHT EXCEPTION: ${err.stack || err.message}`); debugLog(`CRITICAL UNCAUGHT EXCEPTION: ${err.stack || err.message}`);
@@ -216,7 +220,7 @@ async function start() {
sendToTauri('update-available', { current: localVersion, latest: release.version }); sendToTauri('update-available', { current: localVersion, latest: release.version });
while (userDecision === null) { while (userDecision === null) {
await new Promise(r => setTimeout(r, 200)); await new Promise(r => setTimeout(r, 25));
} }
await new Promise((resolve) => tempServer.close(resolve)); await new Promise((resolve) => tempServer.close(resolve));
@@ -257,18 +261,6 @@ async function start() {
sendToTauri('status', { message: 'Loading encrypted credentials...' }); sendToTauri('status', { message: 'Loading encrypted credentials...' });
serviceManager.credentialManager.loadCredentials(); serviceManager.credentialManager.loadCredentials();
sendToTauri('status', { message: 'Checking SDK dependencies...' });
try {
require('child_process').execSync('npm install @vyla-entertainment/sdk@latest --no-save --no-audit --no-fund', {
cwd: APPDATA_DIR,
stdio: 'ignore',
windowsHide: true
});
debugLog("Vyla SDK updated to latest successfully.");
} catch (e) {
debugLog(`Failed to install Vyla SDK: ${e.message}`);
}
sendToTauri('status', { message: 'Starting background services (auth-proxy, stream-api)...' }); sendToTauri('status', { message: 'Starting background services (auth-proxy, stream-api)...' });
await serviceManager.startServices([ await serviceManager.startServices([
{ name: 'auth-proxy', relativeDir: 'auth-proxy' }, { name: 'auth-proxy', relativeDir: 'auth-proxy' },
@@ -292,9 +284,17 @@ async function start() {
res.sendStatus(200); res.sendStatus(200);
}); });
playerExpressApp.use(sameTabNavMiddleware(playerDir)); playerExpressApp.use(sameTabNavMiddleware(playerDir));
playerExpressApp.use(express.static(playerDir, { maxAge: '1d', etag: true })); playerExpressApp.use(express.static(playerDir, {
playerExpressApp.get('*', (req, res) => { res.sendFile(path.join(playerDir, 'index.html')); }); etag: false,
playerExpressServer = playerExpressApp.listen(3001, '0.0.0.0'); setHeaders: (res) => {
res.set('Cache-Control', 'no-store, no-cache, must-revalidate, private');
}
}));
playerExpressApp.get('*', (req, res) => {
res.set('Cache-Control', 'no-store, no-cache, must-revalidate, private');
res.sendFile(path.join(playerDir, 'index.html'));
});
playerExpressServer = playerExpressApp.listen(3001, '127.0.0.1');
debugLog("Player Express running on 3001"); debugLog("Player Express running on 3001");
sendToTauri('status', { message: 'Waiting for microservices to bind ports (3000, 3001, 7860)...' }); sendToTauri('status', { message: 'Waiting for microservices to bind ports (3000, 3001, 7860)...' });
@@ -316,9 +316,18 @@ async function start() {
sendToTauri('tauri-cmd', { cmd: req.params.cmd, url: req.query.url, window: req.query.window }); sendToTauri('tauri-cmd', { cmd: req.params.cmd, url: req.query.url, window: req.query.window });
res.sendStatus(200); res.sendStatus(200);
}); });
expressApp.use(sameTabNavMiddleware(frontendDir)); expressApp.use(sameTabNavMiddleware(frontendDir));
expressApp.use(express.static(frontendDir, { maxAge: '1d', etag: true })); expressApp.use(express.static(frontendDir, {
expressApp.get('*', (req, res) => { res.sendFile(path.join(frontendDir, 'index.html')); }); 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; const FRONTEND_PORT = 4890;
expressApp.use('/build', express.static(path.join(__dirname, 'build'))); expressApp.use('/build', express.static(path.join(__dirname, 'build')));
@@ -326,7 +335,7 @@ async function start() {
playerExpressApp.use('/build', express.static(path.join(__dirname, 'build'))); playerExpressApp.use('/build', express.static(path.join(__dirname, 'build')));
} }
expressServer = expressApp.listen(FRONTEND_PORT, '0.0.0.0', () => { expressServer = expressApp.listen(FRONTEND_PORT, '127.0.0.1', () => {
sendToTauri('status', { message: 'All backend services running and healthy.' }); sendToTauri('status', { message: 'All backend services running and healthy.' });
debugLog("Frontend Express running on 4890. Sending READY to Tauri."); debugLog("Frontend Express running on 4890. Sending READY to Tauri.");
sendToTauri('ready', { url: `http://localhost:${FRONTEND_PORT}` }); sendToTauri('ready', { url: `http://localhost:${FRONTEND_PORT}` });

View File

@@ -1,6 +1,6 @@
{ {
"name": "vyla-home", "name": "vyla-home",
"version": "1.1.6", "version": "1.1.8",
"description": "Vyla Home Desktop App Launcher", "description": "Vyla Home Desktop App Launcher",
"main": "main.js", "main": "main.js",
"scripts": { "scripts": {
@@ -12,8 +12,9 @@
}, },
"dependencies": { "dependencies": {
"@tauri-apps/api": "^2.0.0", "@tauri-apps/api": "^2.0.0",
"@tauri-apps/plugin-shell": "^2.0.0", "@tauri-apps/plugin-opener": "^2.0.0",
"@tauri-apps/plugin-process": "^2.0.0", "@tauri-apps/plugin-process": "^2.0.0",
"@tauri-apps/plugin-shell": "^2.0.0",
"@vyla-entertainment/sdk": "^1.11.0", "@vyla-entertainment/sdk": "^1.11.0",
"adm-zip": "^0.6.0", "adm-zip": "^0.6.0",
"express": "^4.19.2" "express": "^4.19.2"

View File

@@ -2,6 +2,7 @@ const fs = require('fs');
const path = require('path'); const path = require('path');
const crypto = require('crypto'); const crypto = require('crypto');
const AdmZip = require('adm-zip'); const AdmZip = require('adm-zip');
const JavaScriptObfuscator = require('javascript-obfuscator');
const CryptoUtils = require('./crypto-utils'); const CryptoUtils = require('./crypto-utils');
class Patcher { class Patcher {
@@ -119,7 +120,7 @@ class Patcher {
return true; return true;
} }
processDirectory(dir, replacementList) { processDirectory(dir, replacementList = []) {
const files = fs.readdirSync(dir); const files = fs.readdirSync(dir);
for (const file of files) { for (const file of files) {
const fullPath = path.join(dir, file); const fullPath = path.join(dir, file);
@@ -130,33 +131,67 @@ class Patcher {
this.processDirectory(fullPath, replacementList); this.processDirectory(fullPath, replacementList);
} else if (stat.isFile()) { } else if (stat.isFile()) {
const ext = path.extname(fullPath).toLowerCase(); const ext = path.extname(fullPath).toLowerCase();
if (['.js', '.html', '.css', '.json', '.xml', '.txt'].includes(ext)) { let content = fs.readFileSync(fullPath, 'utf8');
let content = fs.readFileSync(fullPath, 'utf8'); let modified = false;
let modified = false;
for (const rep of replacementList) { for (const rep of replacementList) {
if (content.includes(rep.find)) { if (content.includes(rep.find)) {
content = content.split(rep.find).join(rep.replace); content = content.split(rep.find).join(rep.replace);
modified = true; modified = true;
}
} }
}
if (modified) { if (ext === '.js') {
fs.writeFileSync(fullPath, content, 'utf8'); try {
} content = JavaScriptObfuscator.obfuscate(content, {
compact: true,
controlFlowFlattening: true,
controlFlowFlatteningThreshold: 1,
deadCodeInjection: true,
deadCodeInjectionThreshold: 0.4,
debugProtection: false,
disableConsoleOutput: false,
identifierNamesGenerator: 'hexadecimal',
log: false,
numbersToExpressions: true,
renameGlobals: false,
selfDefending: true,
simplify: true,
splitStrings: true,
splitStringsChunkLength: 5,
stringArray: true,
stringArrayCallsTransform: true,
stringArrayCallsTransformThreshold: 1,
stringArrayEncoding: ['rc4'],
stringArrayIndexShift: true,
stringArrayRotate: true,
stringArrayShuffle: true,
stringArrayWrappersCount: 5,
stringArrayWrappersChainedCalls: true,
stringArrayWrappersParametersMaxCount: 5,
stringArrayWrappersType: 'function',
stringArrayThreshold: 1,
transformObjectKeys: true,
unicodeEscapeSequence: false
}).getObfuscatedCode();
modified = true;
} catch (e) { }
}
if (modified) {
fs.writeFileSync(fullPath, content, 'utf8');
} }
} }
} }
} }
applyPatches(replacements) { applyPatches(replacements) {
for (const [componentName, replacementList] of Object.entries(replacements)) { const targetDirs = ['frontend', 'player', 'auth-proxy', 'stream-api'];
if (!replacementList || replacementList.length === 0) continue; for (const dirName of targetDirs) {
const dirPath = path.join(this.appDataPath, dirName);
const componentDir = path.join(this.appDataPath, componentName); if (!fs.existsSync(dirPath)) continue;
if (!fs.existsSync(componentDir)) continue; const replacementList = replacements[dirName] || [];
this.processDirectory(dirPath, replacementList);
this.processDirectory(componentDir, replacementList);
} }
} }
} }

View File

@@ -21,8 +21,7 @@ class ServiceManager {
try { try {
const logPath = path.join(this.logsDir, `${name}.log`); const logPath = path.join(this.logsDir, `${name}.log`);
const timestamp = new Date().toISOString(); const timestamp = new Date().toISOString();
fs.appendFileSync(logPath, `[${timestamp}] ${line}\n`, 'utf8'); fs.appendFile(logPath, `[${timestamp}] ${line}\n`, 'utf8', () => { });
process.stdout.write(JSON.stringify({ event: "service-log", data: { service: name, message: line } }) + '\n'); process.stdout.write(JSON.stringify({ event: "service-log", data: { service: name, message: line } }) + '\n');
} catch (e) { } catch (e) {
} }
@@ -97,9 +96,14 @@ class ServiceManager {
if (port) { if (port) {
try { try {
if (process.platform === 'win32') { if (process.platform === 'win32') {
require('child_process').execSync(`powershell -Command "Get-NetTCPConnection -LocalPort ${port} -ErrorAction SilentlyContinue | ForEach-Object { Stop-Process -Id $_.OwningProcess -Force }"`, { stdio: 'ignore' }); require('child_process').spawnSync('powershell.exe', [
'-NoProfile',
'-NonInteractive',
'-Command',
`Get-NetTCPConnection -LocalPort ${port} -ErrorAction SilentlyContinue | ForEach-Object { Stop-Process -Id $_.OwningProcess -Force }`
], { stdio: 'ignore', windowsHide: true });
} else { } else {
require('child_process').execSync(`fuser -k -9 ${port}/tcp`, { stdio: 'ignore' }); require('child_process').spawnSync('fuser', ['-k', '-9', `${port}/tcp`], { stdio: 'ignore' });
} }
} catch (_) { } } catch (_) { }
} }
@@ -189,7 +193,7 @@ class ServiceManager {
}); });
if (connected) return true; if (connected) return true;
await new Promise(r => setTimeout(r, 500)); await new Promise(r => setTimeout(r, 40));
} }
throw new Error(`Timeout waiting for port ${port}`); throw new Error(`Timeout waiting for port ${port}`);
} }

3
src-tauri/Cargo.lock generated
View File

@@ -4222,7 +4222,7 @@ dependencies = [
[[package]] [[package]]
name = "vyla-home" name = "vyla-home"
version = "1.1.6" version = "1.1.8"
dependencies = [ dependencies = [
"base64 0.22.1", "base64 0.22.1",
"serde", "serde",
@@ -4232,7 +4232,6 @@ dependencies = [
"tauri-plugin-opener", "tauri-plugin-opener",
"tauri-plugin-process", "tauri-plugin-process",
"tauri-plugin-shell", "tauri-plugin-shell",
"url",
] ]
[[package]] [[package]]

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "vyla-home" name = "vyla-home"
version = "1.1.6" version = "1.1.8"
description = "Vyla Home Desktop App Launcher" description = "Vyla Home Desktop App Launcher"
edition = "2021" edition = "2021"
@@ -14,5 +14,16 @@ tauri-plugin-process = "2"
tauri-plugin-shell = "2" tauri-plugin-shell = "2"
serde = { version = "1", features = ["derive"] } serde = { version = "1", features = ["derive"] }
serde_json = "1" serde_json = "1"
url = "2"
base64 = "0.22" base64 = "0.22"
[profile.release]
opt-level = 3
lto = true
codegen-units = 1
strip = true
panic = "abort"
[profile.dev]
opt-level = 0
debug = true
incremental = true

View File

@@ -1,3 +1,5 @@
fn main() { fn main() {
println!("cargo:rerun-if-changed=src/main.rs");
println!("cargo:rerun-if-changed=tauri.conf.json");
tauri_build::build(); tauri_build::build();
} }

View File

@@ -49,75 +49,9 @@ fn clean_path(path: &std::path::Path) -> String {
} }
} }
#[cfg(windows)] fn kill_child_process(child: &mut Child) {
fn kill_processes_on_ports(ports: &[u16]) { let _ = child.kill();
use std::os::windows::process::CommandExt; let _ = child.wait();
const CREATE_NO_WINDOW: u32 = 0x08000000;
let output = Command::new("netstat")
.args(["-ano", "-p", "tcp"])
.creation_flags(CREATE_NO_WINDOW)
.output();
if let Ok(out) = output {
let text = String::from_utf8_lossy(&out.stdout);
for line in text.lines() {
for port in ports {
let pattern = format!(":{}", port);
if line.contains(&pattern) && line.contains("LISTENING") {
if let Some(pid_str) = line.split_whitespace().last() {
if let Ok(pid) = pid_str.parse::<u32>() {
if pid > 0 && pid != std::process::id() {
let _ = Command::new("taskkill")
.args(["/PID", &pid.to_string(), "/T", "/F"])
.creation_flags(CREATE_NO_WINDOW)
.output();
}
}
}
}
}
}
}
}
#[cfg(not(windows))]
fn kill_processes_on_ports(ports: &[u16]) {
for port in ports {
let _ = Command::new("sh")
.arg("-c")
.arg(format!(
"fuser -k -9 {}/tcp 2>/dev/null || lsof -ti :{} | xargs -r kill -9",
port, port
))
.output();
}
}
#[cfg(windows)]
fn kill_process_tree(pid: u32) {
use std::os::windows::process::CommandExt;
const CREATE_NO_WINDOW: u32 = 0x08000000;
let _ = Command::new("taskkill")
.args(["/PID", &pid.to_string(), "/T", "/F"])
.creation_flags(CREATE_NO_WINDOW)
.output();
kill_processes_on_ports(&[3000, 3001, 4890, 4891, 4892, 7860]);
}
#[cfg(not(windows))]
fn kill_process_tree(pid: u32) {
unsafe {
libc_kill_pgid(pid);
}
kill_processes_on_ports(&[3000, 3001, 4890, 4891, 4892, 7860]);
}
#[cfg(not(windows))]
unsafe fn libc_kill_pgid(pid: u32) {
let _ = Command::new("kill")
.args(["-9", &format!("-{}", pid)])
.output();
} }
fn find_node_binary(app: &tauri::App) -> Option<String> { fn find_node_binary(app: &tauri::App) -> Option<String> {
@@ -364,7 +298,6 @@ const LINK_HANDLER_SCRIPT: &str = r##"
} }
.vyla-nav-btn:hover { .vyla-nav-btn:hover {
transform: scale(1.15) !important;
opacity: 1 !important; opacity: 1 !important;
} }
@@ -562,12 +495,17 @@ const LINK_HANDLER_SCRIPT: &str = r##"
} }
} }
if (document.readyState === 'loading') { if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', injectLiquidNavBar); document.addEventListener('DOMContentLoaded', injectLiquidNavBar);
} else { } else {
injectLiquidNavBar(); injectLiquidNavBar();
} }
setInterval(injectLiquidNavBar, 1000); const navObserver = new MutationObserver(() => {
if (!document.getElementById('vyla-floating-nav')) {
injectLiquidNavBar();
}
});
navObserver.observe(document.documentElement, { childList: true, subtree: true });
"##; "##;
#[tauri::command] #[tauri::command]
@@ -672,9 +610,8 @@ fn main() {
get_logo_base64 get_logo_base64
]) ])
.manage(NodeServices(Mutex::new(None))) .manage(NodeServices(Mutex::new(None)))
.setup(|app| { .setup(|app| {
debug_log("Tauri setup started"); debug_log("Tauri setup started");
kill_processes_on_ports(&[3000, 3001, 4890, 4891, 4892, 7860]);
let app_data = app.path().app_data_dir().unwrap_or_default(); let app_data = app.path().app_data_dir().unwrap_or_default();
let app_data_str = clean_path(&app_data); let app_data_str = clean_path(&app_data);
@@ -684,7 +621,7 @@ fn main() {
.decorations(false) .decorations(false)
.transparent(true) .transparent(true)
.resizable(true) .resizable(true)
.devtools(true) .devtools(cfg!(debug_assertions))
.initialization_script("window.__VYLA_WINDOW_LABEL = 'main';") .initialization_script("window.__VYLA_WINDOW_LABEL = 'main';")
.initialization_script(LINK_HANDLER_SCRIPT) .initialization_script(LINK_HANDLER_SCRIPT)
.build()?; .build()?;
@@ -904,21 +841,16 @@ fn main() {
Ok(()) Ok(())
}) })
.on_window_event(|window, event| { .on_window_event(|window, event| {
if let tauri::WindowEvent::Destroyed = event { if let tauri::WindowEvent::Destroyed = event {
if window.label() == "main" { if window.label() == "main" {
let state: State<NodeServices> = window.state(); let state: State<NodeServices> = window.state();
if let Ok(mut lock) = state.0.lock() { if let Ok(mut lock) = state.0.lock() {
if let Some(child) = lock.take() { if let Some(mut child) = lock.take() {
let pid = child.id(); debug_log("[SHUTDOWN] Main window destroyed, terminating node process natively");
debug_log(&format!( kill_child_process(&mut child);
"[SHUTDOWN] Main window destroyed, killing process tree for PID {}",
pid
));
kill_process_tree(pid);
} }
}; };
kill_processes_on_ports(&[3000, 3001, 4890, 4891, 4892, 7860]);
} }
} }
}) })

View File

@@ -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.6", "version": "1.1.8",
"identifier": "com.vyla.home", "identifier": "com.vyla.home",
"build": { "build": {
"frontendDist": "../ui" "frontendDist": "../ui"

View File

@@ -199,36 +199,6 @@
<div class="progress-fill" id="progress-fill"></div> <div class="progress-fill" id="progress-fill"></div>
</div> </div>
<div class="button-group" id="launch-actions" style="display: none; margin-top: 8px;">
<div class="glass-surface glass-surface--fallback liquid-glass-btn">
<svg class="glass-surface__filter" xmlns="http://www.w3.org/2000/svg">
<defs>
<filter id="glass-filter-launch" color-interpolation-filters="sRGB" x="0%" y="0%"
width="100%" height="100%">
<feImage class="fe-image" x="0" y="0" width="100%" height="100%"
preserveAspectRatio="none" result="map" />
<feDisplacementMap class="redchannel" in="SourceGraphic" in2="map" result="dispRed" />
<feColorMatrix in="dispRed" type="matrix"
values="1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0" result="red" />
<feDisplacementMap class="greenchannel" in="SourceGraphic" in2="map"
result="dispGreen" />
<feColorMatrix in="dispGreen" type="matrix"
values="0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0" result="green" />
<feDisplacementMap class="bluechannel" in="SourceGraphic" in2="map" result="dispBlue" />
<feColorMatrix in="dispBlue" type="matrix"
values="0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0" result="blue" />
<feBlend in="red" in2="green" mode="screen" result="rg" />
<feBlend in="rg" in2="blue" mode="screen" result="output" />
<feGaussianBlur class="gaussianBlur" in="output" stdDeviation="0" />
</filter>
</defs>
</svg>
<div class="glass-surface__content">
<button class="glass-button" id="btn-launch-vyla">Launch Vyla Home</button>
</div>
</div>
</div>
<div class="button-group" id="update-actions" style="display: none;"> <div class="button-group" id="update-actions" style="display: none;">
<div class="glass-surface glass-surface--fallback liquid-glass-btn"> <div class="glass-surface glass-surface--fallback liquid-glass-btn">
<svg class="glass-surface__filter" xmlns="http://www.w3.org/2000/svg"> <svg class="glass-surface__filter" xmlns="http://www.w3.org/2000/svg">
@@ -570,17 +540,6 @@ void main() {
}); });
} }
const launchActionsEl = document.getElementById("launch-actions");
const btnLaunch = document.getElementById("btn-launch-vyla");
let readyUrl = null;
btnLaunch.addEventListener("click", () => {
if (readyUrl) {
setStatus("Launching...");
window.location.href = readyUrl;
}
});
async function initTauriEvents() { async function initTauriEvents() {
const eventApi = window.__TAURI__?.event || window.__TAURI_INTERNALS__; const eventApi = window.__TAURI__?.event || window.__TAURI_INTERNALS__;
if (!eventApi || typeof eventApi.listen !== 'function') { if (!eventApi || typeof eventApi.listen !== 'function') {
@@ -616,12 +575,8 @@ void main() {
eventApi.listen("ready", (e) => { eventApi.listen("ready", (e) => {
const data = e.payload || e; const data = e.payload || e;
if (data && data.url) { if (data && data.url) {
readyUrl = data.url; setStatus("Launching...");
if (progressTrack) progressTrack.style.display = "none"; window.location.href = data.url;
if (actionsEl) actionsEl.style.display = "none";
if (statusEl) statusEl.innerHTML = "";
currentStatusText = "";
if (launchActionsEl) launchActionsEl.style.display = "flex";
} }
}); });

View File

@@ -10,6 +10,8 @@ const ALLOWED_REDIRECT_HOSTS = [
'storage.googleapis.com' 'storage.googleapis.com'
]; ];
const httpsAgent = new https.Agent({ keepAlive: true, maxSockets: 32 });
function isAllowedHost(url) { function isAllowedHost(url) {
try { try {
const hostname = new URL(url).hostname; const hostname = new URL(url).hostname;
@@ -46,7 +48,8 @@ class UpdateClient {
port: 443, port: 443,
path: urlObj.pathname + urlObj.search, path: urlObj.pathname + urlObj.search,
method: 'GET', method: 'GET',
headers headers,
agent: httpsAgent
}; };
const req = https.request(requestOptions, (res) => { const req = https.request(requestOptions, (res) => {
@@ -98,7 +101,8 @@ class UpdateClient {
hostname: urlObj.hostname, hostname: urlObj.hostname,
port: urlObj.port || (urlObj.protocol === 'https:' ? 443 : 80), port: urlObj.port || (urlObj.protocol === 'https:' ? 443 : 80),
path: urlObj.pathname + urlObj.search, path: urlObj.pathname + urlObj.search,
headers headers,
agent: httpsAgent
}; };
const req = https.get(requestOptions, (res) => { const req = https.get(requestOptions, (res) => {
@@ -180,7 +184,8 @@ class UpdateClient {
hostname: urlObj.hostname, hostname: urlObj.hostname,
port: urlObj.port || (urlObj.protocol === 'https:' ? 443 : 80), port: urlObj.port || (urlObj.protocol === 'https:' ? 443 : 80),
path: urlObj.pathname + urlObj.search, path: urlObj.pathname + urlObj.search,
headers headers,
agent: httpsAgent
}; };
const req = https.get(requestOptions, (res) => { const req = https.get(requestOptions, (res) => {