fixes
Some checks failed
CI / Check (pull_request) Has been cancelled
CI / Format (pull_request) Has been cancelled
CI / Clippy (pull_request) Has been cancelled
CI / Build (macos-latest) (pull_request) Has been cancelled
CI / Build (ubuntu-latest) (pull_request) Has been cancelled
CI / Build (windows-latest) (pull_request) Has been cancelled
Some checks failed
CI / Check (pull_request) Has been cancelled
CI / Format (pull_request) Has been cancelled
CI / Clippy (pull_request) Has been cancelled
CI / Build (macos-latest) (pull_request) Has been cancelled
CI / Build (ubuntu-latest) (pull_request) Has been cancelled
CI / Build (windows-latest) (pull_request) Has been cancelled
This commit is contained in:
@@ -264,11 +264,16 @@ pub struct TdClient {
|
||||
#[allow(dead_code)]
|
||||
impl TdClient {
|
||||
pub fn new() -> Self {
|
||||
let api_id: i32 = env::var("API_ID")
|
||||
.unwrap_or_else(|_| "0".to_string())
|
||||
.parse()
|
||||
.unwrap_or(0);
|
||||
let api_hash = env::var("API_HASH").unwrap_or_default();
|
||||
// Загружаем credentials из ~/.config/tele-tui/credentials или .env
|
||||
let (api_id, api_hash) = match crate::config::Config::load_credentials() {
|
||||
Ok(creds) => creds,
|
||||
Err(err_msg) => {
|
||||
eprintln!("\n{}\n", err_msg);
|
||||
// Используем дефолтные значения, чтобы приложение запустилось
|
||||
// Пользователь увидит сообщение об ошибке в UI
|
||||
(0, String::new())
|
||||
}
|
||||
};
|
||||
|
||||
let client_id = tdlib_rs::create_client();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user