mirror of
				https://github.com/smartfrigde/armcord.git
				synced 2024-08-14 23:56:58 +00:00 
			
		
		
		
	Titlebar, client mod, Discord, everything loads
This commit is contained in:
		
							parent
							
								
									c2c0e50fd3
								
							
						
					
					
						commit
						521278cf00
					
				
					 10 changed files with 236 additions and 206 deletions
				
			
		
							
								
								
									
										15
									
								
								package-lock.json
									
										
									
										generated
									
									
									
								
							
							
						
						
									
										15
									
								
								package-lock.json
									
										
									
										generated
									
									
									
								
							|  | @ -5,6 +5,7 @@ | |||
|   "requires": true, | ||||
|   "packages": { | ||||
|     "": { | ||||
|       "name": "armcord", | ||||
|       "version": "3.0.0", | ||||
|       "license": "OSL-3.0", | ||||
|       "dependencies": { | ||||
|  | @ -17,7 +18,7 @@ | |||
|         "ws": "^8.4.0" | ||||
|       }, | ||||
|       "devDependencies": { | ||||
|         "electron": "^16.0.5" | ||||
|         "electron": "^16.0.7" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/@electron/get": { | ||||
|  | @ -343,9 +344,9 @@ | |||
|       "dev": true | ||||
|     }, | ||||
|     "node_modules/electron": { | ||||
|       "version": "16.0.5", | ||||
|       "resolved": "https://registry.npmjs.org/electron/-/electron-16.0.5.tgz", | ||||
|       "integrity": "sha512-TgQXWmEGQ3uH2P2JDq5GyJDEu/fimRgqp1iNisARtGreU1k3630PqWlR+4SPnSEHN9NuSv92ng6NWxtefeFzxg==", | ||||
|       "version": "16.0.7", | ||||
|       "resolved": "https://registry.npmjs.org/electron/-/electron-16.0.7.tgz", | ||||
|       "integrity": "sha512-/IMwpBf2svhA1X/7Q58RV+Nn0fvUJsHniG4TizaO7q4iKFYSQ6hBvsLz+cylcZ8hRMKmVy5G1XaMNJID2ah23w==", | ||||
|       "dev": true, | ||||
|       "hasInstallScript": true, | ||||
|       "dependencies": { | ||||
|  | @ -1561,9 +1562,9 @@ | |||
|       "dev": true | ||||
|     }, | ||||
|     "electron": { | ||||
|       "version": "16.0.5", | ||||
|       "resolved": "https://registry.npmjs.org/electron/-/electron-16.0.5.tgz", | ||||
|       "integrity": "sha512-TgQXWmEGQ3uH2P2JDq5GyJDEu/fimRgqp1iNisARtGreU1k3630PqWlR+4SPnSEHN9NuSv92ng6NWxtefeFzxg==", | ||||
|       "version": "16.0.7", | ||||
|       "resolved": "https://registry.npmjs.org/electron/-/electron-16.0.7.tgz", | ||||
|       "integrity": "sha512-/IMwpBf2svhA1X/7Q58RV+Nn0fvUJsHniG4TizaO7q4iKFYSQ6hBvsLz+cylcZ8hRMKmVy5G1XaMNJID2ah23w==", | ||||
|       "dev": true, | ||||
|       "requires": { | ||||
|         "@electron/get": "^1.13.0", | ||||
|  |  | |||
|  | @ -20,7 +20,7 @@ | |||
|   }, | ||||
|   "homepage": "https://github.com/armcord/armcord#readme", | ||||
|   "devDependencies": { | ||||
|     "electron": "^16.0.5" | ||||
|     "electron": "^16.0.7" | ||||
|   }, | ||||
|   "dependencies": { | ||||
|     "@types/electron-json-storage": "^4.5.0", | ||||
|  |  | |||
							
								
								
									
										12
									
								
								src/content/css/discord.css
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								src/content/css/discord.css
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,12 @@ | |||
| .info-1VyQPT:last-child:before { | ||||
|   content: "ArmCord Version: 3.0.0"!important; | ||||
|   height: auto; | ||||
|   line-height: 16px; | ||||
|   text-align: center; | ||||
|   color: var(--text-muted); | ||||
|   font-size: 12px; | ||||
|   text-transform: none; | ||||
| } | ||||
| .notice-3bPHh-.colorDefault-22HBa0 { | ||||
|   display: none; | ||||
| } | ||||
|  | @ -5,122 +5,104 @@ | |||
|   --armcord-color: #7289da; | ||||
|   --titlebar-color: var(--background-tertiary); | ||||
| } | ||||
| .titleebar { | ||||
|     position: absolute; | ||||
|     top: 0; | ||||
|     left: 0; | ||||
|     right: 0; | ||||
|     box-sizing: border-box; | ||||
|     width: 100%; | ||||
|     font-size: 13px; | ||||
|     padding: 0 16px; | ||||
|     overflow: hidden; | ||||
|     flex-shrink: 0; | ||||
|     align-items: center; | ||||
|     justify-content: center; | ||||
|     user-select: none; | ||||
|     zoom: 1; | ||||
|     line-height: 22px; | ||||
|     height: 22px; | ||||
|     display: flex; | ||||
|     z-index: 99999; | ||||
|   } | ||||
|   .titlebar { | ||||
|     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; | ||||
|      | ||||
|   } | ||||
|   .appMount-3lHmkl{ | ||||
|    | ||||
|   } | ||||
|   .titlebar #window-title { | ||||
|     width: 30%; | ||||
|     height: 100%; | ||||
|     line-height: 30px; | ||||
|     float: left; | ||||
|     padding: 0 0 0 1em; | ||||
|   } | ||||
|    | ||||
|   .titlebar #window-controls-container { | ||||
|     float: right; | ||||
|     width: 150px; | ||||
|     height: 100%; | ||||
|     line-height: 30px; | ||||
|     background-color: #202225; | ||||
|     -webkit-app-region: no-drag; | ||||
|   } | ||||
|    | ||||
|   .titlebar #window-controls-container #minimize, | ||||
|   .titlebar #window-controls-container #maximize, | ||||
|   .titlebar #window-controls-container #quit { | ||||
|     float: left; | ||||
|     height: 100%; | ||||
|     width: 33%; | ||||
|     text-align: center; | ||||
|     color: #f7f7f7; | ||||
|     cursor: default; | ||||
|   } | ||||
|    | ||||
|   .titlebar #window-controls-container #minimize:hover { | ||||
|     background-color: #99AAB5; | ||||
|   } | ||||
|   .titlebar #window-controls-container #maximize:hover { | ||||
|     background-color: #99AAB5; | ||||
|   } | ||||
|   .titlebar #window-controls-container #quit:hover { | ||||
|     background-color: #F04747; | ||||
|   } | ||||
|   .titlebar #window-controls-container #quit { | ||||
|     background-color: #f7f7f7; | ||||
|     -webkit-mask: url("data:image/svg+xml;charset=utf-8,%3Csvg width='11' height='11' viewBox='0 0 11 11' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6.279 5.5L11 10.221l-.779.779L5.5 6.279.779 11 0 10.221 4.721 5.5 0 .779.779 0 5.5 4.721 10.221 0 11 .779 6.279 5.5z' fill='%23000'/%3E%3C/svg%3E") no-repeat 50% 50%; | ||||
|     mask: url("data:image/svg+xml;charset=utf-8,%3Csvg width='11' height='11' viewBox='0 0 11 11' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6.279 5.5L11 10.221l-.779.779L5.5 6.279.779 11 0 10.221 4.721 5.5 0 .779.779 0 5.5 4.721 10.221 0 11 .779 6.279 5.5z' fill='%23000'/%3E%3C/svg%3E") no-repeat 50% 50%; | ||||
|   } | ||||
|   .titlebar #window-controls-container #minimize { | ||||
|     background-color: #f7f7f7; | ||||
|     -webkit-mask: url("data:image/svg+xml;charset=utf-8,%3Csvg width='11' height='11' viewBox='0 0 11 11' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 4.399V5.5H0V4.399h11z' fill='%23000'/%3E%3C/svg%3E") no-repeat 50% 50%; | ||||
|     mask: url("data:image/svg+xml;charset=utf-8,%3Csvg width='11' height='11' viewBox='0 0 11 11' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 4.399V5.5H0V4.399h11z' fill='%23000'/%3E%3C/svg%3E") no-repeat 50% 50%; | ||||
|   } | ||||
|   .titlebar #window-controls-container #maximize { | ||||
|     background-color: #f7f7f7; | ||||
|     -webkit-mask: url("data:image/svg+xml;charset=utf-8,%3Csvg width='11' height='11' viewBox='0 0 11 11' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 0v11H0V0h11zM9.899 1.101H1.1V9.9h8.8V1.1z' fill='%23000'/%3E%3C/svg%3E") no-repeat 50% 50%; | ||||
|     mask: url("data:image/svg+xml;charset=utf-8,%3Csvg width='11' height='11' viewBox='0 0 11 11' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 0v11H0V0h11zM9.899 1.101H1.1V9.9h8.8V1.1z' fill='%23000'/%3E%3C/svg%3E") no-repeat 50% 50%; | ||||
|   } | ||||
|   .window-title:after { | ||||
|     content: "Cord"; | ||||
|     color: var(--cord-color) !important; | ||||
|     font-weight: normal; | ||||
|     font-size: 14px; | ||||
|     font-family: Discordinated; | ||||
|   } | ||||
|   .window-title:before { | ||||
|     content: "ARM"; | ||||
|     color: var(--armcord-color); | ||||
|     font-weight: normal; | ||||
|     font-size: 14px; | ||||
|     font-family: Helvetica, sans-serif; | ||||
|   } | ||||
|   .window-title { | ||||
|     font-size: 0px !important; | ||||
|     margin-left: initial !important; | ||||
|     transform: translate(10px, 0px); | ||||
|   } | ||||
|   .withFrame-haYltI { | ||||
|     height: 23px !important; | ||||
|   } | ||||
| .titlebar { | ||||
|   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; | ||||
| } | ||||
| .titlebar #window-title { | ||||
|   width: 30%; | ||||
|   height: 100%; | ||||
|   line-height: 30px; | ||||
|   float: left; | ||||
|   padding: 0 0 0 1em; | ||||
| } | ||||
| 
 | ||||
