From 01c04111bd123cea6a9f070e34907eb55925dd30 Mon Sep 17 00:00:00 2001 From: alwaysmesmerizingyou Date: Tue, 1 Sep 2026 13:26:41 -0700 Subject: [PATCH] remove obfuscation, fix UI scroll stutters, and fix dynamic config loading in updater --- build-pipeline.js | 25 ------------- main.js | 26 ++++++++++--- package.json | 5 +-- patcher.js | 38 ------------------- src-tauri/src/main.rs | 85 ++----------------------------------------- 5 files changed, 26 insertions(+), 153 deletions(-) diff --git a/build-pipeline.js b/build-pipeline.js index 04617b4..f6e0975 100644 --- a/build-pipeline.js +++ b/build-pipeline.js @@ -1,7 +1,6 @@ const fs = require('fs'); const path = require('path'); const crypto = require('crypto'); -const JavaScriptObfuscator = require('javascript-obfuscator'); const AdmZip = require('adm-zip'); const { execSync } = require('child_process'); @@ -73,23 +72,6 @@ function cleanBuildDir() { fs.mkdirSync(BUILD_DIR, { recursive: true }); } -function obfuscateFile(filePath, isEsm = false) { - const content = fs.readFileSync(filePath, 'utf8'); - const result = JavaScriptObfuscator.obfuscate(content, { - compact: true, - controlFlowFlattening: false, - deadCodeInjection: false, - debugProtection: false, - numbersToExpressions: false, - simplify: true, - stringArray: true, - stringArrayThreshold: 0.4, - stringArrayEncoding: [], - module: isEsm - }); - fs.writeFileSync(filePath, result.getObfuscatedCode(), 'utf8'); -} - function encryptCredentialsFile() { const CryptoUtils = require('./crypto-utils'); @@ -170,13 +152,6 @@ function processFolder(src, dest) { if (pkg.type === 'module') isEsm = true; } catch (e) { } } - - for (const filePath of jsFiles) { - try { - obfuscateFile(filePath, isEsm); - } catch (e) { - } - } } function getFileChecksum(filePath) { diff --git a/main.js b/main.js index e0a6402..1c3746a 100644 --- a/main.js +++ b/main.js @@ -99,8 +99,21 @@ process.on('unhandledRejection', (reason) => { sendToTauri('error', { message: reason && reason.message ? reason.message : String(reason) }); }); -const envConfig = JSON.parse(fs.readFileSync(path.join(__dirname, 'config/env.json'), 'utf8')); -const replacementsConfig = JSON.parse(fs.readFileSync(path.join(__dirname, 'config/replacements.json'), 'utf8')); +function getEnvConfig() { + try { + const appPath = path.join(APPDATA_DIR, 'config/env.json'); + if (fs.existsSync(appPath)) return JSON.parse(fs.readFileSync(appPath, 'utf8')); + return JSON.parse(fs.readFileSync(path.join(__dirname, 'config/env.json'), 'utf8')); + } catch (e) { return {}; } +} + +function getReplacementsConfig() { + try { + const appPath = path.join(APPDATA_DIR, 'config/replacements.json'); + if (fs.existsSync(appPath)) return JSON.parse(fs.readFileSync(appPath, 'utf8')); + return JSON.parse(fs.readFileSync(path.join(__dirname, 'config/replacements.json'), 'utf8')); + } catch (e) { return {}; } +} const updateClient = new UpdateClient(APPDATA_DIR); @@ -109,7 +122,7 @@ async function start() { sendToTauri('status', { message: 'Loading core configuration files...' }); const patcher = new Patcher(APPDATA_DIR); - serviceManager = new ServiceManager(APPDATA_DIR, envConfig); + serviceManager = new ServiceManager(APPDATA_DIR, getEnvConfig()); const installBuild = async (release) => { const tempZipPath = path.join(APPDATA_DIR, 'download-temp.zip'); @@ -145,12 +158,14 @@ async function start() { debugLog('Extraction complete. Applying patches...'); sendToTauri('status', { message: 'Applying configuration patches...' }); - patcher.applyPatches(replacementsConfig); + patcher.applyPatches(getReplacementsConfig()); sendToTauri('status', { message: 'Migrating security credentials...' }); patcher.bridgeCredentials(serviceManager.credentialManager); patcher.saveCurrentVersion(release.version, release.sha256); + serviceManager.envConfig = getEnvConfig(); + if (fs.existsSync(tempZipPath)) { fs.unlinkSync(tempZipPath); } @@ -244,9 +259,10 @@ async function start() { sendToTauri('status', { message: 'Extracting local baseline payload...' }); patcher.purgeOldCode(); patcher.extractZipPayload(localZip); - patcher.applyPatches(replacementsConfig); + patcher.applyPatches(getReplacementsConfig()); patcher.bridgeCredentials(serviceManager.credentialManager); patcher.saveCurrentVersion("1.0.0"); + serviceManager.envConfig = getEnvConfig(); debugLog("Local payload extracted successfully."); } else { debugLog("No local payload found!"); diff --git a/package.json b/package.json index b56b43d..820ae9e 100644 --- a/package.json +++ b/package.json @@ -20,8 +20,7 @@ "express": "^4.19.2" }, "devDependencies": { - "@tauri-apps/cli": "^2.0.0", - "javascript-obfuscator": "^4.1.0" + "@tauri-apps/cli": "^2.0.0" }, "build": { "appId": "com.vyla.home", @@ -55,4 +54,4 @@ "installerHeaderIcon": "build/icon.ico" } } -} +} \ No newline at end of file diff --git a/patcher.js b/patcher.js index d644d14..834603c 100644 --- a/patcher.js +++ b/patcher.js @@ -2,7 +2,6 @@ const fs = require('fs'); const path = require('path'); const crypto = require('crypto'); const AdmZip = require('adm-zip'); -const JavaScriptObfuscator = require('javascript-obfuscator'); const CryptoUtils = require('./crypto-utils'); class Patcher { @@ -141,43 +140,6 @@ class Patcher { } } - if (ext === '.js') { - 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'); } diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 4dfb465..65f46b7 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -196,17 +196,6 @@ const LINK_HANDLER_SCRIPT: &str = r##" const style = document.createElement('style'); style.innerHTML = ` - #vyla-nav-filter-svg { - position: fixed !important; - top: 0 !important; - left: 0 !important; - width: 0 !important; - height: 0 !important; - pointer-events: none !important; - opacity: 0 !important; - z-index: -1 !important; - } - #vyla-floating-nav { position: fixed !important; top: 12px !important; @@ -218,7 +207,7 @@ const LINK_HANDLER_SCRIPT: &str = r##" display: flex !important; align-items: center !important; background: rgba(255, 255, 255, 0.04) !important; - backdrop-filter: url(#vyla-glass-filter) blur(16px) saturate(1.8) contrast(1.1) !important; + backdrop-filter: blur(16px) saturate(1.8) contrast(1.1) !important; -webkit-backdrop-filter: blur(16px) saturate(1.8) contrast(1.1) !important; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45) !important; transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1), padding 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important; @@ -365,26 +354,6 @@ const LINK_HANDLER_SCRIPT: &str = r##" `; document.head.appendChild(style); - const filterSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); - filterSvg.id = 'vyla-nav-filter-svg'; - filterSvg.innerHTML = ` - - - - - - - - - - - - - - - `; - document.body.appendChild(filterSvg); - const nav = document.createElement('div'); nav.id = 'vyla-floating-nav'; nav.innerHTML = ` @@ -417,54 +386,6 @@ const LINK_HANDLER_SCRIPT: &str = r##" }; } - const feImage = document.getElementById('vyla-nav-fe-img'); - const redChannel = document.getElementById('vyla-nav-red'); - const greenChannel = document.getElementById('vyla-nav-green'); - const blueChannel = document.getElementById('vyla-nav-blue'); - - function generateNavMap() { - const rect = nav.getBoundingClientRect(); - const w = Math.round(rect.width) || 42; - const h = Math.round(rect.height) || 42; - const edgeSize = Math.min(w, h) * 0.08; - const svgContent = ` - - - - - - - - - - - - - - - - - `; - return "data:image/svg+xml," + encodeURIComponent(svgContent); - } - - function updateNavGlass() { - if (!feImage) return; - feImage.setAttribute("href", generateNavMap()); - const distortionScale = -180; - redChannel.setAttribute("scale", distortionScale - 10); - greenChannel.setAttribute("scale", distortionScale); - blueChannel.setAttribute("scale", distortionScale + 10); - [redChannel, greenChannel, blueChannel].forEach((ch) => { - ch.setAttribute("xChannelSelector", "R"); - ch.setAttribute("yChannelSelector", "G"); - }); - } - - updateNavGlass(); - const obs = new ResizeObserver(() => setTimeout(updateNavGlass, 0)); - obs.observe(nav); - const tb = document.createElement('div'); tb.id = 'tauri-custom-titlebar'; tb.innerHTML = ` @@ -610,7 +531,7 @@ fn main() { get_logo_base64 ]) .manage(NodeServices(Mutex::new(None))) -.setup(|app| { + .setup(|app| { debug_log("Tauri setup started"); let app_data = app.path().app_data_dir().unwrap_or_default(); let app_data_str = clean_path(&app_data); @@ -619,7 +540,7 @@ fn main() { .title("Vyla Home") .inner_size(1280.0, 800.0) .decorations(false) - .transparent(true) + .transparent(false) .resizable(true) .devtools(cfg!(debug_assertions)) .initialization_script("window.__VYLA_WINDOW_LABEL = 'main';")