└── README.md /README.md: -------------------------------------------------------------------------------- 1 | # Notes 2 | RustDesk has moved to using Flutter as the UI framework. This guide was written before this change, and parts may be outdated. 3 | 4 | # Customizing RustDesk 5 | Some tips for customizing RustDesk for Windows (other platforms might require additional changes) 6 | 7 | 1. [Changing the application name](#changing-the-application-name) 8 | 2. [Changing the application icons](#changing-the-application-icons) 9 | 3. [Embedding the UI resources](#embedding-ui--enable-inline-builds) 10 | 4. [Embedding sciter.dll](#embedding-sciterdll) 11 | 5. [Toggling the console window](#hide-console-window) 12 | 6. [Hosting your own server](#hosting-your-own-server) 13 | 7. [Using a static encryption key](#using-a-static-encryption-key) 14 | 15 | Following all of these steps will result in a portable single file application that will only utilize your own personal server. 16 | 17 | # Changing the application name 18 | 19 | 1. In ```Cargo.toml``` under the ```[package]``` block, modify the following values 20 | 21 | ``` 22 | [package] 23 | name = "myapp" # your exe name 24 | version = "1.2.0" 25 | authors = ["rustdesk "] 26 | edition = "2021" 27 | build= "build.rs" 28 | description = "A remote control software." 29 | default-run = "myapp" # should be same as name 30 | ``` 31 | 2. Also in ```Cargo.toml``` under the ```[package.metadata.bundle]``` block, modify these values 32 | ``` 33 | [package.metadata.bundle] 34 | name = "My App" # Your app name here 35 | identifier = "com.polarisworkforce.remote" 36 | icon = ["res/32x32.png", "res/128x128.png", "res/128x128@2x.png"] 37 | deb_depends = ["libgtk-3-0", "libxcb-randr0", "libxdo3", "libxfixes3", "libxcb-shape0", "libxcb-xfixes0", "libasound2", "libsystemd0", "pipewire", "curl", "libayatana-appindicator3-1", "libvdpau1", "libva2"] 38 | osx_minimum_system_version = "10.14" 39 | resources = ["res/mac-tray-light.png","res/mac-tray-dark.png"] 40 | ``` 41 | 3. In ```/rustdesk/libs/hbb_common/src/config.rs``` change the *APP_NAME* variable (line 50) 42 | ``` 43 | pub static ref APP_NAME: Arc> = Arc::new(RwLock::new("My App".to_owned())); 44 | ``` 45 | 4. (Optional) Replace 'RustDesk' in any of the language localization files (i.e. ```/rustdesk/src/lang/en.rs```) 46 | 47 | # Changing the application icons 48 | 49 | The icons are stored in a number of locations, which change depending on platform 50 | 51 | There are a few \*.png, \*.svg, and \*.ico files in ```/rustdesk/res```, you can replace those with your own versions. 52 | 53 | There is also a Base64 encoded icon in the source code. Open ```/rustdesk/libs/hbb_common/src/config.rs``` and modify the following lines (starting at line 32) 54 | ``` 55 | // 128x128 56 | #[cfg(target_os = "macos")] // 128x128 on 160x160 canvas, then shrink to 128, mac looks better with padding 57 | pub const ICON: &str = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAMAAAD04JH5AAAAyVBMVEUAAAAAcf8Acf8Acf8Acv8Acf8Acf8Acf8Acf8AcP8Acf8Ab/8AcP8Acf////8AaP/z+f/o8v/k7v/5/v/T5f8AYP/u9v/X6f+hx/+Kuv95pP8Aef/B1/+TwP9xoP8BdP/g6P+Irv9ZmP8Bgf/E3f98q/9sn/+01f+Es/9nm/9Jif8hhv8off/M4P+syP+avP86iP/c7f+xy/9yqf9Om/9hk/9Rjv+60P99tv9fpf88lv8yjf8Tgf8deP+kvP8BiP8NeP8hkP80gP8oj2VLAAAADXRSTlMA7o7qLvnaxZ1FOxYPjH9HWgAABHJJREFUeNrtm+tW4jAQgBfwuu7MtIUWsOUiCCioIIgLiqvr+z/UHq/LJKVkmwTcc/r9E2nzlU4mSTP9lpGRkZGR8VX5cZjfL+yCEXYL+/nDH//U/Pd8DgyTy39Xbv7oIAcWyB0cqbW/sweW2NtRaj8H1sgpGOwUIAH7Bkd7YJW9dXFwAJY5WNP/cmCZQnJvzIN18on5LwfWySXlxEPYAIcad8D6PdiHDbCfIFCADVBIENiFDbCbIACKPPXrZ+cP8E6/0znvP4EymgIEravIRcTxu8HxNSJ60a8W0AYECKrlAN+YwAthCd9wm1Ug6wKzIn5SgRduXfwkqDasCjx0XFzi9PV6zwNcIuhcWBOg+ikySq8C9UD4dEKWBCoOcspvAuLHTo9sCDQiFPHotRM48j8G5gVur1FdAN2uaYEuiz7xF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C3x8lCFlfkMjuz8iLfk6fzQCQgjg8q3ZEd8RzUVuKelBh96Nzcc3qelL1V+2zfRv1xc56Ino3tpdPT7cd//MspfTrD/7R6p4W4O2qLMObfnyIHvvYcrPtkZjDybW7d/eb32Bg/UlHnYXuXz5CMt8rC90sr7Uy/5iN+vL/ewveLS/5NNKwcbyR1r2a3/h8wdY+v3L2tZC5oUvW2uO1M7qyvp/Xv6/48z4CTxjJEfyjEaMAAAAAElFTkSuQmCC 61 | "; 62 | ``` 63 | 64 | [Convert your image to Base64](https://www.base64-image.de/) and then replace the contents of ```ICON``` with your base64 encoded image (it should start with ```data:image/png;base64,``` followed by your image data). Your image should be 128x128 65 | 66 | 67 | # Embedding UI / Enable Inline Builds 68 | In order to include the applicatin's UI resources in the executable, you will need to enable the ```inline``` feature. This compiles the application resources (*src/ui*) into the executable so you do not have to deploy them yourself. 69 | 70 | 1. Enable ```inline``` feature by editing ```Cargo.toml``` 71 | 72 | Under the ```[features]``` block, find this line 73 | 74 | ``` 75 | default = ["use_dasp"] 76 | ``` 77 | 78 | and change it to read 79 | 80 | ``` 81 | default = ["use_dasp", "inline"] 82 | ``` 83 | 84 | 2. Build the UI resources (requires [Python 3](https://www.python.org/downloads/) to be installed) 85 | 86 | Run ```python res/inline-sciter.py``` every time you want to build the UI resources again (i.e. every time you modify the UI) 87 | 88 | If it complains that it cannot find python or the command is unrecognized, you need to install the latest version of [Python 3](https://www.python.org/downloads/) and add it to your PATH environment variable. 89 | 3. Now build and run application via ```cargo run``` or ```cargo build``` 90 | # Embedding Sciter.dll 91 | If you want a single portable executable file, you can either statically link Sciter, or embed the DLL. Statically linking it requires you [license Sciter](https://sciter.com/prices/), which costs money--so I went with embedding the dll. 92 | 93 | 94 | 1. Copy sciter.dll to your project root directory (where Cargo.toml resides) 95 | 2. Add the following lines into ```fn main()``` in src/main.rs (around line 23 or so) 96 | ``` 97 | let bytes = std::include_bytes!("..\\sciter.dll"); 98 | std::fs::write("sciter.dll", bytes.as_slice()); 99 | ``` 100 | Note: Do not remove the "..\\" as main.rs resides in */rustdesk/src*, and will not be able to find the file otherwise. Alternatively you can put ```sciter.dll``` in */rustdesk/src* 101 | 102 | Also please make sure you are putting this in the ```fn main()``` that is targeting Windows, where it specifies 103 | ``` 104 | #[cfg(not(any(target_os = "android", target_os = "ios", feature = "cli")))] 105 | ``` 106 | as there are other ```fn main()``` that target OTHER platforms. 107 | 108 | The function should now look like so: 109 | ``` 110 | #[cfg(not(any(target_os = "android", target_os = "ios", feature = "cli")))] 111 | fn main() { 112 | 113 | //BEGIN CHANGES 114 | //Embed the Sciter.dll file into the exe, and then write it to disk when application starts 115 | println!("================ LOADING SCITER DLLL =================="); 116 | let bytes = std::include_bytes!("..\\sciter.dll"); //since main.rs is in rustdesk/src, we need to go up one level (to rustdesk) 117 | std::fs::write("sciter.dll", bytes.as_slice()); 118 | //END CHANGES 119 | 120 | if !common::global_init() { 121 | return; 122 | } 123 | 124 | if let Some(args) = crate::core_main::core_main().as_mut() { 125 | ui::start(args); 126 | } 127 | common::global_clean(); 128 | } 129 | ``` 130 | 131 | # Hide Console Window 132 | You can toggle the console terminal window by uncommenting line 3 in ```src/main.rs``` 133 | 134 | ```#![windows_subsystem = "windows"]``` 135 | 136 | Comment it out to show console window, uncomment it to hide. 137 | 138 | # Hosting Your Own Server 139 | 140 | [Follow the instructions on RustDesk to host your own server instance](https://rustdesk.com/docs/en/self-host/install/) 141 | 142 | Before proceeding, verify your server works with your existing client, by overriding the ID and Relay Server values in the client. 143 | 144 | [See RustDesk docs for how to do this](https://rustdesk.com/docs/en/self-host/install/#step-3--set-hbbshbbr-address-on-client-side) 145 | 146 | You will also need to specify the public key you generated on your server. Once you have verified your server is working, you can make your changes permanent below. 147 | 148 | Modify ```/rustdesk/libs/hbb_common/src/config.rs```, line 73. Replace the array of *RENDEVOUS_SERVERS* 149 | ``` 150 | pub const RENDEZVOUS_SERVERS: &'static [&'static str] = &[ 151 | "myserver.com" //or the IP address 152 | ]; 153 | ``` 154 | 155 | You might also want to modify ```/rustdesk/src/common.rs``` and swap out the server specified in ```fn check_software_update()``` (line 517) 156 | ``` 157 | let rendezvous_server = 158 | socket_client::get_target_addr(&format!("myserver.com:{}", config::RENDEZVOUS_PORT))?; 159 | ``` 160 | 161 | Please note that if you have values in the ID/Relay fields in the client, they will override these static values, as they are loaded from a config file in ```%APPDATA%/AppName/config/AppName.toml```, where *AppName* is RustDesk or whatever name you customized it with in the [Changing the application name](#changing-the-application-name) section. So you may want to delete this file. 162 | 163 | # Using a static encryption key 164 | If you wish to only allow the public key for your own server, you can hard code it and ignore any config values entirely, preventing the end user from overriding it. Otherwise you can only do Step 1 and ignore the rest. 165 | 166 | 1. Assign the public key (id_ed25519.pub) [generated on your server](https://rustdesk.com/docs/en/self-host/install/#key) to the *RS_PUB_KEY* variable in ```/rustdesk/libs/hbb_common/src/config.rs``` at line 78 167 | ``` 168 | pub const RS_PUB_KEY: &'static str = "your public key goes here"; 169 | ``` 170 | 2. (Optional) Anywhere the key is loaded from config, change it to just point at *RS_PUB_KEY* if you wish to make it permanent 171 | - /rustdesk/src/client.rs (line 426) 172 | ``` 173 | let rs_pk = get_rs_pk(hbb_common::config::RS_PUB_KEY); //remove the if statement and just assign it directly 174 | ``` 175 | - /rustdesk/src/server.rs (line 235) 176 | ``` 177 | let mut licence_key = hbb_common::config::RS_PUB_KEY.to_owned(); //was Config::get_option("key"); 178 | ``` 179 | - /rustdesk/src/platform/windows.rs (line 1356) 180 | ``` 181 | lic.key = hbb_common::config::RS_PUB_KEY.to_owned(); //was get_reg("Key"); 182 | ``` 183 | - /rustdesk/src/ui_session_interface.rs (line 1401) 184 | ``` 185 | let mut key = hbb_common::config::RS_PUB_KEY.to_owned(); //was options.remove("key").unwrap_or("".to_owned()); 186 | ``` 187 | --------------------------------------------------------------------------------