| 135 | } |
| 136 | |
| 137 | pub async fn get_data( |
| 138 | url: &str, |
| 139 | app: Option<&tauri::AppHandle>, |
| 140 | ) -> Result<Option<String>, reqwest::Error> { |
| 141 | let res = reqwest::get(url).await?; |
| 142 | let is_ok = res.status() == 200; |
| 143 | let body = res.text().await?; |
| 144 | |
| 145 | if is_ok { |
| 146 | Ok(Some(body)) |
| 147 | } else { |
| 148 | error!("chatgpt_http: {}", body); |
| 149 | if let Some(v) = app { |
| 150 | tauri::api::dialog::message(v.get_window("core").as_ref(), "ChatGPT HTTP", body); |
| 151 | } |
| 152 | Ok(None) |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | pub fn run_check_update(app: AppHandle<Wry>, silent: bool, has_msg: Option<bool>) { |
| 157 | info!("run_check_update: silent={} has_msg={:?}", silent, has_msg); |