Add endpoint to send test notification
This commit is contained in:
parent
53dcf3cc38
commit
6e2511bee7
2 changed files with 16 additions and 6 deletions
|
|
@ -8,6 +8,7 @@ import (
|
|||
|
||||
"github.com/aceberg/WatchYourLAN/internal/db"
|
||||
"github.com/aceberg/WatchYourLAN/internal/models"
|
||||
"github.com/aceberg/WatchYourLAN/internal/notify"
|
||||
"github.com/aceberg/WatchYourLAN/internal/portscan"
|
||||
)
|
||||
|
||||
|
|
@ -88,3 +89,11 @@ func apiEdit(c *gin.Context) {
|
|||
|
||||
c.IndentedJSON(http.StatusOK, "OK")
|
||||
}
|
||||
|
||||
func testNotifyHandler(c *gin.Context) {
|
||||
|
||||
msg := "Test notification from WatchYourLAN"
|
||||
notify.Shout(msg, appConfig.ShoutURL)
|
||||
|
||||
c.Status(http.StatusOK)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,12 +46,13 @@ func Gui(dirPath, nodePath string) {
|
|||
|
||||
router.StaticFS("/fs/", http.FS(pubFS)) // public
|
||||
|
||||
router.GET("/api/all", apiAll) // api.go
|
||||
router.GET("/api/edit/:id/:name/*known", apiEdit) // api.go
|
||||
router.GET("/api/history/*mac", apiHistory) // api.go
|
||||
router.GET("/api/host/:id", apiHost) // api.go
|
||||
router.GET("/api/host/del/:id", apiHostDel) // api.go
|
||||
router.GET("/api/port/:addr/:port", apiPort) // api.go
|
||||
router.GET("/api/all", apiAll) // api.go
|
||||
router.GET("/api/edit/:id/:name/*known", apiEdit) // api.go
|
||||
router.GET("/api/history/*mac", apiHistory) // api.go
|
||||
router.GET("/api/host/:id", apiHost) // api.go
|
||||
router.GET("/api/host/del/:id", apiHostDel) // api.go
|
||||
router.GET("/api/port/:addr/:port", apiPort) // api.go
|
||||
router.POST("/api/test_notify", testNotifyHandler) // api.go
|
||||
|
||||
router.GET("/", indexHandler) // index.go
|
||||
router.GET("/history/", historyHandler) // index.go
|
||||
|
|
|
|||
Loading…
Reference in a new issue