| .titlebar #window-controls-container { | ||||
|   float: right; | ||||
|   width: 150px; | ||||
|   height: 100%; | ||||
|   line-height: 30px; | ||||
|   background-color: #202225; | ||||
|   -webkit-app-region: no-drag; | ||||
| } | ||||
| 
 | ||||
| .titlebar #window-controls-container #minimize, | ||||
| .titlebar #window-controls-container #maximize, | ||||
| .titlebar #window-controls-container #quit { | ||||
|   float: left; | ||||
|   height: 100%; | ||||
|   width: 33%; | ||||
|   text-align: center; | ||||
|   color: #f7f7f7; | ||||
|   cursor: default; | ||||
| } | ||||
| 
 | ||||
| .titlebar #window-controls-container #minimize:hover { | ||||
|   background-color: #99aab5; | ||||
| } | ||||
| .titlebar #window-controls-container #maximize:hover { | ||||
|   background-color: #99aab5; | ||||
| } | ||||
| .titlebar #window-controls-container #quit:hover { | ||||
|   background-color: #f04747; | ||||
| } | ||||
| .titlebar #window-controls-container #quit { | ||||
|   background-color: #f7f7f7; | ||||
|   -webkit-mask: url("data:image/svg+xml;charset=utf-8,%3Csvg width='11' height='11' viewBox='0 0 11 11' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6.279 5.5L11 10.221l-.779.779L5.5 6.279.779 11 0 10.221 4.721 5.5 0 .779.779 0 5.5 4.721 10.221 0 11 .779 6.279 5.5z' fill='%23000'/%3E%3C/svg%3E") | ||||
|     no-repeat 50% 50%; | ||||
|   mask: url("data:image/svg+xml;charset=utf-8,%3Csvg width='11' height='11' viewBox='0 0 11 11' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6.279 5.5L11 10.221l-.779.779L5.5 6.279.779 11 0 10.221 4.721 5.5 0 .779.779 0 5.5 4.721 10.221 0 11 .779 6.279 5.5z' fill='%23000'/%3E%3C/svg%3E") | ||||
|     no-repeat 50% 50%; | ||||
| } | ||||
| .titlebar #window-controls-container #minimize { | ||||
|   background-color: #f7f7f7; | ||||
|   -webkit-mask: url("data:image/svg+xml;charset=utf-8,%3Csvg width='11' height='11' viewBox='0 0 11 11' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 4.399V5.5H0V4.399h11z' fill='%23000'/%3E%3C/svg%3E") | ||||
|     no-repeat 50% 50%; | ||||
|   mask: url("data:image/svg+xml;charset=utf-8,%3Csvg width='11' height='11' viewBox='0 0 11 11' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 4.399V5.5H0V4.399h11z' fill='%23000'/%3E%3C/svg%3E") | ||||
|     no-repeat 50% 50%; | ||||
| } | ||||
| .titlebar #window-controls-container #maximize { | ||||
|   background-color: #f7f7f7; | ||||
|   -webkit-mask: url("data:image/svg+xml;charset=utf-8,%3Csvg width='11' height='11' viewBox='0 0 11 11' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 0v11H0V0h11zM9.899 1.101H1.1V9.9h8.8V1.1z' fill='%23000'/%3E%3C/svg%3E") | ||||
|     no-repeat 50% 50%; | ||||
|   mask: url("data:image/svg+xml;charset=utf-8,%3Csvg width='11' height='11' viewBox='0 0 11 11' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 0v11H0V0h11zM9.899 1.101H1.1V9.9h8.8V1.1z' fill='%23000'/%3E%3C/svg%3E") | ||||
|     no-repeat 50% 50%; | ||||
| } | ||||
| .window-title:after { | ||||
|   content: "Cord"; | ||||
|   color: var(--cord-color) !important; | ||||
|   font-weight: normal; | ||||
|   font-size: 14px; | ||||
|   font-family: Discordinated; | ||||
| } | ||||
| .window-title:before { | ||||
|   content: "ARM"; | ||||
|   color: var(--armcord-color); | ||||
|   font-weight: normal; | ||||
|   font-size: 14px; | ||||
|   font-family: Helvetica, sans-serif; | ||||
| } | ||||
| .window-title { | ||||
|   font-size: 0px !important; | ||||
|   margin-left: initial !important; | ||||
|   transform: translate(10px, 0px); | ||||
| } | ||||
| .withFrame-haYltI { | ||||
|   height: 30px !important; | ||||
| } | ||||
|  |  | |||
|  | @ -22,23 +22,23 @@ | |||
|       </div> | ||||
|     </div> | ||||
|     <script> | ||||
|       function discord(){ | ||||
|       function discord() { | ||||
|         switch (window.armcord.channel) { | ||||
|         case "stable": | ||||
|           window.location.href = "https://discord.com/app"; | ||||
|           break; | ||||
|         case "canary": | ||||
|           window.location.href = "https://canary.discord.com/app"; | ||||
|           break; | ||||
|         case "ptb": | ||||
|           window.location.href = "https://ptb.discord.com/app"; | ||||
|           break; | ||||
|         case "foss": | ||||
|           window.location.href = "https://dev.fosscord.com/app"; | ||||
|           break; | ||||
|         default: | ||||
|           window.location.href = "https://discord.com/app"; | ||||
|       } | ||||
|           case "stable": | ||||
|             window.location.href = "https://discord.com/app"; | ||||
|             break; | ||||
|           case "canary": | ||||
|             window.location.href = "https://canary.discord.com/app"; | ||||
|             break; | ||||
|           case "ptb": | ||||
|             window.location.href = "https://ptb.discord.com/app"; | ||||
|             break; | ||||
|           case "foss": | ||||
|             window.location.href = "https://dev.fosscord.com/app"; | ||||
|             break; | ||||
|           default: | ||||
|             window.location.href = "https://discord.com/app"; | ||||
|         } | ||||
|       } | ||||
|       function fade(element) { | ||||
|         var op = 1; // initial opacity | ||||
|  | @ -90,7 +90,7 @@ | |||
|       <select name="mod" id="mod" class="dropdown-button"> | ||||
|         <option value="cumcord">Cumcord</option> | ||||
|         <option value="goosemod">GooseMod</option> | ||||
|         <option value="flicker">Flicker (WIP)</option> | ||||
|         <option value="flicker">Flicker (Heavily WIP)</option> | ||||
|       </select> | ||||
|       </div> | ||||
|       <p>Why not all of them? Having many client mods at the same time can cause issues. If you really want to do it though, check our documentation ;)</p> | ||||
|  |  | |||
|  | @ -26,25 +26,43 @@ | |||
|         "You appear to be offline. Please connect to the internet and try again."; | ||||
|     } else { | ||||
|       text.innerHTML = "Starting ArmCord..."; | ||||
|        | ||||
|       fetch("https://armcord.smartfridge.space/latest.json") | ||||
|         .then((response) => response.json()) | ||||
|         .then((data) => { | ||||
|           if (data.version !== window.armcord.version) { | ||||
|             var elem = document.createElement("img"); | ||||
|             elem.classList.add("logo"); | ||||
|             elem.src = "https://armcord.smartfridge.space/update.webp"; | ||||
|             document.body.prepend(elem); | ||||
|             document.getElementById("splashscreen-armcord").remove(); | ||||
|             text.innerHTML = | ||||
|               "A new version of ArmCord is available. Please update to the latest version."; | ||||
|           } else { | ||||
|             console.log("ArmCord is up to date.") | ||||
|           } | ||||
|         }); | ||||
|       setTimeout(() => { | ||||
|       window.armcord.splashEnd(); | ||||
|       switch (window.armcord.channel) { | ||||
|         window.armcord.splashEnd(); | ||||
|         switch (window.armcord.channel) { | ||||
|         case "stable": | ||||
|           window.location.href = "https://discord.com/app"; | ||||
|           window.location.replace("https://discord.com/app"); | ||||
|           break; | ||||
|         case "canary": | ||||
|           window.location.href = "https://canary.discord.com/app"; | ||||
|           window.location.replace("https://canary.discord.com/app"); | ||||
|           break; | ||||
|         case "ptb": | ||||
|           window.location.href = "https://ptb.discord.com/app"; | ||||
|           window.location.replace("https://ptb.discord.com/app"); | ||||
|           break; | ||||
|         case "foss": | ||||
|           window.location.href = "https://dev.fosscord.com/app"; | ||||
|           window.location.replace("https://dev.fosscord.com/app"); | ||||
|           break; | ||||
|         case undefined: | ||||
|           window.location.replace("https://discord.com/app"); | ||||
|           break; | ||||
|         default: | ||||
|           window.location.href = "https://discord.com/app"; | ||||
|       }}, 5000); | ||||
|           window.location.replace("https://discord.com/app"); | ||||
|       } | ||||
|       }, 5000); | ||||
|     } | ||||
|   </script> | ||||
| </html> | ||||
|  |  | |||
							
								
								
									
										43
									
								
								src/main.ts
									
										
									
									
									
								
							
							
						
						
									
										43
									
								
								src/main.ts
									
										
									
									
									
								
							|  | @ -7,11 +7,12 @@ import { saveSettings } from "./utils"; | |||
