feat: add upload limit endpoint
This commit is contained in:
parent
e73ab26ebf
commit
e864bcb098
|
@ -308,6 +308,12 @@ func (a AccountAPI) logout(c jape.Context) {
|
|||
account.ClearAuthCookie(c, "")
|
||||
}
|
||||
|
||||
func (a AccountAPI) uploadLimit(c jape.Context) {
|
||||
c.Encode(&UploadLimitResponse{
|
||||
Limit: a.config.Config().Core.PostUploadLimit,
|
||||
})
|
||||
}
|
||||
|
||||
func (a *AccountAPI) Routes() (*httprouter.Router, error) {
|
||||
loginAuthMw2fa := authMiddleware(middleware.AuthMiddlewareOptions{
|
||||
Identity: a.identity,
|
||||
|
@ -350,6 +356,7 @@ func (a *AccountAPI) Routes() (*httprouter.Router, error) {
|
|||
getApiJape := jape.Mux(map[string]jape.Handler{
|
||||
"GET /api/auth/otp/generate": middleware.ApplyMiddlewares(a.otpGenerate, authMw, middleware.ProxyMiddleware),
|
||||
"GET /api/account": middleware.ApplyMiddlewares(a.accountInfo, authMw, middleware.ProxyMiddleware),
|
||||
"GET /api/upload-limit": middleware.ApplyMiddlewares(a.uploadLimit, middleware.ProxyMiddleware),
|
||||
})
|
||||
|
||||
getHandler := func(c jape.Context) {
|
||||
|
|
|
@ -53,3 +53,7 @@ type AccountInfoResponse struct {
|
|||
FirstName string `json:"first_name"`
|
||||
LastName string `json:"last_name"`
|
||||
}
|
||||
|
||||
type UploadLimitResponse struct {
|
||||
Limit uint64 `json:"limit"`
|
||||
}
|
||||
|
|
|
@ -148,6 +148,16 @@ paths:
|
|||
$ref: '#/components/schemas/AccountInfoResponse'
|
||||
'401':
|
||||
description: Unauthorized
|
||||
/api/upload-limit:
|
||||
get:
|
||||
summary: Get the basic file upload (POST) upload limit set by the portal
|
||||
responses:
|
||||
'200':
|
||||
description: Upload limit retrieved successfully
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/UploadLimitResponse'
|
||||
|
||||
components:
|
||||
schemas:
|
||||
|
@ -254,3 +264,10 @@ components:
|
|||
type: string
|
||||
email:
|
||||
type: string
|
||||
UploadLimitResponse:
|
||||
type: object
|
||||
properties:
|
||||
limit:
|
||||
type: number
|
||||
required:
|
||||
- limit
|
||||
|
|
Loading…
Reference in New Issue