mirror of
https://gitlab.com/vyla-entertainment/home.git
synced 2026-11-13 21:57:21 -05:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 13f94ab8b9 | |||
| 4946975997 | |||
| 9c401d5487 |
10
.gitignore
vendored
10
.gitignore
vendored
@@ -1,7 +1,6 @@
|
||||
# Dependencies
|
||||
node_modules/
|
||||
package-lock.json
|
||||
|
||||
# Build outputs
|
||||
dist/
|
||||
dist-build/
|
||||
temp-validation-extract/
|
||||
@@ -10,37 +9,30 @@ manifest.json
|
||||
integrity-report.json
|
||||
validation-report.json
|
||||
|
||||
# Rust & Tauri
|
||||
src-tauri/target/
|
||||
|
||||
# Encrypted files (build-time only)
|
||||
config/encrypted-credentials.json
|
||||
|
||||
# Sensitive files
|
||||
credentials.json
|
||||
.env
|
||||
*.key
|
||||
*.pem
|
||||
|
||||
# OS files
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
desktop.ini
|
||||
|
||||
# IDE
|
||||
.vscode/
|
||||
.idea/
|
||||
*.swp
|
||||
*.swo
|
||||
*~
|
||||
|
||||
# Logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# Temporary files
|
||||
*.tmp
|
||||
*.temp
|
||||
download-temp.zip
|
||||
BIN
bin/WebView2Loader.dll
Normal file
BIN
bin/WebView2Loader.dll
Normal file
Binary file not shown.
2366
package-lock.json
generated
2366
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vyla-home",
|
||||
"version": "1.0.9",
|
||||
"version": "1.1.0",
|
||||
"description": "Vyla Home Desktop App Launcher",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
@@ -54,4 +54,4 @@
|
||||
"installerHeaderIcon": "build/icon.ico"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -69,7 +69,7 @@ class Patcher {
|
||||
const trashPath = fullPath + '.trash.' + Date.now();
|
||||
fs.renameSync(fullPath, trashPath);
|
||||
} catch (renameErr) {
|
||||
console.warn(`[PATCHER] Could not remove or rename ${fullPath}. It will be overwritten.`);
|
||||
console.warn(`Could not remove or rename ${fullPath}. It will be overwritten.`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
74
release.js
74
release.js
@@ -137,7 +137,7 @@ async function main() {
|
||||
|
||||
const version = customTag || `v${incrementVersion()}`;
|
||||
|
||||
console.log(`=== Building Vyla Home Release (${version}) ===`);
|
||||
console.log(`Building Vyla Home Release (${version})`);
|
||||
|
||||
console.log('[1/4] Building update payload and manifest...');
|
||||
execSync('node build-pipeline.js', { stdio: 'inherit' });
|
||||
@@ -153,13 +153,15 @@ async function main() {
|
||||
let installerUploadName = null;
|
||||
|
||||
if (isFullBuild) {
|
||||
console.log('[Optional] Ensuring bundled Node.js runtime...');
|
||||
console.log('Ensuring bundled Node.js runtime...');
|
||||
await ensureBundledNode();
|
||||
|
||||
console.log('[Optional] Compiling Windows Tauri installer locally...');
|
||||
console.log('Ensuring WebView2Loader.dll is present for packaging...');
|
||||
await ensureWebView2Loader();
|
||||
|
||||
console.log('Compiling Windows Tauri installer locally...');
|
||||
execSync('npm run build', {
|
||||
stdio: 'inherit',
|
||||
env: Object.assign({}, process.env, { WEBVIEW2_STATIC_LIB: '1' })
|
||||
stdio: 'inherit'
|
||||
});
|
||||
|
||||
const nsisDir = path.join(__dirname, 'src-tauri/target/release/bundle/nsis');
|
||||
@@ -238,6 +240,68 @@ function ensureBundledNode() {
|
||||
});
|
||||
}
|
||||
|
||||
function ensureWebView2Loader() {
|
||||
const releaseDir = path.join(__dirname, 'src-tauri', 'target', 'release');
|
||||
const binDir = path.join(__dirname, 'bin');
|
||||
fs.mkdirSync(releaseDir, { recursive: true });
|
||||
fs.mkdirSync(binDir, { recursive: true });
|
||||
|
||||
const targetDllPath = path.join(releaseDir, 'WebView2Loader.dll');
|
||||
const binDllPath = path.join(binDir, 'WebView2Loader.dll');
|
||||
|
||||
const buildDir = path.join(__dirname, 'src-tauri', 'target', 'release', 'build');
|
||||
if (fs.existsSync(buildDir)) {
|
||||
const entries = fs.readdirSync(buildDir);
|
||||
for (const entry of entries) {
|
||||
if (entry.startsWith('webview2-com-sys-')) {
|
||||
const candidate = path.join(buildDir, entry, 'out', 'x64', 'WebView2Loader.dll');
|
||||
if (fs.existsSync(candidate)) {
|
||||
fs.copyFileSync(candidate, targetDllPath);
|
||||
fs.copyFileSync(candidate, binDllPath);
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const AdmZip = require('adm-zip');
|
||||
const tempNupkg = path.join(__dirname, 'temp-wv2.zip');
|
||||
const nupkgUrl = 'https://www.nuget.org/api/v2/package/Microsoft.Web.WebView2/1.0.4129.50';
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const fileStream = fs.createWriteStream(tempNupkg);
|
||||
const request = (url) => {
|
||||
https.get(url, (res) => {
|
||||
if (res.statusCode === 301 || res.statusCode === 302) {
|
||||
return request(res.headers.location);
|
||||
}
|
||||
res.pipe(fileStream);
|
||||
fileStream.on('finish', () => {
|
||||
fileStream.close();
|
||||
try {
|
||||
const zip = new AdmZip(tempNupkg);
|
||||
const zipEntries = zip.getEntries();
|
||||
const dllEntry = zipEntries.find(e => e.entryName.includes('x64/WebView2Loader.dll') || e.entryName.includes('x64\\WebView2Loader.dll'));
|
||||
if (dllEntry) {
|
||||
fs.writeFileSync(targetDllPath, dllEntry.getData());
|
||||
fs.writeFileSync(binDllPath, dllEntry.getData());
|
||||
}
|
||||
fs.unlinkSync(tempNupkg);
|
||||
resolve();
|
||||
} catch (e) {
|
||||
try { fs.unlinkSync(tempNupkg); } catch (_) { }
|
||||
reject(e);
|
||||
}
|
||||
});
|
||||
}).on('error', (err) => {
|
||||
try { fs.unlinkSync(tempNupkg); } catch (_) { }
|
||||
reject(err);
|
||||
});
|
||||
};
|
||||
request(nupkgUrl);
|
||||
});
|
||||
}
|
||||
|
||||
main().catch(err => {
|
||||
console.error('Release failed:', err.message);
|
||||
process.exit(1);
|
||||
|
||||
5169
src-tauri/Cargo.lock
generated
5169
src-tauri/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "vyla-home"
|
||||
version = "1.0.9"
|
||||
version = "1.1.0"
|
||||
description = "Vyla Home Desktop App Launcher"
|
||||
edition = "2021"
|
||||
|
||||
|
||||
@@ -1,35 +1,3 @@
|
||||
use std::env;
|
||||
use std::fs;
|
||||
use std::path::PathBuf;
|
||||
|
||||
fn main() {
|
||||
tauri_build::build();
|
||||
|
||||
if env::var("CARGO_CFG_TARGET_OS").unwrap_or_default() == "windows" {
|
||||
let target_dir = PathBuf::from(env::var("OUT_DIR").unwrap())
|
||||
.ancestors()
|
||||
.nth(3)
|
||||
.unwrap()
|
||||
.to_path_buf();
|
||||
|
||||
let build_dir = PathBuf::from(env::var("OUT_DIR").unwrap())
|
||||
.ancestors()
|
||||
.nth(2)
|
||||
.unwrap()
|
||||
.to_path_buf();
|
||||
|
||||
if let Ok(entries) = fs::read_dir(&build_dir) {
|
||||
for entry in entries.flatten() {
|
||||
let name = entry.file_name().to_string_lossy().to_string();
|
||||
if name.starts_with("webview2-com-sys-") {
|
||||
let dll_path = entry.path().join("out").join("x64").join("WebView2Loader.dll");
|
||||
if dll_path.exists() {
|
||||
let _ = fs::copy(&dll_path, target_dir.join("WebView2Loader.dll"));
|
||||
let _ = fs::copy(&dll_path, PathBuf::from("../bin").join("WebView2Loader.dll"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40,11 +40,6 @@ fn clean_path(path: &std::path::Path) -> String {
|
||||
}
|
||||
}
|
||||
|
||||
// Windows kill(pid) only terminates the named process, never its descendants.
|
||||
// service-manager.js spawns auth-proxy and stream-api as children of node.exe,
|
||||
// so a plain child.kill() from Rust leaves those orphaned and still holding
|
||||
// ports/handles open - which is exactly why node.exe survives in Task Manager
|
||||
// after the main window closes. taskkill /T walks the full process tree.
|
||||
#[cfg(windows)]
|
||||
fn kill_process_tree(pid: u32) {
|
||||
use std::os::windows::process::CommandExt;
|
||||
@@ -67,8 +62,6 @@ fn kill_process_tree(pid: u32) {
|
||||
|
||||
#[cfg(not(windows))]
|
||||
fn kill_process_tree(pid: u32) {
|
||||
// On Unix, killing the process group covers the same case (auth-proxy/
|
||||
// stream-api inherit the parent's group since detached is never set).
|
||||
unsafe {
|
||||
libc_kill_pgid(pid);
|
||||
}
|
||||
@@ -76,7 +69,6 @@ fn kill_process_tree(pid: u32) {
|
||||
|
||||
#[cfg(not(windows))]
|
||||
unsafe fn libc_kill_pgid(pid: u32) {
|
||||
// Negative pid signals the whole process group in POSIX kill(2).
|
||||
let _ = Command::new("kill")
|
||||
.args(["-9", &format!("-{}", pid)])
|
||||
.output();
|
||||
@@ -174,15 +166,8 @@ fn resolve_script_and_root(app: &tauri::App) -> (String, String) {
|
||||
|
||||
const LINK_HANDLER_SCRIPT: &str = r#"
|
||||
function doInvoke(cmd, args) {
|
||||
console.log(`[TitleBar-DEBUG] Invoking command: ${cmd}`, args);
|
||||
console.log(`[TitleBar-DEBUG] __TAURI__ available:`, !!window.__TAURI__);
|
||||
console.log(`[TitleBar-DEBUG] __TAURI__.core available:`, !!(window.__TAURI__ && window.__TAURI__.core));
|
||||
if (window.__TAURI__ && window.__TAURI__.core) {
|
||||
window.__TAURI__.core.invoke(cmd, args || {})
|
||||
.then(() => console.log(`[TitleBar-DEBUG] ${cmd} succeeded`))
|
||||
.catch((err) => console.error(`[TitleBar-DEBUG] ${cmd} failed:`, err));
|
||||
} else {
|
||||
console.error('[TitleBar-DEBUG] __TAURI__ global not available yet');
|
||||
window.__TAURI__.core.invoke(cmd, args || {});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,8 +177,6 @@ const LINK_HANDLER_SCRIPT: &str = r#"
|
||||
function dragWindow() { doInvoke('win_drag'); }
|
||||
|
||||
window.open = function(url, target, features) {
|
||||
console.log('[TitleBar-DEBUG] window.open intercepted:', url, 'target:', target, 'features:', features);
|
||||
console.log('[TitleBar-DEBUG] Current window label:', window.__VYLA_WINDOW_LABEL);
|
||||
doInvoke('open_new_window', { url: url });
|
||||
return null;
|
||||
};
|
||||
@@ -202,10 +185,7 @@ const LINK_HANDLER_SCRIPT: &str = r#"
|
||||
const a = e.target.closest('a');
|
||||
if (!a || !a.href) return;
|
||||
|
||||
console.log('[TitleBar-DEBUG] Link clicked:', a.href, 'target:', a.target, 'ctrlKey:', e.ctrlKey, 'metaKey:', e.metaKey, 'button:', e.button);
|
||||
|
||||
if (a.target === '_blank' || e.ctrlKey || e.metaKey || e.button === 1) {
|
||||
console.log('[TitleBar-DEBUG] Intercepting link click for new window:', a.href);
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
doInvoke('open_new_window', { url: a.href });
|
||||
@@ -213,17 +193,10 @@ const LINK_HANDLER_SCRIPT: &str = r#"
|
||||
}, true);
|
||||
|
||||
function injectTitlebar() {
|
||||
console.log('[TitleBar-DEBUG] injectTitlebar called');
|
||||
console.log('[TitleBar-DEBUG] Document URL:', window.location.href);
|
||||
console.log('[TitleBar-DEBUG] Document readyState:', document.readyState);
|
||||
console.log('[TitleBar-DEBUG] Window label:', window.__VYLA_WINDOW_LABEL);
|
||||
|
||||
if (document.getElementById('tauri-custom-titlebar')) {
|
||||
console.log('[TitleBar-DEBUG] Titlebar already exists, skipping');
|
||||
return;
|
||||
}
|
||||
if (!document.body) {
|
||||
console.log('[TitleBar-DEBUG] No document.body yet, skipping');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -321,28 +294,18 @@ const LINK_HANDLER_SCRIPT: &str = r#"
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
console.log('[TitleBar-DEBUG] Custom titlebar injected successfully');
|
||||
}
|
||||
|
||||
console.log('[TitleBar-DEBUG] Link handler script executing');
|
||||
console.log('[TitleBar-DEBUG] Current URL:', window.location.href);
|
||||
console.log('[TitleBar-DEBUG] Document readyState:', document.readyState);
|
||||
console.log('[TitleBar-DEBUG] Window label:', window.__VYLA_WINDOW_LABEL);
|
||||
|
||||
injectTitlebar();
|
||||
setInterval(injectTitlebar, 1000);
|
||||
|
||||
if (document.readyState === 'loading') {
|
||||
console.log('[TitleBar-DEBUG] Document still loading, adding DOMContentLoaded listener');
|
||||
document.addEventListener('DOMContentLoaded', injectTitlebar);
|
||||
} else {
|
||||
console.log('[TitleBar-DEBUG] Document already loaded, injecting titlebar immediately');
|
||||
injectTitlebar();
|
||||
}
|
||||
|
||||
window.addEventListener('load', injectTitlebar);
|
||||
console.log('[TitleBar-DEBUG] Link handler script setup complete');
|
||||
"#;
|
||||
|
||||
#[tauri::command]
|
||||
@@ -422,7 +385,7 @@ let window = WebviewWindowBuilder::new(app, "main", WebviewUrl::App("index.html"
|
||||
.transparent(true)
|
||||
.resizable(true)
|
||||
.devtools(true)
|
||||
.initialization_script("console.log('[MAIN-WINDOW-DEBUG] Main window initialization script running'); window.__VYLA_WINDOW_LABEL = 'main'; console.log('[MAIN-WINDOW-DEBUG] Main window label set to main');")
|
||||
.initialization_script("window.__VYLA_WINDOW_LABEL = 'main';")
|
||||
.initialization_script(LINK_HANDLER_SCRIPT)
|
||||
.build()?;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"productName": "Vyla Home",
|
||||
"version": "1.0.9",
|
||||
"version": "1.1.0",
|
||||
"identifier": "com.vyla.home",
|
||||
"build": {
|
||||
"frontendDist": "../ui"
|
||||
@@ -39,4 +39,4 @@
|
||||
"../node_modules/**/*"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user