mirror of
https://github.com/rustdesk/rustdesk.git
synced 2024-12-14 03:36:59 +08:00
afa00df941
Signed-off-by: Tomasz Boguszewski <tomekboguszewski1@gmail.com>
29 lines
770 B
Rust
29 lines
770 B
Rust
mod license;
|
|
use base64::{engine::general_purpose::URL_SAFE_NO_PAD, Engine as _};
|
|
use hbb_common::ResultType;
|
|
use license::*;
|
|
|
|
fn gen_name(lic: &License) -> ResultType<String> {
|
|
let tmp = URL_SAFE_NO_PAD.encode(&serde_json::to_vec(lic)?);
|
|
Ok(tmp.chars().rev().collect())
|
|
}
|
|
|
|
fn main() {
|
|
let args: Vec<_> = std::env::args().skip(1).collect();
|
|
let api = args.get(2).cloned().unwrap_or_default();
|
|
if args.len() >= 2 {
|
|
println!(
|
|
"rustdesk-licensed-{}.exe",
|
|
gen_name(&License {
|
|
key: args[0].clone(),
|
|
host: args[1].clone(),
|
|
api,
|
|
})
|
|
.unwrap()
|
|
);
|
|
}
|
|
if args.len() == 1 {
|
|
println!("{:?}", get_license_from_string(&args[0]));
|
|
}
|
|
}
|