diff --git a/add-on/_locales/en/messages.json b/add-on/_locales/en/messages.json
index e762d3bb2..5ff71f3b1 100644
--- a/add-on/_locales/en/messages.json
+++ b/add-on/_locales/en/messages.json
@@ -63,13 +63,13 @@
"message": "Active Tab",
"description": "A menu item in Browser Action pop-up (panel_activeTabSiteRedirectEnable)"
},
- "panel_activeTabSiteRedirectToggle": {
- "message": "Redirect on $1",
- "description": "A menu item in Browser Action pop-up (panel_activeTabSiteRedirectToggle)"
+ "panel_activeTabSiteIntegrationsToggle": {
+ "message": "Enable integrations on $1",
+ "description": "A menu item in Browser Action pop-up (panel_activeTabSiteIntegrationsToggle)"
},
- "panel_activeTabSiteRedirectToggleTooltip": {
- "message": "Click to toggle gateway redirects on $1",
- "description": "A menu item tooltip in Browser Action pop-up (panel_activeTabSiteRedirectToggleTooltip)"
+ "panel_activeTabSiteIntegrationsToggleTooltip": {
+ "message": "Click to toggle all IPFS integrations on $1",
+ "description": "A menu item tooltip in Browser Action pop-up (panel_activeTabSiteIntegrationsToggleTooltip)"
},
"panel_pinCurrentIpfsAddress": {
"message": "Pin IPFS Resource",
@@ -291,12 +291,12 @@
"message": "Redirecting to a path-based gateway breaks Origin-based security isolation of DNSLink website! Please leave this disabled unless you are aware of (and ok with) related risks.",
"description": "A warning on the Preferences screen, displayed when URL does not belong to Secure Context (option_customGatewayUrl_warning)"
},
- "option_noRedirectHostnames_title": {
- "message": "Redirect Opt-Outs",
- "description": "An option title on the Preferences screen (option_noRedirectHostnames_title)"
+ "option_noIntegrationsHostnames_title": {
+ "message": "IPFS Integrations Opt-Outs",
+ "description": "An option title on the Preferences screen (option_noIntegrationsHostnames_title)"
},
- "option_noRedirectHostnames_description": {
- "message": "List of websites that should not be redirected to the Custom Gateway (includes subresources from other domains). One hostname per line.",
+ "option_noIntegrationsHostnames_description": {
+ "message": "List of websites that should not have any IPFS integrations enabled. One hostname per line.",
"description": "An option description on the Preferences screen (option_noRedirectHostnames_description)"
},
"option_publicGatewayUrl_title": {
diff --git a/add-on/src/lib/ipfs-companion.js b/add-on/src/lib/ipfs-companion.js
index 9f21bbb68..982f2a0d4 100644
--- a/add-on/src/lib/ipfs-companion.js
+++ b/add-on/src/lib/ipfs-companion.js
@@ -241,7 +241,7 @@ module.exports = async function init () {
openViaWebUI: state.openViaWebUI,
apiURLString: dropSlash(state.apiURLString),
redirect: state.redirect,
- noRedirectHostnames: state.noRedirectHostnames,
+ noIntegrationsHostnames: state.noIntegrationsHostnames,
currentTab: await browser.tabs.query({ active: true, currentWindow: true }).then(tabs => tabs[0])
}
try {
@@ -257,7 +257,7 @@ module.exports = async function init () {
info.isIpfsContext = ipfsPathValidator.isIpfsPageActionsContext(url)
info.currentDnslinkFqdn = dnslinkResolver.findDNSLinkHostname(url)
info.currentFqdn = info.currentDnslinkFqdn || new URL(url).hostname
- info.currentTabRedirectOptOut = info.noRedirectHostnames && info.noRedirectHostnames.includes(info.currentFqdn)
+ info.currentTabIntegrationsOptOut = info.noIntegrationsHostnames && info.noIntegrationsHostnames.includes(info.currentFqdn)
info.isRedirectContext = info.currentFqdn && ipfsPathValidator.isRedirectPageActionsContext(url)
}
// Still here?
@@ -679,7 +679,7 @@ module.exports = async function init () {
case 'detectIpfsPathHeader':
case 'preloadAtPublicGateway':
case 'openViaWebUI':
- case 'noRedirectHostnames':
+ case 'noIntegrationsHostnames':
case 'dnslinkRedirect':
state[key] = change.newValue
break
diff --git a/add-on/src/lib/ipfs-request.js b/add-on/src/lib/ipfs-request.js
index 76fb317f3..16901475c 100644
--- a/add-on/src/lib/ipfs-request.js
+++ b/add-on/src/lib/ipfs-request.js
@@ -80,7 +80,7 @@ function createRequestModifier (getState, dnslinkResolver, ipfsPathValidator, ru
const parentUrl = request.originUrl || request.initiator // FF: originUrl (Referer-like Origin URL), Chrome: initiator (just Origin)
const fqdn = new URL(request.url).hostname
const parentFqdn = parentUrl && parentUrl !== 'null' && request.url !== parentUrl ? new URL(parentUrl).hostname : null
- if (state.noRedirectHostnames.some(optout =>
+ if (state.noIntegrationsHostnames.some(optout =>
fqdn !== 'gateway.ipfs.io' && (fqdn.endsWith(optout) || (parentFqdn && parentFqdn.endsWith(optout))
))) {
ignore(request.requestId)
diff --git a/add-on/src/lib/options.js b/add-on/src/lib/options.js
index 3dc5dad41..b9c422a76 100644
--- a/add-on/src/lib/options.js
+++ b/add-on/src/lib/options.js
@@ -13,7 +13,7 @@ exports.optionDefaults = Object.freeze({
publicGatewayUrl: 'https://ipfs.io',
publicSubdomainGatewayUrl: 'https://dweb.link',
useCustomGateway: true,
- noRedirectHostnames: [],
+ noIntegrationsHostnames: [],
automaticMode: true,
linkify: false,
dnslinkPolicy: 'best-effort',
diff --git a/add-on/src/options/forms/gateways-form.js b/add-on/src/options/forms/gateways-form.js
index 09e9f3d9d..1d6133f94 100644
--- a/add-on/src/options/forms/gateways-form.js
+++ b/add-on/src/options/forms/gateways-form.js
@@ -14,7 +14,7 @@ function gatewaysForm ({
ipfsNodeType,
customGatewayUrl,
useCustomGateway,
- noRedirectHostnames,
+ noIntegrationsHostnames,
publicGatewayUrl,
publicSubdomainGatewayUrl,
onOptionChange
@@ -23,7 +23,7 @@ function gatewaysForm ({
const onUseCustomGatewayChange = onOptionChange('useCustomGateway')
const onPublicGatewayUrlChange = onOptionChange('publicGatewayUrl', normalizeGatewayURL)
const onPublicSubdomainGatewayUrlChange = onOptionChange('publicSubdomainGatewayUrl', normalizeGatewayURL)
- const onNoRedirectHostnamesChange = onOptionChange('noRedirectHostnames', hostTextToArray)
+ const onNoIntegrationsHostnamesChange = onOptionChange('noIntegrationsHostnames', hostTextToArray)
const mixedContentWarning = !secureContextUrl.test(customGatewayUrl)
const supportRedirectToCustomGateway = ipfsNodeType !== 'embedded'
const allowChangeOfCustomGateway = ipfsNodeType !== 'embedded:chromesockets'
@@ -110,18 +110,18 @@ function gatewaysForm ({
` : null}
${supportRedirectToCustomGateway ? html`
-
` : null}
diff --git a/add-on/src/options/page.js b/add-on/src/options/page.js
index 138884b3e..ca8bea55c 100644
--- a/add-on/src/options/page.js
+++ b/add-on/src/options/page.js
@@ -69,7 +69,7 @@ module.exports = function optionsPage (state, emit) {
useCustomGateway: state.options.useCustomGateway,
publicGatewayUrl: state.options.publicGatewayUrl,
publicSubdomainGatewayUrl: state.options.publicSubdomainGatewayUrl,
- noRedirectHostnames: state.options.noRedirectHostnames,
+ noIntegrationsHostnames: state.options.noIntegrationsHostnames,
onOptionChange
})}
${fileImportForm({
diff --git a/add-on/src/popup/browser-action/context-actions.js b/add-on/src/popup/browser-action/context-actions.js
index f497a4574..b96e3369d 100644
--- a/add-on/src/popup/browser-action/context-actions.js
+++ b/add-on/src/popup/browser-action/context-actions.js
@@ -22,7 +22,7 @@ function contextActions ({
currentTab,
currentFqdn,
currentDnslinkFqdn,
- currentTabRedirectOptOut,
+ currentTabIntegrationsOptOut,
ipfsNodeType,
isIpfsContext,
isPinning,
@@ -30,7 +30,7 @@ function contextActions ({
isPinned,
isIpfsOnline,
isApiAvailable,
- onToggleSiteRedirect,
+ onToggleSiteIntegrations,
onViewOnGateway,
onCopy,
onPin,
@@ -69,25 +69,23 @@ function contextActions ({
`
}
- /* TODO: change "redirect on {fqdn}" to "disable on {fqdn}" and disable all integrations
- // removed per site toggle for now: ${renderSiteRedirectToggle()}
- const renderSiteRedirectToggle = () => {
+ const renderSiteIntegrationsToggle = () => {
if (!isRedirectContext) return
return html`
${navItem({
- text: browser.i18n.getMessage('panel_activeTabSiteRedirectToggle', currentFqdn),
- title: browser.i18n.getMessage('panel_activeTabSiteRedirectToggleTooltip', currentFqdn),
+ text: browser.i18n.getMessage('panel_activeTabSiteIntegrationsToggle', currentFqdn),
+ title: browser.i18n.getMessage('panel_activeTabSiteIntegrationsToggleTooltip', currentFqdn),
style: 'truncate',
- disabled: !(active && redirect),
- switchValue: active && redirect && !currentTabRedirectOptOut,
- onClick: onToggleSiteRedirect
+ disabled: !(active),
+ switchValue: active && !currentTabIntegrationsOptOut,
+ onClick: onToggleSiteIntegrations
})}
`
}
- */
return html`
${renderIpfsContextItems()}
+ ${renderSiteIntegrationsToggle()}
`
}
diff --git a/add-on/src/popup/browser-action/page.js b/add-on/src/popup/browser-action/page.js
index 6c3b28b9b..e5f81cc6e 100644
--- a/add-on/src/popup/browser-action/page.js
+++ b/add-on/src/popup/browser-action/page.js
@@ -20,11 +20,11 @@ module.exports = function browserActionPage (state, emit) {
const onOpenWebUi = () => emit('openWebUi')
const onOpenPrefs = () => emit('openPrefs')
const onToggleGlobalRedirect = () => emit('toggleGlobalRedirect')
- const onToggleSiteRedirect = () => emit('toggleSiteRedirect')
+ const onToggleSiteIntegrations = () => emit('toggleSiteIntegrations')
const onToggleActive = () => emit('toggleActive')
const headerProps = Object.assign({ onToggleActive, onOpenPrefs }, state)
- const activeTabActionsProps = Object.assign({ onViewOnGateway, onToggleSiteRedirect, onCopy, onPin, onUnPin }, state)
+ const activeTabActionsProps = Object.assign({ onViewOnGateway, onToggleSiteIntegrations, onCopy, onPin, onUnPin }, state)
const opsProps = Object.assign({ onQuickUpload, onOpenWebUi, onToggleGlobalRedirect }, state)
return html`
diff --git a/add-on/src/popup/browser-action/store.js b/add-on/src/popup/browser-action/store.js
index c4f7cdedc..76c048589 100644
--- a/add-on/src/popup/browser-action/store.js
+++ b/add-on/src/popup/browser-action/store.js
@@ -32,7 +32,7 @@ module.exports = (state, emitter) => {
currentTab: null,
currentFqdn: null,
currentDnslinkFqdn: null,
- noRedirectHostnames: []
+ noIntegrationsHostnames: []
})
let port
@@ -166,22 +166,23 @@ module.exports = (state, emitter) => {
}
})
- emitter.on('toggleSiteRedirect', async () => {
- state.currentTabRedirectOptOut = !state.currentTabRedirectOptOut
+ emitter.on('toggleSiteIntegrations', async () => {
+ state.currentTabIntegrationsOptOut = !state.currentTabIntegrationsOptOut
emitter.emit('render')
try {
- let noRedirectHostnames = state.noRedirectHostnames
+ let noIntegrationsHostnames = state.noIntegrationsHostnames
// if we are on /ipns/fqdn.tld/ then use hostname from DNSLink
const fqdn = state.currentDnslinkFqdn || state.currentFqdn
- if (noRedirectHostnames.includes(fqdn)) {
- noRedirectHostnames = noRedirectHostnames.filter(host => !host.endsWith(fqdn))
+ if (noIntegrationsHostnames.includes(fqdn)) {
+ noIntegrationsHostnames = noIntegrationsHostnames.filter(host => !host.endsWith(fqdn))
} else {
- noRedirectHostnames.push(fqdn)
+ noIntegrationsHostnames.push(fqdn)
}
- // console.dir('toggleSiteRedirect', state)
- await browser.storage.local.set({ noRedirectHostnames })
+ // console.dir('toggleSiteIntegrations', state)
+ await browser.storage.local.set({ noIntegrationsHostnames })
+ // TODO: remove below? does it still make sense in "integrations toggle" context?
// Reload the current tab to apply updated redirect preference
if (!state.currentDnslinkFqdn || !IsIpfs.ipnsUrl(state.currentTab.url)) {
// No DNSLink, reload URL as-is
@@ -198,7 +199,7 @@ module.exports = (state, emitter) => {
})
}
} catch (error) {
- console.error(`Unable to update redirect state due to ${error}`)
+ console.error(`Unable to update integrations state due to ${error}`)
emitter.emit('render')
}
})
diff --git a/add-on/src/popup/page-action/page.js b/add-on/src/popup/page-action/page.js
index 1b672e143..4c668dae2 100644
--- a/add-on/src/popup/page-action/page.js
+++ b/add-on/src/popup/page-action/page.js
@@ -13,9 +13,9 @@ module.exports = function pageActionPage (state, emit) {
const onCopy = (copyAction) => emit('copy', copyAction)
const onPin = () => emit('pin')
const onUnPin = () => emit('unPin')
- const onToggleSiteRedirect = () => emit('toggleSiteRedirect')
+ const onToggleSiteIntegrations = () => emit('toggleSiteIntegrations')
- const contextActionsProps = Object.assign({ onViewOnGateway, onCopy, onPin, onUnPin, onToggleSiteRedirect }, state)
+ const contextActionsProps = Object.assign({ onViewOnGateway, onCopy, onPin, onUnPin, onToggleSiteIntegrations }, state)
// Instant init: page-action is shown only in ipfsContext
contextActionsProps.isIpfsContext = true