| import "./extensions/mods"; | ||||
| import "./extensions/plugin"; | ||||
| import "./tray"; | ||||
| var isSetup = null; | ||||
| var contentPath: string = "null"; | ||||
| var frame: boolean; | ||||
| var channel: string; | ||||
| var titlebar: boolean; | ||||
| export var mainWindow: BrowserWindow; | ||||
| 
 | ||||
| var settings:any; | ||||
| storage.keys(function (error, keys) { | ||||
|   if (error) throw error; | ||||
| 
 | ||||
|  | @ -24,26 +25,31 @@ storage.has("settings", function (error, hasKey) { | |||
| 
 | ||||
|   if (!hasKey) { | ||||
|     console.log("First run of the ArmCord. Starting setup."); | ||||
|     isSetup = true; | ||||
|     // setup(); will be done at setup
 | ||||
|     contentPath = __dirname + "/content/setup.html"; | ||||
|   } else { | ||||
|     console.log("ArmCord has been run before. Skipping setup."); | ||||
|     isSetup = false; | ||||
|     contentPath = __dirname + "/content/splash.html"; | ||||
|   } | ||||
| }); | ||||
| storage.get("settings", function (error, data: any) { | ||||
|   if (error) throw error; | ||||
|   console.log(data); | ||||
|   frame = data.customTitlebar; | ||||
|   console.log(frame); | ||||
|   titlebar = data.customTitlebar; | ||||
|   channel = data.channel; | ||||
|   settings = data; | ||||
|   if ((titlebar = true)) { | ||||
|     frame = false; | ||||
|   } else { | ||||
|     frame = true; | ||||
|   } | ||||
| }); | ||||
| function createWindow() { | ||||
|   mainWindow = new BrowserWindow({ | ||||
|     width: 300, | ||||
|     height: 350, | ||||
|     title: "ArmCord", | ||||
|     icon: "./assets/ac_icon_transparent.png", | ||||
|     frame: frame, | ||||
|     webPreferences: { | ||||
|       preload: path.join(__dirname, "preload/preload.js"), | ||||
|  | @ -79,22 +85,18 @@ function createWindow() { | |||
|   ipcMain.on("splashEnd", (event, arg) => { | ||||
|     mainWindow.setSize(800, 600); | ||||
|   }); | ||||
|   ipcMain.on("channel", (event) => { | ||||
|     storage.get("settings", function (error, data: any) { | ||||
|       if (error) throw error; | ||||
|       event.returnValue = data.channel; | ||||
|     }); | ||||
|   }); | ||||
|   ipcMain.on("saveSettings", (event, ...args) => { | ||||
|     //@ts-ignore
 | ||||
|     saveSettings(...args); | ||||
|   }); | ||||
|   ipcMain.on('clientmod' , (event, arg) => { | ||||
|     storage.get("settings", function (error, data: any) { | ||||
|       if (error) throw error; | ||||
|       event.returnValue = data.mods; | ||||
|     }); | ||||
|   }) | ||||
|   ipcMain.on("channel", (event) => { | ||||
|      | ||||
|     event.returnValue = channel; | ||||
|   }); | ||||
|   ipcMain.on("clientmod", (event, arg) => { | ||||
|     event.returnValue = settings.mods; | ||||
|   }); | ||||
| 
 | ||||
|   ipcMain.on("setting-armcordCSP", (event) => { | ||||
|     storage.get("settings", function (error, data: any) { | ||||
|       if (error) throw error; | ||||
|  | @ -110,10 +112,11 @@ function createWindow() { | |||
|   ); | ||||
|   mainWindow.webContents.userAgent = | ||||
|     "Mozilla/5.0 (X11; Linux x86) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36"; //fake useragent
 | ||||
|   mainWindow.webContents.on("new-window", function (e, url) { | ||||
|     e.preventDefault(); | ||||
|   mainWindow.webContents.setWindowOpenHandler(({ url }) => { | ||||
|     shell.openExternal(url); | ||||
|     return { action: "deny" }; | ||||
|   }); | ||||
| 
 | ||||
|   mainWindow.loadFile(contentPath); | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,20 +1,31 @@ | |||
| import { contextBridge, ipcRenderer } from 'electron'; | ||||
| import {getDisplayMediaSelector} from './capturer'; | ||||
| import { contextBridge, ipcRenderer } from "electron"; | ||||
| import { getDisplayMediaSelector } from "./capturer"; | ||||
| 
 | ||||
| console.log(ipcRenderer.send('channel')) | ||||
| 
 | ||||
| contextBridge.exposeInMainWorld("armcord", { | ||||
|   window: { | ||||
|     show: () => ipcRenderer.send('win-show'), | ||||
|     hide: () => ipcRenderer.send('win-hide'), | ||||
|     minimize: () => ipcRenderer.send('win-minimize'), | ||||
|     maximize: () => ipcRenderer.send('win-maximize'), | ||||
|     show: () => ipcRenderer.send("win-show"), | ||||
|     hide: () => ipcRenderer.send("win-hide"), | ||||
|     minimize: () => ipcRenderer.send("win-minimize"), | ||||
|     maximize: () => ipcRenderer.send("win-maximize"), | ||||
|   }, | ||||
|   electron: process.versions.electron, | ||||
|   version: ipcRenderer.send('get-app-version', 'app-version'), | ||||
|   channel: ipcRenderer.sendSync('channel'), | ||||
|   version: ipcRenderer.sendSync("get-app-version", "app-version"), | ||||
|   getDisplayMediaSelector: getDisplayMediaSelector, | ||||
|   saveSettings: (...args: any) => ipcRenderer.send('saveSettings', ...args), | ||||
|   splashEnd: () => ipcRenderer.send('splashEnd'), | ||||
|   channel: ipcRenderer.send('channel') | ||||
|   saveSettings: (...args: any) => ipcRenderer.send("saveSettings", ...args), | ||||
|   splashEnd: () => ipcRenderer.send("splashEnd"), | ||||
|   loadDiscord: () => ipcRenderer.send("loadDiscord"), | ||||
| }); | ||||
| contextBridge.exposeInMainWorld("electron", {}) //deprecated, used for legacy purposes, will be removed in future versions
 | ||||
| contextBridge.exposeInMainWorld("electron", { | ||||
|   //deprecated, used for legacy purposes, will be removed in future versions
 | ||||
|   window: { | ||||
|     show: () => ipcRenderer.send("win-show"), | ||||
|     hide: () => ipcRenderer.send("win-hide"), | ||||
|     minimize: () => ipcRenderer.send("win-minimize"), | ||||
|     maximize: () => ipcRenderer.send("win-maximize"), | ||||
|   }, | ||||
|   electron: process.versions.electron, | ||||
|   warning: 'This is a deprecated API and will be removed in future versions (3.0.0 --> 3.1.0).', | ||||
|   version: ipcRenderer.sendSync("get-app-version", "app-version"), | ||||
| });  | ||||
|  |  | |||
|  | @ -1,12 +1,10 @@ | |||
| import "./capturer"; | ||||
| import "./bridge"; | ||||
| import "./capturer"; | ||||
| import * as fs from "fs"; | ||||
| import * as path from "path"; | ||||
| import { injectTitlebar } from "./titlebar"; | ||||
| import { sleep, addStyle } from "../utils"; | ||||
| import { ipcRenderer } from "electron"; | ||||
| declare global { | ||||
|   interface Window { | ||||
|     splash: any; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| const clientMods = { | ||||
|   goosemod: "https://api.goosemod.com/inject.js", | ||||
|  | @ -29,18 +27,23 @@ if (window.location.href.indexOf("splash.html") > -1) { | |||
|   console.log("Skipping titlebar injection and client mod injection."); | ||||
| } else { | ||||
|   injectTitlebar(); | ||||
|   switch (ipcRenderer.sendSync("clientmod")) { | ||||
|     case "goosemod": | ||||
|       injectJS(clientMods.goosemod); | ||||
|       console.log("Loading GooseMod..."); | ||||
|       break; | ||||
|     case "cumcord": | ||||
|       injectJS(clientMods.cumcord); | ||||
|       console.log("Loading Cumcord..."); | ||||
|       break; | ||||
|     case "flicker": | ||||
|       injectJS(clientMods.flicker); | ||||
|       console.log("Loading FlickerMod..."); | ||||
|       break; | ||||
|   } | ||||
|   sleep(5000).then(() => { | ||||
|     const cssPath = path.join(__dirname, "../", "/content/css/discord.css"); | ||||
|     addStyle(fs.readFileSync(cssPath, "utf8")); | ||||
| 
 | ||||
|     switch (ipcRenderer.sendSync("clientmod")) { | ||||
|       case "goosemod": | ||||
|         injectJS(clientMods.goosemod); | ||||
|         console.log("Loading GooseMod..."); | ||||
|         break; | ||||
|       case "cumcord": | ||||
|         injectJS(clientMods.cumcord); | ||||
|         console.log("Loading Cumcord..."); | ||||
|         break; | ||||
|       case "flicker": | ||||
|         injectJS(clientMods.flicker); | ||||
|         console.log("Loading FlickerMod..."); | ||||
|         break; | ||||
|     } | ||||
|   }); | ||||
| } | ||||
|  |  | |||
|  | @ -26,4 +26,4 @@ export function saveSettings(customTitlebarSetting: boolean, channelSetting: str | |||
|     storage.set('settings', { customTitlebar: customTitlebarSetting, channel: channelSetting, firstRun: 'done', armcordCSP: armcordCSPSetting, mods: modsSetting }, function(error) { | ||||
|       if (error) throw error; | ||||
|     }); | ||||
| } | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue