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:
parent
12a60526f9
commit
c7fcdeb91c
9
API.md
9
API.md
@ -69,10 +69,11 @@ GET /api/v2/info
|
||||
none
|
||||
|
||||
**Response:**
|
||||
```json
|
||||
```jsonc
|
||||
{
|
||||
"modificationTokens": true,
|
||||
"reports": true,
|
||||
"pasteLifetime": -1, // The configured AutoDelete paste lifetime; -1 if AutoDelete is disabled
|
||||
"version": "dev"
|
||||
}
|
||||
```
|
||||
@ -94,7 +95,7 @@ none
|
||||
"id": "paste_id",
|
||||
"content": "paste_content",
|
||||
"created": 0000000000,
|
||||
"metadata": {},
|
||||
"metadata": {}
|
||||
}
|
||||
```
|
||||
|
||||
@ -121,7 +122,7 @@ POST /api/v2/pastes
|
||||
"content": "paste_content",
|
||||
"modificationToken": "raw_modification_token",
|
||||
"created": 0000000000,
|
||||
"metadata": {},
|
||||
"metadata": {}
|
||||
}
|
||||
```
|
||||
|
||||
@ -147,7 +148,7 @@ PATCH /api/v2/pastes/{paste_id}
|
||||
"id": "paste_id",
|
||||
"content": "new_paste_content",
|
||||
"created": 0000000000,
|
||||
"metadata": {},
|
||||
"metadata": {}
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -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)
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user