Files
zeekayandHanzo Dev b695556e53 Name the native webhook type native everywhere it is spelled
The POST routes and the stored type column already said native, but the
webhook menu, form and enabled-types list still said gitea, so the form
posted to a path no route served and creating a native webhook from the web
UI answered 404. Route, template, locale key and API enum now all say native,
which is also what distinguishes our own payload shape from slack or matrix.
No stored value changes, so no migration.

Regenerating the API spec also picks up the owners/*/packages paths, the
pull-mirror endpoint and a profile-page description that the committed spec
had drifted behind.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-10 18:09:48 -07:00

54 lines
1.5 KiB
Go

// Copyright 2026 Hanzo AI, Inc. All rights reserved.
// SPDX-License-Identifier: MIT
package setting
import (
"net/url"
"github.com/hanzoai/git/modules/log"
)
// Webhook settings
var Webhook = struct {
QueueLength int
DeliverTimeout int
SkipTLSVerify bool
AllowedHostList string
Types []string
PagingNum int
ProxyURL string
ProxyURLFixed *url.URL
ProxyHosts []string
}{
QueueLength: 1000,
DeliverTimeout: 5,
SkipTLSVerify: false,
PagingNum: 10,
ProxyURL: "",
ProxyHosts: []string{},
}
func loadWebhookFrom(rootCfg ConfigProvider) {
sec := rootCfg.Section("webhook")
Webhook.QueueLength = sec.Key("QUEUE_LENGTH").MustInt(1000)
Webhook.DeliverTimeout = sec.Key("DELIVER_TIMEOUT").MustInt(5)
Webhook.SkipTLSVerify = sec.Key("SKIP_TLS_VERIFY").MustBool()
deprecatedSetting(rootCfg, "webhook", "ALLOWED_HOST_LIST", "security", "ALLOWED_HOST_LIST", "v28.0.0")
Webhook.AllowedHostList = sec.Key("ALLOWED_HOST_LIST").MustString(Security.AllowedHostList)
Webhook.Types = []string{"native", "gogs", "slack", "discord", "dingtalk", "telegram", "msteams", "feishu", "matrix", "wechatwork", "packagist"}
Webhook.PagingNum = sec.Key("PAGING_NUM").MustInt(10)
Webhook.ProxyURL = sec.Key("PROXY_URL").MustString("")
if Webhook.ProxyURL != "" {
var err error
Webhook.ProxyURLFixed, err = url.Parse(Webhook.ProxyURL)
if err != nil {
log.Error("Webhook PROXY_URL is not valid")
Webhook.ProxyURL = ""
}
}
Webhook.ProxyHosts = sec.Key("PROXY_HOSTS").Strings(",")
}