This commit is contained in:
rustdesk 2024-02-26 18:12:28 +08:00
parent c8392a714c
commit 2217e5303d

View File

@ -1,9 +1,9 @@
mod license; mod custom_server;
use base64::{engine::general_purpose::URL_SAFE_NO_PAD, Engine as _}; use base64::{engine::general_purpose::URL_SAFE_NO_PAD, Engine as _};
use hbb_common::ResultType; use hbb_common::ResultType;
use license::*; use custom_server::*;
fn gen_name(lic: &License) -> ResultType<String> { fn gen_name(lic: &CustomServer) -> ResultType<String> {
let tmp = URL_SAFE_NO_PAD.encode(&serde_json::to_vec(lic)?); let tmp = URL_SAFE_NO_PAD.encode(&serde_json::to_vec(lic)?);
Ok(tmp.chars().rev().collect()) Ok(tmp.chars().rev().collect())
} }
@ -13,17 +13,17 @@ fn main() {
let api = args.get(2).cloned().unwrap_or_default(); let api = args.get(2).cloned().unwrap_or_default();
let relay = args.get(3).cloned().unwrap_or_default(); let relay = args.get(3).cloned().unwrap_or_default();
if args.len() >= 2 { if args.len() >= 2 {
match gen_name(&License { match gen_name(&CustomServer {
key: args[0].clone(), key: args[0].clone(),
host: args[1].clone(), host: args[1].clone(),
api, api,
relay, relay,
}) { }) {
Ok(name) => println!("rustdesk-licensed-{}.exe", name), Ok(name) => println!("rustdesk-custom_serverd-{}.exe", name),
Err(e) => println!("{:?}", e), Err(e) => println!("{:?}", e),
} }
} }
if args.len() == 1 { if args.len() == 1 {
println!("{:?}", get_license_from_string(&args[0])); println!("{:?}", get_custom_server_from_string(&args[0]));
} }
} }