don't remove request from state until after re-hiding window
This commit is contained in:
parent
51fcccafa2
commit
f522674a1c
2
src-tauri/Cargo.lock
generated
2
src-tauri/Cargo.lock
generated
@ -1040,7 +1040,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "creddy"
|
name = "creddy"
|
||||||
version = "0.2.3"
|
version = "0.3.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"argon2",
|
"argon2",
|
||||||
"auto-launch",
|
"auto-launch",
|
||||||
|
@ -116,6 +116,8 @@ pub enum SendResponseError {
|
|||||||
NotFound,
|
NotFound,
|
||||||
#[error("The specified request was already closed by the client")]
|
#[error("The specified request was already closed by the client")]
|
||||||
Abandoned,
|
Abandoned,
|
||||||
|
#[error("A response has already been received for the specified request")]
|
||||||
|
Fulfilled,
|
||||||
#[error("Could not renew AWS sesssion: {0}")]
|
#[error("Could not renew AWS sesssion: {0}")]
|
||||||
SessionRenew(#[from] GetSessionError),
|
SessionRenew(#[from] GetSessionError),
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ pub struct AppState {
|
|||||||
pub config: RwLock<AppConfig>,
|
pub config: RwLock<AppConfig>,
|
||||||
pub session: RwLock<Session>,
|
pub session: RwLock<Session>,
|
||||||
pub request_count: RwLock<u64>,
|
pub request_count: RwLock<u64>,
|
||||||
pub open_requests: RwLock<HashMap<u64, Sender<ipc::Approval>>>,
|
pub open_requests: RwLock<HashMap<u64, Option<Sender<ipc::Approval>>>>,
|
||||||
pub pending_terminal_request: RwLock<bool>,
|
pub pending_terminal_request: RwLock<bool>,
|
||||||
pub bans: RwLock<std::collections::HashSet<Option<Client>>>,
|
pub bans: RwLock<std::collections::HashSet<Option<Client>>>,
|
||||||
server: RwLock<Server>,
|
server: RwLock<Server>,
|
||||||
@ -92,7 +92,7 @@ impl AppState {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let mut open_requests = self.open_requests.write().await;
|
let mut open_requests = self.open_requests.write().await;
|
||||||
open_requests.insert(*count, chan); // `count` is the request id
|
open_requests.insert(*count, Some(chan)); // `count` is the request id
|
||||||
*count
|
*count
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,11 +113,11 @@ impl AppState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let mut open_requests = self.open_requests.write().await;
|
let mut open_requests = self.open_requests.write().await;
|
||||||
let chan = open_requests
|
let req = open_requests
|
||||||
.remove(&response.id)
|
.get_mut(&response.id)
|
||||||
.ok_or(SendResponseError::NotFound)
|
.ok_or(SendResponseError::NotFound)?;
|
||||||
?;
|
|
||||||
|
|
||||||
|
let chan = req.take().ok_or(SendResponseError::Fulfilled)?;
|
||||||
chan.send(response.approval)
|
chan.send(response.approval)
|
||||||
.map_err(|_e| SendResponseError::Abandoned)
|
.map_err(|_e| SendResponseError::Abandoned)
|
||||||
}
|
}
|
||||||
|
2
todo.md
2
todo.md
@ -6,6 +6,7 @@
|
|||||||
* Additional hotkey configuration (approve/deny at the very least)
|
* Additional hotkey configuration (approve/deny at the very least)
|
||||||
* Logging
|
* Logging
|
||||||
* Icon
|
* Icon
|
||||||
|
* Auto-updates
|
||||||
* SSH key handling
|
* SSH key handling
|
||||||
|
|
||||||
## Maybe
|
## Maybe
|
||||||
@ -14,3 +15,4 @@
|
|||||||
* Rehide after terminal launch from locked
|
* Rehide after terminal launch from locked
|
||||||
* Generalize Request across both credentials and terminal launch?
|
* Generalize Request across both credentials and terminal launch?
|
||||||
* Make hotkey configuration a little more tolerant of slight mistiming
|
* Make hotkey configuration a little more tolerant of slight mistiming
|
||||||
|
* Distinguish between request that was denied and request that was canceled (e.g. due to error)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user