File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ pub fn app(state: Arc<AppState>) -> Router {
28
28
. route ( "/" , get ( index) )
29
29
. route ( "/config" , get ( get_config) . post ( set_config) )
30
30
. route ( "/download" , get ( download_handler) )
31
+ . route ( "/restart" , get ( restart_handler) )
31
32
. with_state ( state)
32
33
}
33
34
@@ -45,6 +46,15 @@ fn generate_filename() -> String {
45
46
now. format ( "%Y%m%d%H%M%S_aa-proxy-rs.log" ) . to_string ( )
46
47
}
47
48
49
+ async fn restart_handler ( State ( state) : State < Arc < AppState > > ) -> impl IntoResponse {
50
+ state. config . write ( ) . await . restart_requested = true ;
51
+
52
+ Response :: builder ( )
53
+ . status ( StatusCode :: OK )
54
+ . body ( Body :: from ( "Restart has been requested" ) )
55
+ . unwrap ( )
56
+ }
57
+
48
58
async fn download_handler (
49
59
State ( state) : State < Arc < AppState > > ,
50
60
Query ( params) : Query < HashMap < String , String > > ,
Original file line number Diff line number Diff line change @@ -24,6 +24,9 @@ <h3>🛸 aa-proxy-rs</h3>
24
24
< tr >
25
25
< td colspan ="2 ">
26
26
< button type ="button " id ="downloadBtn "> 📥 Download log</ button >
27
+ < button type ="button " onclick ="window.location.href='/restart' ">
28
+ 🧬 Apply / restart
29
+ </ button >
27
30
</ td >
28
31
</ tr >
29
32
< tr >
You can’t perform that action at this time.
0 commit comments