proxy-switcher icon indicating copy to clipboard operation
proxy-switcher copied to clipboard

Not working in 59.0.3

Open scott-ish opened this issue 6 years ago • 3 comments

Hi, this is a great extension but doesnt work in 59.0.3. I'm using 0.3.3.1 of the plugin. Settings have no effect and do not change the firefox settings.

scott-ish avatar Jul 02 '18 21:07 scott-ish

I've not been able to use Proxy Switcher for some months now, either. I'm currently on Firefox 61.0.1 (64-bit) but it has been going on probably since 59.0.3 or earlier. about:addons claims I have 0.3.9 of the plugin, which is the latest I think, but again this has been going on since before then.

For me, the problem is that the UI just glitches out: if I pick any tab except for PAC Script I see the same empty box:

2018-07-17-130022_1276x745_scrot

This sounds like a different symptom than you're seeing, @scott-ish, but I suspect it might be a similar bug. What happens if you try making a new firefox profile (run firefox -P somethingelse while no firefoxes are open) and reinstalling like I did in #60?

kousu avatar Jul 17 '18 17:07 kousu

(Now that I've deleted my storage.js and reinstalled) I can confirm the same bug as @scott-ish is seeing: clicking to a Manual Proxy enables proxy mode in Firefox but doesn't set the right port number for the proxy; in about:preferences the proxy type controls are greyed out but the actual host and port numbers are editable, and what's the SOCKS setting in Firefox seems to be drawn from the HTTP proxy setting in Proxy Switcher instead of the Fallback Proxy, which is what I've always used to use SOCKS proxies before.

2018-07-17-135722_1276x745_scrot

Did you change what the fields in Proxy Switcher are supposed to mean?

kousu avatar Jul 17 '18 17:07 kousu

All right, I fixed it... kind of. Depends on how you define "fixed," lol. Personally, I only need the extension to switch between direct access-system proxy (my web filtering proxy)-manual proxy (Fiddler). I have the web filtering proxy running on localhost:89, if I need to debug some site, I switch to manual, which is set to localhost:88, on which Fiddler is listening. Fiddler then gets his data from port 89, so it basically sits between the browser and the web filtering proxy.

Now, this extension messes up all the Firefox settings by messing around with the network.proxy. settings. To give you an idea how this extension works, it's very simple, or rather would be in theory, if the creator didn't have his own weirdo logic. Firefox requires the following settings:

DIrect access: Network.proxy.type;0 Click

System access: Network.proxy.type;5

Manual: network.proxy.type;1 network.proxy.ssl_port;88 network.proxy.ssl;127.0.0.1 network.proxy.no_proxies_on;127.0.0.1,localhost,192.168.* network.proxy.http_port;88 network.proxy.http;127.0.0.1

So it's really simple, but the creator changes the network.proxy.socks_version settings, and the other ones are messed up either. Although, I don't think it's strictly a bug, you just have to understand his weird logic. If you want his extension to serve as a http proxy, then he expects you to change the server type setting in the manual window to "http". If you leave it on socks, the extension messes up. Irrelevant now for me, 'cause I deleted all his socks code, as I don't need it. In fact, I don't even know what it is. This? Whatever. Don't care.

Now, if you have the same purpose as I do, you can use my modified copy:

{e4a12b8a-ab12-449a-b70e-4f54ccaf235e}.zip

Download it, unzip it to Profiles\Extensions, delete the original xpi file. If you don't know the extension name, check Profiles\extensions.json, adjust the folder name accordingly (just without the "xpi" at the end). Launch FF. First time it will not find the extension, since it still searches for the xpi file, restart FF and it will adjust extensions.json automatically, so don't mess with this file. The extension is unsigned now, since I messed up all the checksums, but who cares. If you don't want to see the warning, unzip both omni.ja files into the folders they reside in, add a new selector to Firefox_InstallDir\Chrome\Toolkit\Skin\Classic\Mozapps\Extensions\extensions.css:

.addon-view .warning { display: none; }

Alternatively, inside Firefox_InstallDir\Chrome\Toolkit\Content\Mozapps\Extensions\extensions.js change isCorrectlySigned function code to

return true

If you want to mess around with the code yourself, let me point some stuff out.

The page you want is click. It has all the info you need.

For JS info like the Promise object use click

If you need to get some info from the browser on start before the window gets loaded, use

browser.browserAction.setBadgeText( { text: String(browser.proxy.settings.proxyType) })

You may have noticed when you restart FF, the extension button has the wrong color. E.g., you have system mode set, instead the color is always red (manual), until you click the extension. This is caused by the following useless code inside Profiles\Extensions\Extension_GUID\data\panel\firefox-proxy.js:

await browser.proxy.settings.clear({});

clear function

Absolutely no idea why the developer always runs this function before switching modes, but it messes things up, because when a proxy extension clears out, control is returned to FF itself, and for some reason (bug?) FF always sets proxy settings to manual (this is caused by FF itself, not this extension). So when the extension checks proxyType

prompt(undefined, browser.proxy.settings.proxyType)

returns "manual". But you'll say, the damn extension knows what the mode was before running the clear function, why this mistake? Yeah, that's because the developer's right hand function doesn't know what his left is doing. Since this whole BrowserSetting stuff is asynchronous, he must have become confused somewhere along the way, lol.

For a quick adjustment for your purposes, I recommend:

Profiles\Extensions\Extension_GUID\data\panel\index.html:

Set all the values as you need them, then you don't need to type them in the manual window. If you can't read HTML, use the F12 tools in the browser to check which node you have to change. Set server type radio input "http" to checked if you just need http/https proxies, all other radio buttons stay unchecked. Set all radio inputs to disabled. Set all FTP proxy fields to disabled. Who the hell has seen a single ftp server in the last 20 years, huh? Also, kill the search.js script, damn ads

Profiles\Extensions\Extension_GUID\data\panel\firefox-proxy.js:

if (rules.proxyForHttp.scheme.startsWith('socks'))

condition gets changed to

settings.http = url(rules.proxyForHttp); settings.ssl = url(rules.proxyForHttps);

The "clear" code I mentioned above gets removed either.

Delete

config.value.rules.proxyForFtp = parse(value.ftp || value.socks);

Profiles\Extensions\Extension_GUID\data\panel\ui.js:

Remove code that adjusts ftp text input values when you type the http proxy address, e.g.,

ui.manual.http.host.addEventListener ... ui.manual.https.host.value = ui.manual.ftp.host.value = target.value;

ui.manual.ftp.host.value get obliterated, you get the idea

All the changes I just mentioned and others I forgot have been applied to the file I attach here, so take a look.

WRFan avatar Mar 14 '19 02:03 WRFan