mirror of
https://github.com/Ylianst/MeshAgent
synced 2026-01-08 19:44:06 +00:00
IMproved error message for Xwayland
This commit is contained in:
@@ -1433,6 +1433,7 @@ duk_ret_t ILibDuktape_MeshAgent_getRemoteDesktop(duk_context *ctx)
|
||||
// For Linux, we need to determine where the XAUTHORITY is:
|
||||
char *updateXAuth = NULL;
|
||||
char *updateDisplay = NULL;
|
||||
char *xdm = NULL;
|
||||
int needPop = 0;
|
||||
duk_eval_string(ctx, "require('user-sessions').Self()");
|
||||
int self = duk_get_int(ctx, -1); duk_pop(ctx);
|
||||
@@ -1448,6 +1449,15 @@ duk_ret_t ILibDuktape_MeshAgent_getRemoteDesktop(duk_context *ctx)
|
||||
{
|
||||
updateXAuth = Duktape_GetStringPropertyValue(ctx, -1, "xauthority", NULL);
|
||||
updateDisplay = Duktape_GetStringPropertyValue(ctx, -1, "display", NULL);
|
||||
xdm = Duktape_GetStringPropertyValue(ctx, -1, "xdm", NULL);
|
||||
|
||||
if (strcmp(xdm, "xwayland") == 0)
|
||||
{
|
||||
ILibDuktape_MeshAgent_RemoteDesktop_SendError(ptrs, "This platform is configured to use Xwayland");
|
||||
ILibDuktape_MeshAgent_RemoteDesktop_SendError(ptrs, "please modify config to use Xorg");
|
||||
duk_pop(ctx);
|
||||
return(1);
|
||||
}
|
||||
|
||||
if (console_uid != 0 && updateXAuth == NULL)
|
||||
{
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -419,6 +419,21 @@ function monitorinfo()
|
||||
|
||||
return (ret);
|
||||
}
|
||||
function xinfo_xdm(info, uid)
|
||||
{
|
||||
if (process.platform != 'linux') { return(info); }
|
||||
var child = require('child_process').execFile('/bin/sh', ['sh']);
|
||||
child.stdout.str = '';
|
||||
child.stdout.on('data', function (chunk) { this.str += chunk.toString(); });
|
||||
child.stdin.write("ps -e -o uid -o cmd | grep X | grep " + uid + " | tr '\\n' '`' | awk '{ xl=split($2,x,\"/\"); print x[xl]; }'\nexit\n");
|
||||
child.waitExit();
|
||||
if(child.stdout.str.trim() != '')
|
||||
{
|
||||
if (info == null) { info = {}; }
|
||||
info.xdm = child.stdout.str.trim().toLowerCase();
|
||||
}
|
||||
return (info);
|
||||
}
|
||||
this.getXInfo = function getXInfo(consoleuid)
|
||||
{
|
||||
var ret = null;
|
||||
@@ -454,7 +469,7 @@ function monitorinfo()
|
||||
if(e.XAUTHORITY && e.DISPLAY)
|
||||
{
|
||||
ret = { tty: '?', xauthority: e.XAUTHORITY, display: e.DISPLAY, exportEnv: exportEnv };
|
||||
return (ret);
|
||||
return (xinfo_xdm(ret, consoleuid));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -470,7 +485,7 @@ function monitorinfo()
|
||||
if (e.DISPLAY)
|
||||
{
|
||||
ret = { tty: '?', display: e.DISPLAY, exportEnv: exportEnv };
|
||||
return (ret);
|
||||
return (xinfo_xdm(ret, consoleuid));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -508,7 +523,7 @@ function monitorinfo()
|
||||
if (v[0] == 'DISPLAY')
|
||||
{
|
||||
ret.display = v[1];
|
||||
return (ret);
|
||||
return (xinfo_xdm(ret, consoleuid));
|
||||
}
|
||||
vs = psx + 1;
|
||||
}
|
||||
@@ -516,7 +531,7 @@ function monitorinfo()
|
||||
}
|
||||
}
|
||||
}
|
||||
return (ret);
|
||||
return (xinfo_xdm(ret, consoleuid));
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user