mirror of
https://github.com/by-sonic/tglock.git
synced 2026-11-05 15:21:55 +03:00
fix(gui): return a result from asynchronous stop command
This commit is contained in:
@@ -14,7 +14,7 @@ jobs:
|
|||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v6
|
||||||
- uses: dtolnay/rust-toolchain@1.88.0
|
- uses: dtolnay/rust-toolchain@stable
|
||||||
with:
|
with:
|
||||||
components: clippy
|
components: clippy
|
||||||
- name: Lint CLI and core
|
- name: Lint CLI and core
|
||||||
|
|||||||
+2
-2
@@ -266,7 +266,7 @@ async fn start_proxy(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
async fn stop_proxy(state: State<'_, AppState>) -> StatusSnapshot {
|
async fn stop_proxy(state: State<'_, AppState>) -> Result<StatusSnapshot, String> {
|
||||||
let mut task = state.task.lock().await;
|
let mut task = state.task.lock().await;
|
||||||
state.stats.stop();
|
state.stats.stop();
|
||||||
if let Some(worker) = task.take() {
|
if let Some(worker) = task.take() {
|
||||||
@@ -275,7 +275,7 @@ async fn stop_proxy(state: State<'_, AppState>) -> StatusSnapshot {
|
|||||||
*state.active_listen.lock().unwrap() = None;
|
*state.active_listen.lock().unwrap() = None;
|
||||||
*state.started_at.lock().unwrap() = None;
|
*state.started_at.lock().unwrap() = None;
|
||||||
state.log("Защита выключена", false);
|
state.log("Защита выключена", false);
|
||||||
state.snapshot()
|
Ok(state.snapshot())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn telegram_link(state: &AppState) -> Result<String, String> {
|
fn telegram_link(state: &AppState) -> Result<String, String> {
|
||||||
|
|||||||
Reference in New Issue
Block a user