[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [snowflake/master] Move the Yes/No buttons into index.html; redirect options.html to it.



commit 627f37e00485fc87b790418f7edba8fb0c7bfd28
Author: David Fifield <david@xxxxxxxxxxxxxxx>
Date:   Thu Dec 20 17:22:36 2018 -0700

    Move the Yes/No buttons into index.html; redirect options.html to it.
---
 proxy/static/.htaccess    |   1 +
 proxy/static/embed.html   |   2 +-
 proxy/static/index.html   | 106 ++++++++++++++++++++++++++++++++++
 proxy/static/options.html | 143 ----------------------------------------------
 4 files changed, 108 insertions(+), 144 deletions(-)

diff --git a/proxy/static/.htaccess b/proxy/static/.htaccess
index f733194..3dd217d 100644
--- a/proxy/static/.htaccess
+++ b/proxy/static/.htaccess
@@ -1,3 +1,4 @@
 <Files "embed.html">
     Header always unset X-Frame-Options
 </Files>
+Redirect permanent /options.html /index.html
diff --git a/proxy/static/embed.html b/proxy/static/embed.html
index 65303b5..9efe369 100644
--- a/proxy/static/embed.html
+++ b/proxy/static/embed.html
@@ -44,7 +44,7 @@
   </style>
 </head>
 <body>
-  <a target="_blank" href="options.html">
+  <a target="_blank" href="index.html">
     <div id="badge">
       Internet Freedom
     </div>
diff --git a/proxy/static/index.html b/proxy/static/index.html
index 74779e5..cfe8d89 100644
--- a/proxy/static/index.html
+++ b/proxy/static/index.html
@@ -17,6 +17,18 @@ textarea {
   resize: none;
   padding: 1em;
 }
+#options {
+  background-color: rgba(0,0,0,0.8);
+  color: #fff;
+  resize: none;
+  position: relative; border: none;
+  width: 30rem;
+  padding: 3rem; margin: auto; margin-top: 1rem;
+  cursor: default;
+}
+#options .active {
+  color: #2F2 !important;
+}
 </style>
 </head>
 
@@ -30,6 +42,49 @@ is a WebRTC pluggable transport for Tor.
 </p>
 
 <p>
+This page enables you to use your web browser as a proxy to help other
+Internet users in censored places.
+When you click yes, your browser will act as a
+censorship circumvention proxy
+as long as you are viewing a page with the snowflake badge.
+</p>
+
+<div id='options'>
+
+<noscript>
+<hr/>
+Snowflake proxy requires javascript.
+<br/>
+To volunteer as a proxy, please enable javascript.
+</noscript>
+
+<div id='buttons' style='display:none'>
+<p>
+Do you want your browser to act as a proxy?
+</p>
+
+<p>
+<button onclick="enableSnowflake()">
+  Yes
+</button>
+<button onclick="disableSnowflake()">
+  No
+</button>
+</p>
+<div id="snowflake-status"></div>
+</div>
+
+<div id='cookies-disabled' style='display:none'>
+<hr/>
+<p>
+Your browser has cookies disabled. You will need to enable them in order
+to set Snowflake preferences.
+</p>
+</div>
+
+</div>
+
+<p>
 Minimum functionality has been achieved, and it is possible
 to bootstrap a Tor client to 100% using Snowflake, and the
 browsing experience using this PT is reasonable enough.
@@ -74,5 +129,56 @@ gitweb.torproject.org/pluggable-transports/snowflake.git
 <br/>
 Last update: <time>2018-12-20</time>
 
+<script>
+
+// Defaults to opt-in.
+var COOKIE_NAME = "snowflake-allow";
+var COOKIE_LIFETIME = "Thu, 01 Jan 2038 00:00:00 GMT";
+
+function readCookie(cookie) {
+  c = document.cookie.split('; ');
+  cookies = {};
+  for (i = 0 ; i < c.length ; i++) {
+    pair = c[i].split('=');
+    cookies[pair[0]] = pair[1];
+  }
+  return cookies[cookie];
+}
+
+function enableSnowflake() {
+  setSnowflakeCookie(1);
+  location.reload();
+}
+
+function disableSnowflake() {
+  setSnowflakeCookie(0);
+  location.reload();
+}
+
+function setSnowflakeCookie(val) {
+  document.cookie = COOKIE_NAME + "=" + val + ";path=/ ;expires=" + COOKIE_LIFETIME;
+}
+
+window.onload = function() {
+  if (navigator.cookieEnabled) {
+    // Both JS and cookies enabled -- display normal buttons.
+    document.getElementById('buttons').style = '';
+  } else {
+    // Display the cookies disabled message if necessary.
+    document.getElementById('cookies-disabled').style = '';
+  }
+  var enabled = readCookie(COOKIE_NAME);
+  var $status = document.getElementById('snowflake-status');
+  if ("1" === enabled) {
+    $status.innerHTML = 'Snowflake Proxy is ACTIVE <br/><br/>' +
+    'Thank you for contributing to internet freedom!';
+    $status.className = 'active';
+  } else {
+    $status.innerHTML = 'Snowflake Proxy is OFF';
+    $status.className = '';
+  }
+}
+</script>
+
 </body>
 </html>
