File tree 2 files changed +19
-0
lines changed
2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change 1
1
package main
2
2
3
3
import (
4
+ "log"
5
+
6
+ "github.com/facchinm/go-serial"
7
+ "github.com/facchinm/systray"
4
8
"github.com/gin-gonic/gin"
5
9
)
6
10
@@ -13,3 +17,17 @@ func infoHandler(c *gin.Context) {
13
17
"wss" : "wss://localhost" + portSSL ,
14
18
})
15
19
}
20
+
21
+ func pauseHandler (c * gin.Context ) {
22
+ go func () {
23
+ ports , _ := serial .GetPortsList ()
24
+ for _ , element := range ports {
25
+ spClose (element )
26
+ }
27
+ systray .Quit ()
28
+ * hibernate = true
29
+ log .Println ("Restart becayse setup went wrong?" )
30
+ restart ("" )
31
+ }()
32
+ c .JSON (200 , nil )
33
+ }
Original file line number Diff line number Diff line change @@ -242,6 +242,7 @@ func main() {
242
242
r .Handle ("WSS" , "/socket.io/" , socketHandler )
243
243
r .GET ("/info" , infoHandler )
244
244
r .POST ("/killbrowser" , killBrowserHandler )
245
+ r .POST ("/pause" , pauseHandler )
245
246
246
247
go func () {
247
248
// check if certificates exist; if not, use plain http
You can’t perform that action at this time.
0 commit comments