mirror of
				https://github.com/smartfrigde/armcord.git
				synced 2024-08-14 23:56:58 +00:00 
			
		
		
		
	Add a way to set config in cli
This commit is contained in:
		
							parent
							
								
									66821e2dce
								
							
						
					
					
						commit
						08c4cb0a63
					
				
					 4 changed files with 408 additions and 375 deletions
				
			
		
							
								
								
									
										17
									
								
								src/main.ts
									
										
									
									
									
								
							
							
						
						
									
										17
									
								
								src/main.ts
									
										
									
									
									
								
							|  | @ -6,6 +6,7 @@ import { | |||
|     getConfig, | ||||
|     checkIfConfigExists, | ||||
|     injectElectronFlags, | ||||
|     setConfig, | ||||
|     installModLoader, | ||||
|     getConfigLocation | ||||
| } from "./utils"; | ||||
|  | @ -18,7 +19,21 @@ export var iconPath: string; | |||
| export var settings: any; | ||||
| export var customTitlebar: boolean; | ||||
| export var clientName: "ArmCord"; | ||||
| 
 | ||||
| async function args() { | ||||
|     var argNum = 2; | ||||
|     if (process.argv[0] == "electron") argNum++; | ||||
|     var args = process.argv[argNum]; | ||||
|     if (args == undefined) return; | ||||
|     if (args.startsWith("--")) return; //electron flag
 | ||||
|     if (args.includes("=")) { | ||||
|         var e = args.split("="); | ||||
|         await setConfig(e[0], e[1]); | ||||
|         console.log("Setting " + e[0] + " to " + e[1]); | ||||
|         app.relaunch(); | ||||
|         app.exit(); | ||||
|     } | ||||
| } | ||||
| args(); // i want my top level awaits
 | ||||
| if (!app.requestSingleInstanceLock()) { | ||||
|     // kill if 2nd instance
 | ||||
|     app.quit(); | ||||
|  |  | |||
|  | @ -77,7 +77,7 @@ async function doAfterDefiningTheWindow() { | |||
|         if (osType == "Windows_NT") { | ||||
|             osType = "Windows " + os.release().split(".")[0] + " (" + os.release() + ")"; | ||||
|         } | ||||
|         mainWindow.webContents.userAgent = `Mozilla/5.0 (X11; ${osType} ${os.arch()}) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36`; //fake useragent for screenshare to work
 | ||||
|         mainWindow.webContents.userAgent = `Mozilla/5.0 (X11; ${osType} ${os.arch()}) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36`; //fake useragent for screenshare to work
 | ||||
|     } | ||||
|     app.on("second-instance", (event, commandLine, workingDirectory, additionalData) => { | ||||
|         // Print out data received from the second instance.
 | ||||
|  | @ -94,7 +94,12 @@ async function doAfterDefiningTheWindow() { | |||
|         // Allow about:blank (used by Vencord QuickCss popup)
 | ||||
|         if (url === "about:blank") return {action: "allow"}; | ||||
|         // Allow Discord stream popout
 | ||||
|         if ((url === "https://discord.com/popout") || (url === "https://canary.discord.com/popout") || (url === "https://ptb.discord.com/popout")) return {action: "allow"}; | ||||
|         if ( | ||||
|             url === "https://discord.com/popout" || | ||||
|             url === "https://canary.discord.com/popout" || | ||||
|             url === "https://ptb.discord.com/popout" | ||||
|         ) | ||||
|             return {action: "allow"}; | ||||
|         if (url.startsWith("https:") || url.startsWith("http:") || url.startsWith("mailto:")) { | ||||
|             shell.openExternal(url); | ||||
|         } else { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue