From 4e21350ca31beb44d525f62936cc40daa6eefcd3 Mon Sep 17 00:00:00 2001 From: Oj Date: Thu, 10 Mar 2022 21:27:02 +0000 Subject: [PATCH] [MainWindow] Clean up injection source --- src/bootstrap.js | 13 ++++++------- src/mainWindowInject.js | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/bootstrap.js b/src/bootstrap.js index 4633c3a..309f3c3 100644 --- a/src/bootstrap.js +++ b/src/bootstrap.js @@ -62,14 +62,13 @@ const startCore = () => { donePageReady = true; } - let injectJs = readFileSync(join(__dirname, 'mainWindowInject.js'), 'utf8'); + const [ channel, hash ] = oaVersion.split('-'); // Split via - - const [ version1, version2 ] = oaVersion.split('-'); // Split via - - injectJs = injectJs - .replaceAll('', version1[0].toUpperCase() + version1.substring(1).toLowerCase()) - .replaceAll('', version2 || 'custom'); - - bw.webContents.executeJavaScript(injectJs); + bw.webContents.executeJavaScript( + readFileSync(join(__dirname, 'mainWindowInject.js'), 'utf8') + .replaceAll('', channel) + .replaceAll('', hash || 'custom') + ); }); }); }; diff --git a/src/mainWindowInject.js b/src/mainWindowInject.js index 8f6a6ac..5e186ae 100644 --- a/src/mainWindowInject.js +++ b/src/mainWindowInject.js @@ -26,7 +26,7 @@ setInterval(() => { const css = ` [class^="socialLinks-"] + [class^="info-"] [class^="colorMuted-"]:nth-last-child(2)::after { - content: " | OpenAsar "; + content: " | OpenAsar "; display: inline; text-transform: none; }