mirror of
https://github.com/octoleo/syncthing.git
synced 2025-02-08 23:08:27 +00:00
Shutdown from GUI (ref #192)
This commit is contained in:
parent
0fcbee6478
commit
20b23338f7
@ -53,6 +53,7 @@ func startGUI(cfg GUIConfiguration, m *Model) error {
|
|||||||
router.Post("/rest/config", restPostConfig)
|
router.Post("/rest/config", restPostConfig)
|
||||||
router.Post("/rest/restart", restPostRestart)
|
router.Post("/rest/restart", restPostRestart)
|
||||||
router.Post("/rest/reset", restPostReset)
|
router.Post("/rest/reset", restPostReset)
|
||||||
|
router.Post("/rest/shutdown", restPostShutdown)
|
||||||
router.Post("/rest/error", restPostError)
|
router.Post("/rest/error", restPostError)
|
||||||
router.Post("/rest/error/clear", restClearErrors)
|
router.Post("/rest/error/clear", restClearErrors)
|
||||||
|
|
||||||
@ -156,15 +157,19 @@ func restGetConfigInSync(w http.ResponseWriter) {
|
|||||||
json.NewEncoder(w).Encode(map[string]bool{"configInSync": configInSync})
|
json.NewEncoder(w).Encode(map[string]bool{"configInSync": configInSync})
|
||||||
}
|
}
|
||||||
|
|
||||||
func restPostRestart(req *http.Request) {
|
func restPostRestart() {
|
||||||
go restart()
|
go restart()
|
||||||
}
|
}
|
||||||
|
|
||||||
func restPostReset(req *http.Request) {
|
func restPostReset() {
|
||||||
resetRepositories()
|
resetRepositories()
|
||||||
go restart()
|
go restart()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func restPostShutdown() {
|
||||||
|
go shutdown()
|
||||||
|
}
|
||||||
|
|
||||||
var cpuUsagePercent [10]float64 // The last ten seconds
|
var cpuUsagePercent [10]float64 // The last ten seconds
|
||||||
var cpuUsageLock sync.RWMutex
|
var cpuUsageLock sync.RWMutex
|
||||||
|
|
||||||
|
@ -431,6 +431,10 @@ func restart() {
|
|||||||
stop <- true
|
stop <- true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func shutdown() {
|
||||||
|
stop <- true
|
||||||
|
}
|
||||||
|
|
||||||
var saveConfigCh = make(chan struct{})
|
var saveConfigCh = make(chan struct{})
|
||||||
|
|
||||||
func saveConfigLoop(cfgFile string) {
|
func saveConfigLoop(cfgFile string) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user