diff --git a/src/bootstrap.js b/src/bootstrap.js index 832571f..c59c798 100644 --- a/src/bootstrap.js +++ b/src/bootstrap.js @@ -79,7 +79,12 @@ const startCore = () => { bw.webContents.on('dom-ready', () => { log('MainWindowInject', 'dom-ready triggered, injecting JS'); - bw.webContents.executeJavaScript(readFileSync(join(__dirname, 'mainWindowInject.js'), 'utf8')); + let injectJs = readFileSync(join(__dirname, 'mainWindowInject.js'), 'utf8'); + + const [ version1, version2 ] = oaVersion.split('-'); // Split via - + injectJs = injectJs.replace('', version1[0].toUpperCase() + version1.substring(1).toLowerCase()).replace('', version2 || ''); + + bw.webContents.executeJavaScript(injectJs); }); }); }; @@ -136,4 +141,4 @@ getInstallPath: ${paths.getInstallPath()}`); } else { app.once('ready', startUpdate); } -}; +}; \ No newline at end of file diff --git a/src/mainWindowInject.js b/src/mainWindowInject.js index dc8ee4e..82b844f 100644 --- a/src/mainWindowInject.js +++ b/src/mainWindowInject.js @@ -4,11 +4,23 @@ const update = async () => { let cached = await DiscordNative.userDataCache.getCached() || {}; - const value = `.theme-dark {${vars.reduce((acc, x) => acc += `${x}: ${getVar(x)}; `, '')}}`; + const value = `.theme-dark { ${vars.reduce((acc, x) => acc += `${x}: ${getVar(x)}; `, '')} }`; cached['openasarSplashCSS'] = value; DiscordNative.userDataCache.cacheUserData(JSON.stringify(cached)); }; +setInterval(update, 5000); -setInterval(update, 5000); \ No newline at end of file +const settingsInject = async () => { + const infoEl = document.querySelector('.info-1VyQPT'); + if (!infoEl || document.getElementById('openasar-version')) return; + + const el = document.createElement('el'); + el.id = 'openasar-version'; + el.className = 'colorMuted-HdFt4q size12-3cLvbJ line-3ColD0 versionHash-2gXjIB'; + el.textContent = 'OpenAsar ()'; + + infoEl.appendChild(el); +}; +setInterval(settingsInject, 1000); \ No newline at end of file