diff --git a/README.md b/README.md index a242e04..81fd81b 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Sockets have been introduced in Chromium 24. Therefore, it is required to have a ## Features ### Password encryption -Storing your socks password encrypted is a priority but is not available yet. Yes, the chromesoul dev version is unsafe; so is the official NetSoul server which doesn't store a hash but the password itself (it's a requirement from the NetSoul protocol). +Storing your socks password encrypted is a priority but is not available yet. Yes, the chromesoul dev version is unsafe; so is the official NetSoul server which doesn't store a hash but the password itself (it's required by the NetSoul protocol). ### Messages Because the only purpose of this extension is to provide an access to internet when you're on the PIE, there is no plan to support messages at this time. Thoses stupid guys who have fun spamming everyone by broadcasting messages are the second reasons why you won't see any message using chromesoul. Maybe one day I'll write a chat interface, however it will be unobtrusive. @@ -39,17 +39,11 @@ Because it's not packaged yet, you have to: ### Will you package it? Yes, as soon as sockets are supported in the stable channel. -### Where do I enter my login and password? -Why haven't you already looked at the extension's options? Yes, it's there. - -## The option pages doesn't work! -It used to work, but for unknown reason it doesn't anymore. Such things may happened on the dev channel, however I'll try to fix it. - -### Why chromesoul doesn't start with chrome? -This is a known issue, I'm working on it. Sockets aren't available for extensions, packaged app cannot define custom background pages and hosted app isn't a solution. - -## How do I start chromesoul? -In the extension pannel, click on the link "_generated_background_page.html" within the "Inspect views" section. +### How do I start chromesoul? +Just like any other app: +* open a new tab (Ctrl + T) +* click on the "apps" tab (have a look at the bottom of the page) +* click on "chromesoul" ### Could not load extension from '/path/to/chromesoul'. Invalid value for 'permissions[2]'. It seems your browser doesn't support sockets. Have you checked the requirements? @@ -69,7 +63,7 @@ Maybe. If someone pay me I will, otherwise I'll do it if have time to invest in ### I talked to you on netsoul but you never reply! I started this project for my personal usage, which means I use it. Now look at the features list and the previous questions. -### I found a bug! +### I found a bug, what should I do? Hum, please [report it](https://github.com/TychoBrahe/chromesoul/issues) with as much details as you can. Thanks in advance. ### I hate chromesoul! diff --git a/background.html b/background.html new file mode 100644 index 0000000..52d2b0b --- /dev/null +++ b/background.html @@ -0,0 +1,24 @@ + + +
+ +Status:
+ + + + + + + + + diff --git a/background.js b/background.js index 9adc64e..c537998 100644 --- a/background.js +++ b/background.js @@ -14,5 +14,9 @@ // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. // -var cs = new NsClient(); -cs.init(); +chrome.app.runtime.onLaunched.addListener(function(intentData) { + //if (window.chrome && window.chrome.app && window.chrome.app.isInstalled) { + if (window.chrome && window.chrome.app) { + window.open("background.html#0", "bg", "background"); + } +}); diff --git a/lib/ns_client.js b/lib/ns_client.js index 6eb0155..40119cd 100644 --- a/lib/ns_client.js +++ b/lib/ns_client.js @@ -20,26 +20,17 @@ var NsClient = function() { this.allowed_statuses = ["actif", "away", "idle", "lock"]; this.is_connected = false; this.socket = null; - this.verbose = false; }; NsClient.prototype.connect = function() { var cnt = function(elem) { return function(infos) { if (typeof infos.login !== "undefined" && typeof infos.pwd_socks !== "undefined") { - if (elem.verbose) - console.log('creating socket...'); chrome.socket.create('tcp', {}, function(sock_inf) { - if (elem.verbose) - console.log('socket created, id: ' + sock_inf.socketId); elem.socket = sock_inf.socketId; chrome.socket.connect(elem.socket, "ns-server.epita.fr", 4242, function(res) { - if (elem.verbose) - console.log('connected to server'); chrome.socket.read(elem.socket, null, function(rd_inf) { if (rd_inf.resultCode > 0) { - if (elem.verbose) - console.log(ab2str(rd_inf.data)); var data = ab2str(rd_inf.data).split(' '), auth = "ext_user_log "; auth += infos.login + " "; @@ -92,13 +83,8 @@ NsClient.prototype.daemonize = function() { if (rd_inf.resultCode > 0) { var data = ab2str(rd_inf.data); - if (elem.verbose) - console.log("recv: " + data); - if (data.substr(0, 5) === "ping ") { chrome.socket.write(elem.socket, rd_inf.data, function(w_inf) { - if (elem.verbose) - console.log("sent: " + data); chrome.socket.read(elem.socket, null, this); }); } @@ -114,20 +100,20 @@ NsClient.prototype.daemonize = function() { }; NsClient.prototype.updateStatus = function() { + var status_txt = document.getElementById("status_txt"); + console.log(status_txt); + if (this.is_connected) { + if (status_txt !== null) + status_txt.innerHTML = this.state; + var status_msg = "user_cmd state "; status_msg += this.state + ":"; status_msg += Math.round(new Date().getTime() / 1000) + "\n"; chrome.socket.write(this.socket, str2ab(status_msg), function(w_inf) {}); } else { - console.warn("not connected"); - } -}; - -NsClient.prototype.recv = function() { - if (this.is_connected) { - } else { - console.warn("not connected"); + if (status_txt !== null) + status_txt.innerHTML = 'disconnected'; } }; @@ -144,14 +130,12 @@ NsClient.prototype.changeStatus = function(new_status) { }; NsClient.prototype.init = function() { - var upd = function(elem) { + var status_update = function(elem) { return function() { - if (elem.is_connected) { - elem.updateStatus(); - } + elem.updateStatus(); }; }, - con = function(elem) { + connect = function(elem) { return function() { if (!elem.is_connected) { elem.connect(); @@ -159,7 +143,8 @@ NsClient.prototype.init = function() { }; }; - con(this).apply(); - setInterval(con(this), 10000); - setInterval(upd(this), 600000); + status_update(this).apply(); + connect(this).apply(); + setInterval(connect(this), 10000); + setInterval(status_update(this), 600000); }; diff --git a/manifest.json b/manifest.json index 725500f..488ba64 100644 --- a/manifest.json +++ b/manifest.json @@ -1,17 +1,12 @@ { "name": "chromesoul", - "version": "0.1.1", + "version": "0.2.1", "manifest_version": 2, "offline_enabled": false, "description": "A minimalist NetSoul client.", - "options_page": "options.html", "app": { "background": { - "scripts": ["third-party/md5-min.js", - "third-party/ab-str.js", - "lib/ns_client.js", - "background.js" - ] + "scripts": ["background.js"] } }, "permissions": [ diff --git a/options.html b/options.html deleted file mode 100644 index 05e9367..0000000 --- a/options.html +++ /dev/null @@ -1,16 +0,0 @@ - - - - -