mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2026-11-24 15:56:13 -05:00
feat: implement GUI restart functionality and update related routes
This commit is contained in:
5 files changed
+62
-10
No files matched your search
@@ -19,7 +19,10 @@ use axum::{
|
||||
use common::binary_paths;
|
||||
use futures::{SinkExt, StreamExt};
|
||||
use gpapi::{
|
||||
service::{event::WsEvent, request::UpdateGuiRequest},
|
||||
service::{
|
||||
event::WsEvent,
|
||||
request::{RestartGuiRequest, UpdateGuiRequest},
|
||||
},
|
||||
utils::checksum::verify_checksum,
|
||||
};
|
||||
use log::{info, warn};
|
||||
@@ -37,6 +40,17 @@ pub(crate) async fn active_gui(State(ctx): State<Arc<WsServerContext>>) -> impl
|
||||
ctx.send_event(WsEvent::ActiveGui).await;
|
||||
}
|
||||
|
||||
pub(crate) async fn restart_gui(State(ctx): State<Arc<WsServerContext>>, body: Bytes) -> Result<(), StatusCode> {
|
||||
if let Err(err) = ctx.decrypt::<RestartGuiRequest>(body.to_vec()) {
|
||||
warn!("Failed to decrypt restart GUI payload: {}", err);
|
||||
return Err(StatusCode::BAD_REQUEST);
|
||||
}
|
||||
|
||||
ctx.request_gui_restart();
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn update_gui(State(ctx): State<Arc<WsServerContext>>, body: Bytes) -> Result<(), StatusCode> {
|
||||
let payload = match ctx.decrypt::<UpdateGuiRequest>(body.to_vec()) {
|
||||
Ok(payload) => payload,
|
||||
|
||||
Reference in new issue
Block a user