2023-08-05 22:13:43 +02:00
|
|
|
// Copyright 2023 wanderer <a_mirre at utb dot cz>
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
package handlers
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
moduser "git.dotya.ml/mirre-mt/pcmt/modules/user"
|
|
|
|
"github.com/labstack/echo/v4"
|
|
|
|
)
|
|
|
|
|
|
|
|
func ManageAPIKeys() echo.HandlerFunc {
|
|
|
|
return func(c echo.Context) error {
|
|
|
|
addHeaders(c)
|
|
|
|
u := c.Get("sessUsr").(moduser.User)
|
2023-08-15 18:33:48 +02:00
|
|
|
p := newPage()
|
|
|
|
|
|
|
|
p.Title = "Manage API Keys"
|
|
|
|
p.Current = "api-keys"
|
|
|
|
p.User = u
|
2023-08-05 22:13:43 +02:00
|
|
|
|
|
|
|
err := c.Render(http.StatusOK, "manage/apikeys.tmpl",
|
2023-08-15 18:33:48 +02:00
|
|
|
p,
|
2023-08-05 22:13:43 +02:00
|
|
|
)
|
|
|
|
if err != nil {
|
|
|
|
c.Logger().Errorf("error: %q", err)
|
|
|
|
|
|
|
|
return renderErrorPage(
|
|
|
|
c,
|
|
|
|
http.StatusInternalServerError, http.StatusText(http.StatusInternalServerError),
|
|
|
|
err.Error(),
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|