Skip to content
This repository was archived by the owner on Aug 10, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions electron/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const { app, BrowserWindow, systemPreferences } = require("electron");
const fetch = require("node-fetch");
const btoa = require("btoa");
const path = require('path');

async function createWindow() {
var html = await fetch("https://raw.githubusercontent.com/Flam3rboy/discord-bot-client/master/index.html");
Expand All @@ -9,27 +10,29 @@ async function createWindow() {
let win = new BrowserWindow({
width: 1920,
height: 1080,
icon: __dirname + "/buildResources/icon.png",
icon: path.join(__dirname, 'buildResources', 'icon.png'),
frame: false,
titleBarStyle: "hidden",
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
webSecurity: true,
nodeIntegration: false,
enableRemoteModule: false,
enableRemoteModule: true,
contextIsolation: true,
},
});
// win.webContents.openDevTools();
win.webContents.on("did-navigate", () => {
win.webContents.executeJavaScript(`document.write(atob("${btoa(html)}"))`);
win.webContents.executeJavaScript(`window.electron.buildTitleBar()`);

});

if (systemPreferences && systemPreferences.askForMediaAccess) systemPreferences.askForMediaAccess("microphone");
win.webContents.on("new-window", function (e, url) {
e.preventDefault();
require("electron").shell.openExternal(url);
});
win.loadURL("https://blank.org");
// win.loadURL("data:text/html;charset=UTF-8," + encodeURIComponent(html), {
// baseURLForDataURL: `file://${__dirname}/app`,
// });

const filter = {
urls: ["<all_urls>"],
Expand Down
1 change: 1 addition & 0 deletions electron/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
},
"dependencies": {
"btoa": "^1.2.1",
"custom-electron-titlebar": "^3.2.3",
"node-fetch": "^2.6.0"
}
}
43 changes: 43 additions & 0 deletions electron/preload.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.