diff --git a/proxy/static/options.html b/proxy/static/options.html
deleted file mode 100644
index bdffd51..0000000
--- a/proxy/static/options.html
+++ /dev/null
@@ -1,143 +0,0 @@
-<!doctype html>
-<html>
-<head>
-  <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
-  <title>Snowflake - Options</title>
-  <style>
-  * {
-    box-sizing: border-box;
-    -webkit-transition: all 0.3s;
-    -moz-transition: all 0.3s;
-    transition: all 0.3s;
-  }
-  body {
-    position: absolute;
-    width: 100%; height: 100%; top: 0; margin: 0 auto;
-    background-color: #424;
-    color: #000;
-    font-size: 1rem;
-    text-align: center;
-    font-family: monospace;
-    background-image: url('koch.jpg');
-  }
-  .options {
-    background-color: rgba(0,0,0,0.8);
-    color: #fff;
-    resize: none;
-    position: relative; border: none;
-    width: 30rem; min-width: 40em;
-    padding: 3rem; margin: auto; margin-top: 1rem;
-    cursor: default;
-  }
-  a { color: #88F; } a:hover { color: #fff; }
-  #snowflake-status {
-    color: #888;
-  }
-  .active {
-    color: #2F2 !important;
-  }
-  </style>
-</head>
-<body>
-  <div class="options">
-  <h1>Snowflake Options</h1>
-  <p>
-  This page enables you to use your web browser as a proxy to help other
-  Internet users in censored places.
-  When you click yes, your browser will act as a
-  censorship circumvention proxy
-  as long as you are viewing a page with the snowflake badge.
-  </p>
-
-  <p>
-  For more information on this system click
-  <a href="https://snowflake.torproject.org/";>here</a>.
-  </p>
-
-  <noscript>
-  <hr/>
-  Snowflake proxy requires javascript.
-  <br/>
-  To volunteer as a proxy, please enable javascript.
-  </noscript>
-
-  <div id='buttons' style='display:none'>
-  <p>
-  Do you want your browser to act as a proxy?
-  </p>
-
-  <p>
-  <button onclick="enableSnowflake()">
-    Yes
-  </button>
-  <button onclick="disableSnowflake()">
-    No
-  </button>
-  </p>
-  <div id="snowflake-status"></div>
-  </div>
-
-  <div id='cookies-disabled' style='display:none'>
-  <hr/>
-  <p>
-  Your browser has cookies disabled. You will need to enable them in order
-  to set Snowflake preferences.
-  </p>
-  </div>
-
-<script>
-
-// Defaults to opt-in.
-var COOKIE_NAME = "snowflake-allow";
-var COOKIE_LIFETIME = "Thu, 01 Jan 2038 00:00:00 GMT";
-
-function readCookie(cookie) {
-  c = document.cookie.split('; ');
-  cookies = {};
-  for (i = 0 ; i < c.length ; i++) {
-    pair = c[i].split('=');
-    cookies[pair[0]] = pair[1];
-  }
-  return cookies[cookie];
-}
-
-function enableSnowflake() {
-  setSnowflakeCookie(1);
-  refreshStatus();
-}
-
-function disableSnowflake() {
-  setSnowflakeCookie(0);
-  refreshStatus();
-}
-
-function setSnowflakeCookie(val) {
-  document.cookie = COOKIE_NAME + "=" + val + ";path=/ ;expires=" + COOKIE_LIFETIME;
-}
-
-function refreshStatus() {
-  var enabled = readCookie(COOKIE_NAME);
-  var $status = document.getElementById('snowflake-status');
-  if ("1" === enabled) {
-    $status.innerHTML = 'Snowflake Proxy is ACTIVE <br/><br/>' +
-    'Thank you for contributing to internet freedom!';
-    $status.className = 'active';
-  } else {
-    $status.innerHTML = 'Snowflake Proxy is OFF';
-    $status.className = '';
-  }
-}
-
-window.onload = function() {
-  if (navigator.cookieEnabled) {
-    // Both JS and cookies enabled -- display normal buttons.
-    document.getElementById('buttons').style = '';
-  } else {
-    // Display the cookies disabled message if necessary.
-    document.getElementById('cookies-disabled').style = '';
-  }
-  refreshStatus();
-}
-</script>
-</body>
-</html>



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits