mirror of
https://github.com/UNITRONIX/BetterDesk.git
synced 2026-09-10 09:35:39 +00:00
b787ad9996
Replace invalid prototype getter syntax in local-files.js and mesh-files.js so the file transfer modal loads in browsers. Panel updates patch betterdesk-server.service via a passwordless-sudo helper instead of interactive sudo tee. Refs #217
33 lines
1.4 KiB
JavaScript
33 lines
1.4 KiB
JavaScript
'use strict';
|
|
|
|
const {
|
|
isAllowedSystemdUnitPath,
|
|
normalizeUnitPath,
|
|
resolveSystemdUnitScriptPath,
|
|
privilegedSystemdUnitHint,
|
|
} = require('../lib/linuxSystemdUnitPrivileged');
|
|
|
|
describe('linuxSystemdUnitPrivileged', () => {
|
|
test('allows BetterDesk systemd unit paths only', () => {
|
|
expect(isAllowedSystemdUnitPath('/etc/systemd/system/betterdesk-server.service')).toBe(true);
|
|
expect(isAllowedSystemdUnitPath('/etc/systemd/system/betterdesk-console.service')).toBe(true);
|
|
expect(isAllowedSystemdUnitPath('/etc/systemd/system/sshd.service')).toBe(false);
|
|
expect(isAllowedSystemdUnitPath('/tmp/betterdesk-server.service')).toBe(false);
|
|
});
|
|
|
|
test('normalizeUnitPath resolves absolute paths', () => {
|
|
expect(normalizeUnitPath('/etc/systemd/system/betterdesk-server.service'))
|
|
.toBe('/etc/systemd/system/betterdesk-server.service');
|
|
expect(normalizeUnitPath('relative/path')).toBeNull();
|
|
});
|
|
|
|
test('resolveSystemdUnitScriptPath points at helper script', () => {
|
|
const script = resolveSystemdUnitScriptPath('/opt/betterdesk/web-nodejs');
|
|
expect(script).toContain('linux-write-systemd-unit.js');
|
|
});
|
|
|
|
test('privilegedSystemdUnitHint mentions linux-ensure-console-user.js', () => {
|
|
expect(privilegedSystemdUnitHint()).toContain('linux-ensure-console-user.js');
|
|
});
|
|
});
|