mirror of
				https://github.com/smartfrigde/armcord.git
				synced 2024-08-14 23:56:58 +00:00 
			
		
		
		
	2.7.0 - Test
This commit is contained in:
		
							parent
							
								
									d18504bc2f
								
							
						
					
					
						commit
						08b2b312f6
					
				
					 10 changed files with 516 additions and 910 deletions
				
			
		|  | @ -2,7 +2,7 @@ | |||
| <html lang="en"> | ||||
| 
 | ||||
| <head> | ||||
|   <meta charset="UTF-8" /> | ||||
|   <meta charset="UTF-8"/> | ||||
|   <title>ArmCord</title> | ||||
|   <script> | ||||
|     window.onload = setTimeout(function() { | ||||
|  | @ -90,15 +90,13 @@ | |||
|       display: none; | ||||
|     } | ||||
|   </style> | ||||
|   <style> | ||||
|      | ||||
|   </style> | ||||
| </head> | ||||
| 
 | ||||
| <body> | ||||
|    | ||||
|     <div class="container"> | ||||
|   <video autoplay loop class="logo"> | ||||
|     <source src="https://discord.com/assets/0bdc0497eb3a19e66f2b1e3d5741634c.webm" type="video/webm"> | ||||
|     <source src="https://discord.com/assets/3b0d96ed8113994f3d139088726cfecd.webm" type="video/webm"> | ||||
|   </video> | ||||
|   <p>Loading...</p> | ||||
|     <h1></h1> | ||||
|  |  | |||
							
								
								
									
										3
									
								
								main.js
									
										
									
									
									
								
							
							
						
						
									
										3
									
								
								main.js
									
										
									
									
									
								
							|  | @ -4,6 +4,7 @@ const path = require("path"); | |||
| const contextMenu = require("electron-context-menu"); | ||||
| const os = require("os"); | ||||
| require("v8-compile-cache"); | ||||
| require("./utils/updater.js") | ||||
| if (require("./utils/ArmCord.js").Titlebar === "native") { | ||||
|   var frame = true | ||||
| } else { | ||||
|  | @ -42,7 +43,6 @@ function createWindow() { | |||
|       nodeIntegration: false, | ||||
|     }, | ||||
|   }); | ||||
| 
 | ||||
|   var appIcon = new Tray(iconformat); | ||||
|   mainWindow.webContents.userAgent = | ||||
|     "Mozilla/5.0 (X12; Linux x86) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36"; //fake useragent
 | ||||
|  | @ -81,6 +81,7 @@ function createWindow() { | |||
|     mainWindow.show() | ||||
|   }); | ||||
| 
 | ||||
| 
 | ||||
|   appIcon.setContextMenu(contextMenu); | ||||
| 
 | ||||
|   // Emitted when the window is closed.
 | ||||
|  |  | |||
							
								
								
									
										920
									
								
								package-lock.json
									
										
									
										generated
									
									
									
								
							
							
						
						
									
										920
									
								
								package-lock.json
									
										
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
							
								
								
									
										23
									
								
								package.json
									
										
									
									
									
								
							
							
						
						
									
										23
									
								
								package.json
									
										
									
									
									
								
							|  | @ -1,6 +1,6 @@ | |||
