feat: add /api/meta endpoint
This commit is contained in:
parent
73247a86fd
commit
1185a2a56e
|
@ -350,6 +350,13 @@ func (a AccountAPI) updatePassword(c jape.Context) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a AccountAPI) meta(c jape.Context) {
|
||||||
|
c.Encode(&MetaResponse{
|
||||||
|
Domain: a.config.Config().Core.Domain,
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
func (a *AccountAPI) Routes() (*httprouter.Router, error) {
|
func (a *AccountAPI) Routes() (*httprouter.Router, error) {
|
||||||
loginAuthMw2fa := authMiddleware(middleware.AuthMiddlewareOptions{
|
loginAuthMw2fa := authMiddleware(middleware.AuthMiddlewareOptions{
|
||||||
Identity: a.identity,
|
Identity: a.identity,
|
||||||
|
@ -394,6 +401,7 @@ func (a *AccountAPI) Routes() (*httprouter.Router, error) {
|
||||||
"GET /api/auth/otp/generate": middleware.ApplyMiddlewares(a.otpGenerate, authMw, middleware.ProxyMiddleware),
|
"GET /api/auth/otp/generate": middleware.ApplyMiddlewares(a.otpGenerate, authMw, middleware.ProxyMiddleware),
|
||||||
"GET /api/account": middleware.ApplyMiddlewares(a.accountInfo, authMw, middleware.ProxyMiddleware),
|
"GET /api/account": middleware.ApplyMiddlewares(a.accountInfo, authMw, middleware.ProxyMiddleware),
|
||||||
"GET /api/upload-limit": middleware.ApplyMiddlewares(a.uploadLimit, middleware.ProxyMiddleware),
|
"GET /api/upload-limit": middleware.ApplyMiddlewares(a.uploadLimit, middleware.ProxyMiddleware),
|
||||||
|
"GET /api/meta": middleware.ApplyMiddlewares(a.meta, middleware.ProxyMiddleware),
|
||||||
})
|
})
|
||||||
|
|
||||||
getHandler := func(c jape.Context) {
|
getHandler := func(c jape.Context) {
|
||||||
|
|
|
@ -66,3 +66,7 @@ type UpdatePasswordRequest struct {
|
||||||
CurrentPassword string `json:"current_password"`
|
CurrentPassword string `json:"current_password"`
|
||||||
NewPassword string `json:"new_password"`
|
NewPassword string `json:"new_password"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type MetaResponse struct {
|
||||||
|
Domain string `json:"domain"`
|
||||||
|
}
|
||||||
|
|
|
@ -182,6 +182,17 @@ paths:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/UploadLimitResponse'
|
$ref: '#/components/schemas/UploadLimitResponse'
|
||||||
|
/api/meta:
|
||||||
|
get:
|
||||||
|
summary: Get metadata about the portal
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Metadata retrieved successfully
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/MetaResponse'
|
||||||
|
|
||||||
|
|
||||||
components:
|
components:
|
||||||
schemas:
|
schemas:
|
||||||
|
@ -317,3 +328,10 @@ components:
|
||||||
type: number
|
type: number
|
||||||
required:
|
required:
|
||||||
- limit
|
- limit
|
||||||
|
MetaResponse:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- domain
|
||||||
|
properties:
|
||||||
|
domain:
|
||||||
|
type: string
|
||||||
|
|
Loading…
Reference in New Issue