[COMPLETE] MTP-MIGRATION [Some errors to be found]
This commit is contained in:
parent
bc43ee43e4
commit
ee0202d56a
10 changed files with 283 additions and 198 deletions
|
|
@ -15,7 +15,8 @@ static UNIQUE: Lazy<Mutex<bool>> = Lazy::new(|| Mutex::new(false));
|
|||
pub async fn load_from_tu(username: &str) -> Result<(), ()> {
|
||||
let file_content = load_file("", &format!("{}.tu", username));
|
||||
let segments = file_content.split("::").collect::<Vec<&str>>();
|
||||
let uuid = segments[0].parse::<i64>().unwrap_or(0);
|
||||
let (uuid_str, _omega_host) = segments[0].split_once('@').unwrap_or((segments[0], ""));
|
||||
let uuid = uuid_str.parse::<i64>().unwrap_or(0);
|
||||
let b64_private_key = segments[1];
|
||||
|
||||
let keyring = keyring_from_base64(b64_private_key).unwrap();
|
||||
|
|
|
|||
|
|
@ -50,6 +50,14 @@ impl ConfigUtil {
|
|||
self.config["port"].as_u16().unwrap_or(1984)
|
||||
}
|
||||
|
||||
pub fn get_omikron_host(&self) -> Option<String> {
|
||||
self.config["omikron_host"].as_str().map(String::from)
|
||||
}
|
||||
|
||||
pub fn get_omikron_port(&self) -> Option<u16> {
|
||||
self.config["omikron_port"].as_u16()
|
||||
}
|
||||
|
||||
pub fn get_keyring(&self) -> Option<String> {
|
||||
self.config["keyring"].as_str().map(String::from)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue