From 84605ceb3088ca90853ca433911bb818936e70f6 Mon Sep 17 00:00:00 2001 From: bytedream Date: Sun, 28 Jul 2024 23:31:25 +0200 Subject: [PATCH] Make nativeMessaging an optional permission --- src/entries/popup/Popup.svelte | 10 +++++++--- src/manifest.ts | 3 ++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/entries/popup/Popup.svelte b/src/entries/popup/Popup.svelte index 28957ff..f8d0112 100644 --- a/src/entries/popup/Popup.svelte +++ b/src/entries/popup/Popup.svelte @@ -17,8 +17,6 @@ let isMobile: boolean; (async () => { - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore isMobile = (await browser.runtime.getPlatformInfo()).os === 'android'; })(); @@ -75,7 +73,13 @@ Other.setFf2mpv(ff2mpvEnabled)} + on:change={async () => { + ff2mpvEnabled = !ff2mpvEnabled; + if (await browser.permissions.request({ permissions: ['nativeMessaging'] })) { + await Other.setFf2mpv(ff2mpvEnabled); + ff2mpvEnabled = !ff2mpvEnabled; + } + }} > = { 96: 'icons/stream-bypass@96px.png', 128: 'icons/stream-bypass@128px.png' }, - permissions: ['storage', 'nativeMessaging'] + permissions: ['storage'], + optional_permissions: ['nativeMessaging'] }; const browserAction = {