Remove glasstron and tabs completely

This commit is contained in:
smartfrigde 2022-06-14 17:02:37 +02:00
parent 8d85591e1c
commit c979328aee
9 changed files with 11 additions and 192 deletions

View file

@ -1,46 +0,0 @@
.tabs {
display: block;
top: 0;
left: 0;
right: 0;
flex-shrink: 0;
overflow: hidden;
zoom: 1;
box-sizing: border-box;
width: 100%;
clear: both;
height: 30px;
line-height: 30px;
background-color: #202225;
-webkit-app-region: drag;
width: 100%;
user-select: none;
-webkit-user-select: none;
position: fixed;
z-index: 99999;
}
.tabs #tabs-controls-container {
float: left;
width: 150px;
height: 100%;
line-height: 30px;
background-color: #202225;
-webkit-app-region: no-drag;
}
.tabs-buttons {
color: white;
background-color: inherit;
float: left;
border: none;
outline: none;
cursor: pointer;
transition: 0.3s;
font-size: 20px;
}
.tabs-buttons:hover {
background-color: #4e515a;
}
.withFrame-haYltI {
height: 30px !important;
}

View file

@ -123,8 +123,7 @@
automaticPatches: false,
mods: "cumcord",
inviteWebsocket: true,
performanceMode: "none",
blurType: "acrylic"
performanceMode: "none"
});
setTimeout(() => window.armcordinternal.restart(), 5000);
});
@ -155,8 +154,7 @@
automaticPatches: false,
performanceMode: "none",
mods: options.mod,
inviteWebsocket: true,
blurType: "acrylic"
inviteWebsocket: true
});
setTimeout(() => window.armcordinternal.restart(), 500);
});
@ -170,8 +168,7 @@
autoLaunch: true,
mods: "none",
performanceMode: "none",
inviteWebsocket: true,
blurType: "acrylic"
inviteWebsocket: true
});
setTimeout(() => window.armcordinternal.restart(), 500);
}

View file

