Skip to content

Commit

Permalink
rearrangement + rewording
Browse files Browse the repository at this point in the history
  • Loading branch information
claustromaniac committed Dec 3, 2019
1 parent c0949b1 commit 92a329a
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 51 deletions.
2 changes: 1 addition & 1 deletion src/bg/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const sAPI = {
'maxWait': 0,
'proxyCompat': false,
'rememberSecureSites': true,
'whitelist': {}
'whitelist': {} // named Exclusions in the UI from 0.11.0 onwards
},
async getAll() {
if (this.loading) await this.loading;
Expand Down
9 changes: 8 additions & 1 deletion src/pages/httpz.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,17 @@ input[type="checkbox"],
input[type="radio"] {margin-right: 0 !important;}
input[type="text"] {text-align-last: center !important;}
x-fill {
flex-grow: 10;
flex: 10;
min-height: 1em;
min-width: 1em;
}
.flex {display: flex;}
.col {flex-flow: column nowrap;}
.row {flex-flow: row nowrap;}
.align-center {align-items: center;}
.justify-end {justify-content: end;}
.justify-space-around {justify-content: space-around;}
.justify-space-between {justify-content: space-between;}
.info {
background: #FFC;
border-radius: 4px;
Expand Down
17 changes: 9 additions & 8 deletions src/pages/options.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,8 @@ input[type="radio"] {margin-left: 1em;}
textarea {
font-weight: 100;
resize: none;
width: 75%;
}
.flex {display: flex;}
.col {flex-flow: column nowrap;}
.row {flex-flow: row nowrap;}
.align-center {align-items: center;}
.justify-end {justify-content: end;}
.justify-space-around {justify-content: space-around;}
width: 60%;
}
.num {width: 3.5em;}
#main {
border-radius: 5px;
Expand All @@ -32,6 +26,12 @@ textarea {
#sidebar button:disabled {border: none;}
#i_days {margin: 0 1em;}
#save {font-weight: 700;}
#b_clearIgnored,
#b_clearWhitelist {
margin: 0;
min-width: initial;
width: 3em;
}
#modalDialog {
background: rgba(255,255,255,0.2);
bottom: 0;
Expand All @@ -54,3 +54,4 @@ textarea {
text-align: center;
white-space: pre-line;
}
#modalDialog button {margin: auto 0.5em;}
71 changes: 37 additions & 34 deletions src/pages/options.htm
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,42 @@
<head>
<meta charset="utf-8">
<link href="chrome://browser/content/extension.css" rel="stylesheet">
<!-- healthy redundancy in case the page is opened directly -->
<!-- healthy redundancy in case the page is opened directly -->
<link href="httpz.css" rel="stylesheet">
<link href="options.css" rel="stylesheet">
</head>
<body class="flex row">
<div id="main">
<div id="d_general">
<div class="browser-style flex row align-center">
Enable Silent Fallback
Fall back to HTTP without warning
<span class="info" tabindex="0" data-info="HTTPZ's behavior whenever it fails to establish a secure communication with a server
Enabled (default): will try an insecure communication (over HTTP) automatically
Disabled: will show you a warning page asking you how to proceed">i</span>
<x-fill></x-fill>
<input id="i_autoDowngrade" type="checkbox">
</div>
<hr>
<div class="browser-style flex row align-center">
Ignore insecure sites...
<span class="info" tabindex="0" data-info="After determining that a given site does not support HTTPS, HTTPZ will ignore subsequent requests to it for a certain period of time">i</span>
Maximum wait before fallback (seconds)
<span class="info" tabindex="0" data-info="The initial request to some sites that do not support HTTPS can take long to time out. HTTPZ will never wait longer than the time specified here before retrying requests over HTTP
Set to 0 to wait until the browser gives up (default)">i</span>
<x-fill></x-fill>
<input id="i_maxWait" type="text" class="browser-style num" pattern="^\d+$" required>
</div>
<hr>
<div class="browser-style flex row">
<div class="flex col">
<div class="flex row align-center">
Remember insecure sites...
<span class="info" tabindex="0" data-info="After determining that a given site does not support HTTPS, HTTPZ will remember its hostname for a certain period of time in order to avoid making superfluous attempts over HTTPS">i</span>
</div>
<x-fill></x-fill>
<button class="browser-style" type="button" id="b_clearIgnored">🗑️</button>
</div>
<x-fill></x-fill>
<div>
<div class="browser-style flex row align-center justify-end">
Expand All @@ -33,48 +48,36 @@
<div class="browser-style flex row align-center justify-end">
<label for="i_xdays">For</label>
<div class="browser-style">
<input id="i_days" type="text" class="browser-style num" pattern="^0*[1-9]\d*$" required><label></label>
<input id="i_days" type="text" class="browser-style num" pattern="^0*[1-9]\d*$" required>
</div>
<label for="i_xdays">day(s)</label>
<input id="i_xdays" name="period" type="radio" value=1>
</div>
<div class="browser-style flex row align-center justify-end">
<label for="i_permanent">Permanently</label>
<label for="i_permanent">Indefinitely</label>
<input id="i_permanent" name="period" type="radio" value=-1>
</div>
</div>
</div>
<hr>
<div class="browser-style flex row align-center">
Maximum wait before fallback (seconds)
<span class="info" tabindex="0" data-info="The initial request to some sites that do not support HTTPS can take long to time out. HTTPZ will never wait longer than the time specified here before retrying requests over HTTP
Set to 0 to wait until the browser gives up (default)">i</span>
<x-fill></x-fill>
<input id="i_maxWait" type="text" class="browser-style num" pattern="^\d+$" required>
</div>
<hr>
<div class="flex row align-center">
Whitelist
<span class="info" tabindex="0" data-info="Whitelisted sites are ignored unconditionally
This list accepts hostnames only (e.g. www.example.com)">i</span>
Exclusions
<span class="info" tabindex="0" data-info="HTTPZ will never attempt to use HTTPS for sites in this list
Only hostnames are accepted (e.g. www.example.com)">i</span>
<x-fill></x-fill>
<textarea autocomplete="off" class="browser-style" id="t_whitelist" rows="1" spellcheck="false"></textarea>
</div>
<hr>
<div class="flex row justify-space-around">
<button class="browser-style" type="button" id="b_clearIgnored">Clear Ignore List</button>
<button class="browser-style wide" type="button" id="b_clearWhitelist">Clear Whitelist</button>
<x-fill></x-fill>
<button class="browser-style wide" type="button" id="b_clearWhitelist">🗑️</button>
</div>
</div>
<div id="d_advanced" hidden>
<div class="browser-style flex row align-center">
Intercept server-initiated redirections to HTTP
<span class="info" tabindex="0" data-info="Enabled: HTTPZ will block any server-initiated downgrade attempts and display a warning page, allowing you to decide what to do
Disabled (default): HTTPZ will add the site to the ignore list and let the browser proceed with the redirection
💡 Note that a secure communication with a server needs to be established first for it to be able to ask the browser to downgrade this way">i</span>
<x-fill></x-fill>
<input id="i_interceptRedirects" type="checkbox">
Expand All @@ -88,9 +91,9 @@
</div>
<hr>
<div class="browser-style flex row align-center">
Enable Proxy-Compatible Mode
Make compatible with proxies
<span class="info" tabindex="0" data-info="Enable this if you connect through a forward proxy or gateway and HTTPZ causes it to respond with status codes 502 and/or 504 frequently
HTTPZ will start treating those as errors and act accordingly">i</span>
<x-fill></x-fill>
<input id="i_proxyCompat" type="checkbox">
Expand All @@ -99,10 +102,10 @@
<div class="browser-style flex row align-center">
Honor private browsing
<span class="info" tabindex="0" data-info="Enabled (default): potentially compromising information required by some features is not stored in the hard drive whenever it comes from a Private Browsing window. Such information is stored only in RAM instead. This includes:
- ignored sites
- known secure sites (see below)
Disabled: data coming from Private Browsing windows is not given any special treatment">i</span>
<x-fill></x-fill>
<input id="i_honorPB" type="checkbox">
Expand All @@ -111,12 +114,12 @@
<div class="browser-style flex row align-center">
Remember secure sites
<span class="info" tabindex="0" data-info="Every time that you navigate to a site that loads successfully over HTTPS, HTTPZ remembers its hostname, so as to avoid redirecting it back to HTTP if it ever fails in the future. This minimizes the risk of a Man-in-the-Middle being able to exploit the extension's behavior
⚠️ Note that this information is stored unencrypted in HTTPZ's own local database in your hard drive. You may want to disable this if your threat model calls for it">i</span>
<x-fill></x-fill>
<input id="i_rememberSecureSites" type="checkbox">
</div>
</div>
</div>
</div>
<div id="sidebar">
<br><button class="browser-style" type="button" id="b_general" disabled>General</button><br>
Expand Down
4 changes: 2 additions & 2 deletions src/pages/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ ui.i_rememberSecureSites.addEventListener('change', e => {
}
});
ui.b_clearIgnored.addEventListener('click', e => {
showDialog('Are you sure you want to clear the ignore list?', true).then(r => {
showDialog('Clear the list of insecure sites?', true).then(r => {
if (!r) return;
local.set({ignored: {}}).then(() => {
setStatus(ui.b_clearIgnored, true);
Expand Down Expand Up @@ -213,7 +213,7 @@ ui.i_import.addEventListener('change', e => {
reader.readAsText(ui.i_import.files[0]);
});
ui.b_clearWhitelist.addEventListener('click', e => {
showDialog('Are you sure you want to clear the whitelist?', true).then(r => {
showDialog('Clear the list of exclusions?', true).then(r => {
if (!r) return;
local.set({whitelist: {}, incognitoWhitelist: {}}).then(() => {
ui.t_whitelist.value = '';
Expand Down
10 changes: 5 additions & 5 deletions src/pages/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ browser.tabs.query({active: true, currentWindow: true}).then(tabs => {
const tab = tabs[0];
const url = new URL(tab.url);
if (url.protocol === 'https:') {
ui.info.textContent = `${url.hostname} was redirected to HTTPS. If you click the button below, HTTPZ will add this site to the whitelist and will attempt to reload it over HTTP`;
ui.whitelist.textContent = 'add to whitelist';
ui.info.textContent = `${url.hostname} was redirected to HTTPS. If you click the button below, HTTPZ will add this site to the list of exclusions and will attempt to reload it over HTTP`;
ui.whitelist.textContent = 'Add to exclusions';
const incognito = browser.extension.inIncognitoContext;
if (incognito) ui.incognito.textContent = 'Note: sites added to the whitelist from a private window will not be visible in the options page';
if (incognito) ui.incognito.textContent = 'Note: sites excluded from a private window will not be visible in the options page';
ui.whitelist.onclick = e => {
ui.whitelist.disabled = true;
url.protocol = 'http:';
Expand All @@ -21,8 +21,8 @@ browser.tabs.query({active: true, currentWindow: true}).then(tabs => {
}).then(() => {close();});
};
} else {
ui.info.textContent = `HTTPZ did not try to redirect ${url.hostname} to HTTPS because it is in the whitelist. If you click the button below, this site will be removed from the whitelist and the tab will be reloaded`;
ui.whitelist.textContent = 'remove from whitelist';
ui.info.textContent = `HTTPZ did not try to redirect ${url.hostname} to HTTPS because it is in the list of exclusions. If you click the button below, this site will be removed from that list and the tab will be reloaded`;
ui.whitelist.textContent = 'Remove from exclusions';
ui.whitelist.onclick = e => {
ui.whitelist.disabled = true;
browser.runtime.sendMessage({
Expand Down

0 comments on commit 92a329a

Please sign in to comment.