@@ -23,9 +23,7 @@ <h3>🛸 aa-proxy-rs</h3>
23
23
</ tr >
24
24
< tr >
25
25
< td colspan ="2 ">
26
- < button type ="button " onclick ="window.location.href='/download' ">
27
- 📥 Download log
28
- </ button >
26
+ < button type ="button " id ="downloadBtn "> 📥 Download log</ button >
29
27
</ td >
30
28
</ tr >
31
29
< tr >
@@ -67,7 +65,7 @@ <h3>🛸 aa-proxy-rs</h3>
67
65
< td > < label for ="webserver "> webserver</ label > </ td >
68
66
< td >
69
67
< input type ="text " id ="webserver " /> < br /> < small >
70
- Webserver bind address/port, empty = disabled</ small
68
+ Webserver bind address/port, empty = disabled</ small
71
69
>
72
70
</ td >
73
71
</ tr >
@@ -307,6 +305,20 @@ <h3>🛸 aa-proxy-rs</h3>
307
305
</ form >
308
306
309
307
< script >
308
+ // button event listener
309
+ document . getElementById ( "downloadBtn" ) . addEventListener ( "click" , ( ) => {
310
+ const now = new Date ( ) ;
311
+ const filename =
312
+ `${ now . getFullYear ( ) } ` +
313
+ `${ String ( now . getMonth ( ) + 1 ) . padStart ( 2 , "0" ) } ` +
314
+ `${ String ( now . getDate ( ) ) . padStart ( 2 , "0" ) } ` +
315
+ `${ String ( now . getHours ( ) ) . padStart ( 2 , "0" ) } ` +
316
+ `${ String ( now . getMinutes ( ) ) . padStart ( 2 , "0" ) } ` +
317
+ `${ String ( now . getSeconds ( ) ) . padStart ( 2 , "0" ) } ` +
318
+ `_aa-proxy-rs.log` ;
319
+ window . location . href = `/download?filename=${ encodeURIComponent ( filename ) } ` ;
320
+ } ) ;
321
+
310
322
function setValue ( id , value ) {
311
323
const el = document . getElementById ( id ) ;
312
324
if ( ! el ) return ;
0 commit comments