mirror of
				https://github.com/smartfrigde/armcord.git
				synced 2024-08-14 23:56:58 +00:00 
			
		
		
		
	Add keybind maker button
This commit is contained in:
		
							parent
							
								
									6fd260608a
								
							
						
					
					
						commit
						9607a36c3e
					
				
					 5 changed files with 49 additions and 2 deletions
				
			
		|  | @ -70,7 +70,7 @@ class WSServer { | |||
| 
 | ||||
|         if ( | ||||
|             origin !== "" && | ||||
|             !["https://discord.com", "https://ptb.discord.com", "https://canary.discord.com/"].includes(origin) | ||||
|             !["https://discord.com", "https://ptb.discord.com", "https://canary.discord.com"].includes(origin) | ||||
|         ) { | ||||
|             log("disallowed origin", origin); | ||||
| 
 | ||||
|  |  | |||
|  | @ -32,7 +32,8 @@ | |||
| 
 | ||||
| div#acThemes:after, | ||||
| div#acSettings:after, | ||||
| div#acForceQuit:after { | ||||
| div#acForceQuit:after, | ||||
| div#acKeybinds:after { | ||||
|     content: url("https://raw.githubusercontent.com/ArmCord/BrandingStuff/main/ac_white_plug16x.png"); | ||||
|     margin-right: 5px; | ||||
| } | ||||
|  |  | |||
|  | @ -18,6 +18,7 @@ import os from "os"; | |||
| import path from "path"; | ||||
| import {createTManagerWindow} from "./themeManager/main"; | ||||
| import {splashWindow} from "./splash/main"; | ||||
| import {createKeybindWindow} from "./keybindMaker/main"; | ||||
| export function registerIpc(): void { | ||||
|     ipcMain.on("get-app-path", (event) => { | ||||
|         event.reply("app-path", app.getAppPath()); | ||||
|  | @ -130,6 +131,9 @@ export function registerIpc(): void { | |||
|     ipcMain.on("openManagerWindow", () => { | ||||
|         createTManagerWindow(); | ||||
|     }); | ||||
|     ipcMain.on("openKeybindWindow", () => { | ||||
|         createKeybindWindow(); | ||||
|     }); | ||||
|     ipcMain.on("setting-armcordCSP", async (event) => { | ||||
|         if (await getConfig("armcordCSP")) { | ||||
|             event.returnValue = true; | ||||
|  |  | |||
|  | @ -0,0 +1,37 @@ | |||
| import {BrowserWindow, app, shell} from "electron"; | ||||
| import path from "path"; | ||||
| let keybindWindow: BrowserWindow; | ||||
| let instance = 0; | ||||
| 
 | ||||
| export function createKeybindWindow(): void { | ||||
|     console.log("Creating keybind maker window."); | ||||
|     instance += 1; | ||||
|     if (instance > 1) { | ||||
|         if (keybindWindow) { | ||||
|             keybindWindow.show(); | ||||
|             keybindWindow.restore(); | ||||
|         } | ||||
|     } else { | ||||
|         keybindWindow = new BrowserWindow({ | ||||
|             width: 660, | ||||
|             height: 670, | ||||
|             title: `ArmCord Global Keybinds Maker`, | ||||
|             darkTheme: true, | ||||
|             frame: true, | ||||
|             backgroundColor: "#2f3136", | ||||
|             autoHideMenuBar: true, | ||||
|             webPreferences: { | ||||
|                 sandbox: false, | ||||
|                 preload: path.join(__dirname, "preload.js") | ||||
|             } | ||||
|         }); | ||||
|         async function makerLoadPage(): Promise<void> { | ||||
|             keybindWindow.loadURL(`file://${__dirname}/maker.html`); | ||||
|         } | ||||
|         keybindWindow.webContents.setWindowOpenHandler(({url}) => { | ||||
|             shell.openExternal(url); | ||||
|             return {action: "deny"}; | ||||
|         }); | ||||
|         makerLoadPage(); | ||||
|     } | ||||
| } | ||||
|  | @ -94,16 +94,21 @@ setInterval(() => { | |||
|     const acSettings = advanced.cloneNode(true) as HTMLElement; | ||||
|     const tManager = advanced.cloneNode(true) as HTMLElement; | ||||
|     const fQuit = advanced.cloneNode(true) as HTMLElement; | ||||
|     const keybindMaker = advanced.cloneNode(true) as HTMLElement; | ||||
|     acSettings.textContent = "ArmCord"; | ||||
|     acSettings.id = "acSettings"; | ||||
|     acSettings.onclick = () => ipcRenderer.send("openSettingsWindow"); | ||||
|     tManager.textContent = "Themes"; | ||||
|     tManager.id = "acThemes"; | ||||
|     tManager.onclick = () => ipcRenderer.send("openManagerWindow"); | ||||
|     keybindMaker.textContent = "Global keybinds"; | ||||
|     keybindMaker.id = "acKeybinds"; | ||||
|     keybindMaker.onclick = () => ipcRenderer.send("openKeybindWindow"); | ||||
|     fQuit.textContent = "Force Quit"; | ||||
|     fQuit.id = "acForceQuit"; | ||||
|     fQuit.onclick = () => ipcRenderer.send("win-quit"); | ||||
|     advanced.insertAdjacentElement("afterend", acSettings); | ||||
|     advanced.insertAdjacentElement("afterend", tManager); | ||||
|     advanced.insertAdjacentElement("afterend", keybindMaker); | ||||
|     advanced.insertAdjacentElement("afterend", fQuit); | ||||
| }, 1000); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue