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
|
none
|
||||||
|
|
||||||
**Response:**
|
**Response:**
|
||||||
```json
|
```jsonc
|
||||||
{
|
{
|
||||||
"modificationTokens": true,
|
"modificationTokens": true,
|
||||||
"reports": true,
|
"reports": true,
|
||||||
|
"pasteLifetime": -1, // The configured AutoDelete paste lifetime; -1 if AutoDelete is disabled
|
||||||
"version": "dev"
|
"version": "dev"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@ -94,7 +95,7 @@ none
|
|||||||
"id": "paste_id",
|
"id": "paste_id",
|
||||||
"content": "paste_content",
|
"content": "paste_content",
|
||||||
"created": 0000000000,
|
"created": 0000000000,
|
||||||
"metadata": {},
|
"metadata": {}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -121,7 +122,7 @@ POST /api/v2/pastes
|
|||||||
"content": "paste_content",
|
"content": "paste_content",
|
||||||
"modificationToken": "raw_modification_token",
|
"modificationToken": "raw_modification_token",
|
||||||
"created": 0000000000,
|
"created": 0000000000,
|
||||||
"metadata": {},
|
"metadata": {}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -147,7 +148,7 @@ PATCH /api/v2/pastes/{paste_id}
|
|||||||
"id": "paste_id",
|
"id": "paste_id",
|
||||||
"content": "new_paste_content",
|
"content": "new_paste_content",
|
||||||
"created": 0000000000,
|
"created": 0000000000,
|
||||||
"metadata": {},
|
"metadata": {}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -71,11 +71,16 @@ func Serve() error {
|
|||||||
|
|
||||||
v2Route := apiRoute.Group("/v2")
|
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) {
|
v2Route.GET("/info", func(ctx *fasthttp.RequestCtx) {
|
||||||
jsonData, _ := json.Marshal(map[string]interface{}{
|
jsonData, _ := json.Marshal(map[string]interface{}{
|
||||||
"version": static.Version,
|
"version": static.Version,
|
||||||
"modificationTokens": config.Current.ModificationTokens,
|
"modificationTokens": config.Current.ModificationTokens,
|
||||||
"reports": config.Current.Reports.Reports,
|
"reports": config.Current.Reports.Reports,
|
||||||
|
"pasteLifetime": pasteLifetime,
|
||||||
})
|
})
|
||||||
ctx.SetBody(jsonData)
|
ctx.SetBody(jsonData)
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user