Fix image pasting

This commit is contained in:
smartfrigde 2022-05-14 19:55:06 +02:00
parent d1d7c5834c
commit 1222a37a44
4 changed files with 104 additions and 17 deletions

103
package-lock.json generated
View file

@ -10,7 +10,8 @@
"hasInstallScript": true,
"license": "OSL-3.0",
"dependencies": {
"electron-context-menu": "^3.1.2",
"electron-context-menu": "https://github.com/ArmCord/electron-context-menu.git",
"electron-editor-context-menu": "^1.1.1",
"v8-compile-cache": "^2.3.0",
"ws": "^8.6.0"
},
@ -19,11 +20,11 @@
"@types/node": "^17.0.33",
"@types/ws": "^8.5.3",
"copyfiles": "^2.4.1",
"electron": "^18.1.0",
"electron": "^18.2.3",
"electron-builder": "^23.0.3",
"husky": "^8.0.1",
"prettier": "^2.5.1",
"typescript": "^4.6.4"
"typescript": "^4.6.3"
}
},
"node_modules/@develar/schema-utils": {
@ -1326,9 +1327,9 @@
}
},
"node_modules/electron": {
"version": "18.1.0",
"resolved": "https://registry.npmjs.org/electron/-/electron-18.1.0.tgz",
"integrity": "sha512-P55wdHNTRMo7a/agC84ZEZDYEK/pTBcQdlp8lFbHcx3mO4Kr+Im/J5p2uQgiuXtown31HqNh2paL3V0p+E6rpQ==",
"version": "18.2.3",
"resolved": "https://registry.npmjs.org/electron/-/electron-18.2.3.tgz",
"integrity": "sha512-DJWX03hCRKTscsfXxmW4gmgFuseop+g+m4ml7NfOMfankD8uYyr2Xyi3Ui02inL9qZOlbLMeLVCu6jKCKs8p/w==",
"dev": true,
"hasInstallScript": true,
"dependencies": {
@ -1434,8 +1435,8 @@
},
"node_modules/electron-context-menu": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/electron-context-menu/-/electron-context-menu-3.1.2.tgz",
"integrity": "sha512-nNzu4w14n7mOR+4cLjRC9cEFqGUsAY76seOm0sw3f4OxEfX/d75m7HYekyp5b+0m7Ixy2KN/Mrljw1zLmpyV2w==",
"resolved": "git+ssh://git@github.com/ArmCord/electron-context-menu.git#1ec9d1e69c41f44530e2637fbe5f7d99f78b1eeb",
"license": "MIT",
"dependencies": {
"cli-truncate": "^2.1.0",
"electron-dl": "^3.2.1",
@ -1458,6 +1459,18 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/electron-editor-context-menu": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/electron-editor-context-menu/-/electron-editor-context-menu-1.1.1.tgz",
"integrity": "sha1-3DAJjg37N/YmKOQzAxJMfzN5Vy0=",
"dependencies": {
"lodash.clonedeep": "^4.3.0",
"lodash.defaults": "^4.0.1",
"lodash.isarray": "^4.0.0",
"lodash.isempty": "^4.1.2",
"lodash.isfunction": "^3.0.8"
}
},
"node_modules/electron-is-dev": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/electron-is-dev/-/electron-is-dev-2.0.0.tgz",
@ -2346,6 +2359,32 @@
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
"dev": true
},
"node_modules/lodash.clonedeep": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz",
"integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8="
},
"node_modules/lodash.defaults": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-4.2.0.tgz",
"integrity": "sha1-0JF4cW/+pN3p5ft7N/bwgCJ0WAw="
},
"node_modules/lodash.isarray": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-4.0.0.tgz",
"integrity": "sha1-KspJayjEym1yZxUxNZDALm6jRAM=",
"deprecated": "This package is deprecated. Use Array.isArray."
},
"node_modules/lodash.isempty": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/lodash.isempty/-/lodash.isempty-4.4.0.tgz",
"integrity": "sha1-b4bL7di+TsmHvpqvM8loTbGzHn4="
},
"node_modules/lodash.isfunction": {
"version": "3.0.9",
"resolved": "https://registry.npmjs.org/lodash.isfunction/-/lodash.isfunction-3.0.9.tgz",
"integrity": "sha512-AirXNj15uRIMMPihnkInB4i3NHeb4iBtNg9WRWuK2o31S+ePwwNmDPaTL3o7dTJ+VXNZim7rFs4rxN4YU1oUJw=="
},
"node_modules/lowercase-keys": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz",
@ -4585,9 +4624,9 @@
}
},
"electron": {
"version": "18.1.0",
"resolved": "https://registry.npmjs.org/electron/-/electron-18.1.0.tgz",
"integrity": "sha512-P55wdHNTRMo7a/agC84ZEZDYEK/pTBcQdlp8lFbHcx3mO4Kr+Im/J5p2uQgiuXtown31HqNh2paL3V0p+E6rpQ==",
"version": "18.2.3",
"resolved": "https://registry.npmjs.org/electron/-/electron-18.2.3.tgz",
"integrity": "sha512-DJWX03hCRKTscsfXxmW4gmgFuseop+g+m4ml7NfOMfankD8uYyr2Xyi3Ui02inL9qZOlbLMeLVCu6jKCKs8p/w==",
"dev": true,
"requires": {
"@electron/get": "^1.13.0",
@ -4674,9 +4713,8 @@
}
},
"electron-context-menu": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/electron-context-menu/-/electron-context-menu-3.1.2.tgz",
"integrity": "sha512-nNzu4w14n7mOR+4cLjRC9cEFqGUsAY76seOm0sw3f4OxEfX/d75m7HYekyp5b+0m7Ixy2KN/Mrljw1zLmpyV2w==",
"version": "git+ssh://git@github.com/ArmCord/electron-context-menu.git#1ec9d1e69c41f44530e2637fbe5f7d99f78b1eeb",
"from": "electron-context-menu@https://github.com/ArmCord/electron-context-menu.git",
"requires": {
"cli-truncate": "^2.1.0",
"electron-dl": "^3.2.1",
@ -4693,6 +4731,18 @@
"unused-filename": "^2.1.0"
}
},
"electron-editor-context-menu": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/electron-editor-context-menu/-/electron-editor-context-menu-1.1.1.tgz",
"integrity": "sha1-3DAJjg37N/YmKOQzAxJMfzN5Vy0=",
"requires": {
"lodash.clonedeep": "^4.3.0",
"lodash.defaults": "^4.0.1",
"lodash.isarray": "^4.0.0",
"lodash.isempty": "^4.1.2",
"lodash.isfunction": "^3.0.8"
}
},
"electron-is-dev": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/electron-is-dev/-/electron-is-dev-2.0.0.tgz",
@ -5378,6 +5428,31 @@
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
"dev": true
},
"lodash.clonedeep": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz",
"integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8="
},
"lodash.defaults": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-4.2.0.tgz",
"integrity": "sha1-0JF4cW/+pN3p5ft7N/bwgCJ0WAw="
},
"lodash.isarray": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-4.0.0.tgz",
"integrity": "sha1-KspJayjEym1yZxUxNZDALm6jRAM="
},
"lodash.isempty": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/lodash.isempty/-/lodash.isempty-4.4.0.tgz",
"integrity": "sha1-b4bL7di+TsmHvpqvM8loTbGzHn4="
},
"lodash.isfunction": {
"version": "3.0.9",
"resolved": "https://registry.npmjs.org/lodash.isfunction/-/lodash.isfunction-3.0.9.tgz",
"integrity": "sha512-AirXNj15uRIMMPihnkInB4i3NHeb4iBtNg9WRWuK2o31S+ePwwNmDPaTL3o7dTJ+VXNZim7rFs4rxN4YU1oUJw=="
},
"lowercase-keys": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz",

