-
Notifications
You must be signed in to change notification settings - Fork 325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: improved experience on DNSLink websites #826
Merged
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
'use strict' | ||
/* eslint-env browser, webextensions */ | ||
|
||
const browser = require('webextension-polyfill') | ||
const html = require('choo/html') | ||
const switchToggle = require('../../pages/components/switch-toggle') | ||
|
||
function dnslinkForm ({ | ||
dnslinkPolicy, | ||
dnslinkRedirect, | ||
onOptionChange | ||
}) { | ||
const onDnslinkPolicyChange = onOptionChange('dnslinkPolicy') | ||
const onDnslinkRedirectChange = onOptionChange('dnslinkRedirect') | ||
|
||
return html` | ||
<form> | ||
<fieldset> | ||
<legend>${browser.i18n.getMessage('option_header_dnslink')}</legend> | ||
<div> | ||
<label for="dnslinkPolicy"> | ||
<dl> | ||
<dt>${browser.i18n.getMessage('option_dnslinkPolicy_title')}</dt> | ||
<dd> | ||
${browser.i18n.getMessage('option_dnslinkPolicy_description')} | ||
<p><a href="https://github.com/ipfs-shipyard/ipfs-companion/blob/master/docs/dnslink.md#dnslink-support-in-ipfs-companion" target="_blank"> | ||
${browser.i18n.getMessage('option_legend_readMore')} | ||
</a></p> | ||
</dd> | ||
</dl> | ||
</label> | ||
<select id="dnslinkPolicy" name='dnslinkPolicy' onchange=${onDnslinkPolicyChange}> | ||
<option | ||
value='false' | ||
selected=${String(dnslinkPolicy) === 'false'}> | ||
${browser.i18n.getMessage('option_dnslinkPolicy_disabled')} | ||
</option> | ||
<option | ||
value='best-effort' | ||
selected=${dnslinkPolicy === 'best-effort'}> | ||
${browser.i18n.getMessage('option_dnslinkPolicy_bestEffort')} | ||
</option> | ||
<option | ||
value='enabled' | ||
selected=${dnslinkPolicy === 'enabled'}> | ||
${browser.i18n.getMessage('option_dnslinkPolicy_enabled')} | ||
</option> | ||
</select> | ||
</div> | ||
<div> | ||
<label for="dnslinkRedirect"> | ||
<dl> | ||
<dt>${browser.i18n.getMessage('option_dnslinkRedirect_title')}</dt> | ||
<dd> | ||
${browser.i18n.getMessage('option_dnslinkRedirect_description')} | ||
${dnslinkRedirect ? html`<p class="red i">${browser.i18n.getMessage('option_dnslinkRedirect_warning')}</p>` : null} | ||
<p><a href="https://github.com/ipfs-shipyard/ipfs-companion/issues/667" target="_blank"> | ||
${browser.i18n.getMessage('option_legend_readMore')} | ||
</a></p> | ||
</dd> | ||
</dl> | ||
</label> | ||
<div>${switchToggle({ id: 'dnslinkRedirect', checked: dnslinkRedirect, onchange: onDnslinkRedirectChange })}</div> | ||
</div> | ||
</fieldset> | ||
</form> | ||
` | ||
} | ||
|
||
module.exports = dnslinkForm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe change to: "Force page load from custom gateway"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably fine as is, but I am a little on the fence about "force".
"Always load pages from custom gateway"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with the language tweak here. This might be out of scope for this PR but do you think it's widely understood what a Custom Gateway is? I would be inclined to be more specific, such as: Always load DNSLink websites via IPFS Companion's local gateway. (if that is a correct statement?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will tweak the label, but want to keep "force" for now to emphasize its "over the top" behavior (until we can redirect in a way that keeps origin sandbox)
@cwaring ack, lets track that as part of #741