1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-01 17:38:37 +00:00

feat(api): add new endpoints to manage API keys

This commit is contained in:
Frédéric Guillot 2025-05-25 15:37:37 -07:00
parent ebd65da3b6
commit bfd8860398
13 changed files with 316 additions and 66 deletions

View file

@ -5,8 +5,7 @@ package form // import "miniflux.app/v2/internal/ui/form"
import (
"net/http"
"miniflux.app/v2/internal/locale"
"strings"
)
// APIKeyForm represents the API Key form.
@ -14,18 +13,9 @@ type APIKeyForm struct {
Description string
}
// Validate makes sure the form values are valid.
func (a APIKeyForm) Validate() *locale.LocalizedError {
if a.Description == "" {
return locale.NewLocalizedError("error.fields_mandatory")
}
return nil
}
// NewAPIKeyForm returns a new APIKeyForm.
func NewAPIKeyForm(r *http.Request) *APIKeyForm {
return &APIKeyForm{
Description: r.FormValue("description"),
Description: strings.TrimSpace(r.FormValue("description")),
}
}