mirror of
https://github.com/netbirdio/IronRDP.git
synced 2026-05-22 18:43:12 -07:00
feat(iron-remote-desktop): introduce callExtension method in iron-remote-desktop API (#799)
This commit is contained in:
@@ -190,9 +190,11 @@ macro_rules! make_bridge {
|
||||
|
||||
#[wasm_bindgen(js_name = extensionCall)]
|
||||
pub fn extension_call(
|
||||
&self,
|
||||
ext: $crate::Extension,
|
||||
) -> Result<$crate::internal::wasm_bindgen::JsValue, IronError> {
|
||||
<<$api as $crate::RemoteDesktopApi>::Session as $crate::Session>::extension_call(ext).map_err(IronError)
|
||||
<<$api as $crate::RemoteDesktopApi>::Session as $crate::Session>::extension_call(&self.0, ext)
|
||||
.map_err(IronError)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ pub trait Session {
|
||||
|
||||
fn supports_unicode_keyboard_shortcuts(&self) -> bool;
|
||||
|
||||
fn extension_call(ext: Extension) -> Result<JsValue, Self::Error>;
|
||||
fn extension_call(&self, ext: Extension) -> Result<JsValue, Self::Error>;
|
||||
}
|
||||
|
||||
pub trait SessionTerminationInfo {
|
||||
|
||||
@@ -805,7 +805,7 @@ impl iron_remote_desktop::Session for Session {
|
||||
false
|
||||
}
|
||||
|
||||
fn extension_call(ext: Extension) -> Result<JsValue, Self::Error> {
|
||||
fn extension_call(&self, ext: Extension) -> Result<JsValue, Self::Error> {
|
||||
Err(
|
||||
IronError::from(anyhow::Error::msg(format!("unknown extension: {}", ext.ident())))
|
||||
.with_kind(IronErrorKind::General),
|
||||
|
||||
@@ -4,6 +4,7 @@ import type { SessionEvent } from './session-event';
|
||||
import { ConfigBuilder } from '../services/ConfigBuilder';
|
||||
import type { Config } from '../services/Config';
|
||||
import type { PartialObserver } from 'rxjs';
|
||||
import type { Extension } from './Extension';
|
||||
|
||||
export interface UserInteraction {
|
||||
setVisibility(state: boolean): void;
|
||||
@@ -29,4 +30,6 @@ export interface UserInteraction {
|
||||
resize(width: number, height: number, scale?: number): void;
|
||||
|
||||
setEnableClipboard(enable: boolean): void;
|
||||
|
||||
callExtension(ext: Extension): void;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import type { UserInteraction } from '../interfaces/UserInteraction';
|
||||
import type { ScreenScale } from '../enums/ScreenScale';
|
||||
import { ConfigBuilder } from './ConfigBuilder';
|
||||
import { Config } from './Config';
|
||||
import type { Extension } from '../interfaces/Extension';
|
||||
|
||||
export class PublicAPI {
|
||||
private remoteDesktopService: RemoteDesktopService;
|
||||
@@ -62,6 +63,10 @@ export class PublicAPI {
|
||||
this.remoteDesktopService.setEnableClipboard(enable);
|
||||
}
|
||||
|
||||
private callExtension(ext: Extension) {
|
||||
this.remoteDesktopService.callExtension(ext);
|
||||
}
|
||||
|
||||
getExposedFunctions(): UserInteraction {
|
||||
return {
|
||||
setVisibility: this.setVisibility.bind(this),
|
||||
@@ -78,6 +83,7 @@ export class PublicAPI {
|
||||
setCursorStyleOverride: this.setCursorStyleOverride.bind(this),
|
||||
resize: this.resize.bind(this),
|
||||
setEnableClipboard: this.setEnableClipboard.bind(this),
|
||||
callExtension: this.callExtension.bind(this),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import type { SessionTerminationInfo } from '../interfaces/SessionTerminationInf
|
||||
import type { RemoteDesktopModule } from '../interfaces/RemoteDesktopModule';
|
||||
import { ConfigBuilder } from './ConfigBuilder';
|
||||
import type { Config } from './Config';
|
||||
import type { Extension } from '../interfaces/Extension';
|
||||
|
||||
type OnRemoteClipboardChanged = (data: ClipboardData) => void;
|
||||
type OnRemoteReceivedFormatsList = () => void;
|
||||
@@ -280,6 +281,10 @@ export class RemoteDesktopService {
|
||||
}
|
||||
}
|
||||
|
||||
callExtension(ext: Extension) {
|
||||
this.session?.extensionCall(ext);
|
||||
}
|
||||
|
||||
private releaseAllInputs() {
|
||||
this.session?.releaseAllInputs();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user