| { | ||||
|   "name": "ArmCord", | ||||
|   "version": "2.6.1", | ||||
|   "version": "2.7.0", | ||||
|   "description": "ArmCord is a Discord client made for ARM Linux that allows you to customize your experience.", | ||||
|   "main": "main.js", | ||||
|   "scripts": { | ||||
|  | @ -9,21 +9,16 @@ | |||
|     "package": "electron-builder --dir", | ||||
|     "make": "electron-builder", | ||||
|     "linux-build": "electron-builder --linux deb tar.gz rpm AppImage", | ||||
|     "windows-build": "electron-builder --windows nsis portable zip appx" | ||||
|     "windows-build": "electron-builder --windows nsis portable zip" | ||||
|   }, | ||||
|   "author": "smartfrigde <smartfridge1337@protonmail.com>", | ||||
|   "license": "OSL-3.0", | ||||
|   "dependencies": { | ||||
|     "@rollup/plugin-commonjs": "^21.0.1", | ||||
|     "@rollup/plugin-json": "^4.1.0", | ||||
|     "@rollup/plugin-node-resolve": "^13.0.6", | ||||
|     "custom-electron-titlebar": "3.2.7", | ||||
|     "electron-context-menu": "^3.0.0", | ||||
|     "electron-dl": "^3.2.1", | ||||
|     "electron-localshortcut": "^3.2.1", | ||||
|     "electron-store": "^8.0.0", | ||||
|     "rollup": "^2.58.0", | ||||
|     "rollup-plugin-terser": "^7.0.2", | ||||
|     "electron-updater": "^4.3.9", | ||||
|     "unzipper": "^0.10.1", | ||||
|     "v8-compile-cache": "^2.3.0" | ||||
|   }, | ||||
|  | @ -45,14 +40,20 @@ | |||
|     "productName": "ArmCord", | ||||
|     "mac": { | ||||
|       "category": "Network", | ||||
|       "extraResources": ["./mods/cumcord/*"] | ||||
|       "extraResources": [ | ||||
|         "./mods/cumcord/*" | ||||
|       ] | ||||
|     }, | ||||
|     "win": { | ||||
|       "extraResources": ["./mods/cumcord/*"] | ||||
|       "extraResources": [ | ||||
|         "./mods/cumcord/*" | ||||
|       ] | ||||
|     }, | ||||
|     "linux": { | ||||
|       "category": "Network", | ||||
|       "extraResources": ["./mods/cumcord/*"], | ||||
|       "extraResources": [ | ||||
|         "./mods/cumcord/*" | ||||
|       ], | ||||
|       "maintainer": "smartfridge1337@protonmail.com", | ||||
|       "target": [ | ||||
|         "deb", | ||||
|  |  | |||
							
								
								
									
										14
									
								
								preload.js
									
										
									
									
									
								
							
							
						
						
									
										14
									
								
								preload.js
									
										
									
									
									
								
							|  | @ -1,16 +1,14 @@ | |||
| const { remote } = require("electron"); | ||||
| const currentWindow = remote.getCurrentWindow(); | ||||
| const customTitlebar = require("custom-electron-titlebar"); | ||||
| const electronLocalshortcut = require("electron-localshortcut"); | ||||
| const ArmCord = require("./utils/ArmCord.js"); | ||||
| const electronLocalshortcut = require("electron-localshortcut"); | ||||
| require("./utils/theme.js"); | ||||
| require("./utils/bridge.js") | ||||
| require('./utils/titlebar') | ||||
| window.addEventListener("DOMContentLoaded", () => { | ||||
|   if (require("./utils/ArmCord.js").Titlebar === "native") {console.log("Using native titlebar")} else { | ||||
|   new customTitlebar.Titlebar({ | ||||
|     backgroundColor: customTitlebar.Color.fromHex("#202225"), | ||||
|     menu: false, | ||||
|   });} | ||||
|   if (require("./utils/ArmCord.js").Titlebar == "native") {console.log("Using native titlebar")} else { | ||||
|     //todo
 | ||||
|   } | ||||
| 
 | ||||
|   electronLocalshortcut.register(currentWindow, "F5", () => { | ||||
|     location.reload(); | ||||
|  | @ -67,7 +65,7 @@ div.menubar[role="menubar"] { | |||
| .window-title { | ||||
|   font-size: 0px !important; | ||||
|   margin-left: initial !important; | ||||
|   transform: translate(10px, 2px); | ||||
|   transform: translate(10px, 0px); | ||||
| } | ||||
| .titlebar { | ||||
|   background: var(--titlebar-color) !important; | ||||
|  |  | |||
|  | @ -1,5 +1,7 @@ | |||
| const { contextBridge, remote, desktopCapturer } = require("electron"); | ||||
| const { contextBridge, remote } = require("electron"); | ||||
| const currentWindow = remote.getCurrentWindow(); | ||||
| const {getDisplayMediaSelector} = require('./capturer') | ||||
| const ArmCord = require("./ArmCord.js"); | ||||
| const version = require("../package.json").version; | ||||
| contextBridge.exposeInMainWorld("electron", { | ||||
|   window: { | ||||
|  | @ -11,6 +13,7 @@ contextBridge.exposeInMainWorld("electron", { | |||
|   }, | ||||
|   electron: process.versions.electron, | ||||
|   version: version, | ||||
|   desktopCapturer: desktopCapturer, | ||||
|   ArmCord: ArmCord, | ||||
|   getDisplayMediaSelector: getDisplayMediaSelector, | ||||
| 
 | ||||
| }); | ||||
|  |  | |||
|  | @ -1,104 +1,13 @@ | |||
| // This desktop capturer has been taken from https://github.com/SpacingBat3/electron-discord-webapp
 | ||||
| 
 | ||||
| 
 | ||||
| /* | ||||
|  * Thanks, @WesselKroos! | ||||
|  */ | ||||
| 
 | ||||
| /*function l10n(origin, locale){ | ||||
|   if(originalString == 'Entire Screen') { | ||||
|     return locale; | ||||
|   } else { | ||||
|     return origin; | ||||
|   } | ||||
| }*/ | ||||
| const { desktopCapturer } = require("electron"); | ||||
| 
 | ||||
| navigator.mediaDevices.getDisplayMedia = () => { | ||||
|   return new Promise(async (resolve, reject) => { | ||||
|     try { | ||||
| //Fixed context isolation version https://github.com/getferdi/ferdi/blob/develop/src/webview/screenshare.ts
 | ||||
| //original https://github.com/electron/electron/issues/16513#issuecomment-602070250
 | ||||
| const { desktopCapturer } = require('electron'); | ||||
| const CANCEL_ID = 'desktop-capturer-selection__cancel'; | ||||
| const ArmCord = require("./ArmCord.js"); | ||||
| async function getDisplayMediaSelector() { | ||||
|   const sources = await desktopCapturer.getSources({ | ||||
|         types: ["screen", "window"], | ||||
|     types: ['screen', 'window'], | ||||
|   }); | ||||
|       const selectionElem = document.createElement("div"); | ||||
|       selectionElem.setAttribute("class", "desktop-capturer-selection"); | ||||
|       selectionElem.innerHTML = ` | ||||
|         <style> | ||||
|         .desktop-capturer-selection { | ||||
|           position: fixed; | ||||
|           top: 0; | ||||
|           left: 0; | ||||
|           width: 100%; | ||||
|           height: 100vh; | ||||
|           background: rgba(30,30,30,.75); | ||||
|           color: #fff; | ||||
|           z-index: 10000000; | ||||
|           display: flex; | ||||
|           align-items: center; | ||||
|           justify-content: center; | ||||
|         } | ||||
|         .desktop-capturer-selection__scroller { | ||||
|           width: 100%; | ||||
|           max-height: 100vh; | ||||
|           overflow-y: auto; | ||||
|         } | ||||
|         .desktop-capturer-selection__list { | ||||
|           max-width: calc(100% - 100px); | ||||
|           margin: 50px; | ||||
|           padding: 0; | ||||
|           display: flex; | ||||
|           flex-wrap: wrap; | ||||
|           list-style: none; | ||||
|           overflow: hidden; | ||||
|           justify-content: center; | ||||
|         } | ||||
|         .desktop-capturer-selection__item { | ||||
|           display: flex; | ||||
|           margin: 4px; | ||||
|         } | ||||
|         .desktop-capturer-selection__btn { | ||||
|           display: flex; | ||||
|           flex-direction: column; | ||||
|           align-items: stretch; | ||||
|           width: 145px; | ||||
|           margin: 0; | ||||
|           border: 0; | ||||
|           border-radius: 3px; | ||||
|           padding: 4px; | ||||
|           color: #FFFFFF; | ||||
|           background: #36393F; | ||||
|           text-align: left; | ||||
|           transition: background-color .15s, box-shadow .15s; | ||||
|         } | ||||
|         .desktop-capturer-selection__btn:hover, | ||||
|         .desktop-capturer-selection__btn:focus { | ||||
|           background: #7289DA; | ||||
|         } | ||||
|         .desktop-capturer-selection__thumbnail { | ||||
|           width: 100%; | ||||
|           height: 81px; | ||||
|           object-fit: cover; | ||||
|         } | ||||
|         .desktop-capturer-selection__name { | ||||
|           margin: 6px 0 6px; | ||||
|           white-space: nowrap; | ||||
|           text-overflow: ellipsis; | ||||
|           overflow: hidden; | ||||
|         } | ||||
|         .desktop-capturer-close { | ||||
|           background-color: #36393F; | ||||
|           position: fixed; | ||||
|           top: 50%; | ||||
|           transform: translateY(-50%); | ||||
|           right: 15px; | ||||
|           padding-top: 5px; | ||||
|           transition: background-color .15s; | ||||
|         } | ||||
|         .desktop-capturer-close:hover { | ||||
|           background-color: #823A3A; | ||||
|         } | ||||
|         </style> | ||||
|         <div class="desktop-capturer-selection__scroller"> | ||||
|   return `<div class="desktop-capturer-selection__scroller">
 | ||||
|   <ul class="desktop-capturer-selection__list"> | ||||
|     ${sources | ||||
|       .map( | ||||
|  | @ -109,56 +18,135 @@ navigator.mediaDevices.getDisplayMedia = () => { | |||
|           <span class="desktop-capturer-selection__name">${name}</span> | ||||
|         </button> | ||||
|       </li> | ||||
|             ` | ||||
|     `,
 | ||||
|       ) | ||||
|               .join("")} | ||||
|           </ul> | ||||
|           <button class="desktop-capturer-close"> | ||||
|             <svg viewBox="0 0 10 10" height=20px> | ||||
|               <line x1="0" y1="10" x2="10" y2="0" stroke="white" /> | ||||
|               <line x1="0" y1="0" x2="10" y2="10" stroke="white" /> | ||||
|             </svg> | ||||
|       .join('')} | ||||
|     <li class="desktop-capturer-selection__item"> | ||||
|       <button class="desktop-capturer-selection__btn" data-id="${CANCEL_ID}" title="Cancel"> | ||||
|         <span class="desktop-capturer-selection__name desktop-capturer-selection__name--cancel">Cancel</span> | ||||
|       </button> | ||||
|         </div> | ||||
|       `;
 | ||||
|       document.body.appendChild(selectionElem); | ||||
|     </li> | ||||
|   </ul> | ||||
| </div>`; | ||||
| } | ||||
| 
 | ||||
|       document | ||||
|         .querySelectorAll(".desktop-capturer-selection__btn") | ||||
|         .forEach((button) => { | ||||
|           button.addEventListener("click", async () => { | ||||
|             try { | ||||
|               const id = button.getAttribute("data-id"); | ||||
|               const source = sources.find((source) => source.id === id); | ||||
|               if (!source) { | ||||
|                 throw new Error(`Source with id ${id} does not exist`); | ||||
| const screenShareCSS = ` | ||||
| .desktop-capturer-selection { | ||||
|   position: fixed; | ||||
|   top: 0; | ||||
|   left: 0; | ||||
|   width: 100%; | ||||
|   height: 100vh; | ||||
|   background: rgba(30,30,30,.75); | ||||
|   color: #FFFFFF; | ||||
|   z-index: 10000000; | ||||
|   display: flex; | ||||
|   align-items: center; | ||||
|   justify-content: center; | ||||
| } | ||||
| .desktop-capturer-selection__scroller { | ||||
|   width: 100%; | ||||
|   max-height: 100vh; | ||||
|   overflow-y: auto; | ||||
| } | ||||
| .desktop-capturer-selection__list { | ||||
|   max-width: calc(100% - 100px); | ||||
|   margin: 50px; | ||||
|   padding: 0; | ||||
|   display: flex; | ||||
|   flex-wrap: wrap; | ||||
|   list-style: none; | ||||
|   overflow: hidden; | ||||
|   justify-content: center; | ||||
| } | ||||
| .desktop-capturer-selection__item { | ||||
|   display: flex; | ||||
|   margin: 4px; | ||||
| } | ||||
| .desktop-capturer-selection__btn { | ||||
|   display: flex; | ||||
|   flex-direction: column; | ||||
|   align-items: stretch; | ||||
|   width: 145px; | ||||
|   margin: 0; | ||||
|   border: 0; | ||||
|   border-radius: 3px; | ||||
|   padding: 4px; | ||||
|   background: #2C2F33; | ||||
|   text-align: left; | ||||
|   @media (prefers-reduced-motion: no-preference) { | ||||
|     transition: background-color .15s, box-shadow .15s, color .15s; | ||||
|   } | ||||
|               const stream = await navigator.mediaDevices.getUserMedia({ | ||||
|   color: #dedede; | ||||
| } | ||||
| .desktop-capturer-selection__btn:hover, | ||||
| .desktop-capturer-selection__btn:focus { | ||||
|   background: #7289DA; | ||||
|   box-shadow: 0 0 4px rgba(0,0,0,0.45), 0 0 2px rgba(0,0,0,0.25); | ||||
|   color: #fff; | ||||
| } | ||||
| .desktop-capturer-selection__thumbnail { | ||||
|   width: 100%; | ||||
|   height: 81px; | ||||
|   object-fit: cover; | ||||
| } | ||||
| .desktop-capturer-selection__name { | ||||
|   margin: 6px 0; | ||||
|   white-space: nowrap; | ||||
|   color: white; | ||||
|   text-overflow: ellipsis; | ||||
|   text-align: center; | ||||
|   overflow: hidden; | ||||
| } | ||||
| .desktop-capturer-selection__name--cancel { | ||||
|   margin: auto 0; | ||||
| } | ||||
| `;
 | ||||
| 
 | ||||
| const screenShareJS = ` | ||||
| window.navigator.mediaDevices.getDisplayMedia = () => new Promise(async (resolve, reject) => { | ||||
|   try { | ||||
|     const selectionElem = document.createElement('div'); | ||||
|     selectionElem.classList = ['desktop-capturer-selection']; | ||||
|     selectionElem.innerHTML = await window.electron.getDisplayMediaSelector(); | ||||
|     document.body.appendChild(selectionElem); | ||||
|     document | ||||
|       .querySelectorAll('.desktop-capturer-selection__btn') | ||||
|       .forEach((button) => { | ||||
|         button.addEventListener('click', async () => { | ||||
|           try { | ||||
|             const id = button.getAttribute('data-id'); | ||||
|             if (id === '${CANCEL_ID}') { | ||||
|               reject(new Error('Cancelled by user')); | ||||
|             } else { | ||||
|               const stream = await window.navigator.mediaDevices.getUserMedia({ | ||||
|                 audio: false, | ||||
|                 video: { | ||||
|                   mandatory: { | ||||
|                     chromeMediaSource: "desktop", | ||||
|                     chromeMediaSourceId: source.id, | ||||
|                     chromeMediaSource: 'desktop', | ||||
|                     chromeMediaSourceId: id, | ||||
|                   }, | ||||
|                 }, | ||||
|               }); | ||||
|               resolve(stream); | ||||
|               selectionElem.remove(); | ||||
|             } | ||||
|           } catch (err) { | ||||
|               console.error("Error selecting desktop capture source:", err); | ||||
|             reject(err); | ||||
|           } finally { | ||||
|             selectionElem.remove(); | ||||
|           } | ||||
|         }); | ||||
|       }); | ||||
|       document.querySelectorAll(".desktop-capturer-close").forEach((button) => { | ||||
|         button.addEventListener("click", () => { | ||||
|           selectionElem.remove(); | ||||
|         }); | ||||
|       }); | ||||
|   } catch (err) { | ||||
|       console.error("Error displaying desktop capture sources:", err); | ||||
|     reject(err); | ||||
|   } | ||||
|   }); | ||||
| }; | ||||
| console.log("Desktop capturer has been preloaded 🎉️"); | ||||
| }); | ||||
| `;
 | ||||
| 
 | ||||
| document.addEventListener("DOMContentLoaded", function(event) {      | ||||
|   ArmCord.addScript(screenShareJS); | ||||
|   ArmCord.addStyle(screenShareCSS); | ||||
| }); | ||||
| 
 | ||||
| 
 | ||||
| exports.getDisplayMediaSelector = getDisplayMediaSelector; | ||||
|  | @ -1,6 +1,5 @@ | |||
| const fs = require("fs"); | ||||
| const { app, session } = require("electron"); | ||||
| const electron = require("electron"); | ||||
| const path = require ('path'); | ||||
| const execPath = path.dirname (process.execPath); | ||||
| app.whenReady().then(() => { | ||||
|  |  | |||
							
								
								
									
										138
									
								
								utils/titlebar.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										138
									
								
								utils/titlebar.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,138 @@ | |||
| const { remote } = require("electron"); | ||||
| var win = remote.BrowserWindow.getFocusedWindow(); | ||||
| const ArmCord = require("./ArmCord.js"); | ||||
| const css = ` | ||||
| .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%; | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| `;
 | ||||
| document.addEventListener("DOMContentLoaded", function (event) { | ||||
|   var elem = document.createElement("div"); | ||||
|   elem.innerHTML = `<nav class="titlebar">
 | ||||
|     <div class="window-title" id="window-title"></div> | ||||
|     <div id="window-controls-container"> | ||||
|         <div id="minimize"></div> | ||||
|         <div id="maximize"></div> | ||||
|         <div id="quit"></div> | ||||
|     </div> | ||||
|   </nav>`; | ||||
|   document.body.appendChild(elem); | ||||
|    | ||||
|   ArmCord.addStyle(css); | ||||
| 
 | ||||
|   var minimize = document.querySelector("#minimize"); | ||||
|   var maximize = document.querySelector("#maximize"); | ||||
|   var quit = document.querySelector("#quit"); | ||||
| 
 | ||||
|   minimize.addEventListener("click", () => { | ||||
|     win.minimize(); | ||||
|   }); | ||||
| 
 | ||||
|   maximize.addEventListener("click", () => { | ||||
|     if (win.isMaximized() == true) { | ||||
|       win.unmaximize(); | ||||
|     } else { | ||||
|       win.maximize(); | ||||
|     } | ||||
|   }); | ||||
| 
 | ||||
|   quit.addEventListener("click", () => { | ||||
|     win.close(); | ||||
|   }); | ||||
| }); | ||||
							
								
								
									
										22
									
								
								utils/updater.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								utils/updater.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,22 @@ | |||
| const { app, autoUpdater } = require('electron') | ||||
| const server = "https://download.smartfridge.space" | ||||
| const url = `${server}/update/${process.platform}/${app.getVersion()}` | ||||
| 
 | ||||
| autoUpdater.setFeedURL({ url }) | ||||
| autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName) => { | ||||
|     const dialogOpts = { | ||||
|       type: 'info', | ||||
|       buttons: ['Restart', 'Later'], | ||||
|       title: 'ArmCord Update', | ||||
|       message: process.platform === 'win32' ? releaseNotes : releaseName, | ||||
|       detail: 'A new version has been downloaded. Restart the application to apply the updates.' | ||||
|     } | ||||
|    | ||||
|     dialog.showMessageBox(dialogOpts).then((returnValue) => { | ||||
|       if (returnValue.response === 0) autoUpdater.quitAndInstall() | ||||
|     }) | ||||
|   }) | ||||
|   autoUpdater.on('error', message => { | ||||
|     console.error('There was a problem updating the application') | ||||
|     console.error(message) | ||||
|   }) | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue