diff --git a/index.html b/index.html index 63c7bd2..2ec69f4 100644 --- a/index.html +++ b/index.html @@ -23,7 +23,6 @@ - diff --git a/libbrowz.js b/libbrowz.js index 9aea89b..ea6bf90 100644 --- a/libbrowz.js +++ b/libbrowz.js @@ -77,11 +77,6 @@ function go() { tabGroup.getActiveTab().setTitle(title) console.log(title) }) - for (let i = 0; i < userscripts.length; i++) { - fetch(userscripts[i]).then( r => r.text() ).then( t => userscripts.executeJavaScript(t)).catch(() => { - console.log("Error loading userscripts! (Did you provide any?)") - }) - } } function stop() { diff --git a/main.js b/main.js index 96075f2..a35574d 100644 --- a/main.js +++ b/main.js @@ -55,6 +55,11 @@ function isLocal(url) { } function createWindow () { + try { + extensions = new ElectronChromeExtensions() + } catch { + console.log("Creating a new window in the same extension session...") + } const mainWindow = new BrowserWindow({ width: 1100, height: 600, @@ -70,8 +75,8 @@ function createWindow () { } }) - const userDataPath = app.getPath('userData'); - const extensionsDir = path.join(userDataPath, 'SneedExtensions'); + const homePath = app.getPath('home'); + const extensionsDir = path.join(homePath, 'SneedExtensions'); if (!fs.existsSync(extensionsDir)) { fs.mkdirSync(extensionsDir, { recursive: true }); @@ -216,7 +221,6 @@ app.on('window-all-closed', function () { // Set DNS app.on('ready', () => { - extensions = new ElectronChromeExtensions() app.configureHostResolver({ mode: 'secure', dohServers: [ diff --git a/userscript/userscripts.js b/userscript/userscripts.js deleted file mode 100644 index 984823e..0000000 --- a/userscript/userscripts.js +++ /dev/null @@ -1 +0,0 @@ -var userscripts = [""]