|
|
@ -4,7 +4,7 @@ const Gio = imports.gi.Gio;
|
|
|
|
const Extension = imports.misc.extensionUtils.getCurrentExtension();
|
|
|
|
const Extension = imports.misc.extensionUtils.getCurrentExtension();
|
|
|
|
const Dialog = Extension.imports.dialog;
|
|
|
|
const Dialog = Extension.imports.dialog;
|
|
|
|
const Menu = Extension.imports.menu;
|
|
|
|
const Menu = Extension.imports.menu;
|
|
|
|
const ConnectionMonitor = Extension.imports.cmonitor;
|
|
|
|
//const ConnectionMonitor = Extension.imports.cmonitor;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function init() {
|
|
|
|
function init() {
|
|
|
@ -16,7 +16,7 @@ const FirewallSupport = new Lang.Class({
|
|
|
|
|
|
|
|
|
|
|
|
_init: function() {
|
|
|
|
_init: function() {
|
|
|
|
this.menu = new Menu.FirewallMenu();
|
|
|
|
this.menu = new Menu.FirewallMenu();
|
|
|
|
this.cmon = new ConnectionMonitor.ConnectionMonitor();
|
|
|
|
//this.cmon = new ConnectionMonitor.ConnectionMonitor();
|
|
|
|
this.handler = null;
|
|
|
|
this.handler = null;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
@ -29,12 +29,12 @@ const FirewallSupport = new Lang.Class({
|
|
|
|
enable: function() {
|
|
|
|
enable: function() {
|
|
|
|
this._destroyHandler();
|
|
|
|
this._destroyHandler();
|
|
|
|
this.handler = new FirewallPromptHandler();
|
|
|
|
this.handler = new FirewallPromptHandler();
|
|
|
|
this.cmon.install();
|
|
|
|
//this.cmon.install();
|
|
|
|
this.menu.install();
|
|
|
|
this.menu.install();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
disable: function() {
|
|
|
|
disable: function() {
|
|
|
|
this.menu.destroy();
|
|
|
|
this.menu.destroy();
|
|
|
|
this.cmon.remove();
|
|
|
|
//this.cmon.remove();
|
|
|
|
this._destroyHandler();
|
|
|
|
this._destroyHandler();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -78,39 +78,48 @@ const FirewallPromptHandler = new Lang.Class({
|
|
|
|
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(FirewallPromptInterface, this);
|
|
|
|
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(FirewallPromptInterface, this);
|
|
|
|
this._dbusImpl.export(Gio.DBus.system, '/com/subgraph/FirewallPrompt');
|
|
|
|
this._dbusImpl.export(Gio.DBus.system, '/com/subgraph/FirewallPrompt');
|
|
|
|
Gio.bus_own_name_on_connection(Gio.DBus.system, 'com.subgraph.FirewallPrompt', Gio.BusNameOwnerFlags.REPLACE, null, null);
|
|
|
|
Gio.bus_own_name_on_connection(Gio.DBus.system, 'com.subgraph.FirewallPrompt', Gio.BusNameOwnerFlags.REPLACE, null, null);
|
|
|
|
this._dialog = null;
|
|
|
|
this._dialogs = new Array();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
destroy: function() {
|
|
|
|
destroy: function() {
|
|
|
|
this._closeDialog();
|
|
|
|
this._closeDialogs();
|
|
|
|
this._dbusImpl.unexport();
|
|
|
|
this._dbusImpl.unexport();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
_closeDialog: function() {
|
|
|
|
_closeDialogs: function() {
|
|
|
|
if (this._dialog) {
|
|
|
|
if (this._dialogs.length > 0) {
|
|
|
|
this._dialog.close();
|
|
|
|
dialog = this._dialogs.shift();
|
|
|
|
this._dialog = null;
|
|
|
|
dialog.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
RequestPromptAsync: function(params, invocation) {
|
|
|
|
RequestPromptAsync: function(params, invocation) {
|
|
|
|
let [app, icon, path, address, port, ip, origin, proto, uid, gid, user, group, pid, sandbox, tlsguard, optstring, expanded, expert, action] = params;
|
|
|
|
let [app, icon, path, address, port, ip, origin, proto, uid, gid, user, group, pid, sandbox, tlsguard, optstring, expanded, expert, action] = params;
|
|
|
|
// this._closeDialog();
|
|
|
|
let cbfn = function(self) {
|
|
|
|
this._dialog = new Dialog.PromptDialog(invocation, (pid >= 0), (sandbox != ""), tlsguard);
|
|
|
|
return function() { return self.onCloseDialog(); }
|
|
|
|
this._invocation = invocation;
|
|
|
|
}(this)
|
|
|
|
this._dialog.update(app, icon, path, address, port, ip, origin, uid, gid, user, group, pid, proto, tlsguard, optstring, sandbox, expanded, expert, action);
|
|
|
|
|
|
|
|
this._dialog.open();
|
|
|
|
let l = this._dialogs.push(new Dialog.PromptDialog(invocation, (pid >= 0), (sandbox != ""), tlsguard, cbfn));
|
|
|
|
|
|
|
|
let dialog = this._dialogs[l-1]
|
|
|
|
|
|
|
|
dialog.update(app, icon, path, address, port, ip, origin, uid, gid, user, group, pid, proto, tlsguard, optstring, sandbox, expanded, expert, action);
|
|
|
|
|
|
|
|
if (this._dialogs.length == 1) {
|
|
|
|
|
|
|
|
dialog.open();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onCloseDialog: function() {
|
|
|
|
|
|
|
|
this._dialogs.shift();
|
|
|
|
|
|
|
|
if (this._dialogs.length > 0) {
|
|
|
|
|
|
|
|
this._dialogs[0].open();
|
|
|
|
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
CloseAsync: function(params, invocation) {
|
|
|
|
CloseAsync: function(params, invocation) {
|
|
|
|
this._closeDialog();
|
|
|
|
this._closeDialogs();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
TestPrompt: function(params, invocation) {
|
|
|
|
TestPrompt: function(params, invocation) {
|
|
|
|
this._closeDialog();
|
|
|
|
this.RequestPromptAsync(["Firefox", "firefox", "/usr/bin/firefox-esr", "242.12.111.18", "443", "linux", "2342", "TCP", true, true], nil);
|
|
|
|
this._dialog = new Dialog.PromptDialog(nil);
|
|
|
|
|
|
|
|
this._dialog.update("Firefox", "firefox", "/usr/bin/firefox-esr", "242.12.111.18", "443", "linux", "2342", "TCP", true, true);
|
|
|
|
|
|
|
|
this._dialog.open();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|