mirror of
https://gitlab.com/ryzen-controller-team/ryzen-controller.git
synced 2024-12-22 10:03:28 +07:00
Crossplatform check right.
This commit is contained in:
parent
da100e210a
commit
235b7e77d5
@ -66,16 +66,26 @@ function registerRepeaterForAllInput() {
|
|||||||
* Will display a warning if not.
|
* Will display a warning if not.
|
||||||
*/
|
*/
|
||||||
function checkForAdminRights() {
|
function checkForAdminRights() {
|
||||||
|
if (require('os').platform !== 'win32') {
|
||||||
|
const isRoot = process.getuid && process.getuid() === 0;
|
||||||
|
if (!isRoot) {
|
||||||
|
notification('danger',
|
||||||
|
`Warning: you must launch this app as administrator.<br/>`
|
||||||
|
+ `Use "sudo ryzencontroller" from terminal to fix this.`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
var exec = require('child_process').exec;
|
var exec = require('child_process').exec;
|
||||||
exec('NET SESSION', function(err,so,se) {
|
exec('NET SESSION', function(err,so,se) {
|
||||||
if (se.length !== 0) {
|
if (se.length !== 0) {
|
||||||
notification('warning',
|
notification('warning',
|
||||||
`Warning: you should launch this app as administrator,`
|
`Warning: you should launch this app as administrator, `
|
||||||
+ `ryzenadj.exe doesn't seems to work correctly without administrator rights.`
|
+ `ryzenadj.exe doesn't seems to work correctly without administrator rights.`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will display a notification in ".notification-zone".
|
* Will display a notification in ".notification-zone".
|
||||||
|
Loading…
Reference in New Issue
Block a user