Import packages/plugin/src/client-control.ts

This commit is contained in:
QQ 2026-11-17 08:45:21 +08:00
parent c0a1bbedc4
commit 5ece561234
1 changed files with 4 additions and 0 deletions

View File

@ -300,6 +300,10 @@ export class ClientControl {
if (typeof value.route !== 'string' || !isAllowedPluginRoute(value.route)) {
throw new ClientModeError('INVALID_MESSAGE', 'A valid plugin route is required.')
}
if (value.route === 'api/session/uploadFileBinary'
&& (typeof value.targetDeviceId !== 'string' || this.context.activeRemote()?.target.deviceId !== value.targetDeviceId)) {
throw new ClientModeError('REMOTE_NOT_CONNECTED', 'The selected upload Host changed. Select the file again.')
}
if (!isRecord(value.body)) throw new ClientModeError('INVALID_MESSAGE', 'A plugin route body object is required.')
return ok(await this.context.pluginRoute(value.route, value.body, signal))
}