diff --git a/ACKNOWLEDGMENTS.md b/ACKNOWLEDGMENTS.md index ddbc8dc9fc..061d92cf18 100644 --- a/ACKNOWLEDGMENTS.md +++ b/ACKNOWLEDGMENTS.md @@ -2899,10 +2899,6 @@ Signal Desktop makes use of the following open source projects. ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -## mac-screen-capture-permissions - - License: MIT - ## memoizee ISC License diff --git a/app/main.ts b/app/main.ts index feb9d1c8fe..a1ca29497f 100644 --- a/app/main.ts +++ b/app/main.ts @@ -2184,7 +2184,8 @@ app.on('ready', async () => { logger.info( 'media access status', getMediaAccessStatus('microphone'), - getMediaAccessStatus('camera') + getMediaAccessStatus('camera'), + getMediaAccessStatus('screen') ); } @@ -3023,7 +3024,7 @@ ipc.handle('get-media-access-status', async (_event, value) => { ipc.handle( 'open-system-media-permissions', - async (_event, mediaType: 'camera' | 'microphone') => { + async (_event, mediaType: 'camera' | 'microphone' | 'screenCapture') => { if (!OS.isMacOS()) { return; } @@ -3035,6 +3036,10 @@ ipc.handle( await shell.openExternal( 'x-apple.systempreferences:com.apple.preference.security?Privacy_Microphone' ); + } else if (mediaType === 'screenCapture') { + await shell.openExternal( + 'x-apple.systempreferences:com.apple.preference.security?Privacy_ScreenCapture' + ); } else { throw missingCaseError(mediaType); } diff --git a/background.html b/background.html index d9c3d7fb28..7e2ccc9ebe 100644 --- a/background.html +++ b/background.html @@ -83,6 +83,12 @@ crossorigin /> + - /// - /// --import {AllElectron, Remote, BrowserWindow, Size, Rectangle, Session, MenuItemConstructorOptions, MenuItem} from 'electron'; -+import { BrowserWindow, Size, Rectangle, Session, MenuItemConstructorOptions, MenuItem} from 'electron'; - import {Options as NewGithubIssueUrlOptions} from 'new-github-issue-url'; - import {RequireAtLeastOne} from 'type-fest'; - -@@ -14,7 +14,7 @@ Access the Electron APIs in both the main and renderer process without having to - api.app.quit(); // The `app` API is usually only available in the main process. - ``` - */ --export const api: AllElectron | Remote; -+export const api: never; - - /** - Check for various things. -diff --git a/source/is.js b/source/is.js -index 9a7622f..9530a9c 100644 ---- a/source/is.js -+++ b/source/is.js -@@ -1,5 +1,4 @@ - 'use strict'; --const isDev = require('electron-is-dev'); - const isUsingAsar = require('./is-using-asar'); - - module.exports = { -@@ -9,7 +8,12 @@ module.exports = { - main: process.type === 'browser', - renderer: process.type === 'renderer', - usingAsar: isUsingAsar, -- development: isDev, - macAppStore: process.mas === true, - windowsStore: process.windowsStore === true - }; -+ -+Object.defineProperty(module.exports, 'isDev', { -+ get() { -+ throw new Error('Not supported in electron 15'); -+ } -+}); diff --git a/patches/mac-screen-capture-permissions.patch b/patches/mac-screen-capture-permissions.patch deleted file mode 100644 index 1d4c74abff..0000000000 --- a/patches/mac-screen-capture-permissions.patch +++ /dev/null @@ -1,40 +0,0 @@ -diff --git a/binding.gyp b/binding.gyp -index f3030f89e418275f10eeff4cb97269cdb248144d..330e120cab4b2c8873a31135e06136733f052340 100644 ---- a/binding.gyp -+++ b/binding.gyp -@@ -1,14 +1,23 @@ - { -- "targets": [ -- { -- "target_name": "screencapturepermissions", -- "sources": [ -- "screen-capture-permissions.m" -- ], -- "xcode_settings": { -- "MACOSX_DEPLOYMENT_TARGET": "10.14", -- "OTHER_LDFLAGS": ["-framework CoreGraphics"] -- } -- } -- ] -+ "conditions": [ -+ ["OS=='mac'", { -+ "targets": [ -+ { -+ "target_name": "screencapturepermissions", -+ "sources": [ -+ "screen-capture-permissions.m" -+ ], -+ "xcode_settings": { -+ "MACOSX_DEPLOYMENT_TARGET": "10.14", -+ "OTHER_LDFLAGS": ["-framework CoreGraphics"] -+ } -+ } -+ ] -+ }, { -+ "targets": [{ -+ "target_name": "noop", -+ "type": "none", -+ }], -+ }], -+ ], - } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d648939341..d10cd1291e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -44,9 +44,6 @@ patchedDependencies: dmg-builder@26.0.10: hash: cb72ed47fa8d45513a36db33fcb41cb75c30cada4737da067bf3fa1f063725f2 path: patches/dmg-builder@26.0.10.patch - electron-util@0.13.1: - hash: 8c6bd08d524425c72958f8edfc730eeccdbdb424bff9d1d724d6c391c2c03e99 - path: patches/electron-util+0.13.1.patch fabric@4.6.0: hash: 259e6eff3d60c4a453f7815fca6aa0d3a81842f4efdc4051836812fc1e711e00 path: patches/fabric+4.6.0.patch @@ -56,9 +53,6 @@ patchedDependencies: growing-file@0.1.3: hash: 1bb085e3fda38f2983114beedc229acf8b0c539736fe73e2e8183dab2df074b4 path: patches/growing-file+0.1.3.patch - mac-screen-capture-permissions: - hash: b8dc0573396f72c869190aa36e306030fdb778263076e9ba35bc3099ded2c6cc - path: patches/mac-screen-capture-permissions.patch node-fetch@2.6.7: hash: 94385e2da301d6873723275386bb0c70da98cf56487f2431668d8fd79623818d path: patches/node-fetch+2.6.7.patch @@ -256,9 +250,6 @@ importers: lru-cache: specifier: 11.0.2 version: 11.0.2 - mac-screen-capture-permissions: - specifier: 2.0.0 - version: 2.0.0(patch_hash=b8dc0573396f72c869190aa36e306030fdb778263076e9ba35bc3099ded2c6cc) memoizee: specifier: 0.4.17 version: 0.4.17 @@ -3534,10 +3525,6 @@ packages: engines: {'0': node >= 0.8.0} hasBin: true - ansi-regex@2.1.1: - resolution: {integrity: sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==} - engines: {node: '>=0.10.0'} - ansi-regex@3.0.1: resolution: {integrity: sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==} engines: {node: '>=4'} @@ -3591,16 +3578,9 @@ packages: resolution: {integrity: sha512-7yeyCEurROLQJFv5Xj4lEGTy0borxepjFv1g22oAdqFu//SrAlDl1O1Nxx15SH1RoliUml6p8dwJW9jvZughhg==} engines: {node: '>=8'} - aproba@1.2.0: - resolution: {integrity: sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==} - archy@1.0.0: resolution: {integrity: sha512-Xg+9RwCg/0p32teKdGMPTPnVXKD0w3DfHnFTficozsAgsvq2XenPJq/MYpzzQ/v8zrOyJn6Ds39VA4JIDwFfqw==} - are-we-there-yet@1.1.7: - resolution: {integrity: sha512-nxwy40TuMiUGqMyRHgCSWZ9FM4VAoRP4xUYSTv5ImRog+h9yISPbVH7H8fASCIzYn9wlEv4zvFL7uKDMCFQm3g==} - deprecated: This package is no longer supported. - arg@4.1.0: resolution: {integrity: sha512-ZWc51jO3qegGkVh8Hwpv636EkbesNV5ZNQPCtRa+0qytRYPEs9IYT9qITY9buezqUH5uqyzlWLcufrzU2rffdg==} @@ -4054,9 +4034,6 @@ packages: resolution: {integrity: sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==} engines: {node: '>= 14.16.0'} - chownr@1.1.4: - resolution: {integrity: sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==} - chownr@2.0.0: resolution: {integrity: sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==} engines: {node: '>=10'} @@ -4159,10 +4136,6 @@ packages: resolution: {integrity: sha512-cadkfKp6932H8UkhzE/gcUqhRMNf8jHzkAN7+5Myabswaghu4xABTgPHDCjW+dBAJxj/SpkTYokpzDqY4pCzQw==} engines: {node: '>= 4'} - code-point-at@1.1.0: - resolution: {integrity: sha512-RpAVKQA5T63xEj6/giIbUEtZwJ4UFIc3ZtvEkiaUERylqe8xb5IvqcgOurZLahv93CLKfxcw5YI+DZcUBRyLXA==} - engines: {node: '>=0.10.0'} - collect-v8-coverage@1.0.2: resolution: {integrity: sha512-lHl4d5/ONEbLlJvaJNtsF/Lz+WvB07u2ycqTYbdrq7UypDXailES4valYb2eWiJFxZlVmpGekfqoxQhzyFdT4Q==} @@ -4262,9 +4235,6 @@ packages: resolution: {integrity: sha512-U73+6lQFmfiNPrYbXqr6kZ1i1wiRqXnp2nhMsINseWXO8lDau0LGEffJ8kQi4EjLZympVgRdvqjAgiZ1tgzDDA==} engines: {node: '>=0.8'} - console-control-strings@1.1.0: - resolution: {integrity: sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==} - constants-browserify@1.0.0: resolution: {integrity: sha512-xFxOwqIzR/e1k1gLiWEophSCMqXcwVHIH7akf7b/vxcUeGunlj3hvZaaqxwHsTgn+IndtkQJgSztIDWeumWJDQ==} @@ -4504,10 +4474,6 @@ packages: decimal.js@10.5.0: resolution: {integrity: sha512-8vDa8Qxvr/+d94hSh5P3IJwI5t8/c0KsMp+g8bNw9cY2icONa5aPfvKeieW1WlG0WQYwwhJ7mjui2xtiePQSXw==} - decompress-response@4.2.1: - resolution: {integrity: sha512-jOSne2qbyE+/r8G1VU+G/82LBs2Fs4LAsTiLSHOCOMZQl2OKZ6i8i4IyHemTe+/yIXOtTcRQMzPcgyhoFlqPkw==} - engines: {node: '>=8'} - decompress-response@6.0.0: resolution: {integrity: sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==} engines: {node: '>=10'} @@ -4592,9 +4558,6 @@ packages: resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} engines: {node: '>=0.4.0'} - delegates@1.0.0: - resolution: {integrity: sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==} - denque@2.1.0: resolution: {integrity: sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw==} engines: {node: '>=0.10'} @@ -4782,9 +4745,6 @@ packages: engines: {node: '>=14.0.0'} hasBin: true - electron-is-dev@1.2.0: - resolution: {integrity: sha512-R1oD5gMBPS7PVU8gJwH6CtT0e6VSoD0+SzSnYpNm+dBkcijgA+K7VAMHDfnRq/lkKPZArpzplTW6jfiMYosdzw==} - electron-mocha@13.0.1: resolution: {integrity: sha512-Ik7clwPU9WUYGsEsyryKhS6q+rmecNTqMqSbx3vGel7Lo6haipgscdTMdkaWGkvgVaBJFWsDWIBuFWNvlCL+og==} engines: {node: '>= 16.0.0'} @@ -4796,9 +4756,6 @@ packages: electron-to-chromium@1.5.99: resolution: {integrity: sha512-77c/+fCyL2U+aOyqfIFi89wYLBeSTCs55xCZL0oFH0KjqsvSvyh6AdQ+UIl1vgpnQQE6g+/KK8hOIupH6VwPtg==} - electron-util@0.13.1: - resolution: {integrity: sha512-CvOuAyQPaPtnDp7SspwnT1yTb1yynw6yp4LrZCfEJ7TG/kJFiZW9RqMHlCEFWMn3QNoMkNhGVeCvWJV5NsYyuQ==} - electron-window@0.8.1: resolution: {integrity: sha512-W1i9LfnZJozk3MXE8VgsL2E5wOUHSgyCvcg1H2vQQjj+gqhO9lVudgY3z3SF7LJAmi+0vy3CJkbMqsynWB49EA==} @@ -5191,10 +5148,6 @@ packages: resolution: {integrity: sha512-RztN09XglpYI7aBBrJCPW95jEH7YF1UEPOoX9yDhUTPdp7mK+CQvnLTuD10BNXZ3byLTu2uehZ8EcKT/4CGiFw==} engines: {node: '>=4'} - execa@2.1.0: - resolution: {integrity: sha512-Y/URAVapfbYy2Xp/gb6A0E7iR8xeqOCXsuuaoMn7A5PzrXUK84E1gyiEfq0wQd/GHA6GsoHWwhNq8anb0mleIw==} - engines: {node: ^8.12.0 || >=9.7.0} - execa@5.1.1: resolution: {integrity: sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==} engines: {node: '>=10'} @@ -5203,10 +5156,6 @@ packages: resolution: {integrity: sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==} engines: {node: '>= 0.8.0'} - expand-template@2.0.3: - resolution: {integrity: sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==} - engines: {node: '>=6'} - expand-tilde@1.2.2: resolution: {integrity: sha512-rtmc+cjLZqnu9dSYosX9EWmSJhTwpACgJQTfj4hgg2JjOD/6SIQalZrt4a3aQeh++oNxkazcaxrhPUj6+g5G/Q==} engines: {node: '>=0.10.0'} @@ -5444,9 +5393,6 @@ packages: fromentries@1.3.2: resolution: {integrity: sha512-cHEpEQHUg0f8XdtZCc2ZAhrHzKzT0MrFUTcvx+hfxYu7rGMDc5SKoXFh+n4YigxsHXRzc6OrCshdR1bWH6HHyg==} - fs-constants@1.0.0: - resolution: {integrity: sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==} - fs-exists-sync@0.1.0: resolution: {integrity: sha512-cR/vflFyPZtrN6b38ZyWxpWdhlXrzZEBawlpBQMq7033xVY7/kg0GDMBK5jg8lDYQckdJ5x/YC88lM3C7VMsLg==} engines: {node: '>=0.10.0'} @@ -5521,10 +5467,6 @@ packages: resolution: {integrity: sha512-sA5etGE7yD/pOqivZRBvUBd/NaL2sjAu6QuSaFoe1H2BrJSkH/T/UXAJ8CdXdw7DvY3Hs8CXKYkDWX7RiP5KOg==} engines: {node: '>=10'} - gauge@2.7.4: - resolution: {integrity: sha512-14x4kjc6lkD3ltw589k0NrPD6cCNTD6CWoVUNpB85+DrtONoZn+Rug6xZU5RvSC4+TZPxA5AnBibQYAvZn41Hg==} - deprecated: This package is no longer supported. - generic-pool@3.9.0: resolution: {integrity: sha512-hymDOu5B53XvN4QT9dBmZxPX4CWhBPPLguTZ9MMFeFa/Kg0xWVfylOVNlJji/E7yTZWFd/q9GO5TxDLq156D7g==} engines: {node: '>= 4'} @@ -5580,9 +5522,6 @@ packages: resolution: {integrity: sha512-KcJ2dlrrP5DbBnYIZ2nlikALfRhKzNSX0stvv3ImJ+fvC4hXKoV+U+74SV0upg+jlQZbrtQzc0bu6/Zh+7aQbg==} engines: {node: '>=0.10.0'} - github-from-package@0.0.0: - resolution: {integrity: sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==} - glob-parent@5.1.2: resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} engines: {node: '>= 6'} @@ -5719,9 +5658,6 @@ packages: resolution: {integrity: sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==} engines: {node: '>= 0.4'} - has-unicode@2.0.1: - resolution: {integrity: sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==} - has@1.0.4: resolution: {integrity: sha512-qdSAmqLF6209RFj4VVItywPMbm3vWylknmB3nvNiUIs72xAimcM8nVYxYr7ncvZq5qzk9MKIZR8ijqD/1QuYjQ==} engines: {node: '>= 0.4.0'} @@ -6093,10 +6029,6 @@ packages: resolution: {integrity: sha512-1pC6N8qWJbWoPtEjgcL2xyhQOP491EQjeUo3qTKcmV8YSDDJrOepfG8pcC7h/QgnQHYSv0mJ3Z/ZWxmatVrysg==} engines: {node: '>= 0.4'} - is-fullwidth-code-point@1.0.0: - resolution: {integrity: sha512-1pqUqRjkhPJ9miNq9SwMfdvi6lBJcd6eFxvfaivQhaH3SgisfiuudvFntdKOmxuee/77l+FPjKrQjWvmPjWrRw==} - engines: {node: '>=0.10.0'} - is-fullwidth-code-point@2.0.0: resolution: {integrity: sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w==} engines: {node: '>=4'} @@ -6829,14 +6761,6 @@ packages: resolution: {integrity: sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==} hasBin: true - mac-screen-capture-permissions@2.0.0: - resolution: {integrity: sha512-f70KKpx5WhD8mmrAwLeeee31EfSM4p1K7kBBNBVXyfWE7ZQTIbbAF2PxJ0bMsDxyyeX5roBcH+qJYlSTANtCOA==} - engines: {node: '>=8'} - - macos-version@5.2.1: - resolution: {integrity: sha512-OHJU8nTNxHYL1FQhD+nZawWgXKXAqDGr4kluLtaqKO4au3cR41y1mKuVShOU5U4rOYiuPanljq6oFGmV2B9DFA==} - engines: {node: '>=6'} - magic-string@0.30.17: resolution: {integrity: sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==} @@ -7054,10 +6978,6 @@ packages: resolution: {integrity: sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==} engines: {node: '>=4'} - mimic-response@2.1.0: - resolution: {integrity: sha512-wXqjST+SLt7R009ySCglWBCFpjUygmCIfD790/kVbiGmUgfYGuB14PiTd5DwVxSV4NcYHjzMkoj5LjQZwTQLEA==} - engines: {node: '>=8'} - mimic-response@3.1.0: resolution: {integrity: sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==} engines: {node: '>=10'} @@ -7155,9 +7075,6 @@ packages: resolution: {integrity: sha512-umcy022ILvb5/3Djuu8LWeqUa8D68JaBzlttKeMWen48SjabqS3iY5w/vzeMzMUNhLDifyhbOwKDSznB1vvrwg==} engines: {node: '>= 18'} - mkdirp-classic@0.5.3: - resolution: {integrity: sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==} - mkdirp@0.5.6: resolution: {integrity: sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==} hasBin: true @@ -7201,9 +7118,6 @@ packages: engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true - napi-build-utils@1.0.2: - resolution: {integrity: sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==} - natural-compare-lite@1.4.0: resolution: {integrity: sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==} @@ -7229,10 +7143,6 @@ packages: resolution: {integrity: sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg==} engines: {node: '>= 0.4.0'} - new-github-issue-url@0.2.1: - resolution: {integrity: sha512-md4cGoxuT4T4d/HDOXbrUHkTKrp/vp+m3aOA7XXVYwNsUNMK49g3SQicTSeV5GIz/5QVGAeYRAOlyp9OvlgsYA==} - engines: {node: '>=10'} - next-tick@1.1.0: resolution: {integrity: sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==} @@ -7245,9 +7155,6 @@ packages: no-case@3.0.4: resolution: {integrity: sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==} - node-abi@2.30.1: - resolution: {integrity: sha512-/2D0wOQPgaUWzVSVgRMx+trKJRC2UG4SUc4oCJoXx9Uxjtp0Vy3/kt7zcbxHF8+Z/pK3UloLWzBISg72brfy1w==} - node-abi@3.74.0: resolution: {integrity: sha512-c5XK0MjkGBrQPGYG24GBADZud0NCbznxNx0ZkS+ebUTrmV1qTDxPxSL8zEAPURXSbLRWVexxmP4986BziahL5w==} engines: {node: '>=10'} @@ -7336,25 +7243,13 @@ packages: resolution: {integrity: sha512-lJxZYlT4DW/bRUtFh1MQIWqmLwQfAxnqWG4HhEdjMlkrJYnJn0Jrr2u3mgxqaWsdiBc76TYkTG/mhrnYTuzfHw==} engines: {node: '>=4'} - npm-run-path@3.1.0: - resolution: {integrity: sha512-Dbl4A/VfiVGLgQv29URL9xshU8XDY1GeLy+fsaZ1AA8JDSfjvr5P5+pzRbWqRSBxk6/DW7MIh8lTM/PaGnP2kg==} - engines: {node: '>=8'} - npm-run-path@4.0.1: resolution: {integrity: sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==} engines: {node: '>=8'} - npmlog@4.1.2: - resolution: {integrity: sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==} - deprecated: This package is no longer supported. - nth-check@2.1.1: resolution: {integrity: sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==} - number-is-nan@1.0.1: - resolution: {integrity: sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ==} - engines: {node: '>=0.10.0'} - nyc@15.1.0: resolution: {integrity: sha512-jMW04n9SxKdKi1ZMGhvUTHBN0EICCRkHemEoE5jm6mTYcqcdas0ATzgUgejlQUHMvpnOZqGB5Xxsv9KxJW1j8A==} engines: {node: '>=8.9'} @@ -7471,10 +7366,6 @@ packages: resolution: {integrity: sha512-LICb2p9CB7FS+0eR1oqWnHhp0FljGLZCWBE9aix0Uye9W8LTQPwMTYVGWQWIw9RdQiDg4+epXQODwIYJtSJaow==} engines: {node: '>=4'} - p-finally@2.0.1: - resolution: {integrity: sha512-vpm09aKwq6H9phqRQzecoDpD8TmVyGw70qmWlyq5onxY7tqyTTFVvxMykxQSQKILBSFlbXpypIw2T1Ml7+DDtw==} - engines: {node: '>=8'} - p-limit@2.3.0: resolution: {integrity: sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==} engines: {node: '>=6'} @@ -7824,11 +7715,6 @@ packages: engines: {node: '>=14.0.0'} hasBin: true - prebuild-install@6.1.4: - resolution: {integrity: sha512-Z4vpywnK1lBg+zdPCVCsKq0xO66eEV9rWo2zrROGGiRS4JtueBOdlB1FnY8lcy7JsUud/Q3ijUxyWN26Ika0vQ==} - engines: {node: '>=6'} - hasBin: true - prelude-ls@1.1.2: resolution: {integrity: sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==} engines: {node: '>= 0.8.0'} @@ -8588,12 +8474,6 @@ packages: resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==} engines: {node: '>=14'} - simple-concat@1.0.1: - resolution: {integrity: sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==} - - simple-get@3.1.1: - resolution: {integrity: sha512-CQ5LTKGfCpvE1K0n2us+kuMPbk/q0EKl82s4aheV9oXjFEz6W/Y7oQFVJuU6QG77hRT4Ghb5RURteF5vnWjupA==} - simple-update-notifier@2.0.0: resolution: {integrity: sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==} engines: {node: '>=10'} @@ -8747,10 +8627,6 @@ packages: resolution: {integrity: sha512-9Ep08KAMUn0OadnVaBuRdE2l615CQ508kr0XMadjClfYpdCyvrbFp6Taebo8yyxokQ4viUd/xPPUA4FGgUa0ow==} engines: {node: '>=12.20'} - string-width@1.0.2: - resolution: {integrity: sha512-0XsVpQLnVCXHJfyEs8tC0zpTVIr5PKKsQtkT29IwupnPTjtPmQ3xT/4yCREF9hYkV/3M3kzcUTSAZT6a6h81tw==} - engines: {node: '>=0.10.0'} - string-width@2.1.1: resolution: {integrity: sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==} engines: {node: '>=4'} @@ -8797,10 +8673,6 @@ packages: string_decoder@1.3.0: resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==} - strip-ansi@3.0.1: - resolution: {integrity: sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==} - engines: {node: '>=0.10.0'} - strip-ansi@4.0.0: resolution: {integrity: sha512-4XaJ2zQdCzROZDivEVIDPkcQn8LMFSa8kj8Gxb/Lnwzv9A8VctNZ+lfivC/sV3ivW8ElJTERXZoPBRrZKkNKow==} engines: {node: '>=4'} @@ -8959,13 +8831,6 @@ packages: resolution: {integrity: sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==} engines: {node: '>=6'} - tar-fs@2.1.2: - resolution: {integrity: sha512-EsaAXwxmx8UB7FRKqeozqEPop69DXcmYwTQwXvyAPF352HJsPdkVhvTaDPYqfNgruveJIJy3TA2l+2zj8LJIJA==} - - tar-stream@2.2.0: - resolution: {integrity: sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==} - engines: {node: '>=6'} - tar@6.2.1: resolution: {integrity: sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==} engines: {node: '>=10'} @@ -9157,9 +9022,6 @@ packages: peerDependencies: typescript: '>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta' - tunnel-agent@0.6.0: - resolution: {integrity: sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==} - type-check@0.3.2: resolution: {integrity: sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg==} engines: {node: '>= 0.8.0'} @@ -9606,9 +9468,6 @@ packages: engines: {node: ^18.17.0 || >=20.5.0} hasBin: true - wide-align@1.1.5: - resolution: {integrity: sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==} - widest-line@2.0.1: resolution: {integrity: sha512-Ba5m9/Fa4Xt9eb2ELXt77JxVDV8w7qQrH0zS/TWSJdLyAwQjWoOzpzj5lwVftDz6n/EOu3tNACS84v509qwnJA==} engines: {node: '>=4'} @@ -13525,8 +13384,6 @@ snapshots: ansi-html-community@0.0.8: {} - ansi-regex@2.1.1: {} - ansi-regex@3.0.1: {} ansi-regex@4.1.1: {} @@ -13601,15 +13458,8 @@ snapshots: dependencies: default-require-extensions: 3.0.1 - aproba@1.2.0: {} - archy@1.0.0: {} - are-we-there-yet@1.1.7: - dependencies: - delegates: 1.0.0 - readable-stream: 2.3.8 - arg@4.1.0: {} arg@4.1.3: {} @@ -14182,8 +14032,6 @@ snapshots: dependencies: readdirp: 4.1.1 - chownr@1.1.4: {} - chownr@2.0.0: {} chownr@3.0.0: {} @@ -14271,8 +14119,6 @@ snapshots: code-error-fragment@0.0.230: {} - code-point-at@1.1.0: {} - collect-v8-coverage@1.0.2: {} color-convert@1.9.3: @@ -14360,8 +14206,6 @@ snapshots: connect-history-api-fallback@2.0.0: {} - console-control-strings@1.1.0: {} - constants-browserify@1.0.0: {} content-disposition@0.5.4: @@ -14639,10 +14483,6 @@ snapshots: decimal.js@10.5.0: {} - decompress-response@4.2.1: - dependencies: - mimic-response: 2.1.0 - decompress-response@6.0.0: dependencies: mimic-response: 3.1.0 @@ -14710,8 +14550,6 @@ snapshots: delayed-stream@1.0.0: {} - delegates@1.0.0: {} - denque@2.1.0: optional: true @@ -14725,7 +14563,8 @@ snapshots: destroy@1.2.0: {} - detect-libc@1.0.3: {} + detect-libc@1.0.3: + optional: true detect-libc@2.0.3: {} @@ -14929,8 +14768,6 @@ snapshots: - electron-builder-squirrel-windows - supports-color - electron-is-dev@1.2.0: {} - electron-mocha@13.0.1: dependencies: ansi-colors: 4.1.3 @@ -14954,11 +14791,6 @@ snapshots: electron-to-chromium@1.5.99: {} - electron-util@0.13.1(patch_hash=8c6bd08d524425c72958f8edfc730eeccdbdb424bff9d1d724d6c391c2c03e99): - dependencies: - electron-is-dev: 1.2.0 - new-github-issue-url: 0.2.1 - electron-window@0.8.1: dependencies: is-electron-renderer: 2.0.1 @@ -15544,18 +15376,6 @@ snapshots: signal-exit: 3.0.7 strip-eof: 1.0.0 - execa@2.1.0: - dependencies: - cross-spawn: 7.0.6 - get-stream: 5.2.0 - is-stream: 2.0.1 - merge-stream: 2.0.0 - npm-run-path: 3.1.0 - onetime: 5.1.2 - p-finally: 2.0.1 - signal-exit: 3.0.7 - strip-final-newline: 2.0.0 - execa@5.1.1: dependencies: cross-spawn: 7.0.6 @@ -15570,8 +15390,6 @@ snapshots: exit@0.1.2: {} - expand-template@2.0.3: {} - expand-tilde@1.2.2: dependencies: os-homedir: 1.0.2 @@ -15870,8 +15688,6 @@ snapshots: fromentries@1.3.2: {} - fs-constants@1.0.0: {} - fs-exists-sync@0.1.0: {} fs-extra@10.1.0: @@ -15949,17 +15765,6 @@ snapshots: fuse.js@6.5.3: {} - gauge@2.7.4: - dependencies: - aproba: 1.2.0 - console-control-strings: 1.1.0 - has-unicode: 2.0.1 - object-assign: 4.1.1 - signal-exit: 3.0.7 - string-width: 1.0.2 - strip-ansi: 3.0.1 - wide-align: 1.1.5 - generic-pool@3.9.0: optional: true @@ -16019,8 +15824,6 @@ snapshots: fs-exists-sync: 0.1.0 homedir-polyfill: 1.0.3 - github-from-package@0.0.0: {} - glob-parent@5.1.2: dependencies: is-glob: 4.0.3 @@ -16201,8 +16004,6 @@ snapshots: dependencies: has-symbols: 1.1.0 - has-unicode@2.0.1: {} - has@1.0.4: {} hasha@5.2.2: @@ -16630,10 +16431,6 @@ snapshots: dependencies: call-bound: 1.0.3 - is-fullwidth-code-point@1.0.0: - dependencies: - number-is-nan: 1.0.1 - is-fullwidth-code-point@2.0.0: {} is-fullwidth-code-point@3.0.0: {} @@ -17546,17 +17343,6 @@ snapshots: lz-string@1.5.0: {} - mac-screen-capture-permissions@2.0.0(patch_hash=b8dc0573396f72c869190aa36e306030fdb778263076e9ba35bc3099ded2c6cc): - dependencies: - electron-util: 0.13.1(patch_hash=8c6bd08d524425c72958f8edfc730eeccdbdb424bff9d1d724d6c391c2c03e99) - execa: 2.1.0 - macos-version: 5.2.1 - prebuild-install: 6.1.4 - - macos-version@5.2.1: - dependencies: - semver: 5.7.2 - magic-string@0.30.17: dependencies: '@jridgewell/sourcemap-codec': 1.5.0 @@ -17841,8 +17627,6 @@ snapshots: mimic-response@1.0.1: {} - mimic-response@2.1.0: {} - mimic-response@3.1.0: {} min-document@2.19.0: @@ -17942,8 +17726,6 @@ snapshots: minipass: 7.1.2 rimraf: 5.0.10 - mkdirp-classic@0.5.3: {} - mkdirp@0.5.6: dependencies: minimist: 1.2.8 @@ -17996,8 +17778,6 @@ snapshots: nanoid@3.3.8: {} - napi-build-utils@1.0.2: {} - natural-compare-lite@1.4.0: {} natural-compare@1.4.0: {} @@ -18012,8 +17792,6 @@ snapshots: netmask@2.0.2: {} - new-github-issue-url@0.2.1: {} - next-tick@1.1.0: {} nice-try@1.0.5: {} @@ -18031,10 +17809,6 @@ snapshots: lower-case: 2.0.2 tslib: 2.8.1 - node-abi@2.30.1: - dependencies: - semver: 5.7.2 - node-abi@3.74.0: dependencies: semver: 7.6.3 @@ -18125,27 +17899,14 @@ snapshots: dependencies: path-key: 2.0.1 - npm-run-path@3.1.0: - dependencies: - path-key: 3.1.1 - npm-run-path@4.0.1: dependencies: path-key: 3.1.1 - npmlog@4.1.2: - dependencies: - are-we-there-yet: 1.1.7 - console-control-strings: 1.1.0 - gauge: 2.7.4 - set-blocking: 2.0.0 - nth-check@2.1.1: dependencies: boolbase: 1.0.0 - number-is-nan@1.0.1: {} - nyc@15.1.0: dependencies: '@istanbuljs/load-nyc-config': 1.1.0 @@ -18308,8 +18069,6 @@ snapshots: p-finally@1.0.0: {} - p-finally@2.0.1: {} - p-limit@2.3.0: dependencies: p-try: 2.2.0 @@ -18644,22 +18403,6 @@ snapshots: commander: 9.5.0 optional: true - prebuild-install@6.1.4: - dependencies: - detect-libc: 1.0.3 - expand-template: 2.0.3 - github-from-package: 0.0.0 - minimist: 1.2.8 - mkdirp-classic: 0.5.3 - napi-build-utils: 1.0.2 - node-abi: 2.30.1 - npmlog: 4.1.2 - pump: 3.0.2 - rc: 1.2.8 - simple-get: 3.1.1 - tar-fs: 2.1.2 - tunnel-agent: 0.6.0 - prelude-ls@1.1.2: {} prelude-ls@1.2.1: {} @@ -19631,14 +19374,6 @@ snapshots: signal-exit@4.1.0: {} - simple-concat@1.0.1: {} - - simple-get@3.1.1: - dependencies: - decompress-response: 4.2.1 - once: 1.4.0 - simple-concat: 1.0.1 - simple-update-notifier@2.0.0: dependencies: semver: 7.6.3 @@ -19824,12 +19559,6 @@ snapshots: char-regex: 2.0.2 strip-ansi: 7.1.0 - string-width@1.0.2: - dependencies: - code-point-at: 1.1.0 - is-fullwidth-code-point: 1.0.0 - strip-ansi: 3.0.1 - string-width@2.1.1: dependencies: is-fullwidth-code-point: 2.0.0 @@ -19913,10 +19642,6 @@ snapshots: dependencies: safe-buffer: 5.2.1 - strip-ansi@3.0.1: - dependencies: - ansi-regex: 2.1.1 - strip-ansi@4.0.0: dependencies: ansi-regex: 3.0.1 @@ -20110,21 +19835,6 @@ snapshots: tapable@2.2.1: {} - tar-fs@2.1.2: - dependencies: - chownr: 1.1.4 - mkdirp-classic: 0.5.3 - pump: 3.0.2 - tar-stream: 2.2.0 - - tar-stream@2.2.0: - dependencies: - bl: 4.1.0 - end-of-stream: 1.4.4 - fs-constants: 1.0.0 - inherits: 2.0.4 - readable-stream: 3.6.2 - tar@6.2.1: dependencies: chownr: 2.0.0 @@ -20320,10 +20030,6 @@ snapshots: tslib: 1.14.1 typescript: 5.6.3 - tunnel-agent@0.6.0: - dependencies: - safe-buffer: 5.2.1 - type-check@0.3.2: dependencies: prelude-ls: 1.1.2 @@ -20869,10 +20575,6 @@ snapshots: dependencies: isexe: 3.1.1 - wide-align@1.1.5: - dependencies: - string-width: 4.2.3 - widest-line@2.0.1: dependencies: string-width: 2.1.1 diff --git a/scripts/esbuild.js b/scripts/esbuild.js index c1aca126d8..220d36235a 100644 --- a/scripts/esbuild.js +++ b/scripts/esbuild.js @@ -46,7 +46,6 @@ const bundleDefaults = { // Things that don't bundle well 'got', - 'jquery', 'node-fetch', 'pino', 'proxy-agent', diff --git a/ts/state/ducks/calling.ts b/ts/state/ducks/calling.ts index 8d2435fff0..ce62be8003 100644 --- a/ts/state/ducks/calling.ts +++ b/ts/state/ducks/calling.ts @@ -2,11 +2,6 @@ // SPDX-License-Identifier: AGPL-3.0-only import type { ThunkAction, ThunkDispatch } from 'redux-thunk'; -import { - hasScreenCapturePermission, - openSystemPreferences, -} from 'mac-screen-capture-permissions'; -import { isSupported as isNativeMacScreenShareSupported } from '@indutny/mac-screen-share'; import { omit } from 'lodash'; import type { ReadonlyDeep } from 'type-fest'; import { @@ -22,6 +17,7 @@ import { missingCaseError } from '../../util/missingCaseError'; import { drop } from '../../util/drop'; import { DesktopCapturer, + isNativeMacScreenShareSupported, type DesktopCapturerBaton, } from '../../util/desktopCapturer'; import { calling } from '../../services/calling'; @@ -1371,7 +1367,7 @@ function getPresentingSources(): ThunkAction< const needsPermission = platform === 'darwin' && !isNativeMacScreenShareSupported && - !hasScreenCapturePermission(); + (await window.IPC.getMediaAccessStatus('screen')) === 'denied'; const capturer = new DesktopCapturer({ i18n, @@ -1757,7 +1753,7 @@ function openSystemPreferencesAction(): ThunkAction< never > { return () => { - void openSystemPreferences(); + drop(window.IPC.openSystemMediaPermissions('screenCapture')); }; } diff --git a/ts/util/desktopCapturer.ts b/ts/util/desktopCapturer.ts index fa785ac242..e8f6b83526 100644 --- a/ts/util/desktopCapturer.ts +++ b/ts/util/desktopCapturer.ts @@ -3,7 +3,7 @@ /* eslint-disable max-classes-per-file */ import { ipcRenderer, type DesktopCapturerSource } from 'electron'; -import * as macScreenShare from '@indutny/mac-screen-share'; +import type { Stream, StreamOptions } from '@indutny/mac-screen-share'; import * as log from '../logging/log'; import * as Errors from '../types/errors'; @@ -58,7 +58,7 @@ type State = Readonly< } | { step: Step.NativeMacOS; - stream: macScreenShare.Stream; + stream: Stream; } | { step: Step.Done; @@ -101,7 +101,7 @@ export class DesktopCapturer { DesktopCapturer.initialize(); } - if (macScreenShare.isSupported) { + if (isNativeMacScreenShareSupported()) { this.#state = { step: Step.NativeMacOS, stream: this.#getNativeMacOSStream(), @@ -231,7 +231,7 @@ export class DesktopCapturer { } } - #getNativeMacOSStream(): macScreenShare.Stream { + #getNativeMacOSStream(): Stream { const track = new MediaStreamTrackGenerator({ kind: 'video' }); const writer = track.writable.getWriter(); @@ -254,7 +254,11 @@ export class DesktopCapturer { lastFrame = undefined; }; - const stream = new macScreenShare.Stream({ + // process.dlopen() for the addon takes roughly 34ms so avoid running it + // until requested by user. + // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires + const macScreenShare = require('@indutny/mac-screen-share'); + const stream: Stream = new macScreenShare.Stream({ width: REQUESTED_SCREEN_SHARE_WIDTH, height: REQUESTED_SCREEN_SHARE_HEIGHT, frameRate: REQUESTED_SCREEN_SHARE_FRAMERATE, @@ -306,7 +310,7 @@ export class DesktopCapturer { }); drop(writer.write(lastFrame.clone())); }, - }); + } satisfies StreamOptions); return stream; } @@ -361,3 +365,10 @@ export class DesktopCapturer { function isScreenSource(source: DesktopCapturerSource): boolean { return source.id.startsWith('screen'); } + +export function isNativeMacScreenShareSupported(): boolean { + // process.dlopen() for the addon takes roughly 34ms so avoid running it + // until requested by user. + // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires + return require('@indutny/mac-screen-share').isSupported; +} diff --git a/ts/window.d.ts b/ts/window.d.ts index db75ea5101..0cbe55ec2a 100644 --- a/ts/window.d.ts +++ b/ts/window.d.ts @@ -72,7 +72,7 @@ export type IPCType = { ) => Promise>; getMediaCameraPermissions: () => Promise; openSystemMediaPermissions: ( - mediaType: 'microphone' | 'camera' + mediaType: 'microphone' | 'camera' | 'screenCapture' ) => Promise; getMediaPermissions: () => Promise; logAppLoadedEvent?: (options: { processedCount?: number }) => void;