Skip to content

Commit

Permalink
version 0.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
andy-portmen committed Mar 8, 2020
1 parent dd32871 commit c532bb3
Show file tree
Hide file tree
Showing 36 changed files with 153 additions and 145 deletions.
2 changes: 1 addition & 1 deletion EventEmitter.js
@@ -1,6 +1,6 @@
'use strict';

var EventEmitter = function() {
const EventEmitter = function() {
this.ecb = {};
};
EventEmitter.prototype.emit = function(id, data) {
Expand Down
55 changes: 32 additions & 23 deletions common.js
@@ -1,19 +1,20 @@
/* globals Tor, proxy, privacy, ui */
'use strict';

var prefs = {
webrtc: 2,
policy: {
const prefs = {
'webrtc': 2,
'policy': {
'proxy': 0, // 0: turn on when tor is active and turn off when tor is disabled; 1: turn on when browser starts and do not turn off when tor is disabled
'webrtc': 0, // 0: turn on when tor is active and turn off when tor is disabled; 1: turn on when browser starts and do not turn off when tor is disabled
'webrtc': 0 // 0: turn on when tor is active and turn off when tor is disabled; 1: turn on when browser starts and do not turn off when tor is disabled
},
'auto-run': false,
'directory': null
};

var tor = new Tor({
const tor = new Tor({
directory: ''
});
window.tor = tor;

// get external IP address
tor.on('status', status => {
Expand Down Expand Up @@ -45,7 +46,7 @@ proxy.addListener('change', bol => ui.emit('title', {
proxy: bol ? 'SOCKS' : 'default'
}));
chrome.storage.local.get(prefs, p => {
prefs = Object.assign(prefs, p);
Object.assign(prefs, p);
// directory
tor.directory = p.directory;
// auto run?
Expand Down Expand Up @@ -101,23 +102,31 @@ chrome.storage.onChanged.addListener(ps => {
});
});

// FAQs & Feedback
chrome.storage.local.get({
'version': null,
'faqs': navigator.userAgent.toLowerCase().indexOf('firefox') === -1
}, prefs => {
const version = chrome.runtime.getManifest().version;

if (prefs.version ? (prefs.faqs && prefs.version !== version) : true) {
chrome.storage.local.set({version}, () => {
chrome.tabs.create({
url: 'http://add0n.com/tor-control.html?version=' + version +
'&type=' + (prefs.version ? ('upgrade&p=' + prefs.version) : 'install')
/* FAQs & Feedback */
{
const {onInstalled, setUninstallURL, getManifest} = chrome.runtime;
const {name, version} = getManifest();
const page = getManifest().homepage_url;
if (navigator.webdriver !== true) {
onInstalled.addListener(({reason, previousVersion}) => {
chrome.storage.local.get({
'faqs': true,
'last-update': 0
}, prefs => {
if (reason === 'install' || (prefs.faqs && reason === 'update')) {
const doUpdate = (Date.now() - prefs['last-update']) / 1000 / 60 / 60 / 24 > 45;
if (doUpdate && previousVersion !== version) {
chrome.tabs.create({
url: page + '?version=' + version +
(previousVersion ? '&p=' + previousVersion : '') +
'&type=' + reason,
active: reason === 'install'
});
chrome.storage.local.set({'last-update': Date.now()});
}
}
});
});
setUninstallURL(page + '?rd=feedback&name=' + encodeURIComponent(name) + '&version=' + version);
}
});
(function() {
const {name, version} = chrome.runtime.getManifest();
chrome.runtime.setUninstallURL('http://add0n.com/feedback.html?name=' + name + '&version=' + version);
})();
}
2 changes: 1 addition & 1 deletion data/helper
Binary file modified data/icons/128.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/icons/16.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/icons/19.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/icons/256.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/icons/32.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/icons/38.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/icons/48.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/icons/512.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/icons/64.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/icons/enabled/128.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/icons/enabled/16.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/icons/enabled/19.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/icons/enabled/256.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/icons/enabled/32.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/icons/enabled/38.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/icons/enabled/48.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/icons/enabled/512.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/icons/enabled/64.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion data/options/index.js
Expand Up @@ -13,7 +13,7 @@ function save() {

function restore() {
chrome.storage.local.get({
directory: '',
directory: ''
}, prefs => {
document.getElementById('directory').value = prefs.directory;
});
Expand Down
3 changes: 0 additions & 3 deletions data/pac/chrome.js

This file was deleted.

10 changes: 1 addition & 9 deletions data/pac/firefox.js
@@ -1,11 +1,3 @@
var proxy = 'DIRECT';

function FindProxyForURL() {
return proxy;
return 'SOCKS5 127.0.0.1:22050';
}

browser.runtime.onMessage.addListener(request => {
if (request.method === 'register-proxy') {
proxy = request.proxy;
}
});
50 changes: 29 additions & 21 deletions data/popup/index.css
@@ -1,20 +1,21 @@
body {
width: 500px;
height: 300px;
font-family: "Helvetica Neue",Helvetica,sans-serif;
font-family: "Helvetica Neue", Helvetica, sans-serif;
font-size: 13px;
background-color: #fff;
background-color: #f3f3f3;
color: #3e3e3e;
}
img {
cursor: pointer;
}
input[type=button] {
border: solid 1px #eee;
background-color: #fff;
background-color: #dadada;
width: 120px;
margin: 2px 0;
padding: 8px 10px;
outline: none;
cursor: pointer;
border: none;
}
input {
outline: none;
Expand Down Expand Up @@ -44,34 +45,41 @@ input[type=button]:active {
align-items: center;
}
body[data-status=connecting] img[data-cmd=connection] {
opacity: 0.3;
opacity: 0.3;
}

#log {
padding: 10px;
padding: 5px;
overflow-x: hidden;
overflow-y: auto;
width: calc(47vw - 20px);
background-color: rgba(0, 0, 0, 0.01);
border: dashed 1px rgba(0, 0, 0, 0.05);
background-color: #dadada;
}
#log > * {
word-break: break-word;
padding: 2px 5px;
font-size: 12px;
}
#log>* {
margin-bottom: 10px;
#log > *:not(:last-child) {
margin-bottom: 5px;
}
#toolbar {
margin-top: 8px;
}

.msg span:nth-child(1) {
font-size: 80%;
}
.msg span:nth-child(2) {
padding: 0 5px;
background-color: rgba(0, 0, 0, 0.05);
display: flex;
justify-content: space-around;
}

.log {
background-color: rgba(0, 0, 0, 0.05);
border: dotted 1px rgba(0, 0, 0, 0.05);
background-color: #fff;
padding: 0 5px;
}
.log.notice {
background-color: #f3f3f3;
}
.log.warn {
background-color: #ffe3fe;
}
.log.err {
background-color: #ff8282;
color: #fff;
}
6 changes: 3 additions & 3 deletions data/popup/index.html
Expand Up @@ -6,8 +6,8 @@
</head>
<body vbox>
<div hbox flex=1 style="overflow: hidden;">
<div flex=1 hbox id="toggle" pack="center" align="center">
<img width="120" height="120" src="off.png" data-cmd="connection">
<div flex=1 hbox id="toggle" pack="center" align="center" title="Press 'ON' to start a TOR executable and wait for a new connection. Press 'OFF' to kill the running TOR executable.">
<img width="80" height="80" src="off.svg" data-cmd="connection">
</div>

<div flex=2 vbox id="log">
Expand All @@ -22,7 +22,7 @@
</div>
<div id="toolbar">
<input type="button" value="New Identity" data-rcmd="SIGNAL NEWNYM">
<input type="button" value="Get IP" data-rcmd="GETINFO address">
<input type="button" value="Get IP" data-cmd="address">
<input type="button" value="Status" data-rcmd="GETINFO circuit-status">
<input type="button" value="Verify" data-cmd="verify">
</div>
Expand Down
31 changes: 20 additions & 11 deletions data/popup/index.js
@@ -1,6 +1,6 @@
'use strict';

var elements = {
const elements = {
log: document.getElementById('log'),
template: document.querySelector('#log template'),
webrtc: document.getElementById('prefs.webrtc')
Expand All @@ -9,17 +9,18 @@ var elements = {
function log(msg) {
function single(msg) {
let node = document.importNode(elements.template.content, true);
const parts = /(.*)\[(err|warn|notice)\] (.*)/.exec(msg);
if (parts) {
node.querySelector('span:nth-child(1)').textContent = parts[1];
node.querySelector('span:nth-child(2)').textContent = parts[2];
node.querySelector('span:nth-child(3)').textContent = parts[3];
node = document.createElement('span');
node.classList.add('log');
if (msg.indexOf('[notice]') !== -1) {
node.classList.add('notice');
}
else {
node = document.createElement('span');
node.classList.add('log');
node.textContent = msg;
if (msg.indexOf('[warn]') !== -1) {
node.classList.add('warn');
}
if (msg.indexOf('[err]') !== -1) {
node.classList.add('err');
}
node.textContent = msg.replace(//g, '\n');

elements.log.appendChild(node);
elements.log.scrollTop = elements.log.scrollHeight;
Expand All @@ -30,7 +31,7 @@ function log(msg) {
function status(s) {
document.body.dataset.status = s;
document.querySelector('[data-cmd="connection"]').src =
s === 'disconnected' ? 'off.png' : 'on.png';
s === 'disconnected' ? 'off.svg' : 'on.svg';
}

window.addEventListener('load', () => {
Expand All @@ -44,6 +45,9 @@ chrome.runtime.onMessage.addListener(request => {
if (request.cmd === 'event' && request.id === 'stdout') {
log(request.data);
}
if (request.cmd === 'event' && request.id === 'stderr') {
log(request.data);
}
else if (request.cmd === 'event' && request.id === 'status') {
status(request.data);
}
Expand All @@ -63,6 +67,11 @@ document.addEventListener('click', e => {
url: 'https://check.torproject.org/'
});
}
if (cmd === 'address') {
chrome.tabs.create({
url: 'https://webbrowsertools.com/ip-address/'
});
}
else if (cmd === 'connection') {
chrome.runtime.sendMessage({
method: 'popup-action',
Expand Down
Binary file removed data/popup/off.png
Binary file not shown.
6 changes: 6 additions & 0 deletions data/popup/off.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed data/popup/on.png
Binary file not shown.
6 changes: 6 additions & 0 deletions data/popup/on.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 12 additions & 23 deletions manifest.json
@@ -1,21 +1,14 @@
{
"name": "Tor Control (anonymity layer)",
"short_name": "itbrowser",
"description": "Brings the anonymity of the Tor network and modifies few settings to protect user privacy",
"author": "Jeremy Schomery, Andy Portmen",
"version": "0.1.2",
"name": "Onion Control (anonymous proxy)",
"description": "Brings the anonymity of the Tor network plus modifies few settings to protect user privacy",
"version": "0.1.3",
"manifest_version": 2,
"permissions": [
"storage",
"tabs",
"proxy",
"privacy",
"webRequest",
"downloads",
"management",
"notifications",
"nativeMessaging",
"https://api.github.com/repos/andy-portmen/native-client/releases/latest"
"nativeMessaging"
],
"background": {
"scripts": [
Expand All @@ -28,26 +21,22 @@
]
},
"browser_action": {
"default_icon": {
"16": "data/icons/16.png",
"32": "data/icons/32.png"
},
"default_popup": "data/popup/index.html"
},
"homepage_url": "http://add0n.com/tor-control.html",
"homepage_url": "https://add0n.com/tor-control.html",
"icons": {
"16": "data/icons/16.png",
"19": "data/icons/19.png",
"32": "data/icons/32.png",
"38": "data/icons/38.png",
"48": "data/icons/48.png",
"128": "data/icons/128.png"
"64": "data/icons/64.png",
"128": "data/icons/128.png",
"256": "data/icons/256.png",
"512": "data/icons/512.png"
},
"options_ui": {
"page": "data/options/index.html",
"chrome_style": true
},
"applications": {
"gecko": {
"id": "{d22a1484-dcef-44e9-ab52-80f0f4a331a3}",
"strict_min_version": "57.0"
}
}
}
4 changes: 2 additions & 2 deletions privacy.js
@@ -1,11 +1,11 @@
'use strict';

var privacy = {
const privacy = {
onchanges: [],
modes: {
0: 'default_public_and_private_interfaces',
1: 'default_public_interface_only',
2: 'disable_non_proxied_udp',
2: 'disable_non_proxied_udp'
},
current: {
value: 'default'
Expand Down

0 comments on commit c532bb3

Please sign in to comment.