update pwd change
This commit is contained in:
parent
b91daad8ad
commit
47b6f4903f
13 changed files with 572 additions and 90 deletions
24
api/api.go
24
api/api.go
|
|
@ -31,6 +31,24 @@ func ApiGroup(v0 touka.IRouter, cdb *db.ConfigDB, cfg *config.Config) {
|
|||
|
||||
api.GET("/config/templates", GetTemplates(cdb)) // 获取可用模板名称
|
||||
|
||||
api.GET("/config/headers-presets", func(c *touka.Context) {
|
||||
c.JSON(200, GetHeaderSetMetadataList())
|
||||
})
|
||||
|
||||
api.GET("/config/headers-presets/:name", func(c *touka.Context) {
|
||||
presetName := c.Param("name")
|
||||
if presetName == "" {
|
||||
c.JSON(400, touka.H{"error": "presetName is required"})
|
||||
return
|
||||
}
|
||||
preset, found := GetHeaderSetByID(presetName)
|
||||
if !found {
|
||||
c.JSON(404, touka.H{"error": "preset not found"})
|
||||
return
|
||||
}
|
||||
c.JSON(200, preset)
|
||||
})
|
||||
|
||||
// caddy实例相关
|
||||
api.POST("/caddy/stop", apic.StopCaddy()) // 无需payload
|
||||
api.POST("/caddy/run", apic.StartCaddy(cfg))
|
||||
|
|
@ -46,10 +64,7 @@ func ApiGroup(v0 touka.IRouter, cdb *db.ConfigDB, cfg *config.Config) {
|
|||
AuthLogout(c)
|
||||
})
|
||||
auth.GET("/logout", func(c *touka.Context) {
|
||||
// 重定向到/
|
||||
c.Redirect(302, "/")
|
||||
c.Abort()
|
||||
return
|
||||
AuthLogout(c)
|
||||
})
|
||||
auth.GET("/init", func(c *touka.Context) {
|
||||
// 返回是否init管理员
|
||||
|
|
@ -76,6 +91,7 @@ func ApiGroup(v0 touka.IRouter, cdb *db.ConfigDB, cfg *config.Config) {
|
|||
}
|
||||
c.JSON(200, touka.H{"message": "admin initialized"})
|
||||
})
|
||||
auth.POST("resetpwd", ResetPassword(cdb))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue