From 1da709eb5ed250e1280ec897cd7fb787748409d6 Mon Sep 17 00:00:00 2001 From: hensm Date: Sat, 16 Apr 2022 12:02:19 +0100 Subject: [PATCH] Implement receiver selector whitelist suggestion banner --- CONTRIBUTING.md | 83 ++- ext/src/_locales/en/messages.json | 677 +++++++++--------- ext/src/background/background.ts | 5 +- .../receiverSelector/ReceiverSelector.ts | 13 +- .../ReceiverSelectorManager.ts | 24 +- ext/src/cast/knownApps.ts | 2 +- ext/src/lib/matchPattern.ts | 136 ++++ ext/src/lib/utils.ts | 5 +- ext/src/messaging.ts | 5 + ext/src/ui/options/index.tsx | 2 +- ext/src/ui/photon-widgets.css | 23 +- ext/src/ui/popup/index.tsx | 134 +++- ext/src/ui/popup/photon_info.svg | 13 + ext/src/ui/popup/styles/index.css | 44 +- 14 files changed, 751 insertions(+), 415 deletions(-) create mode 100644 ext/src/lib/matchPattern.ts create mode 100644 ext/src/ui/popup/photon_info.svg diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index be201c9..34c91ab 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,75 +2,88 @@ Contributions welcome. -Implementation notes are at [IMPLEMENTATION.md](IMPLEMENTATION.md). +Implementation notes are at [IMPLEMENTATION.md](IMPLEMENTATION.md). If you're unsure about anything, feel free to ask. -Just submit a PR for small changes (bugfixes, typos, etc...). Comment first on existing +Just submit a PR for small changes (bugfixes, typos, etc...). Comment first on existing issues if you're going to work on something to avoid duplication of effort. Submit an issue for new features before submitting a PR. - ## Bug Reports Follow the bug report issue template and provide as much info as possible. Logs can be found in various locations depending on the component at fault: -* https://developer.mozilla.org/en-US/docs/Tools/Web_Console -* https://developer.mozilla.org/en-US/docs/Tools/Browser_Console -* https://extensionworkshop.com/documentation/develop/debugging/ - +- https://developer.mozilla.org/en-US/docs/Tools/Web_Console +- https://developer.mozilla.org/en-US/docs/Tools/Browser_Console +- https://extensionworkshop.com/documentation/develop/debugging/ ## Compatibility Reports Compatibility reports are always helpful. They're tracked in a separate repository, so go to [@hensm/fx_cast-compat](https://github.com/hensm/fx_cast-compat) and use the "Compatibility Report" issue template. Ensure you have a working environment and that the site is in the whitelist (check options page). - ## Localizations Either fork and edit the messages files manually or to easily add/edit localizations, use the web-ext-translator tool: https://lusito.github.io/web-ext-translator/?gh=https://github.com/hensm/fx_cast/ - Missing/outdated strings: -* `de` - * `optionsMirroringCategoryName` - * `optionsMirroringCategoryDescription` - * `optionsMirroringEnabled` - * `optionsMirroringAppId` - * `popupMediaTypeAppNotFound` - * `optionsBridgeCompatible` - * `optionsBridgeLikelyCompatible` - * `optionsBridgeIncompatible` +- `de` -* `nl` - * `optionsBridgeBackupEnabled` - * `optionsUserAgentWhitelistRestrictedEnabled` - * `optionsUserAgentWhitelistRestrictedEnabledDescription` - * `optionsOptionRecommended` - * `optionsMirroringCategoryName` - * `optionsMirroringCategoryDescription` - * `optionsMirroringEnabled` - * `optionsMirroringAppId` - * `popupMediaTypeAppNotFound` - * `optionsBridgeCompatible` - * `optionsBridgeLikelyCompatible` - * `optionsBridgeIncompatible` + - `optionsMirroringCategoryName` + - `optionsMirroringCategoryDescription` + - `optionsMirroringEnabled` + - `optionsMirroringAppId` + - `popupWhitelistNotWhitelisted` + - `popupWhitelistAddToWhitelist` + - `popupMediaTypeAppNotFound` + - `optionsBridgeCompatible` + - `optionsBridgeLikelyCompatible` + - `optionsBridgeIncompatible` +- `es` + + - `popupWhitelistNotWhitelisted` + - `popupWhitelistAddToWhitelist` + +- `nl` + + - `optionsBridgeBackupEnabled` + - `optionsUserAgentWhitelistRestrictedEnabled` + - `optionsUserAgentWhitelistRestrictedEnabledDescription` + - `optionsOptionRecommended` + - `optionsMirroringCategoryName` + - `optionsMirroringCategoryDescription` + - `optionsMirroringEnabled` + - `optionsMirroringAppId` + - `popupWhitelistNotWhitelisted` + - `popupWhitelistAddToWhitelist` + - `popupMediaTypeAppNotFound` + - `optionsBridgeCompatible` + - `optionsBridgeLikelyCompatible` + - `optionsBridgeIncompatible` + +- `no` + - `popupWhitelistNotWhitelisted` + - `popupWhitelistAddToWhitelist` ### NSIS Installer Localization If you're comfortable editing and compiling NSIS installer scripts, use the following guide, otherwise just provide translated strings in an issue or PR comment. To localize Windows installer strings, first add the relevant `MUI_LANGUAGE` macro to the end of the existing list (list of language names can be found [here](https://sourceforge.net/p/nsis/code/HEAD/tree/NSIS/trunk/Contrib/Language%20files/)): -````nsi + +```nsi !insertmacro MUI_LANGUAGE "German" -```` +``` + Then, provide each version of the existing `LangString` commands with that language grouped under the existing strings: -````nsi + +```nsi LangString MSG__EXAMPLE_STRING1 ${LANG_GERMAN} "Hallo" LangString MSG__EXAMPLE_STRING2 ${LANG_GERMAN} "Welt" -```` +``` Try to keep the line length under 80 characters by splitting lines within the string with a backslash at the end of the line and a double indent on the next line. To escape characters (like other double quotes), prepend with a `$\`. diff --git a/ext/src/_locales/en/messages.json b/ext/src/_locales/en/messages.json index a9f8ec9..c088243 100755 --- a/ext/src/_locales/en/messages.json +++ b/ext/src/_locales/en/messages.json @@ -1,370 +1,381 @@ { "extensionName": { - "message": "fx_cast" - , "description": "Name of the extension and the native receiver selector window title." - } - , "extensionDescription": { - "message": "Enables Chromecast support for casting web apps (like Netflix or BBC iPlayer), HTML5 video and screen/tab sharing." - , "description": "Description of the extension shown in the add-ons manager." - } + "message": "fx_cast", + "description": "Name of the extension and the native receiver selector window title." + }, + "extensionDescription": { + "message": "Enables Chromecast support for casting web apps (like Netflix or BBC iPlayer), HTML5 video and screen/tab sharing.", + "description": "Description of the extension shown in the add-ons manager." + }, + "popupWhitelistNotWhitelisted": { + "message": "$appName$ is not whitelisted", + "description": "Receiver selector whitelist suggestion banner label.", + "placeholders": { + "appName": { + "content": "$1", + "example": "Netflix" + } + } + }, + "popupWhitelistAddToWhitelist": { + "message": "Add to Whitelist", + "description": "Receiver selector whitelist suggestion banner button label." + }, + "popupMediaTypeApp": { + "message": "this site's app", + "description": "Receiver selector media type