Make nativeMessaging an optional permission

This commit is contained in:
2024-07-28 23:31:25 +02:00
parent 67c492db47
commit 84605ceb30
2 changed files with 9 additions and 4 deletions

View File

@ -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 @@
<Toggle
bind:checked={ff2mpvEnabled}
id="ff2mpv"
on:change={async () => Other.setFf2mpv(ff2mpvEnabled)}
on:change={async () => {
ff2mpvEnabled = !ff2mpvEnabled;
if (await browser.permissions.request({ permissions: ['nativeMessaging'] })) {
await Other.setFf2mpv(ff2mpvEnabled);
ff2mpvEnabled = !ff2mpvEnabled;
}
}}
></Toggle>
<a
class="info-questionmark"