fix license migration
This commit is contained in:
parent
12e565fb03
commit
f000e05267
@ -1067,12 +1067,10 @@ if exist \"{tmp_path}\\{app_name} Tray.lnk\" del /f /q \"{tmp_path}\\{app_name}
|
||||
};
|
||||
|
||||
// potential bug here: if run_cmd cancelled, but config file is changed.
|
||||
if let Ok(lic) = crate::platform::windows::get_license_from_exe_name() {
|
||||
if !lic.host.is_empty() {
|
||||
Config::set_option("key".into(), lic.key);
|
||||
Config::set_option("custom-rendezvous-server".into(), lic.host);
|
||||
Config::set_option("api-server".into(), lic.api);
|
||||
}
|
||||
if let Some(lic) = get_license() {
|
||||
Config::set_option("key".into(), lic.key);
|
||||
Config::set_option("custom-rendezvous-server".into(), lic.host);
|
||||
Config::set_option("api-server".into(), lic.api);
|
||||
}
|
||||
|
||||
let cmds = format!(
|
||||
@ -2342,3 +2340,19 @@ pub fn alloc_console() {
|
||||
alloc_console_and_redirect();
|
||||
}
|
||||
}
|
||||
|
||||
fn get_license() -> Option<License> {
|
||||
let mut lic: License = Default::default();
|
||||
if let Ok(tmp) = get_license_from_exe_name() {
|
||||
lic = tmp;
|
||||
} else {
|
||||
// for back compatibility from migrating from <= 1.2.1 to 1.2.2
|
||||
lic.key = get_reg("Key");
|
||||
lic.host = get_reg("Host");
|
||||
lic.api = get_reg("Api");
|
||||
}
|
||||
if lic.key.is_empty() || lic.host.is_empty() {
|
||||
return None;
|
||||
}
|
||||
Some(lic)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user