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 = {