mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 05:11:19 -04:00
confirmation dialog on proxy close (close #23)
This commit is contained in:
parent
8a8273e972
commit
d2e61e315c
2 changed files with 21 additions and 0 deletions
|
@ -44,6 +44,8 @@ MODE =
|
|||
WEBRTC_CONNECTING: 1
|
||||
WEBRTC_READY: 2
|
||||
|
||||
CONFIRMATION_MESSAGE = "You're currently serving a Tor user via Snowflake."
|
||||
|
||||
# Minimum viable snowflake for now - just 1 client.
|
||||
class Snowflake
|
||||
|
||||
|
@ -200,4 +202,11 @@ init = ->
|
|||
snowflake.setRelayAddr relayAddr
|
||||
snowflake.beginWebRTC()
|
||||
|
||||
# Notification of closing tab with active proxy.
|
||||
# TODO: Opt-in/out parameter or cookie
|
||||
window.onbeforeunload = ->
|
||||
if MODE.WEBRTC_READY == snowflake.state
|
||||
return CONFIRMATION_MESSAGE
|
||||
null
|
||||
|
||||
window.onload = init if window
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue