c572fcfe04
Rename the Go module path from code.gitea.io/gitea to git.mokoconsulting.tech/MokoConsulting/MokoGitea across the entire codebase. Scope: - go.mod module declaration - 2,235 Go source files (import paths) - Dockerfile WORKDIR and COPY paths - Swagger API templates - golangci.yml linter config External dependencies (code.gitea.io/gitea-vet, code.gitea.io/sdk/gitea, gitea.com/gitea/act, etc.) are intentionally NOT renamed — they are separate upstream modules. Closes #132 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
43 lines
1.5 KiB
Go
43 lines
1.5 KiB
Go
// Copyright 2025 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package misc
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"git.mokoconsulting.tech/MokoConsulting/MokoGitea/modules/optional"
|
|
"git.mokoconsulting.tech/MokoConsulting/MokoGitea/modules/templates"
|
|
"git.mokoconsulting.tech/MokoConsulting/MokoGitea/modules/util"
|
|
"git.mokoconsulting.tech/MokoConsulting/MokoGitea/modules/web/middleware"
|
|
"git.mokoconsulting.tech/MokoConsulting/MokoGitea/services/context"
|
|
user_service "git.mokoconsulting.tech/MokoConsulting/MokoGitea/services/user"
|
|
"git.mokoconsulting.tech/MokoConsulting/MokoGitea/services/webtheme"
|
|
)
|
|
|
|
func WebThemeList(ctx *context.Context) {
|
|
curWebTheme := ctx.TemplateContext.CurrentWebTheme()
|
|
renderUtils := templates.NewRenderUtils(ctx)
|
|
allThemes := webtheme.GetAvailableThemes()
|
|
|
|
var results []map[string]any
|
|
for _, theme := range allThemes {
|
|
results = append(results, map[string]any{
|
|
"name": renderUtils.RenderThemeItem(theme, 14),
|
|
"value": theme.InternalName,
|
|
"class": "item js-aria-clickable" + util.Iif(theme.InternalName == curWebTheme.InternalName, " selected", ""),
|
|
})
|
|
}
|
|
ctx.JSON(http.StatusOK, map[string]any{"results": results})
|
|
}
|
|
|
|
func WebThemeApply(ctx *context.Context) {
|
|
themeName := ctx.FormString("theme")
|
|
if ctx.Doer != nil {
|
|
opts := &user_service.UpdateOptions{Theme: optional.Some(themeName)}
|
|
_ = user_service.UpdateUser(ctx, ctx.Doer, opts)
|
|
} else {
|
|
middleware.SetSiteCookie(ctx.Resp, middleware.CookieTheme, themeName, 0)
|
|
}
|
|
}
|