Merge branch 'main' into virtmic
This commit is contained in:
		
						commit
						115e436ff1
					
				
					 5 changed files with 35 additions and 3 deletions
				
			
		
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							|  | @ -2,4 +2,4 @@ dist | |||
| node_modules | ||||
| .env | ||||
| .DS_Store | ||||
| .idea/ | ||||
| .idea/ | ||||
|  |  | |||
|  | @ -95,7 +95,13 @@ | |||
|                     ] | ||||
|                 } | ||||
|             ], | ||||
|             "category": "Network" | ||||
|             "category": "Network", | ||||
|             "extendInfo": { | ||||
|                 "NSMicrophoneUsageDescription": "This app needs access to the microphone", | ||||
|                 "NSCameraUsageDescription": "This app needs access to the camera", | ||||
|                 "com.apple.security.device.audio-input": true, | ||||
|                 "com.apple.security.device.camera": true | ||||
|             } | ||||
|         }, | ||||
|         "nsis": { | ||||
|             "include": "build/installer.nsh", | ||||
|  |  | |||
|  | @ -12,6 +12,7 @@ import { checkUpdates } from "updater/main"; | |||
| import { DATA_DIR } from "./constants"; | ||||
| import { createFirstLaunchTour } from "./firstLaunch"; | ||||
| import { createWindows, mainWin } from "./mainWindow"; | ||||
| import { registerMediaPermissionsHandler } from "./mediaPermissions"; | ||||
| import { registerScreenShareHandler } from "./screenShare"; | ||||
| import { Settings } from "./settings"; | ||||
| 
 | ||||
|  | @ -49,6 +50,8 @@ function init() { | |||
|         if (process.platform === "win32") app.setAppUserModelId("dev.vencord.desktop"); | ||||
| 
 | ||||
|         registerScreenShareHandler(); | ||||
|         registerMediaPermissionsHandler(); | ||||
| 
 | ||||
|         bootstrap(); | ||||
| 
 | ||||
|         app.on("activate", () => { | ||||
|  |  | |||
							
								
								
									
										24
									
								
								src/main/mediaPermissions.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								src/main/mediaPermissions.ts
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,24 @@ | |||
| /* | ||||
|  * SPDX-License-Identifier: GPL-3.0 | ||||
|  * Vesktop, a desktop app aiming to give you a snappier Discord Experience | ||||
|  * Copyright (c) 2023 Vendicated and Vencord contributors | ||||
|  */ | ||||
| 
 | ||||
| import { session, systemPreferences } from "electron"; | ||||
| 
 | ||||
| export function registerMediaPermissionsHandler() { | ||||
|     if (process.platform !== "darwin") return; | ||||
| 
 | ||||
|     session.defaultSession.setPermissionRequestHandler(async (_webContents, permission, callback, details) => { | ||||
|         let granted = true; | ||||
| 
 | ||||
|         if (details.mediaTypes?.includes("audio")) { | ||||
|             granted = await systemPreferences.askForMediaAccess("microphone"); | ||||
|         } | ||||
|         if (details.mediaTypes?.includes("video")) { | ||||
|             granted &&= await systemPreferences.askForMediaAccess("camera"); | ||||
|         } | ||||
| 
 | ||||
|         callback(granted); | ||||
|     }); | ||||
| } | ||||
|  | @ -59,7 +59,6 @@ export const VesktopNative = { | |||
|     capturer: { | ||||
|         getLargeThumbnail: (id: string) => invoke<string>(IpcEvents.CAPTURER_GET_LARGE_THUMBNAIL, id) | ||||
|     }, | ||||
| 
 | ||||
|     /** only available on Linux. */ | ||||
|     virtmic: { | ||||
|         list: () => invoke<string[] | null>(IpcEvents.VIRT_MIC_LIST), | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue
	
	 V
						V