mirror of
https://gitlab.com/vyla-entertainment/home.git
synced 2026-11-14 06:07:23 -05:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| dfb0893316 | |||
| 08c70a2c6d | |||
| 1092d359ab | |||
| dcba2a2438 | |||
| 8f99096bfb | |||
| 2f5efe45c4 | |||
| 403eb59370 | |||
| 13f94ab8b9 | |||
| 4946975997 | |||
| 9c401d5487 |
10
.gitignore
vendored
10
.gitignore
vendored
@@ -1,7 +1,6 @@
|
|||||||
# Dependencies
|
|
||||||
node_modules/
|
node_modules/
|
||||||
|
package-lock.json
|
||||||
|
|
||||||
# Build outputs
|
|
||||||
dist/
|
dist/
|
||||||
dist-build/
|
dist-build/
|
||||||
temp-validation-extract/
|
temp-validation-extract/
|
||||||
@@ -10,37 +9,30 @@ manifest.json
|
|||||||
integrity-report.json
|
integrity-report.json
|
||||||
validation-report.json
|
validation-report.json
|
||||||
|
|
||||||
# Rust & Tauri
|
|
||||||
src-tauri/target/
|
src-tauri/target/
|
||||||
|
|
||||||
# Encrypted files (build-time only)
|
|
||||||
config/encrypted-credentials.json
|
config/encrypted-credentials.json
|
||||||
|
|
||||||
# Sensitive files
|
|
||||||
credentials.json
|
credentials.json
|
||||||
.env
|
.env
|
||||||
*.key
|
*.key
|
||||||
*.pem
|
*.pem
|
||||||
|
|
||||||
# OS files
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
desktop.ini
|
desktop.ini
|
||||||
|
|
||||||
# IDE
|
|
||||||
.vscode/
|
.vscode/
|
||||||
.idea/
|
.idea/
|
||||||
*.swp
|
*.swp
|
||||||
*.swo
|
*.swo
|
||||||
*~
|
*~
|
||||||
|
|
||||||
# Logs
|
|
||||||
*.log
|
*.log
|
||||||
npm-debug.log*
|
npm-debug.log*
|
||||||
yarn-debug.log*
|
yarn-debug.log*
|
||||||
yarn-error.log*
|
yarn-error.log*
|
||||||
|
|
||||||
# Temporary files
|
|
||||||
*.tmp
|
*.tmp
|
||||||
*.temp
|
*.temp
|
||||||
download-temp.zip
|
download-temp.zip
|
||||||
BIN
bin/WebView2Loader.dll
Normal file
BIN
bin/WebView2Loader.dll
Normal file
Binary file not shown.
@@ -20,11 +20,13 @@ const REPO_CONFIG = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function clonePrivateRepo(repoConfig, targetDir) {
|
function clonePrivateRepo(repoConfig, targetDir) {
|
||||||
const repoUrl = `https://gitlab.com/${GITLAB_GROUP}/${repoConfig.name}.git`;
|
const token = process.env.GITLAB_TOKEN || process.env.VYLA_GITLAB_TOKEN;
|
||||||
|
const auth = token ? `oauth2:${token}@` : '';
|
||||||
|
const repoUrl = `https://${auth}gitlab.com/${GITLAB_GROUP}/${repoConfig.name}.git`;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (fs.existsSync(targetDir)) {
|
if (fs.existsSync(targetDir)) {
|
||||||
fs.rmSync(targetDir, { recursive: true, force: true });
|
fs.rmSync(targetDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
|
||||||
}
|
}
|
||||||
|
|
||||||
execSync(`git clone --depth 1 --branch ${repoConfig.branch} ${repoUrl} ${targetDir}`, {
|
execSync(`git clone --depth 1 --branch ${repoConfig.branch} ${repoUrl} ${targetDir}`, {
|
||||||
@@ -332,6 +334,9 @@ async function build() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const zipPath = path.join(__dirname, 'update-payload.zip');
|
const zipPath = path.join(__dirname, 'update-payload.zip');
|
||||||
|
if (fs.existsSync(zipPath)) {
|
||||||
|
fs.rmSync(zipPath, { force: true });
|
||||||
|
}
|
||||||
zip.writeZip(zipPath);
|
zip.writeZip(zipPath);
|
||||||
|
|
||||||
const checksum = validatePayload(zipPath);
|
const checksum = validatePayload(zipPath);
|
||||||
|
|||||||
12
main.js
12
main.js
@@ -243,6 +243,18 @@ async function start() {
|
|||||||
sendToTauri('status', { message: 'Loading credentials...' });
|
sendToTauri('status', { message: 'Loading credentials...' });
|
||||||
serviceManager.credentialManager.loadCredentials();
|
serviceManager.credentialManager.loadCredentials();
|
||||||
|
|
||||||
|
sendToTauri('status', { message: 'Installing the Vyla SDK to latest version...' });
|
||||||
|
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 backend services...' });
|
sendToTauri('status', { message: 'Starting backend services...' });
|
||||||
await serviceManager.startServices([
|
await serviceManager.startServices([
|
||||||
{ name: 'auth-proxy', relativeDir: 'auth-proxy' },
|
{ name: 'auth-proxy', relativeDir: 'auth-proxy' },
|
||||||
|
|||||||
2366
package-lock.json
generated
2366
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "vyla-home",
|
"name": "vyla-home",
|
||||||
"version": "1.0.9",
|
"version": "1.1.5",
|
||||||
"description": "Vyla Home Desktop App Launcher",
|
"description": "Vyla Home Desktop App Launcher",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "tauri dev",
|
"dev": "tauri dev",
|
||||||
"build:payload": "node build-pipeline.js",
|
"build:payload": "node build-pipeline.js",
|
||||||
"build": "node -e \"require('child_process').execSync('tauri build', {stdio:'inherit', env:Object.assign({}, process.env, {WEBVIEW2_STATIC_LIB:'1'})})\"",
|
"build": "tauri build",
|
||||||
"release": "node release.js",
|
"release": "node release.js",
|
||||||
"release:full": "node release.js --installer"
|
"release:full": "node release.js --installer"
|
||||||
},
|
},
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
"@tauri-apps/api": "^2.0.0",
|
"@tauri-apps/api": "^2.0.0",
|
||||||
"@tauri-apps/plugin-shell": "^2.0.0",
|
"@tauri-apps/plugin-shell": "^2.0.0",
|
||||||
"@tauri-apps/plugin-process": "^2.0.0",
|
"@tauri-apps/plugin-process": "^2.0.0",
|
||||||
"@vyla-entertainment/sdk": "^1.10.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"
|
||||||
},
|
},
|
||||||
@@ -54,4 +54,4 @@
|
|||||||
"installerHeaderIcon": "build/icon.ico"
|
"installerHeaderIcon": "build/icon.ico"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -69,7 +69,7 @@ class Patcher {
|
|||||||
const trashPath = fullPath + '.trash.' + Date.now();
|
const trashPath = fullPath + '.trash.' + Date.now();
|
||||||
fs.renameSync(fullPath, trashPath);
|
fs.renameSync(fullPath, trashPath);
|
||||||
} catch (renameErr) {
|
} 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.`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
145
release.js
145
release.js
@@ -78,42 +78,38 @@ function uploadFileToGitLabPackage(filePath, packageName, version, fileName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function createGitLabRelease(tag, releaseLinks) {
|
function createGitLabRelease(tag, releaseLinks) {
|
||||||
const sendRequest = (method, path) => {
|
const sendRequest = (method, path, data = null) => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let currentRef = 'main';
|
const options = {
|
||||||
try {
|
|
||||||
currentRef = execSync('git rev-parse HEAD').toString().trim();
|
|
||||||
} catch (e) { }
|
|
||||||
|
|
||||||
const postData = JSON.stringify({
|
|
||||||
name: `Vyla Home Release ${tag}`,
|
|
||||||
tag_name: tag,
|
|
||||||
ref: currentRef,
|
|
||||||
description: `Automated local release ${tag}`,
|
|
||||||
assets: {
|
|
||||||
links: releaseLinks
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const req = https.request({
|
|
||||||
hostname: 'gitlab.com',
|
hostname: 'gitlab.com',
|
||||||
port: 443,
|
port: 443,
|
||||||
path: path,
|
path: path,
|
||||||
method: method,
|
method: method,
|
||||||
headers: {
|
headers: {
|
||||||
'PRIVATE-TOKEN': TOKEN,
|
'PRIVATE-TOKEN': TOKEN,
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json'
|
||||||
'Content-Length': Buffer.byteLength(postData)
|
|
||||||
}
|
}
|
||||||
}, (res) => {
|
};
|
||||||
|
let postData = '';
|
||||||
|
if (data) {
|
||||||
|
postData = JSON.stringify(data);
|
||||||
|
options.headers['Content-Length'] = Buffer.byteLength(postData);
|
||||||
|
}
|
||||||
|
|
||||||
|
const req = https.request(options, (res) => {
|
||||||
let body = '';
|
let body = '';
|
||||||
res.on('data', chunk => body += chunk);
|
res.on('data', chunk => body += chunk);
|
||||||
res.on('end', () => {
|
res.on('end', () => {
|
||||||
if (res.statusCode === 200 || res.statusCode === 201) {
|
if (res.statusCode >= 200 && res.statusCode < 300) {
|
||||||
resolve(JSON.parse(body));
|
try {
|
||||||
|
resolve(body ? JSON.parse(body) : {});
|
||||||
|
} catch (e) {
|
||||||
|
resolve({});
|
||||||
|
}
|
||||||
} else if (res.statusCode === 409 && method === 'POST') {
|
} else if (res.statusCode === 409 && method === 'POST') {
|
||||||
console.log(`Release ${tag} already exists, updating assets...`);
|
console.log(`Release ${tag} already exists, deleting and recreating...`);
|
||||||
sendRequest('PUT', `/api/v4/projects/${PROJECT_ID}/releases/${encodeURIComponent(tag)}`)
|
sendRequest('DELETE', `/api/v4/projects/${PROJECT_ID}/releases/${encodeURIComponent(tag)}`)
|
||||||
|
.then(() => sendRequest('POST', `/api/v4/projects/${PROJECT_ID}/releases`, data))
|
||||||
.then(resolve)
|
.then(resolve)
|
||||||
.catch(reject);
|
.catch(reject);
|
||||||
} else {
|
} else {
|
||||||
@@ -123,12 +119,27 @@ function createGitLabRelease(tag, releaseLinks) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
req.on('error', reject);
|
req.on('error', reject);
|
||||||
req.write(postData);
|
if (data) req.write(postData);
|
||||||
req.end();
|
req.end();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return sendRequest('POST', `/api/v4/projects/${PROJECT_ID}/releases`);
|
let currentRef = 'main';
|
||||||
|
try {
|
||||||
|
currentRef = execSync('git rev-parse HEAD').toString().trim();
|
||||||
|
} catch (e) { }
|
||||||
|
|
||||||
|
const releaseData = {
|
||||||
|
name: `Vyla Home Release ${tag}`,
|
||||||
|
tag_name: tag,
|
||||||
|
ref: currentRef,
|
||||||
|
description: `Automated local release ${tag}`,
|
||||||
|
assets: {
|
||||||
|
links: releaseLinks
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return sendRequest('POST', `/api/v4/projects/${PROJECT_ID}/releases`, releaseData);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
@@ -137,7 +148,7 @@ async function main() {
|
|||||||
|
|
||||||
const version = customTag || `v${incrementVersion()}`;
|
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...');
|
console.log('[1/4] Building update payload and manifest...');
|
||||||
execSync('node build-pipeline.js', { stdio: 'inherit' });
|
execSync('node build-pipeline.js', { stdio: 'inherit' });
|
||||||
@@ -153,18 +164,26 @@ async function main() {
|
|||||||
let installerUploadName = null;
|
let installerUploadName = null;
|
||||||
|
|
||||||
if (isFullBuild) {
|
if (isFullBuild) {
|
||||||
console.log('[Optional] Ensuring bundled Node.js runtime...');
|
console.log('Ensuring bundled Node.js runtime...');
|
||||||
await ensureBundledNode();
|
await ensureBundledNode();
|
||||||
|
|
||||||
console.log('[Optional] Compiling Windows Tauri installer locally...');
|
await ensureWebView2Loader();
|
||||||
|
|
||||||
|
const bundleDir = path.join(__dirname, 'src-tauri', 'target', 'release', 'bundle');
|
||||||
|
if (fs.existsSync(bundleDir)) {
|
||||||
|
fs.rmSync(bundleDir, { recursive: true, force: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('Compiling Windows Tauri installer locally...');
|
||||||
execSync('npm run build', {
|
execSync('npm run build', {
|
||||||
stdio: 'inherit',
|
stdio: 'inherit'
|
||||||
env: Object.assign({}, process.env, { WEBVIEW2_STATIC_LIB: '1' })
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const nsisDir = path.join(__dirname, 'src-tauri/target/release/bundle/nsis');
|
const nsisDir = path.join(__dirname, 'src-tauri/target/release/bundle/nsis');
|
||||||
if (fs.existsSync(nsisDir)) {
|
if (fs.existsSync(nsisDir)) {
|
||||||
const files = fs.readdirSync(nsisDir).filter(f => f.endsWith('.exe'));
|
const targetVersion = version.startsWith('v') ? version.substring(1) : version;
|
||||||
|
const files = fs.readdirSync(nsisDir).filter(f => f.endsWith('.exe') && f.includes(targetVersion));
|
||||||
|
|
||||||
if (files.length > 0) {
|
if (files.length > 0) {
|
||||||
const originalName = files[0];
|
const originalName = files[0];
|
||||||
installerPath = path.join(nsisDir, originalName);
|
installerPath = path.join(nsisDir, originalName);
|
||||||
@@ -174,11 +193,13 @@ async function main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
console.log('[2/4] Uploading artifacts to GitLab Package Registry...');
|
console.log('[2/4] Uploading artifacts to GitLab Package Registry...');
|
||||||
|
const timestamp = Date.now();
|
||||||
|
|
||||||
console.log('Uploading update-payload.zip...');
|
console.log('Uploading update-payload.zip...');
|
||||||
const payloadUrl = await uploadFileToGitLabPackage(payloadPath, 'vyla-home', version, 'update-payload.zip');
|
const payloadUrl = await uploadFileToGitLabPackage(payloadPath, 'vyla-home', version, `update-payload-${timestamp}.zip`);
|
||||||
|
|
||||||
console.log('Uploading manifest.json...');
|
console.log('Uploading manifest.json...');
|
||||||
const manifestUrl = await uploadFileToGitLabPackage(manifestPath, 'vyla-home', version, 'manifest.json');
|
const manifestUrl = await uploadFileToGitLabPackage(manifestPath, 'vyla-home', version, `manifest-${timestamp}.json`);
|
||||||
|
|
||||||
const releaseLinks = [
|
const releaseLinks = [
|
||||||
{ name: 'update-payload.zip', url: payloadUrl, link_type: 'other' },
|
{ name: 'update-payload.zip', url: payloadUrl, link_type: 'other' },
|
||||||
@@ -187,7 +208,8 @@ async function main() {
|
|||||||
|
|
||||||
if (installerPath && installerUploadName) {
|
if (installerPath && installerUploadName) {
|
||||||
console.log(`Uploading installer ${installerUploadName}...`);
|
console.log(`Uploading installer ${installerUploadName}...`);
|
||||||
const installerUrl = await uploadFileToGitLabPackage(installerPath, 'vyla-home', version, installerUploadName);
|
const installerUnique = installerUploadName.replace('.exe', `-${timestamp}.exe`);
|
||||||
|
const installerUrl = await uploadFileToGitLabPackage(installerPath, 'vyla-home', version, installerUnique);
|
||||||
releaseLinks.push({ name: installerUploadName, url: installerUrl, link_type: 'package' });
|
releaseLinks.push({ name: installerUploadName, url: installerUrl, link_type: 'package' });
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -238,6 +260,59 @@ function ensureBundledNode() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ensureWebView2Loader() {
|
||||||
|
const releaseDir = path.join(__dirname, 'src-tauri', 'target', 'release');
|
||||||
|
const rootDllPath = path.join(__dirname, 'src-tauri', 'WebView2Loader.dll');
|
||||||
|
fs.mkdirSync(releaseDir, { recursive: true });
|
||||||
|
|
||||||
|
const targetDllPath = path.join(releaseDir, 'WebView2Loader.dll');
|
||||||
|
|
||||||
|
if (fs.existsSync(rootDllPath) && fs.existsSync(targetDllPath)) {
|
||||||
|
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.2903.40';
|
||||||
|
|
||||||
|
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) {
|
||||||
|
const buffer = dllEntry.getData();
|
||||||
|
fs.writeFileSync(targetDllPath, buffer);
|
||||||
|
fs.writeFileSync(rootDllPath, buffer);
|
||||||
|
}
|
||||||
|
try { fs.unlinkSync(tempNupkg); } catch (_) { }
|
||||||
|
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 => {
|
main().catch(err => {
|
||||||
console.error('Release failed:', err.message);
|
console.error('Release failed:', err.message);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
|
|||||||
18
src-tauri/Cargo.lock
generated
18
src-tauri/Cargo.lock
generated
@@ -412,9 +412,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.4.3"
|
version = "1.4.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "509591b7bcd67f4ef775afad7662703b4935daaa6ec0e5605cfb1090b32a2b6d"
|
checksum = "0ad534f4357a5264cce5019c989cf66a4f0dc4e0d1b1d15f8aacec0ff7360273"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"find-msvc-tools",
|
"find-msvc-tools",
|
||||||
"shlex",
|
"shlex",
|
||||||
@@ -545,9 +545,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crc32fast"
|
name = "crc32fast"
|
||||||
version = "1.5.0"
|
version = "1.5.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511"
|
checksum = "8498c871161e1742aaa9d52551b2d6ebdd4c3d45a3be423e3728f33b955be550"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
]
|
]
|
||||||
@@ -2012,9 +2012,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "log"
|
name = "log"
|
||||||
version = "0.4.33"
|
version = "0.4.34"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0ceec5bc11778974d1bcb055b18002eba7f4b3518b6a0081b3af5f21666da9ad"
|
checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "markup5ever"
|
name = "markup5ever"
|
||||||
@@ -4178,9 +4178,9 @@ checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "uuid"
|
name = "uuid"
|
||||||
version = "1.24.1"
|
version = "1.25.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2cefc03fd367c0c6d4305de1b312cf00248c4114f4a0418ce6a6af769e3b0bd9"
|
checksum = "f053576934f05a761a402421fbbe3d425d9366f75f978806a037b3ca481abecc"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"getrandom 0.4.3",
|
"getrandom 0.4.3",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
@@ -4222,7 +4222,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "vyla-home"
|
name = "vyla-home"
|
||||||
version = "1.0.9"
|
version = "1.1.5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "vyla-home"
|
name = "vyla-home"
|
||||||
version = "1.0.9"
|
version = "1.1.5"
|
||||||
description = "Vyla Home Desktop App Launcher"
|
description = "Vyla Home Desktop App Launcher"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
|
|||||||
BIN
src-tauri/WebView2Loader.dll
Normal file
BIN
src-tauri/WebView2Loader.dll
Normal file
Binary file not shown.
@@ -1,35 +1,3 @@
|
|||||||
use std::env;
|
|
||||||
use std::fs;
|
|
||||||
use std::path::PathBuf;
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
tauri_build::build();
|
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)]
|
#[cfg(windows)]
|
||||||
fn kill_process_tree(pid: u32) {
|
fn kill_process_tree(pid: u32) {
|
||||||
use std::os::windows::process::CommandExt;
|
use std::os::windows::process::CommandExt;
|
||||||
@@ -67,8 +62,6 @@ fn kill_process_tree(pid: u32) {
|
|||||||
|
|
||||||
#[cfg(not(windows))]
|
#[cfg(not(windows))]
|
||||||
fn kill_process_tree(pid: u32) {
|
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 {
|
unsafe {
|
||||||
libc_kill_pgid(pid);
|
libc_kill_pgid(pid);
|
||||||
}
|
}
|
||||||
@@ -76,7 +69,6 @@ fn kill_process_tree(pid: u32) {
|
|||||||
|
|
||||||
#[cfg(not(windows))]
|
#[cfg(not(windows))]
|
||||||
unsafe fn libc_kill_pgid(pid: u32) {
|
unsafe fn libc_kill_pgid(pid: u32) {
|
||||||
// Negative pid signals the whole process group in POSIX kill(2).
|
|
||||||
let _ = Command::new("kill")
|
let _ = Command::new("kill")
|
||||||
.args(["-9", &format!("-{}", pid)])
|
.args(["-9", &format!("-{}", pid)])
|
||||||
.output();
|
.output();
|
||||||
@@ -174,15 +166,8 @@ fn resolve_script_and_root(app: &tauri::App) -> (String, String) {
|
|||||||
|
|
||||||
const LINK_HANDLER_SCRIPT: &str = r#"
|
const LINK_HANDLER_SCRIPT: &str = r#"
|
||||||
function doInvoke(cmd, args) {
|
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) {
|
if (window.__TAURI__ && window.__TAURI__.core) {
|
||||||
window.__TAURI__.core.invoke(cmd, args || {})
|
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');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,8 +177,6 @@ const LINK_HANDLER_SCRIPT: &str = r#"
|
|||||||
function dragWindow() { doInvoke('win_drag'); }
|
function dragWindow() { doInvoke('win_drag'); }
|
||||||
|
|
||||||
window.open = function(url, target, features) {
|
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 });
|
doInvoke('open_new_window', { url: url });
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
@@ -202,10 +185,7 @@ const LINK_HANDLER_SCRIPT: &str = r#"
|
|||||||
const a = e.target.closest('a');
|
const a = e.target.closest('a');
|
||||||
if (!a || !a.href) return;
|
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) {
|
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.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
doInvoke('open_new_window', { url: a.href });
|
doInvoke('open_new_window', { url: a.href });
|
||||||
@@ -213,17 +193,10 @@ const LINK_HANDLER_SCRIPT: &str = r#"
|
|||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
function injectTitlebar() {
|
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')) {
|
if (document.getElementById('tauri-custom-titlebar')) {
|
||||||
console.log('[TitleBar-DEBUG] Titlebar already exists, skipping');
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!document.body) {
|
if (!document.body) {
|
||||||
console.log('[TitleBar-DEBUG] No document.body yet, skipping');
|
|
||||||
return;
|
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();
|
injectTitlebar();
|
||||||
setInterval(injectTitlebar, 1000);
|
setInterval(injectTitlebar, 1000);
|
||||||
|
|
||||||
if (document.readyState === 'loading') {
|
if (document.readyState === 'loading') {
|
||||||
console.log('[TitleBar-DEBUG] Document still loading, adding DOMContentLoaded listener');
|
|
||||||
document.addEventListener('DOMContentLoaded', injectTitlebar);
|
document.addEventListener('DOMContentLoaded', injectTitlebar);
|
||||||
} else {
|
} else {
|
||||||
console.log('[TitleBar-DEBUG] Document already loaded, injecting titlebar immediately');
|
|
||||||
injectTitlebar();
|
injectTitlebar();
|
||||||
}
|
}
|
||||||
|
|
||||||
window.addEventListener('load', injectTitlebar);
|
window.addEventListener('load', injectTitlebar);
|
||||||
console.log('[TitleBar-DEBUG] Link handler script setup complete');
|
|
||||||
"#;
|
"#;
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
@@ -422,7 +385,7 @@ let window = WebviewWindowBuilder::new(app, "main", WebviewUrl::App("index.html"
|
|||||||
.transparent(true)
|
.transparent(true)
|
||||||
.resizable(true)
|
.resizable(true)
|
||||||
.devtools(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)
|
.initialization_script(LINK_HANDLER_SCRIPT)
|
||||||
.build()?;
|
.build()?;
|
||||||
|
|
||||||
|
|||||||
@@ -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.0.9",
|
"version": "1.1.5",
|
||||||
"identifier": "com.vyla.home",
|
"identifier": "com.vyla.home",
|
||||||
"build": {
|
"build": {
|
||||||
"frontendDist": "../ui"
|
"frontendDist": "../ui"
|
||||||
@@ -28,6 +28,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"resources": [
|
"resources": [
|
||||||
|
"WebView2Loader.dll",
|
||||||
"../bin/*",
|
"../bin/*",
|
||||||
"../main.js",
|
"../main.js",
|
||||||
"../service-manager.js",
|
"../service-manager.js",
|
||||||
|
|||||||
Reference in New Issue
Block a user