mirror of
https://github.com/ngoduykhanh/wireguard-ui.git
synced 2025-05-24 00:24:06 +03:00
Show apply config button only when needed (#292)
This commit is contained in:
parent
6dd5590940
commit
9f20fe6c09
9 changed files with 144 additions and 7 deletions
|
@ -983,11 +983,31 @@ func ApplyServerConfig(db store.IStore, tmplBox *rice.Box) echo.HandlerFunc {
|
|||
false, fmt.Sprintf("Cannot apply server config: %v", err),
|
||||
})
|
||||
}
|
||||
|
||||
err = util.UpdateHashes(db)
|
||||
if err != nil {
|
||||
log.Error("Cannot update hashes: ", err)
|
||||
return c.JSON(http.StatusInternalServerError, jsonHTTPResponse{
|
||||
false, fmt.Sprintf("Cannot update hashes: %v", err),
|
||||
})
|
||||
}
|
||||
|
||||
return c.JSON(http.StatusOK, jsonHTTPResponse{true, "Applied server config successfully"})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// GetHashesChanges handler returns if database hashes have changed
|
||||
func GetHashesChanges(db store.IStore) echo.HandlerFunc {
|
||||
return func(c echo.Context) error {
|
||||
if util.HashesChanged(db) {
|
||||
return c.JSON(http.StatusOK, jsonHTTPResponse{true, "Hashes changed"})
|
||||
} else {
|
||||
return c.JSON(http.StatusOK, jsonHTTPResponse{false, "Hashes not changed"})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// AboutPage handler
|
||||
func AboutPage() echo.HandlerFunc {
|
||||
return func(c echo.Context) error {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue