cherry pick changes from f65ca14f38 and 544d1e1b22 into an 8.1 branch

This commit is contained in:
eric@ericjung.net 2023-12-04 11:57:55 -07:00
parent 874f956dbe
commit e1dc3cc0aa
3 changed files with 19 additions and 4 deletions

View File

@ -15,6 +15,11 @@
<article class="about">
<h1 id="changelog">Changelog</h1>
<dl>
<dt>8.2</dt>
<dd>Fixed an issue with sync (#45)</dd>
<dd>Updated Incognito process on Chrome</dd>
<dl>
<dt>8.1</dt>
<dd>Added Drag and Drop sorting of proxies (#29)</dd>

View File

@ -133,7 +133,12 @@ export class Proxy {
static async setChrome(pref) {
// https://developer.chrome.com/docs/extensions/reference/types/
// Scope and life cycle: regular | regular_only | incognito_persistent | incognito_session_only
const config = {value: {}, scope: 'regular'};
// --- incognito
const incognito = await this.setChromeIncognito(pref);
const scope = incognito ? 'regular_only' : 'regular';
const config = {value: {}, scope};
switch (true) {
case pref.mode === 'disable':
case pref.mode === 'direct':
@ -164,9 +169,6 @@ export class Proxy {
}
browser.proxy.settings.set(config);
// --- incognito
this.setChromeIncognito(pref);
}
static findProxy(pref, mode = pref.mode) {
@ -204,6 +206,7 @@ export class Proxy {
}
browser.proxy.settings.set(config);
return !!pxy; // true/false
}
static getPacString(pref) {

View File

@ -36,6 +36,13 @@ export class Sync {
const syncPref = await browser.storage.sync.get();
// check sync from old version 3-7
if (!Object.keys(pref)[0] &&
(Object.hasOwn(syncPref, 'settings') || Object.hasOwn(syncPref, 'foxyProxyEdition'))) {
Object.keys(syncPref).forEach(i => pref[i] = syncPref[i]);
return;
}
// convert object to array & filter proxies
const data = Object.values(syncPref).filter(i => Object.hasOwn(i, 'hostname'));