@ -1,16 +1,13 @@
//ipc stuff
import {app, ipcMain, shell, desktopCapturer} from "electron";
import {createTabsGuest, mainWindow} from "./window";
import {mainWindow} from "./window";
import {setConfigBulk, getVersion, getConfig, setLang, getLang} from "./utils";
import {customTitlebar, tabs} from "./main";
import {customTitlebar} from "./main";
import {createSettingsWindow} from "./settings/main";
export function registerIpc() {
ipcMain.on("get-app-path", (event, arg) => {
event.reply("app-path", app.getAppPath());
});
ipcMain.on("openTab", (event, number: number) => {
createTabsGuest(number);
});
ipcMain.on("setLang", (event, lang: string) => {
setLang(lang);
});
@ -66,9 +63,6 @@ export function registerIpc() {
ipcMain.on("titlebar", (event, arg) => {
event.returnValue = customTitlebar;
});
ipcMain.on("tabs", (event, arg) => {
event.returnValue = tabs;
});
ipcMain.on("shouldPatch", async (event, arg) => {
event.returnValue = await getConfig("automaticPatches");
});

View file

@ -1,16 +1,15 @@
// Modules to control application life and create native browser window
import {app, BrowserWindow, session, dialog} from "electron";
import {app, BrowserWindow, session} from "electron";
import "v8-compile-cache";
import {getConfig, setup, checkIfConfigExists, injectElectronFlags} from "./utils";
import {getConfig, checkIfConfigExists, injectElectronFlags} from "./utils";
import "./extensions/mods";
import "./extensions/plugin";
import "./tray";
import {createCustomWindow, createNativeWindow, createTabsHost} from "./window";
import {createCustomWindow, createNativeWindow} from "./window";
import "./shortcuts";
export var settings: any;
export var customTitlebar: boolean;
export var tabs: boolean;
if (process.platform == "linux") {
@ -38,17 +37,6 @@ app.whenReady().then(async () => {
case "discord":
createNativeWindow();
break;
case "glasstron":
dialog.showErrorBox(
"Glasstron is unsupported.",
"This build doesn't include Glasstron functionality, please edit windowStyle value in your settings.json to something different (default for example)"
);
app.quit();
break;
case "tabs":
createTabsHost();
tabs = true;
break;
default:
createCustomWindow();
customTitlebar = true;
@ -73,16 +61,8 @@ app.whenReady().then(async () => {
case "native":
createNativeWindow();
break;
case "glasstron":
dialog.showErrorBox(
"Glasstron is unsupported.",
"This build doesn't include Glasstron functionality, please edit windowStyle value in your settings.json to something different (default for example)"
);
app.quit();
break;
case "tabs":
createTabsHost();
tabs = true;
case "discord":
createNativeWindow();
break;
default:
createCustomWindow();

View file

@ -6,7 +6,6 @@ import * as path from "path";
import {injectTitlebar} from "./titlebar";
import {sleep, addStyle, injectJS, addScript} from "../utils";
import {ipcRenderer} from "electron";
import {injectTabs} from "./tabs";
var version = ipcRenderer.sendSync("get-app-version", "app-version");
async function updateLang() {
if (window.location.href.indexOf("setup.html") > -1) {
@ -35,9 +34,6 @@ if (window.location.href.indexOf("splash.html") > -1) {
if (ipcRenderer.sendSync("titlebar")) {
injectTitlebar();
}
if (ipcRenderer.sendSync("tabs")) {
injectTabs();
}
sleep(5000).then(async () => {
const cssPath = path.join(__dirname, "../", "/content/css/discord.css");
addStyle(fs.readFileSync(cssPath, "utf8"));

View file

@ -1,26 +0,0 @@
import {addStyle} from "../utils";
import * as fs from "fs";
import * as path from "path";
export function injectTabs() {
document.addEventListener("DOMContentLoaded", function (event) {
var elem = document.createElement("div");
elem.innerHTML = `<nav class="tabs">
<div id="tabs-controls-container">
<button class="tabs-buttons" onclick="armcord.openTab(1)">1</button>
<button class="tabs-buttons" onclick="armcord.openTab(2)">2</button>
<button class="tabs-buttons" onclick="armcord.openTab(3)">3</button>
<button class="tabs-buttons" onclick="armcord.openTab(4)">4</button>
<button class="tabs-buttons" onclick="armcord.openTab(5)">5</button>
<p class="experimental">Experimental</p>
</div>
</nav>`;
elem.classList.add("withFrame-haYltI");
if (document.getElementById("app-mount") == null) {
document.body.appendChild(elem);
} else {
document.getElementById("app-mount")!.prepend(elem);
}
const cssPath = path.join(__dirname, "../", "/content/css/tabs.css");
addStyle(fs.readFileSync(cssPath, "utf8"));
});
}

View file

@ -104,7 +104,6 @@
}
loadSettings();
document.getElementById("settings-save").addEventListener("click", function () {
//function saveSettings(windowStyle: string, channelSetting: string, armcordCSPSetting: boolean, minimizeToTray: boolean, automaticPatches: boolean,modsSetting: string, blurType: string)
settings.save({
windowStyle: document.getElementById("theme").value,
channel: document.getElementById("channel").value,
@ -112,7 +111,6 @@
minimizeToTray: document.getElementById("tray").checked,
automaticPatches: document.getElementById("patches").checked,
mods: document.getElementById("mod").value,
blurType: "acrylic",
inviteWebsocket: document.getElementById("websocket").checked,
performanceMode: document.getElementById("prfmMode").value,
doneSetup: true

View file

@ -42,7 +42,6 @@ export function setup() {
minimizeToTray: true,
automaticPatches: false,
mods: "cumcord",
blurType: "acrylic",
performanceMode: "none",
inviteWebsocket: true,
doneSetup: false
@ -148,7 +147,6 @@ export interface Settings {
automaticPatches: boolean;
mods: string;
performanceMode: string;
blurType: string;
inviteWebsocket: boolean;
doneSetup: boolean;
}

View file

@ -2,7 +2,7 @@
// I had to add most of the window creation code here to split both into seperete functions
// WHY? Because I can't use the same code for both due to annoying bug with value `frame` not responding to variables
// I'm sorry for this mess but I'm not sure how to fix it.
import {BrowserWindow, shell, app, ipcMain, dialog, clipboard} from "electron";
import {BrowserWindow, shell, app, dialog} from "electron";
import path from "path";
import {checkIfConfigIsBroken, firstRun, getConfig, contentPath, isSetup, setConfig, setLang} from "./utils";
import {registerIpc} from "./ipc";
@ -12,7 +12,6 @@ import os from "os";
export var icon: string;
export let mainWindow: BrowserWindow;
export let inviteWindow: BrowserWindow;
let guestWindows: BrowserWindow[] = [];
var osType = os.type()
contextMenu({
@ -154,77 +153,6 @@ export function createNativeWindow() {
doAfterDefiningTheWindow();
}
export function createTabsHost() {
dialog.showErrorBox(
"READ THIS BEFORE USING THE APP",
"ArmCord Tabs are highly experimental and should be only used for strict testing purposes. Please don't ask for support, however you can still report bugs!"
);
guestWindows[1] = mainWindow;
mainWindow = new BrowserWindow({
width: 300,
height: 350,
title: "ArmCord",
darkTheme: true,
icon: path.join(__dirname, "../", "/assets/ac_icon_transparent.png"),
frame: true,
autoHideMenuBar: true,
webPreferences: {
preload: path.join(__dirname, "preload/preload.js")
}
});
doAfterDefiningTheWindow();
}
export function createTabsGuest(number: number) {
console.log(guestWindows);
if (guestWindows[number] !== undefined || null) {
try {
console.log("Showing Guest Window " + number);
mainWindow.hide();
guestWindows[number].show();
mainWindow = guestWindows[number];
} catch (e) {
console.error(e);
}
} else {
console.log("Creating Guest Window " + number);
mainWindow.hide();
guestWindows[number] = new BrowserWindow({
width: 800,
height: 600,
title: "ArmCord Guest Window " + number,
darkTheme: true,
icon: path.join(__dirname, "../", "/assets/ac_icon_transparent.png"),
frame: true,
autoHideMenuBar: true,
webPreferences: {
preload: path.join(__dirname, "preload/preload.js")
}
});
mainWindow = guestWindows[number];
ipcMain.on("tab" + number, (event) => {
event.returnValue = true; //return true so we know the tab exists
});
guestWindows[number].webContents.userAgent =
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36"; //fake useragent for screenshare to work
guestWindows[number].webContents.setWindowOpenHandler(({url}) => {
shell.openExternal(url);
return {action: "deny"};
});
guestWindows[number].webContents.session.webRequest.onBeforeRequest(
(details: {url: string}, callback: (arg0: {cancel?: boolean}) => any) => {
if (/api\/v\d\/science$/g.test(details.url)) return callback({cancel: true});
return callback({});
}
);
guestWindows[number].loadURL("https://discord.com/app");
}
}
export function createInviteWindow() {
inviteWindow = new BrowserWindow({
width: 800,