From bbefd8a07ba71d7fe5e9c707ddb06e99bfd2a502 Mon Sep 17 00:00:00 2001 From: praschke Date: Sun, 29 Oct 2023 22:17:08 +0000 Subject: [PATCH] nativeMessaging can always be optional this is the only blocker to Firefox for Android. --- dev/data/manifest-variants.json | 29 ++++++----------------------- docs/permissions.md | 5 ++--- ext/js/extension/environment.js | 16 ++++++---------- ext/permissions.html | 4 ++-- ext/settings.html | 2 +- 5 files changed, 17 insertions(+), 39 deletions(-) diff --git a/dev/data/manifest-variants.json b/dev/data/manifest-variants.json index 4d4ec30103..139814fd67 100644 --- a/dev/data/manifest-variants.json +++ b/dev/data/manifest-variants.json @@ -229,25 +229,12 @@ "gecko": { "id": "{cb7c0bec-7085-4f84-8422-7b55a7c4467c}", "strict_min_version": "115.0" + }, + "gecko_android": { + "strict_min_version": "115.0" } } }, - { - "action": "remove", - "path": [ - "optional_permissions" - ], - "item": "nativeMessaging" - }, - { - "action": "add", - "path": [ - "permissions" - ], - "items": [ - "nativeMessaging" - ] - }, { "action": "remove", "path": [ @@ -327,13 +314,6 @@ ], "item": "clipboardRead" }, - { - "action": "remove", - "path": [ - "permissions" - ], - "item": "webRequestBlocking" - }, { "action": "remove", "path": [ @@ -365,6 +345,9 @@ ], "excludeFiles": [ "sw.js", + "offscreen.html", + "js/background/offscreen.js", + "js/background/offscreen-main.js", "js/dom/simple-dom-parser.js", "lib/parse5.js" ] diff --git a/docs/permissions.md b/docs/permissions.md index 8ab3bba52c..b2b1a34ca3 100644 --- a/docs/permissions.md +++ b/docs/permissions.md @@ -27,15 +27,14 @@ Yomichan supports simulating the `Ctrl+C` (copy to clipboard) keyboard shortcut when a definitions popup is open and focused. -* `clipboardRead` (optional)
+* `clipboardRead` _(optional)_
Yomichan supports automatically opening a search window when Japanese text is copied to the clipboard while the browser is running, depending on how certain settings are configured. This allows Yomichan to support scanning text from external applications, provided there is a way to copy text from those applications to the clipboard. -* `nativeMessaging` (optional on Chrome)
+* `nativeMessaging` _(optional, unavailable on Firefox for Android)_
Yomichan has the ability to communicate with an optional native messaging component in order to support parsing large blocks of Japanese text using [MeCab](https://en.wikipedia.org/wiki/MeCab). The installation of this component is optional and is not included by default. - This permission is optional on Chrome, but required on Firefox, because Firefox does not permit it to be optional. diff --git a/ext/js/extension/environment.js b/ext/js/extension/environment.js index ec1e861253..ad5a19aea2 100644 --- a/ext/js/extension/environment.js +++ b/ext/js/extension/environment.js @@ -31,8 +31,9 @@ class Environment { } async _loadEnvironmentInfo() { - const browser = await this._getBrowser(); const os = await this._getOperatingSystem(); + const browser = await this._getBrowser(os); + return { browser, platform: {os} @@ -64,7 +65,7 @@ class Environment { }); } - async _getBrowser() { + async _getBrowser(os) { try { if (chrome.runtime.getURL('/').startsWith('ms-browser-extension://')) { return 'edge-legacy'; @@ -76,17 +77,12 @@ class Environment { // NOP } if (typeof browser !== 'undefined') { - try { - const info = await browser.runtime.getBrowserInfo(); - if (info.name === 'Fennec') { - return 'firefox-mobile'; - } - } catch (e) { - // NOP - } if (this._isSafari()) { return 'safari'; } + if (os === 'android') { + return 'firefox-mobile'; + } return 'firefox'; } else { return 'chrome'; diff --git a/ext/permissions.html b/ext/permissions.html index f6956cd702..376a9de572 100644 --- a/ext/permissions.html +++ b/ext/permissions.html @@ -94,9 +94,9 @@

-
+
-
nativeMessaging (optional)
+
nativeMessaging (optional)
Yomitan has the ability to communicate with an optional native messaging component in order to support parsing large blocks of Japanese text using diff --git a/ext/settings.html b/ext/settings.html index f1001f905a..8d5f0a7661 100644 --- a/ext/settings.html +++ b/ext/settings.html @@ -1372,7 +1372,7 @@

Yomitan Settings

-
+