livedesk 0.1.438 → 0.1.439
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/hub/package.json +1 -1
- package/hub/src/remote-hub.js +18 -9
- package/hub/src/server.js +1 -1
- package/package.json +1 -1
package/hub/package.json
CHANGED
package/hub/src/remote-hub.js
CHANGED
|
@@ -29,7 +29,12 @@ const LIVE_STREAM_MIN_FRESH_MS = 3000;
|
|
|
29
29
|
const LIVE_STREAM_MAX_FRESH_MS = 12000;
|
|
30
30
|
const DEFAULT_REMOTE_INPUT_ACK_TIMEOUT_MS = 5000;
|
|
31
31
|
const DEFAULT_LIVE_CAPTURE_STOP_ACK_TIMEOUT_MS = 8000;
|
|
32
|
-
const
|
|
32
|
+
const REMOTE_POLICY_BYPASS_COMMANDS = new Set([
|
|
33
|
+
'ping',
|
|
34
|
+
'stream.stop',
|
|
35
|
+
'audio.stop'
|
|
36
|
+
]);
|
|
37
|
+
const REMOTE_PROTOCOL_VERSION = 2;
|
|
33
38
|
const REMOTE_AGENT_PROTOCOL = 'mindexec.remote.agent';
|
|
34
39
|
const REMOTE_FRAME_PROTOCOL = 'mindexec.remote.frame.v2';
|
|
35
40
|
const REMOTE_FRAME_PROTOCOL_VERSION = 2;
|
|
@@ -1515,12 +1520,16 @@ export function createRemoteHub(options = {}) {
|
|
|
1515
1520
|
}
|
|
1516
1521
|
}
|
|
1517
1522
|
|
|
1518
|
-
function policyError(device, permission = '') {
|
|
1519
|
-
const policy = getDevicePolicy(device);
|
|
1520
|
-
|
|
1521
|
-
if (
|
|
1522
|
-
|
|
1523
|
-
|
|
1523
|
+
function policyError(device, permission = '', command = '') {
|
|
1524
|
+
const policy = getDevicePolicy(device);
|
|
1525
|
+
const commandName = safeString(command, 80);
|
|
1526
|
+
if (policy.accessMode === 'block-remote-access'
|
|
1527
|
+
&& !REMOTE_POLICY_BYPASS_COMMANDS.has(commandName)) {
|
|
1528
|
+
return 'remote-access-blocked-by-settings';
|
|
1529
|
+
}
|
|
1530
|
+
if (permission && policy[permission] === false) {
|
|
1531
|
+
return `${permission}-blocked-by-settings`;
|
|
1532
|
+
}
|
|
1524
1533
|
return '';
|
|
1525
1534
|
}
|
|
1526
1535
|
|
|
@@ -5348,7 +5357,7 @@ export function createRemoteHub(options = {}) {
|
|
|
5348
5357
|
: commandName.startsWith('agent.')
|
|
5349
5358
|
? 'allowAgent'
|
|
5350
5359
|
: '';
|
|
5351
|
-
const denied = policyError(device, requiredPermission);
|
|
5360
|
+
const denied = policyError(device, requiredPermission, commandName);
|
|
5352
5361
|
if (denied) return { ok: false, error: denied };
|
|
5353
5362
|
if (device?.synthetic === true && device.connected) {
|
|
5354
5363
|
const commandId = safeString(command?.commandId, 128) || crypto.randomUUID();
|
|
@@ -6899,7 +6908,7 @@ export function createRemoteHub(options = {}) {
|
|
|
6899
6908
|
if (!device) {
|
|
6900
6909
|
return { ok: false, paused: false, error: 'device-not-found' };
|
|
6901
6910
|
}
|
|
6902
|
-
const denied = policyError(device);
|
|
6911
|
+
const denied = policyError(device, '', 'stream.stop');
|
|
6903
6912
|
if (denied) return { ok: false, paused: false, error: denied };
|
|
6904
6913
|
|
|
6905
6914
|
let pause = device.liveCapturePause;
|
package/hub/src/server.js
CHANGED
|
@@ -4071,7 +4071,7 @@ app.post('/api/remote/devices/:deviceId/live/stop', (req, res) => {
|
|
|
4071
4071
|
res.json(remoteHub.stopLiveStream(req.params.deviceId, req.body || {}));
|
|
4072
4072
|
});
|
|
4073
4073
|
|
|
4074
|
-
app.post('/api/remote/devices/:deviceId/live/pause',
|
|
4074
|
+
app.post('/api/remote/devices/:deviceId/live/pause', async (req, res, next) => {
|
|
4075
4075
|
noStore(res);
|
|
4076
4076
|
try {
|
|
4077
4077
|
res.json(await remoteHub.pauseLiveCapture(req.params.deviceId, req.body || {}));
|