Skip to content
Permalink
Browse files
Changed to get the HEADLESS patch working.
Also,

  - Adds a README file
  - Moves the node.js related files to modules/nodejs
  - flashproxy.js is symlinked and an npm prepublish script is added
  • Loading branch information
arlolra committed Jun 27, 2013
1 parent b34ff06 commit d3e90c8c227dc0267887b60378f0119f7d135d14
Showing with 43 additions and 11 deletions.
  1. +1 −0 .gitignore
  2. +4 −0 modules/nodejs/Makefile
  3. +29 −0 modules/nodejs/README
  4. +1 −0 modules/nodejs/flashproxy.js
  5. +0 −3 proxy/flashproxy-node.js → modules/nodejs/main.js
  6. +7 −7 {proxy → modules/nodejs}/package.json
  7. +1 −1 proxy/flashproxy.js
@@ -3,3 +3,4 @@
/py2exe-tmp
/websocket-transport/websocket-client
/websocket-transport/websocket-server
/modules/nodejs/node_modules
@@ -0,0 +1,4 @@
.PHONY: prepublish
prepublish:
rm flashproxy.js
cp ../../proxy/flashproxy.js flashproxy.js
@@ -0,0 +1,29 @@
== Headless flash proxies with node.js

Traditionally, flash proxies have run in the browser. However, it may be
desirable to run them as background daemons. This directory contains a main.js
file which wraps the regular flashproxy.js (symlinked here) and runs
headlessly from node.js.

To install the requirements (known to be in Debian testing and Ubuntu universe),

> apt-get install git nodejs npm

Then, if you've checked out the flashproxy source from git,

> git clone https://git.torproject.org/flashproxy.git
> cd flashproxy/modules/nodejs
> npm install
> npm start # or, node main.js

This package is also being published on the npm registry. To add a `flashproxy`
bin to your path without checking out from git, at any time run,

> npm install -g flashproxy
> flashproxy

Rather than install globally, you can also,

> cd ~/ # or, to the dir of your choice
> npm install flashproxy
> npm start flashproxy # or, node node_modules/flashproxy
@@ -20,8 +20,5 @@ var file = path.join(__dirname, "flashproxy.js");
var data = fs.readFileSync(file, "utf8");
eval(data);

// Remove debug_div
debug_div = null;

// Start 'er up
flashproxy_badge_new().start();
@@ -1,18 +1,18 @@
{
"name": "flashproxy",
"version": "1.1",
"version": "1.1.0",
"description": "Standalone flash proxy. A flash proxy is a lightweight proxy providing access to the Tor network.",
"main": "flashproxy.js",
"main": "main.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node flashproxy-node.js"
"prepublish": "make prepublish",
"start": "node main.js"
},
"bin": {
"flashproxy": "flashproxy-node.js"
"flashproxy": "main.js"
},
"dependencies": {
"xmlhttprequest": "1.5.0",
"ws": "git://github.com/einaros/ws#02b12c184"
"ws": "0.4.27"
},
"repository": {
"type": "git",
@@ -26,5 +26,5 @@
"websocket",
"pluggable transport"
],
"license": "MIT",
"license": "MIT"
}
@@ -84,11 +84,11 @@ var OPT_IN_COOKIE = "flashproxy-allow";
var WebSocket = window.WebSocket || window.MozWebSocket;

var query = parse_query_string(window.location.search.substr(1));
var cookies = parse_cookie_string(document.cookie);
var DEBUG = get_param_boolean(query, "debug", false);
var debug_div;
/* HEADLESS is true if we are running not in a browser with a DOM. */
var HEADLESS = typeof(document) === "undefined";
var cookies = HEADLESS ? {} : parse_cookie_string(document.cookie);

if (DEBUG && !HEADLESS) {
debug_div = document.createElement("pre");

0 comments on commit d3e90c8

Please sign in to comment.