fix: Replace Gitea branding with GitCaddy throughout codebase
- Fix lint errors in AI learning MCP tools (interface{} -> any, append pattern)
- Update OAuth realm names from Gitea to GitCaddy
- Update User-Agent strings to GitCaddy
- Update default git user.name, mailer X-Mailer header
- Update API docs descriptions
- Update template comments and swagger descriptions
- Keep Gitea attribution in footer and as OAuth provider option
🤖 Generated with Claude Code
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
BIN
gitcaddy-server
BIN
gitcaddy-server
Binary file not shown.
@@ -130,8 +130,8 @@ func RecordTelemetry(ctx context.Context, t *WorkflowTelemetry) error {
|
||||
}
|
||||
|
||||
// GetCompatibilityMatrix returns what works on which runners
|
||||
func GetCompatibilityMatrix(ctx context.Context, projectType string) ([]map[string]interface{}, error) {
|
||||
results := make([]map[string]interface{}, 0)
|
||||
func GetCompatibilityMatrix(ctx context.Context, projectType string) ([]map[string]any, error) {
|
||||
results := make([]map[string]any, 0)
|
||||
|
||||
// Use XORM's native query which returns []map[string][]byte
|
||||
sql := "SELECT runner_name, framework, target, " +
|
||||
@@ -139,10 +139,8 @@ func GetCompatibilityMatrix(ctx context.Context, projectType string) ([]map[stri
|
||||
"SUM(CASE WHEN status = 'failure' THEN 1 ELSE 0 END) as failures, " +
|
||||
"COUNT(*) as total " +
|
||||
"FROM workflow_telemetry WHERE 1=1"
|
||||
args := make([]interface{}, 0)
|
||||
if projectType != "" {
|
||||
sql += " AND project_type = ?"
|
||||
args = append(args, projectType)
|
||||
}
|
||||
sql += " GROUP BY runner_name, framework, target ORDER BY total DESC"
|
||||
|
||||
@@ -165,7 +163,7 @@ func GetCompatibilityMatrix(ctx context.Context, projectType string) ([]map[stri
|
||||
if total > 0 {
|
||||
successRate = float64(successes) / float64(total) * 100
|
||||
}
|
||||
results = append(results, map[string]interface{}{
|
||||
results = append(results, map[string]any{
|
||||
"runner_name": string(row["runner_name"]),
|
||||
"framework": string(row["framework"]),
|
||||
"target": string(row["target"]),
|
||||
|
||||
@@ -104,7 +104,7 @@ func (c *Client) NewRequest(b []byte, to string) (req *http.Request, err error)
|
||||
}
|
||||
req.Header.Add("Content-Type", ActivityStreamsContentType)
|
||||
req.Header.Add("Date", CurrentTime())
|
||||
req.Header.Add("User-Agent", "Gitea/"+setting.AppVer)
|
||||
req.Header.Add("User-Agent", "GitCaddy/"+setting.AppVer)
|
||||
signer, _, err := httpsig.NewSigner(c.algs, c.digestAlg, c.postHeaders, httpsig.Signature, httpsigExpirationTime)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -64,7 +64,7 @@ func newRequest(ctx context.Context, method, url string, body io.ReadCloser) (*h
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
req.Header.Add("User-Agent", "Gitea "+setting.AppVer)
|
||||
req.Header.Add("User-Agent", "GitCaddy/"+setting.AppVer)
|
||||
return req, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ func syncGitConfig(ctx context.Context) (err error) {
|
||||
// TODO: need to confirm whether users really need to change these values manually. It seems that these values are dummy only and not really used.
|
||||
// If these values are not really used, then they can be set (overwritten) directly without considering about existence.
|
||||
for configKey, defaultValue := range map[string]string{
|
||||
"user.name": "Gitea",
|
||||
"user.name": "GitCaddy",
|
||||
"user.email": "gitea@fake.local",
|
||||
} {
|
||||
if err := configSetNonExist(ctx, configKey, defaultValue); err != nil {
|
||||
|
||||
@@ -154,7 +154,7 @@ func (r *Request) Response() (*http.Response, error) {
|
||||
}
|
||||
|
||||
if r.req.Header.Get("User-Agent") == "" {
|
||||
r.req.Header.Set("User-Agent", "GiteaHttpLib")
|
||||
r.req.Header.Set("User-Agent", "GitCaddyHttpLib")
|
||||
}
|
||||
|
||||
return client.Do(r.req)
|
||||
|
||||
@@ -142,8 +142,8 @@ var UI = struct {
|
||||
Description string
|
||||
Keywords string
|
||||
}{
|
||||
Author: "Gitea - Git with a cup of tea",
|
||||
Description: "Gitea (Git with a cup of tea) is a painless self-hosted Git service written in Go",
|
||||
Author: "GitCaddy",
|
||||
Description: "GitCaddy - AI-Native Git Forge",
|
||||
Keywords: "go,git,self-hosted,gitea",
|
||||
},
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ func wrapTmplErrMsg(msg string) {
|
||||
}
|
||||
if setting.IsProd {
|
||||
// in prod mode, Gitea must have correct templates to run
|
||||
log.Fatal("Gitea can't run with template errors: %s", msg)
|
||||
log.Fatal("GitCaddy can't run with template errors: %s", msg)
|
||||
}
|
||||
// in dev mode, do not need to really exit, because the template errors could be fixed by developer soon and the templates get reloaded
|
||||
log.Error("There are template errors but Gitea continues to run in dev mode: %s", msg)
|
||||
|
||||
@@ -59,7 +59,7 @@ func reqPackageAccess(accessMode perm.AccessMode) func(ctx *context.Context) {
|
||||
}
|
||||
}
|
||||
if !scopeMatched {
|
||||
ctx.Resp.Header().Set("WWW-Authenticate", `Basic realm="Gitea Package API"`)
|
||||
ctx.Resp.Header().Set("WWW-Authenticate", `Basic realm="GitCaddy Package API"`)
|
||||
ctx.HTTPError(http.StatusUnauthorized, "reqPackageAccess", "user should have specific permission or be a site admin")
|
||||
return
|
||||
}
|
||||
@@ -81,7 +81,7 @@ func reqPackageAccess(accessMode perm.AccessMode) func(ctx *context.Context) {
|
||||
}
|
||||
|
||||
if ctx.Package.AccessMode < accessMode && !ctx.IsUserSiteAdmin() {
|
||||
ctx.Resp.Header().Set("WWW-Authenticate", `Basic realm="Gitea Package API"`)
|
||||
ctx.Resp.Header().Set("WWW-Authenticate", `Basic realm="GitCaddy Package API"`)
|
||||
ctx.HTTPError(http.StatusUnauthorized, "reqPackageAccess", "user should have specific permission or be a site admin")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ func getPublicKeyFromResponse(b []byte, keyID *url.URL) (p crypto.PublicKey, err
|
||||
func fetch(iri *url.URL) (b []byte, err error) {
|
||||
req := httplib.NewRequest(iri.String(), http.MethodGet)
|
||||
req.Header("Accept", activitypub.ActivityStreamsContentType)
|
||||
req.Header("User-Agent", "Gitea/"+setting.AppVer)
|
||||
req.Header("User-Agent", "GitCaddy/"+setting.AppVer)
|
||||
resp, err := req.Response()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -153,10 +153,10 @@ func generateOpenAPISpec() map[string]any {
|
||||
"openapi": "3.0.3",
|
||||
"info": map[string]any{
|
||||
"title": setting.AppName + " API v2",
|
||||
"description": "Gitea API v2 with structured error codes, batch operations, and AI-friendly endpoints.",
|
||||
"description": "GitCaddy API v2 with structured error codes, batch operations, and AI-friendly endpoints.",
|
||||
"version": "2.0.0",
|
||||
"contact": map[string]string{
|
||||
"name": "Gitea",
|
||||
"name": "GitCaddy",
|
||||
"url": "https://gitea.com",
|
||||
},
|
||||
"license": map[string]string{
|
||||
@@ -243,7 +243,7 @@ func generateOpenAPISpec() map[string]any {
|
||||
"Version": map[string]any{
|
||||
"type": "object",
|
||||
"properties": map[string]any{
|
||||
"version": map[string]string{"type": "string", "description": "Gitea version"},
|
||||
"version": map[string]string{"type": "string", "description": "GitCaddy version"},
|
||||
"api": map[string]string{"type": "string", "description": "API version"},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -294,7 +294,9 @@ func handleInitialize(ctx *context.APIContext, req *MCPRequest) {
|
||||
}
|
||||
|
||||
func handleToolsList(ctx *context.APIContext, req *MCPRequest) {
|
||||
allTools := append(mcpTools, mcpAITools...)
|
||||
allTools := make([]MCPTool, 0, len(mcpTools)+len(mcpAITools))
|
||||
allTools = append(allTools, mcpTools...)
|
||||
allTools = append(allTools, mcpAITools...)
|
||||
result := MCPToolsListResult{Tools: allTools}
|
||||
sendMCPResult(ctx, req.ID, result)
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ func checkDatabase(ctx *context.Context, form *forms.InstallForm) bool {
|
||||
}
|
||||
|
||||
if hasPostInstallationUser || dbMigrationVersion > 0 {
|
||||
log.Info("Gitea will be installed in a database with: hasPostInstallationUser=%v, dbMigrationVersion=%v", hasPostInstallationUser, dbMigrationVersion)
|
||||
log.Info("GitCaddy will be installed in a database with: hasPostInstallationUser=%v, dbMigrationVersion=%v", hasPostInstallationUser, dbMigrationVersion)
|
||||
}
|
||||
|
||||
return true
|
||||
|
||||
@@ -92,7 +92,7 @@ type userInfoResponse struct {
|
||||
// InfoOAuth manages request for userinfo endpoint
|
||||
func InfoOAuth(ctx *context.Context) {
|
||||
if ctx.Doer == nil || ctx.Data["AuthedMethod"] != (&auth_service.OAuth2{}).Name() {
|
||||
ctx.Resp.Header().Set("WWW-Authenticate", `Bearer realm="Gitea OAuth2"`)
|
||||
ctx.Resp.Header().Set("WWW-Authenticate", `Bearer realm="GitCaddy OAuth2"`)
|
||||
ctx.PlainText(http.StatusUnauthorized, "no valid authorization")
|
||||
return
|
||||
}
|
||||
@@ -141,7 +141,7 @@ func IntrospectOAuth(ctx *context.Context) {
|
||||
clientIDValid = err == nil && app.ValidateClientSecret([]byte(clientSecret))
|
||||
}
|
||||
if !clientIDValid {
|
||||
ctx.Resp.Header().Set("WWW-Authenticate", `Basic realm="Gitea OAuth2"`)
|
||||
ctx.Resp.Header().Set("WWW-Authenticate", `Basic realm="GitCaddy OAuth2"`)
|
||||
ctx.PlainText(http.StatusUnauthorized, "no valid authorization")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -147,11 +147,11 @@ func httpBase(ctx *context.Context) *serviceHandler {
|
||||
if !ctx.IsSigned {
|
||||
// TODO: support digit auth - which would be Authorization header with digit
|
||||
if setting.OAuth2.Enabled {
|
||||
// `Basic realm="Gitea"` tells the GCM to use builtin OAuth2 application: https://github.com/git-ecosystem/git-credential-manager/pull/1442
|
||||
ctx.Resp.Header().Set("WWW-Authenticate", `Basic realm="Gitea"`)
|
||||
// `Basic realm="GitCaddy"` tells the GCM to use builtin OAuth2 application: https://github.com/git-ecosystem/git-credential-manager/pull/1442
|
||||
ctx.Resp.Header().Set("WWW-Authenticate", `Basic realm="GitCaddy"`)
|
||||
} else {
|
||||
// If OAuth2 is disabled, then use another realm to avoid GCM OAuth2 attempt
|
||||
ctx.Resp.Header().Set("WWW-Authenticate", `Basic realm="Gitea (Basic Auth)"`)
|
||||
ctx.Resp.Header().Set("WWW-Authenticate", `Basic realm="GitCaddy (Basic Auth)"`)
|
||||
}
|
||||
ctx.HTTPError(http.StatusUnauthorized)
|
||||
return nil
|
||||
|
||||
@@ -147,7 +147,7 @@ func WebhooksNew(ctx *context.Context) {
|
||||
}
|
||||
if hookType == "discord" {
|
||||
ctx.Data["DiscordHook"] = map[string]any{
|
||||
"Username": "Gitea",
|
||||
"Username": "GitCaddy",
|
||||
}
|
||||
}
|
||||
ctx.Data["BaseLink"] = orCtx.LinkNew
|
||||
|
||||
@@ -46,7 +46,7 @@ func SendTestMail(email string) error {
|
||||
// No mail service configured
|
||||
return nil
|
||||
}
|
||||
return sender_service.Send(sender, sender_service.NewMessage(email, "Gitea Test Email!", "Gitea Test Email!"))
|
||||
return sender_service.Send(sender, sender_service.NewMessage(email, "GitCaddy Test Email!", "GitCaddy Test Email!"))
|
||||
}
|
||||
|
||||
func sanitizeSubject(subject string) string {
|
||||
@@ -183,7 +183,7 @@ func generateMetadataHeaders(repo *repo_model.Repository) map[string]string {
|
||||
// https://datatracker.ietf.org/doc/html/rfc2369
|
||||
"List-Archive": fmt.Sprintf("<%s>", repo.HTMLURL()),
|
||||
|
||||
"X-Mailer": "Gitea",
|
||||
"X-Mailer": "GitCaddy",
|
||||
|
||||
"X-Gitea-Repository": repo.Name,
|
||||
"X-Gitea-Repository-Path": repo.FullName(),
|
||||
|
||||
@@ -107,7 +107,7 @@
|
||||
<span>{{ctx.Locale.Tr "admin.auths.tip.twitter" "https://dev.twitter.com/apps"}}</span>
|
||||
<li>Discord</li>
|
||||
<span>{{ctx.Locale.Tr "admin.auths.tip.discord" "https://discordapp.com/developers/applications/me"}}</span>
|
||||
<li>Gitea</li>
|
||||
<li>Gitea / GitCaddy</li>
|
||||
<span>{{ctx.Locale.Tr "admin.auths.tip.gitea" "https://docs.gitea.com/development/oauth2-provider"}}</span>
|
||||
<li>Nextcloud</li>
|
||||
<span>{{ctx.Locale.Tr "admin.auths.tip.nextcloud"}}</span>
|
||||
|
||||
@@ -4,7 +4,7 @@ Why we need to disable form autofill:
|
||||
2. We have `areYouSure` confirm dialog if a user leaves a pages without submit.
|
||||
Autofill will make the form changed even if the user didn't input anything. Then the user keeps seeing annoying confirm dialog.
|
||||
|
||||
In history, Gitea put `<input class="fake" type="password">` in forms to bypass the autofill,
|
||||
In history, GitCaddy put `<input class="fake" type="password">` in forms to bypass the autofill,
|
||||
but there were still many forms suffered the autofill problem.
|
||||
|
||||
Now we improve it.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{{/* ==== DO NOT EDIT ====
|
||||
If you are customizing Gitea, please do not change this file.
|
||||
If you introduce mistakes in it, Gitea JavaScript code wouldn't run correctly.
|
||||
If you are customizing GitCaddy, please do not change this file.
|
||||
If you introduce mistakes in it, GitCaddy JavaScript code wouldn't run correctly.
|
||||
*/}}
|
||||
<script>
|
||||
{{/* before our JS code gets loaded, use arrays to store errors, then the arrays will be switched to our error handler later */}}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<link rel="icon" href="{{AssetUrlPrefix}}/img/favicon.svg" type="image/svg+xml">
|
||||
{{template "base/head_style" .}}
|
||||
<style>
|
||||
/* Pages standalone styles - no Gitea navbar */
|
||||
/* Pages standalone styles - no GitCaddy navbar */
|
||||
:root {
|
||||
--pages-primary: {{if .Config.Theme.PrimaryColor}}{{.Config.Theme.PrimaryColor}}{{else}}#4183c4{{end}};
|
||||
--pages-secondary: {{if .Config.Theme.AccentColor}}{{.Config.Theme.AccentColor}}{{else}}#6c757d{{end}};
|
||||
|
||||
@@ -377,7 +377,7 @@
|
||||
To test it:
|
||||
* Enable "Manually Merged" feature in the Repository Settings
|
||||
* Create a pull request, either:
|
||||
* - Merge the pull request branch locally and push the merged commit to Gitea
|
||||
* - Merge the pull request branch locally and push the merged commit to GitCaddy
|
||||
* - Make some conflicts between the base branch and the pull request branch
|
||||
* Then the Manually Merged form will be shown in the merge form
|
||||
*/}}
|
||||
|
||||
8
templates/swagger/v1_json.tmpl
generated
8
templates/swagger/v1_json.tmpl
generated
@@ -1534,7 +1534,7 @@
|
||||
"tags": [
|
||||
"miscellaneous"
|
||||
],
|
||||
"summary": "Returns the nodeinfo of the Gitea application",
|
||||
"summary": "Returns the nodeinfo of the GitCaddy application",
|
||||
"operationId": "getNodeInfo",
|
||||
"responses": {
|
||||
"200": {
|
||||
@@ -20881,7 +20881,7 @@
|
||||
"tags": [
|
||||
"miscellaneous"
|
||||
],
|
||||
"summary": "Returns the version of the Gitea application",
|
||||
"summary": "Returns the version of the GitCaddy application",
|
||||
"operationId": "getVersion",
|
||||
"responses": {
|
||||
"200": {
|
||||
@@ -30480,7 +30480,7 @@
|
||||
},
|
||||
"securityDefinitions": {
|
||||
"AccessToken": {
|
||||
"description": "This authentication option is deprecated for removal in Gitea 1.23. Please use AuthorizationHeaderToken instead.",
|
||||
"description": "This authentication option is deprecated for removal in a future version. Please use AuthorizationHeaderToken instead.",
|
||||
"type": "apiKey",
|
||||
"name": "access_token",
|
||||
"in": "query"
|
||||
@@ -30513,7 +30513,7 @@
|
||||
"in": "header"
|
||||
},
|
||||
"Token": {
|
||||
"description": "This authentication option is deprecated for removal in Gitea 1.23. Please use AuthorizationHeaderToken instead.",
|
||||
"description": "This authentication option is deprecated for removal in a future version. Please use AuthorizationHeaderToken instead.",
|
||||
"type": "apiKey",
|
||||
"name": "token",
|
||||
"in": "query"
|
||||
|
||||
Reference in New Issue
Block a user