Add files via upload
This commit is contained in:
parent
26e41c1bfc
commit
bf4e42f808
|
@ -132,7 +132,7 @@ export class Migrate {
|
|||
};
|
||||
|
||||
// Validate RegExp, deactivate on error
|
||||
!Pattern.validate(p.pattern, p.type) && (p.active = false);
|
||||
!Pattern.validate(pat.pattern, pat.type) && (pat.active = false);
|
||||
|
||||
// whitelist: Inclusive/Exclusive
|
||||
p.whitelist === 'Inclusive' ? pxy.include.push(pat) : pxy.exclude.push(pat);
|
||||
|
|
|
@ -89,6 +89,7 @@ class Options {
|
|||
const arr = passthrough.split(/[\s,;]+/)
|
||||
.map(i => /[\d.]+\/\d+/.test(i) ? i : i.replace(/(?<=[a-z\d])\/[^\s,;]*/gi, ''));// remove path
|
||||
this.passthrough.value = [...new Set(arr)].join(separator); // remove duplicates
|
||||
pref.passthrough = this.passthrough.value;
|
||||
|
||||
// --- check and build proxies & patterns
|
||||
const data = [];
|
||||
|
@ -511,13 +512,13 @@ class Proxies {
|
|||
});
|
||||
|
||||
pac.addEventListener('change', e => {
|
||||
const {hostname, port} = App.parseURL(e.target.value);
|
||||
if (!hostname) {
|
||||
const {hostname: h, port: p} = App.parseURL(e.target.value);
|
||||
if (!h) {
|
||||
e.target.classList.add('invalid');
|
||||
return;
|
||||
}
|
||||
hostname.value = hostname;
|
||||
port && (port.value = port);
|
||||
hostname.value = h;
|
||||
p && (port.value = p);
|
||||
});
|
||||
|
||||
// patterns
|
||||
|
@ -944,6 +945,21 @@ class ImportProxyList {
|
|||
pram[key.toLowerCase()] = value;
|
||||
}
|
||||
|
||||
// fix missing default port
|
||||
if (!pram.port) {
|
||||
switch (type) {
|
||||
case 'http':
|
||||
case 'ws':
|
||||
pram.port = '80';
|
||||
break;
|
||||
|
||||
case 'https':
|
||||
case 'wss':
|
||||
pram.port = '443';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// proxy template
|
||||
const pxy = {
|
||||
active: pram.active !== 'false', // defaults to true
|
||||
|
|
|
@ -64,7 +64,7 @@ export class Proxy {
|
|||
|
||||
if (!control) {
|
||||
browser.action.setTitle({title: browser.i18n.getMessage('controlledByOtherExtensions')});
|
||||
browser.action.setBadgeText({text: '❌'});
|
||||
browser.action.setBadgeText({text: ''});
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -284,7 +284,7 @@ String.raw`function FindProxyForURL(url, host) {
|
|||
|
||||
// Chrome commands returns command, tab
|
||||
static async excludeHost(pref, tab) {
|
||||
const activeTab = tab || await this.getActiveTab();
|
||||
const activeTab = tab ? [tab] : await this.getActiveTab();
|
||||
const url = this.getURL(activeTab[0].url);
|
||||
if (!url) { return; }
|
||||
|
||||
|
@ -302,7 +302,7 @@ String.raw`function FindProxyForURL(url, host) {
|
|||
this.set(pref); // update Proxy
|
||||
}
|
||||
|
||||
static async getActiveTab() {
|
||||
static getActiveTab() {
|
||||
return browser.tabs.query({currentWindow: true, active: true});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue