1
0
mirror of https://github.com/lus/pasty.git synced 2023-08-10 21:13:09 +03:00

Include AutoDelete lifetime in /api/v2/info response

This commit is contained in:
Lukas Schulte Pelkum
2022-01-29 16:18:40 +01:00
parent 12a60526f9
commit c7fcdeb91c
2 changed files with 10 additions and 4 deletions

View File

@@ -71,11 +71,16 @@ func Serve() error {
v2Route := apiRoute.Group("/v2")
{
pasteLifetime := int64(-1)
if config.Current.AutoDelete.Enabled {
pasteLifetime = config.Current.AutoDelete.Lifetime.Milliseconds()
}
v2Route.GET("/info", func(ctx *fasthttp.RequestCtx) {
jsonData, _ := json.Marshal(map[string]interface{}{
"version": static.Version,
"modificationTokens": config.Current.ModificationTokens,
"reports": config.Current.Reports.Reports,
"pasteLifetime": pasteLifetime,
})
ctx.SetBody(jsonData)
})