feat: Accept more domains in IPM create_on_page_dialog [#1485]
This MR adds a new feature to the IPM command create_on_page_dialog
. The parameter button_target
now accepts more domains. Beforehand it would only take the user to pages inside "https://adblockplus.org" and the docs said button_target
should be a "URL without the domain name (i.e. path name plus query string)" but now it accepts full URLs as well, as long as the domain is "https://adblockplus.org", "https://blog.getadblock.com", "https://helpcenter.getadblock.com" or "https://vpn.getadblock.com".
In prefs
, a new variable defaults.ipm_safe_origins
was added to define which domains are considered safe. The old defaults.ipm_safe_origin
was renamed to defaults.ipm_default_safe_origin
and is used as the base domain when the URL passed in button_target
is a relative URL.
To do before merging this MR:
- Add the same feature to
create_tab
IPM command⛔ - looks like we don't have support for this command in ABP yet (according to https://www.notion.so/adblock/Command-Library-ae6a606bcfcc4e0b9ab2865181335318)
- skipping this one for now
- Explore if it is possible to link to the Extension settings page
✅ - It is possible. The link looks like "chrome-extension://cfhdojbkjhnklbpkdaibdccddilifddb/desktop-options.html" or "moz-extension://bcce1347-0946-4369-9cd5-441036738c18/desktop-options.html", with the first part of the URL being acessible through
browser.runtime.getURL("/")
. Since the link is unique for every installation, it will be calculated dynamically when the value passed tobutton_target
is equal to a predefined key. I'm hardcoding this key to "browser-extension-options" for now.
- It is possible. The link looks like "chrome-extension://cfhdojbkjhnklbpkdaibdccddilifddb/desktop-options.html" or "moz-extension://bcce1347-0946-4369-9cd5-441036738c18/desktop-options.html", with the first part of the URL being acessible through
- Update the docs with this change
- Bump the version of IPM commands
✅ - This change is backward compatible, the old values will still work after merging, so I'm not sure if it is necessary to change the version.
- maybe we should wait for !943 (merged) to be merged (bumping version to 3) before merging this one and bumping it to 4.
- Done