- New files: Copyright 2026 MarketAlly - Modified files: Copyright YYYY The Gitea Authors and MarketAlly 🤖 Generated with Claude Code Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
36 lines
786 B
Go
36 lines
786 B
Go
// Copyright 2026 MarketAlly. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package v2
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"code.gitea.io/gitea/modules/setting"
|
|
"code.gitea.io/gitea/services/context"
|
|
)
|
|
|
|
// VersionResponse contains version information
|
|
type VersionResponse struct {
|
|
Version string `json:"version"`
|
|
API string `json:"api"`
|
|
}
|
|
|
|
// Version returns the Gitea version
|
|
func Version(ctx *context.APIContext) {
|
|
ctx.JSON(http.StatusOK, VersionResponse{
|
|
Version: setting.AppVer,
|
|
API: "v2",
|
|
})
|
|
}
|
|
|
|
// GetAuthenticatedUser returns the authenticated user
|
|
func GetAuthenticatedUser(ctx *context.APIContext) {
|
|
ctx.JSON(http.StatusOK, map[string]any{
|
|
"id": ctx.Doer.ID,
|
|
"login": ctx.Doer.Name,
|
|
"email": ctx.Doer.Email,
|
|
"is_admin": ctx.Doer.IsAdmin,
|
|
})
|
|
}
|