Skip to content

Commit ec1832b

Browse files
feat(ironrdp-web): iron-remote-desktop helper crate for remote desktop WASM modules (#755)
1 parent 178670b commit ec1832b

17 files changed

Lines changed: 748 additions & 252 deletions

File tree

Cargo.lock

Lines changed: 13 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
[package]
2+
name = "iron-remote-desktop"
3+
version = "0.1.0"
4+
edition.workspace = true
5+
license.workspace = true
6+
homepage.workspace = true
7+
repository.workspace = true
8+
authors.workspace = true
9+
keywords.workspace = true
10+
categories.workspace = true
11+
12+
[features]
13+
panic_hook = ["dep:console_error_panic_hook"]
14+
15+
[dependencies]
16+
# WASM
17+
wasm-bindgen = "0.2"
18+
web-sys = { version = "0.3", features = ["HtmlCanvasElement"] }
19+
tracing-web = "0.1"
20+
21+
# The `console_error_panic_hook` crate provides better debugging of panics by
22+
# logging them with `console.error`. This is great for development, but requires
23+
# all the `std::fmt` and `std::panicking` infrastructure, so isn't great for
24+
# code size when deploying.
25+
console_error_panic_hook = { version = "0.1", optional = true }
26+
27+
# Logging
28+
tracing = { version = "0.1", features = ["log"] }
29+
tracing-subscriber = { version = "0.3", features = ["time"] }
30+
31+
[lints]
32+
workspace = true
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
use wasm_bindgen::JsValue;
2+
use web_sys::js_sys;
3+
4+
pub trait ClipboardTransaction {
5+
type ClipboardContent: ClipboardContent;
6+
7+
fn init() -> Self;
8+
fn add_content(&mut self, content: Self::ClipboardContent);
9+
fn is_empty(&self) -> bool;
10+
fn contents(&self) -> js_sys::Array;
11+
}
12+
13+
pub trait ClipboardContent {
14+
fn new_text(mime_type: &str, text: &str) -> Self;
15+
fn new_binary(mime_type: &str, binary: &[u8]) -> Self;
16+
fn mime_type(&self) -> &str;
17+
fn value(&self) -> JsValue;
18+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#[derive(Debug)]
2+
pub enum CursorStyle {
3+
Default,
4+
Hidden,
5+
Url {
6+
data: String,
7+
hotspot_x: u16,
8+
hotspot_y: u16,
9+
},
10+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
use wasm_bindgen::prelude::*;
2+
3+
pub trait IronError {
4+
fn backtrace(&self) -> String;
5+
fn kind(&self) -> IronErrorKind;
6+
}
7+
8+
#[derive(Clone, Copy)]
9+
#[wasm_bindgen]
10+
pub enum IronErrorKind {
11+
/// Catch-all error kind
12+
General,
13+
/// Incorrect password used
14+
WrongPassword,
15+
/// Unable to login to machine
16+
LogonFailure,
17+
/// Insufficient permission, server denied access
18+
AccessDenied,
19+
/// Something wrong happened when sending or receiving the RDCleanPath message
20+
RDCleanPath,
21+
/// Couldn’t connect to proxy
22+
ProxyConnect,
23+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
pub trait DeviceEvent {
2+
fn mouse_button_pressed(button: u8) -> Self;
3+
fn mouse_button_released(button: u8) -> Self;
4+
fn mouse_move(x: u16, y: u16) -> Self;
5+
fn wheel_rotations(vertical: bool, rotation_units: i16) -> Self;
6+
fn key_pressed(scancode: u16) -> Self;
7+
fn key_released(scancode: u16) -> Self;
8+
fn unicode_pressed(unicode: char) -> Self;
9+
fn unicode_released(unicode: char) -> Self;
10+
}
11+
12+
pub trait InputTransaction {
13+
type DeviceEvent: DeviceEvent;
14+
15+
fn init() -> Self;
16+
fn add_event(&mut self, event: Self::DeviceEvent);
17+
}

0 commit comments

Comments
 (0)