2.4 Update

Canary
This commit is contained in:
smartfridge 2021-05-09 21:40:57 +02:00 committed by GitHub
commit df5403c1c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 47 additions and 30 deletions

16
main.js
View file

@ -2,9 +2,17 @@
const { app, BrowserWindow, session, Tray, Menu } = require("electron"); const { app, BrowserWindow, session, Tray, Menu } = require("electron");
const path = require("path"); const path = require("path");
const contextMenu = require("electron-context-menu"); const contextMenu = require("electron-context-menu");
const os = require("os");
require("v8-compile-cache"); require("v8-compile-cache");
require("./utils/updater"); require("./utils/updater");
if (os.type() == 'Linux'){
var iconformat = __dirname + "/discord.png"
} else { //test this
console.log("Running Non-Linux")
var iconformat = __dirname + "/discord.ico";
}
contextMenu({ contextMenu({
prepend: (defaultActions, parameters, browserWindow) => [ prepend: (defaultActions, parameters, browserWindow) => [
{ {
@ -21,7 +29,7 @@ function createWindow() {
mainWindow = new BrowserWindow({ mainWindow = new BrowserWindow({
width: 800, width: 800,
height: 600, height: 600,
icon: __dirname + "/discord.png", icon: iconformat,
title: "ArmCord", title: "ArmCord",
frame: false, frame: false,
webPreferences: { webPreferences: {
@ -31,7 +39,7 @@ function createWindow() {
}, },
}); });
var appIcon = new Tray(__dirname + "/discord.ico"); var appIcon = new Tray(iconformat);
mainWindow.webContents.userAgent = mainWindow.webContents.userAgent =
"Mozilla/5.0 (X12; FreeBSD x86) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36"; //fake useragent "Mozilla/5.0 (X12; FreeBSD x86) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36"; //fake useragent
mainWindow.loadFile("index.html"); mainWindow.loadFile("index.html");
@ -106,6 +114,10 @@ app.whenReady().then(() => {
// Approves the permissions request // Approves the permissions request
callback(true); callback(true);
} }
if (!url.startsWith("discord://")) {
// Denies the permissions request
return callback(false);
}
}); });
app.on("activate", function () { app.on("activate", function () {
// On macOS it's common to re-create a window in the app when the // On macOS it's common to re-create a window in the app when the

View file

@ -1,6 +1,6 @@
{ {
"name": "armcord", "name": "armcord",
"version": "2.3.3", "version": "2.4.0",
"description": "ArmCord is a Discord client made for ARM Linux that allows you to customize your experience.", "description": "ArmCord is a Discord client made for ARM Linux that allows you to customize your experience.",
"main": "main.js", "main": "main.js",
"scripts": { "scripts": {

View file

@ -1,30 +1,30 @@
const customTitlebar = require('custom-electron-titlebar') const customTitlebar = require("custom-electron-titlebar");
const electronLocalshortcut = require("electron-localshortcut"); const electronLocalshortcut = require("electron-localshortcut");
const { remote } = require("electron"); const { remote } = require("electron");
const ArmCord = require("./utils/ArmCord.js") const ArmCord = require("./utils/ArmCord.js");
window.addEventListener('DOMContentLoaded', () => { window.addEventListener("DOMContentLoaded", () => {
new customTitlebar.Titlebar({ new customTitlebar.Titlebar({
backgroundColor: customTitlebar.Color.fromHex("#202225"), backgroundColor: customTitlebar.Color.fromHex("#202225"),
menu: false, menu: false,
}); });
const currentWindow = remote.getCurrentWindow(); const currentWindow = remote.getCurrentWindow();
electronLocalshortcut.register(currentWindow, "F5", () => { electronLocalshortcut.register(currentWindow, "F5", () => {
location.reload(); location.reload();
}); });
electronLocalshortcut.register(currentWindow, "F12", () => { electronLocalshortcut.register(currentWindow, "F12", () => {
currentWindow.webContents.openDevTools(); currentWindow.webContents.openDevTools();
}); });
electronLocalshortcut.register(currentWindow, "F1", () => { electronLocalshortcut.register(currentWindow, "F1", () => {
require("shell").openExternal("https://support.discord.com/") require("shell").openExternal("https://support.discord.com/");
}); });
electronLocalshortcut.register(currentWindow, "F2", () => { electronLocalshortcut.register(currentWindow, "F2", () => {
window.location.href = "https://discord.com/invite/F25bc4RYDt" window.location.href = "https://discord.com/invite/F25bc4RYDt";
}); });
require("./utils/capturer.js") require("./utils/capturer.js");
ArmCord.addStyle(` ArmCord.addStyle(`
@import url("https://kckarnige.github.io/femboi_owo/discord-font.css"); @import url("https://kckarnige.github.io/femboi_owo/discord-font.css");
:root { :root {
@ -79,6 +79,7 @@ div.menubar[role="menubar"] {
} }
`); `);
ArmCord.addStyle(`.info-1VyQPT:last-child:before { ArmCord.addStyle(`.info-1VyQPT:last-child:before {
content: "ArmCord Version: ` + ArmCord.Version + `"; content: "ArmCord Version: ` + ArmCord.Version + `";
height: auto; height: auto;
@ -87,5 +88,7 @@ ArmCord.addStyle(`.info-1VyQPT:last-child:before {
color: var(--text-muted); color: var(--text-muted);
font-size: 12px; font-size: 12px;
text-transform: none; text-transform: none;
}`); }`);
}) })

View file

@ -1,13 +1,15 @@
exports.Version = "DevBuild";
exports.addStyle = function(styleString) { exports.Version = "2.4";
const style = document.createElement('style');
style.textContent = styleString; exports.addStyle = function (styleString) {
document.head.append(style); const style = document.createElement("style");
style.textContent = styleString;
document.head.append(style);
}; };
exports.addScript = function(scriptString) { exports.addScript = function (scriptString) {
var script = document.createElement('script'); var script = document.createElement("script");
script.textContent = scriptString; script.textContent = scriptString;
document.body.append(script); document.body.append(script);
}; };