Add files via upload
This commit is contained in:
parent
be505e180b
commit
7845a6cbd0
|
@ -19,14 +19,16 @@
|
|||
<dt>8.1</dt>
|
||||
<dd>Added 'DIRECT' option to Set Tab Proxy (#33)</dd>
|
||||
<dd>Added Drag and Drop sorting of proxies (#29)</dd>
|
||||
<dd>Added duplicate proxy feature</dd>
|
||||
<dd>Added Incognito/Container proxy (#33)</dd>
|
||||
<dd>Added Keyboard Shortcut feature</dd>
|
||||
<dd>Added more data to the Log</dd>
|
||||
<dd>Added pattern import/export</dd>
|
||||
<dd>Added port search to search filter</dd>
|
||||
<dd>Added search filter to Toolbar popup (#23)</dd>
|
||||
<dd>Fixed a pattern conversion issue (#28)</dd>
|
||||
<dd>Fixed an error in Sync (#36)</dd>
|
||||
<dd>Increased Log display entries to 200</dd>
|
||||
<dd>Increased log content</dd>
|
||||
<dd>Increased log display entries to 200</dd>
|
||||
<dd>Increased log width to full screen</dd>
|
||||
<dd>Updated Global Exclude process</dd>
|
||||
|
||||
|
|
|
@ -416,6 +416,9 @@
|
|||
<p class="warning">If FoxyProxy is to set to use an Individual Proxy/PAC, editing proxy's hostname, port, or PAC URL, may result in a mismatch until it is set again.</p>
|
||||
|
||||
<dl>
|
||||
<dt>⎘ Duplicate Proxy</dt>
|
||||
<dd>Click to duplicate proxy and its patterns</dd>
|
||||
|
||||
<dt>Toggle Button</dt>
|
||||
<dd>Toggle proxy active or inactive</dd>
|
||||
<dd>Inactive proxies do not show in toolbar popup select</dd>
|
||||
|
@ -473,6 +476,12 @@
|
|||
<p>Duplicate patterns will be removed.</p>
|
||||
|
||||
<dl>
|
||||
<dt>📥 Import</dt>
|
||||
<dd>Import patterns that were exported</dd>
|
||||
|
||||
<dt>📤 Export</dt>
|
||||
<dd>Export patterns to import later</dd>
|
||||
|
||||
<dt>Quick Add</dt>
|
||||
<dd>Add ready-made patterns</dd>
|
||||
<dd><code>Plain Host</code> matches hostnames that contain no dots, e.g. <code>http://intranet/</code></dd>
|
||||
|
|
|
@ -24,7 +24,7 @@ export class Log {
|
|||
method.textContent = e.method;
|
||||
doc.textContent = e.documentUrl || ''; // For a top-level document, documentUrl is undefined
|
||||
doc.title = e.documentUrl || '';
|
||||
url.textContent = e.url;
|
||||
url.textContent = decodeURIComponent(e.url);
|
||||
url.title = e.url;
|
||||
container.classList.toggle('incognito', e.incognito);
|
||||
container.textContent = e.cookieStoreId?.startsWith('firefox-container-') ? 'C' + e.cookieStoreId.substring(18) : '';
|
||||
|
|
|
@ -22,7 +22,7 @@ import {CryptoJS} from '../lib/aes.3.1.2.js';
|
|||
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/proxy/ProxyInfo
|
||||
https://chromium.googlesource.com/chromium/src/+/HEAD/net/docs/proxy.md#http-proxy-scheme
|
||||
Chrome PAC schemes PROXY | HTTPS | SOCKS4/SOCKS | SOCKS5
|
||||
Chrome API schemes http | https | socks4 | socks5
|
||||
Chrome API schemes http | https | socks4 | socks5 | quic
|
||||
|
||||
Firefox PAC schemes PROXY/HTTP | HTTPS | SOCKS4/SOCKS | SOCKS5
|
||||
Firefox API types http | https | socks4 | socks (means socks5) | direct
|
||||
|
|
|
@ -416,7 +416,7 @@ details.proxy > summary {
|
|||
list-style: none;
|
||||
border-left: 1.5em solid var(--btn-bg);
|
||||
display: grid;
|
||||
grid-template-columns: auto 1fr auto auto auto auto;
|
||||
grid-template-columns: auto 1fr repeat(5, auto);
|
||||
column-gap: 0.2em;
|
||||
align-items: center;
|
||||
}
|
||||
|
@ -426,6 +426,10 @@ details.proxy[open] > summary {
|
|||
background-color: var(--hover);
|
||||
}
|
||||
|
||||
/* details.proxy > summary button.plain {
|
||||
color: var(--btn-bg);
|
||||
} */
|
||||
|
||||
details.proxy.off {
|
||||
display: none;
|
||||
}
|
||||
|
@ -469,7 +473,7 @@ details.proxy > summary span:nth-of-type(2):empty::before {
|
|||
|
||||
.patternHead {
|
||||
display: grid;
|
||||
grid-template-columns: 6em 5em 5em 1fr 2fr 4em;
|
||||
grid-template-columns: 6em 5em 5em 1fr 2fr 1.5em 1.5em 4em;
|
||||
column-gap: 0.2em;
|
||||
align-items: center;
|
||||
justify-items: center;
|
||||
|
@ -482,13 +486,27 @@ details.proxy > summary span:nth-of-type(2):empty::before {
|
|||
min-width: unset;
|
||||
}
|
||||
|
||||
.patternHead .plain {
|
||||
font-size: 1em;
|
||||
cursor: pointer;
|
||||
padding: 0.2em 0.5em;
|
||||
}
|
||||
|
||||
/* .patternHead .plain:hover {
|
||||
background-color: var(--hover);
|
||||
} */
|
||||
|
||||
.patternRow {
|
||||
display: grid;
|
||||
grid-template-columns: 6em 5em 5em 1fr 2fr 2em 1em 1em;
|
||||
grid-template-columns: 6em 5em 5em 1fr 2fr 1.5em 1.5em 2em 1em 1em;
|
||||
column-gap: 0.2em;
|
||||
align-items: center;
|
||||
margin-top: 0.3em;
|
||||
}
|
||||
|
||||
.patternRow input:nth-of-type(2) {
|
||||
grid-column: span 3;
|
||||
}
|
||||
/* ----- /Pattern ----- */
|
||||
|
||||
/* ----- Import ----- */
|
||||
|
|
|
@ -156,6 +156,7 @@
|
|||
<span>🌎</span>
|
||||
<span></span>
|
||||
<input type="checkbox" class="toggle" data-id="active" checked>
|
||||
<button type="button" class="plain" data-i18n="duplicate|title">⎘</button>
|
||||
<button type="button" class="bin" data-i18n="delete|title"></button>
|
||||
<button type="button" class="up">▲</button>
|
||||
<button type="button" class="down">▼</button>
|
||||
|
@ -176,6 +177,7 @@
|
|||
<option value="https">HTTPS</option>
|
||||
<option value="socks4">SOCKS4</option>
|
||||
<option value="socks5">SOCKS5</option>
|
||||
<!-- <option value="quic">QUIC</option> -->
|
||||
<option value="socks5">TOR</option>
|
||||
<option value="socks5">Psiphon</option>
|
||||
<option value="http">Privoxy</option>
|
||||
|
@ -467,10 +469,12 @@
|
|||
|
||||
<div class="patternHead">
|
||||
<span data-i18n="quickAdd"></span>
|
||||
<span>+ / -</span>
|
||||
<span data-i18n="include"></span>
|
||||
<span data-i18n="type"></span>
|
||||
<span data-i18n="title"></span>
|
||||
<span data-i18n="pattern"></span>
|
||||
<label class="plain" data-i18n="import|title"><input type="file" accept=".json">📥</label>
|
||||
<button type="button" class="plain" data-i18n="export|title">📤</button>
|
||||
<button type="button" class="flat" data-i18n="add"></button>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -433,9 +433,10 @@ class Proxies {
|
|||
|
||||
// --- summary
|
||||
const sum = pxy.children[0].children;
|
||||
sum[3].addEventListener('click', () => confirm(browser.i18n.getMessage('deleteConfirm')) && pxy.remove());
|
||||
sum[4].addEventListener('click', () => pxy.previousElementSibling?.before(pxy));
|
||||
sum[5].addEventListener('click', () => pxy.nextElementSibling?.after(pxy));
|
||||
sum[3].addEventListener('click', () => this.duplicateProxy(pxy, proxyBox));
|
||||
sum[4].addEventListener('click', () => confirm(browser.i18n.getMessage('deleteConfirm')) && pxy.remove());
|
||||
sum[5].addEventListener('click', () => pxy.previousElementSibling?.before(pxy));
|
||||
sum[6].addEventListener('click', () => pxy.nextElementSibling?.after(pxy));
|
||||
|
||||
// proxy details
|
||||
const elem = proxyBox.children;
|
||||
|
@ -517,6 +518,10 @@ class Proxies {
|
|||
|
||||
// patterns
|
||||
pxy.querySelector('button[data-i18n="add"]').addEventListener('click', () => this.addPattern(patternBox));
|
||||
pxy.querySelector('input[type="file"]').addEventListener('change', e => this.importPattern(e, patternBox));
|
||||
pxy.querySelector('button[data-i18n^="export"]').addEventListener('click', () =>
|
||||
this.exportPattern(patternBox, elem[1].value.trim() || elem[3].value.trim()));
|
||||
|
||||
|
||||
// from add button
|
||||
if (!item) {
|
||||
|
@ -562,7 +567,7 @@ class Proxies {
|
|||
this.docFrag.appendChild(pxy);
|
||||
}
|
||||
|
||||
static addPattern(parent, item, inc) {
|
||||
static addPattern(parent, item, include) {
|
||||
// --- make a blank pattern with all event listeners
|
||||
const div = this.patternTemplate.cloneNode(true);
|
||||
const elem = div.children;
|
||||
|
@ -584,7 +589,7 @@ class Proxies {
|
|||
elem[7].addEventListener('click', () => div.remove());
|
||||
|
||||
if (item) {
|
||||
elem[1].value = inc;
|
||||
elem[1].value = include;
|
||||
elem[2].value = item.type;
|
||||
elem[3].value = item.title;
|
||||
elem[4].value = item.pattern;
|
||||
|
@ -594,6 +599,60 @@ class Proxies {
|
|||
parent.appendChild(div);
|
||||
}
|
||||
|
||||
static duplicateProxy(pxy, proxyBox) {
|
||||
const elem = proxyBox.children;
|
||||
const hostname = elem[3].value.trim();
|
||||
const type = elem[5].value;
|
||||
const port = elem[7].value.trim();
|
||||
const pac = elem[19].value.trim();
|
||||
|
||||
const id = type === 'pac' ? pac : `${hostname}:${port}`;
|
||||
const item = this.proxyCache[id];
|
||||
|
||||
item && this.addProxy(item);
|
||||
pxy.after(this.docFrag);
|
||||
}
|
||||
|
||||
static importPattern(e, patternBox) {
|
||||
const file = e.target.files[0];
|
||||
switch (true) {
|
||||
case !file: App.notify(browser.i18n.getMessage('error')); return;
|
||||
case !['text/plain', 'application/json'].includes(file.type): // check file MIME type
|
||||
App.notify(browser.i18n.getMessage('fileTypeError'));
|
||||
return;
|
||||
}
|
||||
|
||||
ImportExport.fileReader(file, data => {
|
||||
try { data = JSON.parse(data); }
|
||||
catch(e) {
|
||||
App.notify(browser.i18n.getMessage('fileParseError')); // display the error
|
||||
return;
|
||||
}
|
||||
|
||||
Array.isArray(data) && data.forEach(i => this.addPattern(patternBox, i, i.include));
|
||||
});
|
||||
}
|
||||
|
||||
static exportPattern(patternBox, title = '') {
|
||||
const arr = [...patternBox.children].map(item => {
|
||||
const elem = item.children;
|
||||
return {
|
||||
include: elem[1].value,
|
||||
type: elem[2].value,
|
||||
title: elem[3].value.trim(),
|
||||
pattern: elem[4].value.trim(),
|
||||
active: elem[5].checked,
|
||||
};
|
||||
});
|
||||
|
||||
if (!arr[0]) { return; } // no patterns to export
|
||||
|
||||
title &&= '_' + title;
|
||||
const data = JSON.stringify(arr, null, 2);
|
||||
const filename = `${browser.i18n.getMessage('pattern')}${title}_${new Date().toISOString().substring(0, 10)}.json`;
|
||||
ImportExport.saveFile({data, filename, type: 'application/json'});
|
||||
}
|
||||
|
||||
static getLocation() {
|
||||
// filter & remove duplicates
|
||||
const ignore = ['DIRECT', '127.0.0.1', 'localhost'];
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1804693
|
||||
// Setting single proxy for all fails
|
||||
// https://bugs.chromium.org/p/chromium/issues/detail?id=1495756
|
||||
// Issue 1495756: Support bypassList for PAC scripts in the chrome.proxy API
|
||||
// Chrome bypassList applies to 'fixed_servers', not 'pac_script' or URL
|
||||
// Firefox passthrough applies to all set in proxy.settings.set, i.e. PAC URL
|
||||
// manual bypass list:
|
||||
// Chrome: pac_script data, not possible for URL
|
||||
// Firefox proxy.onRequest
|
||||
|
||||
|
||||
import {App} from './app.js';
|
||||
import {Pattern} from './pattern.js';
|
||||
import {Authentication} from './authentication.js';
|
||||
|
|
Loading…
Reference in New Issue