Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright 2015 The Native Client Authors. All rights reserved. | |
| 3 * Use of this source code is governed by a BSD-style license that can be | |
| 4 * found in the LICENSE file. | |
| 5 */ | |
| 6 | |
| 7 NaClTerm.nmf = 'tor.nmf'; | |
| 8 //NaClTerm.cwd = '/home/user'; | |
|
binji
2015/08/24 22:28:02
remove
deepankar-tyagi
2015/08/25 18:14:44
Done.
| |
| 9 | |
| 10 /* check whether another instance of this app is running | |
| 11 #TODO(dt) check if default port is occupied | |
| 12 #TODO(dt) check if(allowed) another tor process is running outside chrome. */ | |
| 13 function anotherTorRunning(){ | |
| 14 // since chrome 34 multiple windows in apps are not allowed by default | |
| 15 // thus returning false without any checking, (for now) | |
| 16 // return NaClTerm.started; | |
| 17 return false; | |
| 18 } | |
| 19 function saveTorArgs() { // this fucntion is redundant for now | |
| 20 var torArgs_ = 'defaults'; | |
| 21 chrome.storage.local.set({ | |
| 22 torArgs: torArgs_ | |
| 23 }, function () { | |
| 24 // | |
|
binji
2015/08/24 22:28:01
Log an error message here?
deepankar-tyagi
2015/08/25 18:14:44
remove the function for now(till GUI is developed)
| |
| 25 }); | |
| 26 } | |
| 27 // here argv is just one string | |
| 28 function populateArgv() { // this fucntion is redundant for now | |
| 29 chrome.storage.local.get({ | |
| 30 torArgs: 'default' | |
| 31 }, function (items) { | |
| 32 if(items.torArgs === "default"){ | |
| 33 // NaClTerm.argv = ['--SOCKSPort', '9999']; | |
|
binji
2015/08/24 22:28:01
Remove or clean up these comments -- as it is, it
deepankar-tyagi
2015/08/25 18:14:44
Done.
| |
| 34 //playing it safe for now, | |
| 35 //NaClTerm.argv = NaClTerm.argv.concat(['ReachableAddresses','*:80,*:443']); | |
| 36 //TODO(dt) remove this once gui is ready | |
| 37 NaClTerm.argv = ['-f', '/mnt/http/torrc']; | |
| 38 } | |
| 39 //console.log(items.torArgs); | |
|
binji
2015/08/24 22:28:01
nit: indent 2 spaces everywhere
deepankar-tyagi
2015/08/25 18:14:44
Done.
| |
| 40 }); | |
| 41 } | |
| 42 function runTor() { | |
| 43 if(!anotherTorRunning()){ | |
|
binji
2015/08/24 22:28:01
nit: indent 2 spaces
deepankar-tyagi
2015/08/25 18:14:45
Done.
| |
| 44 populateArgv(); | |
| 45 NaClTerm.init(); | |
| 46 }else{ | |
| 47 console.log("another tor instance running,exiting..."); | |
|
binji
2015/08/24 22:28:02
remove else clause for now, as it is untested.
deepankar-tyagi
2015/08/25 18:14:45
Done.
| |
| 48 window.open('', '_self', ''); | |
| 49 window.close(); | |
| 50 | |
| 51 } | |
| 52 } | |
| 53 window.onload = function() { | |
| 54 lib.init(function() { | |
| 55 runTor(); | |
| 56 }); | |
| 57 }; | |
| OLD | NEW |