mirror of
https://github.com/rustdesk/rustdesk.git
synced 2024-11-27 23:19:02 +08:00
feat: support hot,key specification in portable file name
This commit is contained in:
parent
d465792d41
commit
c8c726b565
@ -26,6 +26,9 @@ pub type NotifyMessageBox = fn(String, String, String, String) -> dyn Future<Out
|
||||
pub const CLIPBOARD_NAME: &'static str = "clipboard";
|
||||
pub const CLIPBOARD_INTERVAL: u64 = 333;
|
||||
|
||||
// the executable name of the portable version
|
||||
pub const PORTABLE_APPNAME_RUNTIME_ENV_KEY: &str = "RUSTDESK_APPNAME";
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
pub static ref CONTENT: Arc<Mutex<String>> = Default::default();
|
||||
pub static ref SOFTWARE_UPDATE_URL: Arc<Mutex<String>> = Default::default();
|
||||
|
@ -1,4 +1,5 @@
|
||||
use super::{CursorData, ResultType};
|
||||
use crate::common::PORTABLE_APPNAME_RUNTIME_ENV_KEY;
|
||||
use crate::ipc;
|
||||
use crate::license::*;
|
||||
use hbb_common::{
|
||||
@ -1333,7 +1334,12 @@ fn get_reg_of(subkey: &str, name: &str) -> String {
|
||||
}
|
||||
|
||||
fn get_license_from_exe_name() -> ResultType<License> {
|
||||
let exe = std::env::current_exe()?.to_str().unwrap_or("").to_owned();
|
||||
let mut exe = std::env::current_exe()?.to_str().unwrap_or("").to_owned();
|
||||
// if defined portable appname entry, replace original executable name with it.
|
||||
if let Ok(portable_exe) = std::env::var(PORTABLE_APPNAME_RUNTIME_ENV_KEY) {
|
||||
exe = portable_exe;
|
||||
log::debug!("update portable executable name to {}", exe);
|
||||
}
|
||||
get_license_from_string(&exe)
|
||||
}
|
||||
|
||||
|
@ -141,6 +141,11 @@ pub fn has_rendezvous_service() -> bool {
|
||||
pub fn get_license() -> String {
|
||||
#[cfg(windows)]
|
||||
if let Some(lic) = crate::platform::windows::get_license() {
|
||||
#[cfg(feature = "flutter")]
|
||||
{
|
||||
return format!("Key: {}\nHost: {}\nApi: {}", lic.key, lic.host, lic.api);
|
||||
}
|
||||
// default license format is html formed (sciter)
|
||||
return format!(
|
||||
"<br /> Key: {} <br /> Host: {} Api: {}",
|
||||
lic.key, lic.host, lic.api
|
||||
|
Loading…
Reference in New Issue
Block a user