The first commit is a UI update from antonela that adds the toggle button and reformats the Learn more link
The second commit is a refactoring of the broker poll. To disable snowflake, we need to somehow break the infinite poll loop that cycles between countdown and findClients. I pulled this out into a setInterval call and slightly changed how to determine whether there are available proxyPairs.
Finally in the third commit, to add the Off/On toggle functionality, we have to change how the webpage handles this. It doesn't make sense to use cookies and completely reload the web extension as before, so I added an enabled variable to the UI class an messaging back and forth to update this.
There's still a few more things to do:
change the snowflake image to reflect whether or not it's enabled
Okay I added a few lint and test fixes and then updated the popup display here. These commits could do with a squashing but I'll put this into review for now: https://github.com/cohosh/snowflake/pull/4
I haven't gotten the rotation to work yet with the svg image.
I haven't gotten the rotation to work yet with the svg image.
Yeah, some sort of indication that it is active would be nice, like rotation or switching to green. Is rotation going to be too distracting in the browserAction icon?
A final note is that this doesn't save the toggle state so a user needs to turn it on at every browser restart.
This look good to me. I like the cleanup of cease/disable/reset. Merged these as well.
I haven't gotten the rotation to work yet with the svg image.
Yeah, some sort of indication that it is active would be nice, like rotation or switching to green. Is rotation going to be too distracting in the browserAction icon?
I'll work on this next.
A final note is that this doesn't save the toggle state so a user needs to turn it on at every browser restart.
Yeah, I noticed that as well. I think this is okay.. the only thing we'd want to save is the displayed stats for:
Your snowflake has helped 0 users circumvent censorship in the last 24 hours.
My guess is that it makes sense to reset this on a browser restart since 24 hours isn't that long anyway? If we want to allow users to see long-term usage we could save this, but is that even a good idea?
A final note is that this doesn't save the toggle state so a user needs to turn it on at every browser restart.
Yeah, I noticed that as well. I think this is okay.. the only thing we'd want to save is the displayed stats for:
Your snowflake has helped 0 users circumvent censorship in the last 24 hours.
My guess is that it makes sense to reset this on a browser restart since 24 hours isn't that long anyway? If we want to allow users to see long-term usage we could save this, but is that even a good idea?
Oh wait my bad, it's the opt-in thing they have to reset. Hm. Okay I'll look into saving this state.
I haven't checked the code but is it the case that by default it's set to "On" (without any user input)?
No, the default is for the Snowflake proxy to be disabled and a user has to opt-in by clicking the popup and turning it on.
This is the same case as the current webpage snowflake.torproject.org. We could perhaps add some more obvious instructions to enable it if it's a usability problem.
No, the default is for the Snowflake proxy to be disabled and a user has to opt-in by clicking the popup and turning it on.
This is the same case as the current webpage snowflake.torproject.org. We could perhaps add some more obvious instructions to enable it if it's a usability problem.
Doesn't the mere fact that someone installed that extension mean that they want to (immediately) start acting as a proxy? I don't think your choice for the default makes sense then.
On the whole, these changes seem fine. I left two comments on the pull.
This is the same case as the current webpage snowflake.torproject.org. We could perhaps add some more obvious instructions to enable it if it's a usability problem.
I agree with the cypherpunk that it should default to "on" since this isn't the same as browsing to a webpage that potentially has a snowflake embed and could start proxying traffic against the user's will; here we have explicit interaction of installing the extension.
I agree with the cypherpunk that it should default to "on" since this isn't the same as browsing to a webpage that potentially has a snowflake embed and could start proxying traffic against the user's will; here we have explicit interaction of installing the extension.
Hrm I'm seeing what looks like an infinite loop that the extension eventually goes into.
On Firefox:
Snowflake: At client capacity. snowflake.js:1186:13XML Parsing Error: no element foundLocation: https://snowflake-broker.bamsoftware.com/answerLine Number 1, Column 1: answer:1:1XML Parsing Error: no element foundLocation: https://snowflake-broker.bamsoftware.com/proxyLine Number 1, Column 1: proxy:1:1Snowflake: At client capacity.snowflake.js:1186:13ICE failed, add a STUN server and see about:webrtc for more details
On Chrome:
POST https://snowflake-broker.bamsoftware.com/proxy 504(2) snowflake.js:1186 Snowflake: At client capacity.proxy:1 POST https://snowflake-broker.bamsoftware.com/proxy 504(35) snowflake.js:1186 Snowflake: At client capacity.
It doesn't seem to happen with the currently published version 0.0.1, so I'll look into whether the refactoring changes might have caused it
This is the same case as the current webpage snowflake.torproject.org. We could perhaps add some more obvious instructions to enable it if it's a usability problem.
I agree with the cypherpunk that it should default to "on" since this isn't the same as browsing to a webpage that potentially has a snowflake embed and could start proxying traffic against the user's will; here we have explicit interaction of installing the extension.
I think so too. The way I see it, installing the extension is opting in (equivalent to setting a cookie on the web page), and the on/off toggle is for the convenience of not having to dig into the browser's extension settings if you want to disable it temporarily.
Hrm I'm seeing what looks like an infinite loop that the extension eventually goes into.
Could it be if broker.getClientOffer (first HTTP request to broker) succeeds, but then ProxyPair.receiveOffer fails (JSON parsing and second HTTP request to broker). In that case, the ProxyPair is neither closed nor set inactive? Formerly, the ProxyPair was only set active after receiving the client offer, compared to now where it is set active immediately and made inactive when there's an error. Forgive me, I might be misinterpreting the code.
This is the same case as the current webpage snowflake.torproject.org. We could perhaps add some more obvious instructions to enable it if it's a usability problem.
I agree with the cypherpunk that it should default to "on" since this isn't the same as browsing to a webpage that potentially has a snowflake embed and could start proxying traffic against the user's will; here we have explicit interaction of installing the extension.
I think so too. The way I see it, installing the extension is opting in (equivalent to setting a cookie on the web page), and the on/off toggle is for the convenience of not having to dig into the browser's extension settings if you want to disable it temporarily.
Cool, added here
Hrm I'm seeing what looks like an infinite loop that the extension eventually goes into.
Could it be if broker.getClientOffer (first HTTP request to broker) succeeds, but then ProxyPair.receiveOffer fails (JSON parsing and second HTTP request to broker). In that case, the ProxyPair is neither closed nor set inactive? Formerly, the ProxyPair was only set active after receiving the client offer, compared to now where it is set active immediately and made inactive when there's an error. Forgive me, I might be misinterpreting the code.
Yeah that's what I'm looking into, I'll add a fix to cover that case but it actually seems that the WebRTC might not be closing correctly. My snowflake has been green (active) for well over an hour now. Usually the connection times out during a browsing session before then.
Hrm I'm seeing what looks like an infinite loop that the extension eventually goes into.
Could it be if broker.getClientOffer (first HTTP request to broker) succeeds, but then ProxyPair.receiveOffer fails (JSON parsing and second HTTP request to broker). In that case, the ProxyPair is neither closed nor set inactive? Formerly, the ProxyPair was only set active after receiving the client offer, compared to now where it is set active immediately and made inactive when there's an error. Forgive me, I might be misinterpreting the code.
Yeah that's what I'm looking into, I'll add a fix to cover that case but it actually seems that the WebRTC might not be closing correctly. My snowflake has been green (active) for well over an hour now. Usually the connection times out during a browsing session before then.
This commit should put us back at the state we were at before the refactor in terms of error checking and returning the pair to inactive.
I just merged to master. I think we can wait for #31067 (moved) for the next release. I think we'll want to update the screenshots anyway with the current UI from this ticket and from the new feature added in #31067 (moved).