Skip to content

Commit

Permalink
v8.4
Browse files Browse the repository at this point in the history
  • Loading branch information
erosman authored Dec 10, 2023
1 parent 2761f63 commit dc4af14
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 14 deletions.
6 changes: 5 additions & 1 deletion src/content/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@

<h1 id="changelog">Changelog</h1>
<dl>
<dt>8.4</dt>
<dd>Added light/dark theme detection for badge background color (#61)</dd>
<dd>Enabled to run with "controlled_by_other_extensions" on Firefox (#68)</dd>
<dd>Removed localhost & local network passthrough in Firefox (#50, #63, #64, #66, #71)</dd>
<dd>Updated Options save process to fill blank proxy header title display (#74)</dd>

<dt>8.3</dt>
<dd>Added enterprise policy & managed storage feature (#42) (experimental)</dd>
Expand All @@ -27,7 +32,6 @@ <h1 id="changelog">Changelog</h1>
<dd>Updated PAC check to allow "file:" (#49)</dd>
<dd>Updated user interface to disable inapplicable options in proxies</dd>


<dt>8.2</dt>
<dd>Added option to set the country to blank</dd>
<dd>Fixed an issue with upgrade sync data on Chrome (#45)</dd>
Expand Down
5 changes: 4 additions & 1 deletion src/content/action.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
import {Location} from './location.js';

export class Action {
// https://github.com/w3c/webextensions/issues/72#issuecomment-1848874359
// 'prefers-color-scheme' detection in Chrome background service worker
static dark = false;

static set(pref) {
// --- set action/browserAction
let title = '', text = '';
let color = '#fff';
let color = this.dark ? '#444' : '#fff';
switch (pref.mode) {
case 'disable':
title = browser.i18n.getMessage('disable');
Expand Down
3 changes: 2 additions & 1 deletion src/content/default.css
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ button:hover {
background: var(--btn-hover);
}

button:disabled {
button:disabled,
select:disabled {
cursor: not-allowed;
opacity: 0.4;
}
Expand Down
10 changes: 5 additions & 5 deletions src/content/help.html
Original file line number Diff line number Diff line change
Expand Up @@ -283,14 +283,14 @@ <h2 id="global-exclude">Global Exclude</h2>
<th>Proxy by Patterns</th>
<td>browser</td>
<td><mark>FoxyProxy</mark><br><i>scheme, host, wildcard, CIDR (IPv4)</i></td>
<td><mark>FoxyProxy</mark></td>
<td><mark><s>FoxyProxy</s></mark></td>
<td><mark>FoxyProxy</mark><br><i>scheme, host, wildcard, CIDR (IPv4)</i></td>
</tr>
<tr>
<th>Single Proxy</th>
<td>browser</td>
<td>browser<br><i>scheme, host, wildcard, CIDR</i></td>
<td><mark>FoxyProxy</mark></td>
<td><mark><s>FoxyProxy</s></mark></td>
<td><mark>FoxyProxy</mark><br><i>scheme, host, wildcard, CIDR (IPv4)</i></td>
</tr>
<tr>
Expand All @@ -304,21 +304,21 @@ <h2 id="global-exclude">Global Exclude</h2>
<th>Incognito</th>
<td>browser</td>
<td>browser<br><i>scheme, host, wildcard, CIDR</i></td>
<td><mark>FoxyProxy</mark></td>
<td><mark><s>FoxyProxy</s></mark></td>
<td><mark>FoxyProxy</mark><br><i>scheme, host, wildcard, CIDR (IPv4)</i></td>
</tr>
<tr>
<th>Container</th>
<td>n/a</td>
<td>n/a</td>
<td><mark>FoxyProxy</mark></td>
<td><mark><s>FoxyProxy</s></mark></td>
<td><mark>FoxyProxy</mark><br><i>scheme, host, wildcard, CIDR (IPv4)</i></td>
</tr>
<tr>
<th>Tab Proxy</th>
<td>n/a</td>
<td>n/a</td>
<td><mark>FoxyProxy</mark></td>
<td><mark><s>FoxyProxy</s></mark></td>
<td><mark>FoxyProxy</mark><br><i>scheme, host, wildcard, CIDR (IPv4)</i></td>
</tr>
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion src/content/on-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export class OnRequest {
// ---------- passthrough --------------------------------
static bypass(url) {
switch (true) {
case this.localhost(url): // localhost passthrough
// case this.localhost(url): // localhost passthrough
case this.passthrough.some(i => new RegExp(i, 'i').test(url)): // global passthrough
case this.net[0] && this.isInNet(url): // global passthrough CIDR
return true;
Expand Down
6 changes: 6 additions & 0 deletions src/content/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,12 @@ class Options {
return;
}

// --- title check
if (!obj.title) {
const id = obj.type === 'pac' ? obj.pac : `${obj.hostname}:${obj.port}`;
elem.children[0].children[1].textContent = id;
}

// --- check store locally for active PAC
if (obj.active && obj.pac) {
const storeLocally = elem.querySelector('.pac input[type="checkbox"]');
Expand Down
2 changes: 1 addition & 1 deletion src/content/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ <h1 data-i18n="extensionName"><img src="../image/icon.svg" alt=""> </h1>
<div class="host">
<input type="text" id="filter" spellcheck="false" placeholder="filter">

<select>
<select class="local">
<option value="" disabled selected>&nbsp;</option>
</select>

Expand Down
5 changes: 4 additions & 1 deletion src/content/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,12 @@ class Popup {
if (mode === pref.mode) { return; } // disregard re-click
if (pref.managed) { return; } // not for storage.managed

// check 'prefers-color-scheme' since it is not available in background service worker
const dark = window.matchMedia('(prefers-color-scheme: dark)').matches;

pref.mode = mode;
browser.storage.local.set({mode}); // save mode
browser.runtime.sendMessage({id: 'setProxy', pref});
browser.runtime.sendMessage({id: 'setProxy', pref, dark});
}

static processButtons(e) {
Expand Down
8 changes: 5 additions & 3 deletions src/content/proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ export class Proxy {
}

static onMessage(message) {
const {id, pref, host, proxy} = message;
const {id, pref, host, proxy, dark} = message;
switch (id) {
case 'setProxy':
Action.dark = dark;
this.set(pref);
break;

Expand Down Expand Up @@ -62,9 +63,9 @@ export class Proxy {
const path = control ? `/image/icon.${ext}` : `/image/icon-off.${ext}`;
browser.action.setIcon({path});

if (!control) {
if (!App.firefox && !control) {
browser.action.setTitle({title: browser.i18n.getMessage('controlledByOtherExtensions')});
browser.action.setBadgeText({text: '❌'});
// browser.action.setBadgeText({text: '❌'});
return null;
}

Expand Down Expand Up @@ -131,6 +132,7 @@ export class Proxy {
value.proxyType = 'system';
}

// no error if levelOfControl: "controlled_by_other_extensions"
browser.proxy.settings.set({value});
}

Expand Down

0 comments on commit dc4af14

Please sign in to comment.