mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-15 07:43:50 +00:00
Added support for fetching system proxy settings from gnome
This commit is contained in:
@@ -444,6 +444,16 @@ int MeshAgent_GetSystemProxy(MeshAgentHostContainer *agent, char *buffer, size_t
|
||||
child.ret = child.stdout.str.trim().split('\\n')[0].split('//')[1];\
|
||||
if(child.ret != '') { return(child.ret); }\
|
||||
}\
|
||||
if (require('fs').existsSync('/usr/bin/gsettings'))\
|
||||
{\
|
||||
var setting;\
|
||||
var ids = require('user-sessions').loginUids(); \
|
||||
for (var i in ids)\
|
||||
{\
|
||||
setting = require('linux-gnome-helpers').getProxySettings(ids[i]);\
|
||||
if (setting.mode == 'manual') { return(setting.host + ':' + setting.port);} \
|
||||
}\
|
||||
}\
|
||||
throw('No Proxy set');\
|
||||
})();";
|
||||
#endif
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -554,6 +554,16 @@ function UserSessions()
|
||||
}
|
||||
return (ret);
|
||||
}
|
||||
this.loginUids = function loginUids()
|
||||
{
|
||||
var min = this.minUid();
|
||||
var child = require('child_process').execFile('/bin/sh', ['sh']);
|
||||
child.stderr.str = ''; child.stderr.on('data', function (chunk) { this.str += chunk.toString(); });
|
||||
child.stdout.str = ''; child.stdout.on('data', function (chunk) { this.str += chunk.toString(); });
|
||||
child.stdin.write('getent passwd | awk -F: \'{ if($3 >= ' + min + ') { a=split($7,b,"/"); if(b[a]!="nologin") { print $3; } }}\' | tr "\\n" "\\," | awk \'{ printf "[%s]", $0; }\'\nexit\n');
|
||||
child.waitExit();
|
||||
return (JSON.parse(child.stdout.str.trim().replace(',]',']')));
|
||||
}
|
||||
this.consoleUid = function consoleUid()
|
||||
{
|
||||
var child = require('child_process').execFile('/bin/sh', ['sh']);
|
||||
|
||||
Reference in New Issue
Block a user