mirror of
https://github.com/UNITRONIX/BetterDesk.git
synced 2026-09-10 01:27:11 +00:00
29d03492fb
Harden native, agent and Docker lifecycle paths with tracked update verification, rollback and preflight checks, safe uninstall semantics, and health verification. Add shared protocol tests, installer CI gates, and lifecycle documentation. Thanks: INSOLVE (Honorary); Marco Jakobs (@jacotec); MyNameisStitch (@MyNameisStitch); Redspin (@playerumpknow)
35 lines
1.4 KiB
JavaScript
35 lines
1.4 KiB
JavaScript
'use strict';
|
|
|
|
const {
|
|
isAllowedSystemdUnitPath,
|
|
normalizeUnitPath,
|
|
resolveSystemdUnitScriptPath,
|
|
privilegedSystemdUnitHint,
|
|
} = require('../lib/linuxSystemdUnitPrivileged');
|
|
|
|
const describeLinux = process.platform === 'linux' ? describe : describe.skip;
|
|
|
|
describeLinux('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');
|
|
});
|
|
});
|