✨ Adds lock and alert commands to admin
This commit is contained in:
@@ -103,7 +103,7 @@ func main() {
|
||||
}
|
||||
|
||||
app.GET("/", func(c echo.Context) error {
|
||||
return c.JSON(http.StatusOK, "Hello, World!")
|
||||
return c.JSON(http.StatusOK, "Hello world!")
|
||||
})
|
||||
|
||||
app.GET("/read", authed(func(c echo.Context) error {
|
||||
@@ -143,7 +143,7 @@ func main() {
|
||||
return c.NoContent(http.StatusOK)
|
||||
}))
|
||||
|
||||
app.GET("/locked", authed(func(c echo.Context) error {
|
||||
app.GET("/lock", authed(func(c echo.Context) error {
|
||||
mut.Lock()
|
||||
l := locked
|
||||
mut.Unlock()
|
||||
@@ -151,7 +151,7 @@ func main() {
|
||||
return c.JSON(http.StatusOK, l)
|
||||
}))
|
||||
|
||||
app.POST("/lock", authed(func(c echo.Context) error {
|
||||
app.POST("/lock/do", authed(func(c echo.Context) error {
|
||||
mut.Lock()
|
||||
locked = true
|
||||
mut.Unlock()
|
||||
@@ -159,7 +159,7 @@ func main() {
|
||||
return c.NoContent(http.StatusOK)
|
||||
}))
|
||||
|
||||
app.POST("/unlock", authed(func(c echo.Context) error {
|
||||
app.POST("/lock/undo", authed(func(c echo.Context) error {
|
||||
mut.Lock()
|
||||
locked = false
|
||||
mut.Unlock()
|
||||
@@ -167,6 +167,14 @@ func main() {
|
||||
return c.NoContent(http.StatusOK)
|
||||
}))
|
||||
|
||||
app.GET("/alerts", authed(func(c echo.Context) error {
|
||||
mut.Lock()
|
||||
a := alert
|
||||
mut.Unlock()
|
||||
|
||||
return c.JSON(http.StatusOK, a)
|
||||
}))
|
||||
|
||||
app.POST("/alerts/pause", authed(func(c echo.Context) error {
|
||||
pauseForRaw := c.QueryParam("for")
|
||||
if pauseForRaw != "" {
|
||||
|
Reference in New Issue
Block a user