[tor-commits] [flashproxy/master] allow some proxy defaults to be defined from an external script file.

infinity0 at torproject.org infinity0 at torproject.org
Wed Nov 6 17:04:49 UTC 2013


commit f0e9b3647c6df72c2b1f71a3cbe180150d1b67a9
Author: Ximin Luo <infinity0 at gmx.com>
Date:   Wed Nov 6 16:14:10 2013 +0000

    allow some proxy defaults to be defined from an external script file.
    - one can imagine scenarios where it's inconvenient to give query params to embed.html or other wrapper; this helps flexibility in those cases
---
 proxy/embed.html    |   11 +++++++++++
 proxy/flashproxy.js |   10 +++++-----
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/proxy/embed.html b/proxy/embed.html
index 53b5bf5..d475adb 100644
--- a/proxy/embed.html
+++ b/proxy/embed.html
@@ -3,6 +3,17 @@
 <head>
 <meta charset="utf-8">
 <meta http-equiv="refresh" content="86400">
+<script type="text/javascript" >
+/*
+	You can tweak the behaviour of the proxy by giving URL query parameters to
+	this embedding document. If you wish to override the default values even in
+	the absense of those parameters, you may set them below.
+
+	See the main code of the proxy for details on which URL query parameters
+	are available, as well as which defaults you can override.
+*/
+//var DEFAULT_FACILITATOR_URL = "https://fp-facilitator.org/";
+</script>
 <style type="text/css">
 html {
 	width: 100%;
diff --git a/proxy/flashproxy.js b/proxy/flashproxy.js
index cb2ac9e..87b083e 100644
--- a/proxy/flashproxy.js
+++ b/proxy/flashproxy.js
@@ -62,16 +62,16 @@
  * http://autobahn.ws/testsuite/reports/clients/index.html
  */
 
-var DEFAULT_FACILITATOR_URL = "https://fp-facilitator.org/";
+var DEFAULT_FACILITATOR_URL = DEFAULT_FACILITATOR_URL || "https://fp-facilitator.org/";
 
-var DEFAULT_MAX_NUM_PROXY_PAIRS = 10;
+var DEFAULT_MAX_NUM_PROXY_PAIRS = DEFAULT_MAX_NUM_PROXY_PAIRS || 10;
 
-var DEFAULT_INITIAL_FACILITATOR_POLL_INTERVAL = 60.0;
-var DEFAULT_FACILITATOR_POLL_INTERVAL = 3600.0;
+var DEFAULT_INITIAL_FACILITATOR_POLL_INTERVAL = DEFAULT_INITIAL_FACILITATOR_POLL_INTERVAL || 60.0;
+var DEFAULT_FACILITATOR_POLL_INTERVAL = DEFAULT_FACILITATOR_POLL_INTERVAL || 3600.0;
 var MIN_FACILITATOR_POLL_INTERVAL = 10.0;
 
 /* Bytes per second. Set to undefined to disable limit. */
-var DEFAULT_RATE_LIMIT = undefined;
+var DEFAULT_RATE_LIMIT = DEFAULT_RATE_LIMIT || undefined;
 var MIN_RATE_LIMIT = 10 * 1024;
 var RATE_LIMIT_HISTORY = 5.0;
 





More information about the tor-commits mailing list