40 lines
818 B
Go
40 lines
818 B
Go
// 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)
|
|
|
|
err := c.Render(http.StatusOK, "manage/apikeys.tmpl",
|
|
page{
|
|
AppName: setting.AppName(),
|
|
AppVer: appver,
|
|
Title: "Manage API Keys",
|
|
DevelMode: setting.IsDevel(),
|
|
Current: "api-keys",
|
|
User: u,
|
|
},
|
|
)
|
|
if err != nil {
|
|
c.Logger().Errorf("error: %q", err)
|
|
|
|
return renderErrorPage(
|
|
c,
|
|
http.StatusInternalServerError, http.StatusText(http.StatusInternalServerError),
|
|
err.Error(),
|
|
)
|
|
}
|
|
|
|
return nil
|
|
}
|
|
}
|