mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-05-06 13:48:52 +00:00
feat: rewrite notification system and telegram interactive bot
This commit is contained in:
@@ -156,6 +156,7 @@ func routers(r *gin.Engine, frontendDist fs.FS) {
|
||||
auth.POST("/domains", commonHandler(AddDomain))
|
||||
auth.POST("/domains/:id/verify", commonHandler(VerifyDomain))
|
||||
auth.POST("/domains/:id/sync", commonHandler(SyncDomainWHOIS))
|
||||
auth.POST("/domains/sync-all", commonHandler(SyncAllDomains))
|
||||
auth.PUT("/domains/:id", commonHandler(UpdateDomain))
|
||||
auth.DELETE("/domains/:id", commonHandler(DeleteDomain))
|
||||
|
||||
|
||||
@@ -137,3 +137,8 @@ func SyncDomainWHOIS(c *gin.Context) (any, error) {
|
||||
|
||||
return domain, nil
|
||||
}
|
||||
|
||||
func SyncAllDomains(c *gin.Context) (any, error) {
|
||||
singleton.SyncAllDomains()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@ func createNotification(c *gin.Context) (uint64, error) {
|
||||
n.RequestHeader = nf.RequestHeader
|
||||
n.RequestBody = nf.RequestBody
|
||||
n.URL = nf.URL
|
||||
n.Type = nf.Type
|
||||
verifyTLS := nf.VerifyTLS
|
||||
n.VerifyTLS = &verifyTLS
|
||||
formatMetricUnits := nf.FormatMetricUnits
|
||||
@@ -120,6 +121,7 @@ func updateNotification(c *gin.Context) (any, error) {
|
||||
n.RequestHeader = nf.RequestHeader
|
||||
n.RequestBody = nf.RequestBody
|
||||
n.URL = nf.URL
|
||||
n.Type = nf.Type
|
||||
verifyTLS := nf.VerifyTLS
|
||||
n.VerifyTLS = &verifyTLS
|
||||
formatMetricUnits := nf.FormatMetricUnits
|
||||
|
||||
@@ -111,8 +111,8 @@ func updateConfig(c *gin.Context) (any, error) {
|
||||
singleton.Conf.CustomLogo = sf.CustomLogo
|
||||
singleton.Conf.CustomDescription = sf.CustomDescription
|
||||
singleton.Conf.CustomLinks = sf.CustomLinks
|
||||
singleton.Conf.BackgroundImageDay = sf.BackgroundImageDay
|
||||
singleton.Conf.BackgroundImageNight = sf.BackgroundImageNight
|
||||
singleton.Conf.TelegramBotToken = sf.TelegramBotToken
|
||||
singleton.Conf.TelegramAdminChatID = sf.TelegramAdminChatID
|
||||
|
||||
if err := singleton.Conf.Save(); err != nil {
|
||||
return nil, newGormError("%v", err)
|
||||
|
||||
Reference in New Issue
Block a user