1
0
Fork 0
mirror of https://github.com/gocsaf/csaf.git synced 2025-12-22 11:55:40 +01:00

Added JSON endpoints. Made Web UI optional.

This commit is contained in:
Sascha L. Teichmann 2021-12-05 21:20:27 +01:00
parent 565238da9a
commit 52b586d82f
4 changed files with 76 additions and 24 deletions

View file

@ -115,11 +115,19 @@ func (c *controller) tlpParam(r *http.Request) (tlp, error) {
return "", fmt.Errorf("unsupported TLP type '%s'", t)
}
func (c *controller) create(http.ResponseWriter, *http.Request) error {
return ensureFolders(c.cfg)
func (c *controller) create(*http.Request) (interface{}, error) {
if err := ensureFolders(c.cfg); err != nil {
return nil, err
}
return &struct {
Message string `json:"message"`
Error bool `json:"-"`
}{
Message: "Everything is setup fine now.",
}, nil
}
func (c *controller) upload(rw http.ResponseWriter, r *http.Request) (interface{}, error) {
func (c *controller) upload(r *http.Request) (interface{}, error) {
newCSAF, data, err := loadCSAF(r)
if err != nil {