mirror of
https://gitlab.com/vyla-entertainment/home.git
synced 2026-11-14 06:07:23 -05:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| af7f236c7e | |||
| c801bb7668 | |||
| 86adb28f41 |
@@ -1,13 +1,40 @@
|
|||||||
taskkill /F /IM node.exe -ErrorAction SilentlyContinue
|
taskkill /F /IM "node.exe" 2>$null
|
||||||
taskkill /F /IM vyla-home.exe -ErrorAction SilentlyContinue
|
taskkill /F /IM "vyla-home.exe" 2>$null
|
||||||
|
taskkill /F /IM "Vyla Home.exe" 2>$null
|
||||||
|
|
||||||
Remove-Item -Recurse -Force "$env:APPDATA\com.vyla.home" -ErrorAction SilentlyContinue
|
Stop-Process -Name "node", "vyla-home", "Vyla Home" -Force -ErrorAction SilentlyContinue
|
||||||
Remove-Item -Recurse -Force "$env:APPDATA\vyla-home" -ErrorAction SilentlyContinue
|
|
||||||
|
|
||||||
Remove-Item -Force "$env:USERPROFILE\Downloads\vyla-*-debug*.log" -ErrorAction SilentlyContinue
|
$pathsToDelete = @(
|
||||||
|
"$env:APPDATA\com.vyla.home",
|
||||||
|
"$env:APPDATA\vyla-home",
|
||||||
|
"$env:LOCALAPPDATA\com.vyla.home",
|
||||||
|
"$env:LOCALAPPDATA\vyla-home",
|
||||||
|
"$env:LOCALAPPDATA\Vyla Home",
|
||||||
|
"$env:LOCALAPPDATA\Programs\Vyla Home",
|
||||||
|
"$env:LOCALAPPDATA\Programs\vyla-home",
|
||||||
|
"$env:USERPROFILE\AppData\LocalLow\com.vyla.home",
|
||||||
|
"$env:USERPROFILE\AppData\LocalLow\vyla-home",
|
||||||
|
"$env:ProgramFiles\Vyla Home",
|
||||||
|
"${env:ProgramFiles(x86)}\Vyla Home",
|
||||||
|
"$env:USERPROFILE\Desktop\Vyla Home.lnk",
|
||||||
|
"$env:APPDATA\Microsoft\Windows\Start Menu\Programs\Vyla Home.lnk",
|
||||||
|
"$env:USERPROFILE\Downloads\vyla-*-debug*.log",
|
||||||
|
"src-tauri\target",
|
||||||
|
"dist-build",
|
||||||
|
"temp-validation-extract",
|
||||||
|
"dist",
|
||||||
|
"frontend",
|
||||||
|
"player",
|
||||||
|
"auth-proxy",
|
||||||
|
"stream-api",
|
||||||
|
"update-payload.zip",
|
||||||
|
"manifest.json",
|
||||||
|
"validation-report.json",
|
||||||
|
"config\encrypted-credentials.json"
|
||||||
|
)
|
||||||
|
|
||||||
Remove-Item -Recurse -Force "src-tauri\target" -ErrorAction SilentlyContinue
|
foreach ($path in $pathsToDelete) {
|
||||||
Remove-Item -Recurse -Force "dist-build" -ErrorAction SilentlyContinue
|
if (Test-Path $path) {
|
||||||
Remove-Item -Force "update-payload.zip" -ErrorAction SilentlyContinue
|
Remove-Item -Recurse -Force $path -ErrorAction SilentlyContinue
|
||||||
Remove-Item -Force "manifest.json" -ErrorAction SilentlyContinue
|
}
|
||||||
Remove-Item -Force "validation-report.json" -ErrorAction SilentlyContinue
|
}
|
||||||
14
main.js
14
main.js
@@ -128,14 +128,24 @@ async function start() {
|
|||||||
await installBuild(release);
|
await installBuild(release);
|
||||||
} else if (hasUpdate) {
|
} else if (hasUpdate) {
|
||||||
debugLog("Update available. Prompting user...");
|
debugLog("Update available. Prompting user...");
|
||||||
sendToTauri('update-available', { current: localVersion, latest: release.version });
|
|
||||||
|
|
||||||
const tempApp = express();
|
const tempApp = express();
|
||||||
let userDecision = null;
|
let userDecision = null;
|
||||||
|
tempApp.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();
|
||||||
|
});
|
||||||
|
tempApp.get('/update/info', (req, res) => {
|
||||||
|
res.json({ available: true, current: localVersion, latest: release.version });
|
||||||
|
});
|
||||||
tempApp.post('/update/yes', (req, res) => { userDecision = true; res.sendStatus(200); });
|
tempApp.post('/update/yes', (req, res) => { userDecision = true; res.sendStatus(200); });
|
||||||
tempApp.post('/update/no', (req, res) => { userDecision = false; res.sendStatus(200); });
|
tempApp.post('/update/no', (req, res) => { userDecision = false; res.sendStatus(200); });
|
||||||
const tempServer = tempApp.listen(4891, '127.0.0.1');
|
const tempServer = tempApp.listen(4891, '127.0.0.1');
|
||||||
|
|
||||||
|
sendToTauri('update-available', { current: localVersion, latest: release.version });
|
||||||
|
|
||||||
while (userDecision === null) {
|
while (userDecision === null) {
|
||||||
await new Promise(r => setTimeout(r, 500));
|
await new Promise(r => setTimeout(r, 500));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "vyla-home",
|
"name": "vyla-home",
|
||||||
"version": "1.0.3",
|
"version": "1.0.4",
|
||||||
"description": "Vyla Home Desktop App Launcher",
|
"description": "Vyla Home Desktop App Launcher",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
40
release.js
40
release.js
@@ -153,6 +153,9 @@ async function main() {
|
|||||||
let installerUploadName = null;
|
let installerUploadName = null;
|
||||||
|
|
||||||
if (isFullBuild) {
|
if (isFullBuild) {
|
||||||
|
console.log('[Optional] Ensuring bundled Node.js runtime...');
|
||||||
|
await ensureBundledNode();
|
||||||
|
|
||||||
console.log('[Optional] Compiling Windows Tauri installer locally...');
|
console.log('[Optional] Compiling Windows Tauri installer locally...');
|
||||||
execSync('npm run build', { stdio: 'inherit' });
|
execSync('npm run build', { stdio: 'inherit' });
|
||||||
|
|
||||||
@@ -190,6 +193,43 @@ async function main() {
|
|||||||
console.log(`[4/4] Release successfully created: ${release.name} (${release.tag_name})`);
|
console.log(`[4/4] Release successfully created: ${release.name} (${release.tag_name})`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ensureBundledNode() {
|
||||||
|
const binDir = path.join(__dirname, 'bin');
|
||||||
|
const nodeExePath = path.join(binDir, 'node.exe');
|
||||||
|
|
||||||
|
if (fs.existsSync(nodeExePath) && fs.statSync(nodeExePath).size > 10000000) {
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
|
||||||
|
fs.mkdirSync(binDir, { recursive: true });
|
||||||
|
console.log('Downloading standalone Node.js runtime for bundling...');
|
||||||
|
|
||||||
|
const nodeUrl = 'https://nodejs.org/dist/v20.18.0/win-x64/node.exe';
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const fileStream = fs.createWriteStream(nodeExePath);
|
||||||
|
https.get(nodeUrl, (res) => {
|
||||||
|
if (res.statusCode === 302 || res.statusCode === 301) {
|
||||||
|
https.get(res.headers.location, (redirectRes) => {
|
||||||
|
redirectRes.pipe(fileStream);
|
||||||
|
fileStream.on('finish', () => {
|
||||||
|
fileStream.close();
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
}).on('error', reject);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
res.pipe(fileStream);
|
||||||
|
fileStream.on('finish', () => {
|
||||||
|
fileStream.close();
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
}).on('error', (err) => {
|
||||||
|
try { fs.unlinkSync(nodeExePath); } catch (e) { }
|
||||||
|
reject(err);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
main().catch(err => {
|
main().catch(err => {
|
||||||
console.error('Release failed:', err.message);
|
console.error('Release failed:', err.message);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
|
|||||||
2
src-tauri/Cargo.lock
generated
2
src-tauri/Cargo.lock
generated
@@ -4222,7 +4222,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "vyla-home"
|
name = "vyla-home"
|
||||||
version = "1.0.3"
|
version = "1.0.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "vyla-home"
|
name = "vyla-home"
|
||||||
version = "1.0.3"
|
version = "1.0.4"
|
||||||
description = "Vyla Home Desktop App Launcher"
|
description = "Vyla Home Desktop App Launcher"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
|
|||||||
@@ -35,8 +35,9 @@ fn clean_path(path: &std::path::Path) -> String {
|
|||||||
fn find_node_binary(app: &tauri::App) -> Option<String> {
|
fn find_node_binary(app: &tauri::App) -> Option<String> {
|
||||||
if let Ok(resource_dir) = app.path().resource_dir() {
|
if let Ok(resource_dir) = app.path().resource_dir() {
|
||||||
let candidates = [
|
let candidates = [
|
||||||
resource_dir.join("node.exe"),
|
|
||||||
resource_dir.join("bin").join("node.exe"),
|
resource_dir.join("bin").join("node.exe"),
|
||||||
|
resource_dir.join("node.exe"),
|
||||||
|
resource_dir.join("_up_").join("bin").join("node.exe"),
|
||||||
resource_dir.join("_up_").join("node.exe"),
|
resource_dir.join("_up_").join("node.exe"),
|
||||||
];
|
];
|
||||||
for candidate in candidates {
|
for candidate in candidates {
|
||||||
@@ -46,19 +47,28 @@ fn find_node_binary(app: &tauri::App) -> Option<String> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let Ok(exe_path) = std::env::current_exe() {
|
||||||
|
if let Some(parent) = exe_path.parent() {
|
||||||
|
let candidates = [
|
||||||
|
parent.join("bin").join("node.exe"),
|
||||||
|
parent.join("node.exe"),
|
||||||
|
parent.join("resources").join("bin").join("node.exe"),
|
||||||
|
parent.join("resources").join("node.exe"),
|
||||||
|
];
|
||||||
|
for candidate in candidates {
|
||||||
|
if candidate.exists() {
|
||||||
|
return Some(clean_path(&candidate));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if let Ok(path_var) = std::env::var("PATH") {
|
if let Ok(path_var) = std::env::var("PATH") {
|
||||||
for p in std::env::split_paths(&path_var) {
|
for p in std::env::split_paths(&path_var) {
|
||||||
let candidate = p.join("node.exe");
|
let candidate = p.join("node.exe");
|
||||||
if candidate.exists() {
|
if candidate.exists() {
|
||||||
return Some(clean_path(&candidate));
|
return Some(clean_path(&candidate));
|
||||||
}
|
}
|
||||||
#[cfg(not(windows))]
|
|
||||||
{
|
|
||||||
let candidate_unix = p.join("node");
|
|
||||||
if candidate_unix.exists() {
|
|
||||||
return Some(clean_path(&candidate_unix));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,15 +94,6 @@ fn find_node_binary(app: &tauri::App) -> Option<String> {
|
|||||||
return Some(clean_path(&candidate));
|
return Some(clean_path(&candidate));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Ok(app_data) = std::env::var("APPDATA") {
|
|
||||||
let candidate = std::path::PathBuf::from(app_data)
|
|
||||||
.join("npm")
|
|
||||||
.join("node.exe");
|
|
||||||
if candidate.exists() {
|
|
||||||
return Some(clean_path(&candidate));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
None
|
None
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://raw.githubusercontent.com/tauri-apps/tauri/dev/tooling/cli/schema.json",
|
"$schema": "https://raw.githubusercontent.com/tauri-apps/tauri/dev/tooling/cli/schema.json",
|
||||||
"productName": "Vyla Home",
|
"productName": "Vyla Home",
|
||||||
"version": "1.0.3",
|
"version": "1.0.4",
|
||||||
"identifier": "com.vyla.home",
|
"identifier": "com.vyla.home",
|
||||||
"build": {
|
"build": {
|
||||||
"frontendDist": "../ui"
|
"frontendDist": "../ui"
|
||||||
@@ -28,6 +28,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"resources": [
|
"resources": [
|
||||||
|
"../bin/**/*",
|
||||||
"../main.js",
|
"../main.js",
|
||||||
"../service-manager.js",
|
"../service-manager.js",
|
||||||
"../patcher.js",
|
"../patcher.js",
|
||||||
@@ -38,4 +39,4 @@
|
|||||||
"../node_modules/**/*"
|
"../node_modules/**/*"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -681,21 +681,27 @@
|
|||||||
viewElement.classList.add('active');
|
viewElement.classList.add('active');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window.__TAURI__ && window.__TAURI__.event) {
|
function setupTauriListeners() {
|
||||||
window.__TAURI__.event.listen('update-available', (e) => {
|
const eventApi = window.__TAURI__?.event || window.__TAURI_INTERNALS__;
|
||||||
|
if (!eventApi || typeof eventApi.listen !== 'function') {
|
||||||
|
setTimeout(setupTauriListeners, 200);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
eventApi.listen('update-available', (e) => {
|
||||||
if (e.payload) {
|
if (e.payload) {
|
||||||
document.getElementById('update-msg').textContent = `Version ${e.payload.latest} is available (Current: ${e.payload.current}).`;
|
document.getElementById('update-msg').textContent = `Version ${e.payload.latest} is available (Current: ${e.payload.current}).`;
|
||||||
showView(viewUpdate);
|
showView(viewUpdate);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
window.__TAURI__.event.listen('status', (e) => {
|
eventApi.listen('status', (e) => {
|
||||||
if (e.payload && e.payload.message) {
|
if (e.payload && e.payload.message) {
|
||||||
statusMsg.textContent = e.payload.message;
|
statusMsg.textContent = e.payload.message;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
window.__TAURI__.event.listen('download-progress', (e) => {
|
eventApi.listen('download-progress', (e) => {
|
||||||
if (e.payload) {
|
if (e.payload) {
|
||||||
statusMsg.textContent = `Downloading update: ${e.payload.percent}%`;
|
statusMsg.textContent = `Downloading update: ${e.payload.percent}%`;
|
||||||
progressWrap.style.display = 'block';
|
progressWrap.style.display = 'block';
|
||||||
@@ -703,27 +709,43 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
window.__TAURI__.event.listen('error', (e) => {
|
eventApi.listen('error', (e) => {
|
||||||
if (e.payload && e.payload.message) {
|
if (e.payload && e.payload.message) {
|
||||||
errorMsg.textContent = e.payload.message;
|
errorMsg.textContent = e.payload.message;
|
||||||
showView(viewError);
|
showView(viewError);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
window.__TAURI__.event.listen('ready', (e) => {
|
eventApi.listen('ready', (e) => {
|
||||||
if (e.payload && e.payload.url) {
|
if (e.payload && e.payload.url) {
|
||||||
window.location.href = e.payload.url;
|
window.location.href = e.payload.url;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
setupTauriListeners();
|
||||||
|
|
||||||
|
function checkUpdateApi() {
|
||||||
|
fetch('http://127.0.0.1:4891/update/info')
|
||||||
|
.then(r => r.json())
|
||||||
|
.then(data => {
|
||||||
|
if (data && data.available) {
|
||||||
|
document.getElementById('update-msg').textContent = `Version ${data.latest} is available (Current: ${data.current}).`;
|
||||||
|
showView(viewUpdate);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => { });
|
||||||
|
}
|
||||||
|
const updateInterval = setInterval(checkUpdateApi, 500);
|
||||||
|
|
||||||
function installUpdate() {
|
function installUpdate() {
|
||||||
|
clearInterval(updateInterval);
|
||||||
fetch('http://127.0.0.1:4891/update/yes', { method: 'POST' }).catch(() => { });
|
fetch('http://127.0.0.1:4891/update/yes', { method: 'POST' }).catch(() => { });
|
||||||
statusMsg.textContent = 'Starting update...';
|
statusMsg.textContent = 'Starting update...';
|
||||||
showView(viewLoader);
|
showView(viewLoader);
|
||||||
}
|
}
|
||||||
|
|
||||||
function skipUpdate() {
|
function skipUpdate() {
|
||||||
|
clearInterval(updateInterval);
|
||||||
fetch('http://127.0.0.1:4891/update/no', { method: 'POST' }).catch(() => { });
|
fetch('http://127.0.0.1:4891/update/no', { method: 'POST' }).catch(() => { });
|
||||||
statusMsg.textContent = 'Continuing to app...';
|
statusMsg.textContent = 'Continuing to app...';
|
||||||
showView(viewLoader);
|
showView(viewLoader);
|
||||||
|
|||||||
Reference in New Issue
Block a user