Remove userscript support.

This commit is contained in:
The Ghost of FOSS' Past 2024-11-21 15:04:35 -06:00
parent 995962a497
commit dc9f6a45a6
4 changed files with 7 additions and 10 deletions

View file

@ -23,7 +23,6 @@
</tab-group> </tab-group>
</div> </div>
<script src="node_modules/electron-tabs/dist/electron-tabs.js"></script> <script src="node_modules/electron-tabs/dist/electron-tabs.js"></script>
<script type="text/javascript" src="./userscript/userscripts.js"></script>
<script type="text/javascript" src="./config.js"></script> <script type="text/javascript" src="./config.js"></script>
<script type="text/javascript" src="./libbrowz.js"></script> <script type="text/javascript" src="./libbrowz.js"></script>
</body> </body>

View file

@ -77,11 +77,6 @@ function go() {
tabGroup.getActiveTab().setTitle(title) tabGroup.getActiveTab().setTitle(title)
console.log(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() { function stop() {

10
main.js
View file

@ -55,6 +55,11 @@ function isLocal(url) {
} }
function createWindow () { function createWindow () {
try {
extensions = new ElectronChromeExtensions()
} catch {
console.log("Creating a new window in the same extension session...")
}
const mainWindow = new BrowserWindow({ const mainWindow = new BrowserWindow({
width: 1100, width: 1100,
height: 600, height: 600,
@ -70,8 +75,8 @@ function createWindow () {
} }
}) })
const userDataPath = app.getPath('userData'); const homePath = app.getPath('home');
const extensionsDir = path.join(userDataPath, 'SneedExtensions'); const extensionsDir = path.join(homePath, 'SneedExtensions');
if (!fs.existsSync(extensionsDir)) { if (!fs.existsSync(extensionsDir)) {
fs.mkdirSync(extensionsDir, { recursive: true }); fs.mkdirSync(extensionsDir, { recursive: true });
@ -216,7 +221,6 @@ app.on('window-all-closed', function () {
// Set DNS // Set DNS
app.on('ready', () => { app.on('ready', () => {
extensions = new ElectronChromeExtensions()
app.configureHostResolver({ app.configureHostResolver({
mode: 'secure', mode: 'secure',
dohServers: [ dohServers: [

View file

@ -1 +0,0 @@
var userscripts = [""]