View file

@ -34,7 +34,8 @@
"typescript": "^4.6.3"
},
"dependencies": {
"electron-context-menu": "^3.1.2",
"electron-context-menu": "https://github.com/ArmCord/electron-context-menu.git",
"electron-editor-context-menu": "^1.1.1",
"v8-compile-cache": "^2.3.0",
"ws": "^8.6.0"
},

View file

@ -27,6 +27,12 @@ app.whenReady().then(async () => {
} else {
tray = new Tray(path.join(__dirname, "../", "/assets/ac_plug.png"));
const contextMenu = Menu.buildFromTemplate([
{
label: "ArmCord",
},
{
type: "separator"
},
{
label: "Open ArmCord",
click: function () {
@ -46,6 +52,9 @@ app.whenReady().then(async () => {
mainWindow.loadURL("https://discord.gg/TnhxcqynZ2");
}
},
{
type: "separator"
},
{
label: "Quit ArmCord",
click: function () {

View file

@ -2,16 +2,18 @@
// 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} from "electron";
import {BrowserWindow, shell, app, ipcMain, dialog, clipboard} from "electron";
import path from "path";
import {checkIfConfigIsBroken, firstRun, getConfig, contentPath} from "./utils";
import {registerIpc} from "./ipc";
import startServer from "./socket"
import contextMenu from "electron-context-menu";
import os from "os";
export var icon: string;
export let mainWindow: BrowserWindow;
export let inviteWindow: BrowserWindow;
let guestWindows: BrowserWindow[] = [];
contextMenu({
showSaveImageAs: true,
showCopyImageAddress: true,
@ -22,7 +24,7 @@ async function doAfterDefiningTheWindow() {
checkIfConfigIsBroken();
registerIpc();
mainWindow.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
`Mozilla/5.0 (X11; ${os.type()} ${os.arch()}) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36`; //fake useragent for screenshare to work
mainWindow.webContents.setWindowOpenHandler(({url}) => {
shell.openExternal(url);
return {action: "deny"};