mirror of
https://github.com/go-gitea/gitea.git
synced 2026-09-22 04:59:45 +02:00
Merge remote-tracking branch 'upstream/main' into limit-repo-size
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
package setting
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net"
|
||||
"net/mail"
|
||||
"strings"
|
||||
@@ -198,7 +199,7 @@ func loadMailerFrom(rootCfg ConfigProvider) {
|
||||
ips := tryResolveAddr(MailService.SMTPAddr)
|
||||
if MailService.Protocol == "smtp" {
|
||||
for _, ip := range ips {
|
||||
if !ip.IsLoopback() {
|
||||
if !ip.IP.IsLoopback() {
|
||||
log.Warn("connecting over insecure SMTP protocol to non-local address is not recommended")
|
||||
break
|
||||
}
|
||||
@@ -258,20 +259,21 @@ func loadNotifyMailFrom(rootCfg ConfigProvider) {
|
||||
log.Info("Notify Mail Service Enabled")
|
||||
}
|
||||
|
||||
func tryResolveAddr(addr string) []net.IP {
|
||||
func tryResolveAddr(addr string) []net.IPAddr {
|
||||
if strings.HasPrefix(addr, "[") && strings.HasSuffix(addr, "]") {
|
||||
addr = addr[1 : len(addr)-1]
|
||||
}
|
||||
ip := net.ParseIP(addr)
|
||||
if ip != nil {
|
||||
ips := make([]net.IP, 1)
|
||||
ips[0] = ip
|
||||
return ips
|
||||
return []net.IPAddr{{IP: ip}}
|
||||
}
|
||||
ips, err := net.LookupIP(addr)
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
|
||||
defer cancel()
|
||||
ips, err := net.DefaultResolver.LookupIPAddr(ctx, addr)
|
||||
if err != nil {
|
||||
log.Warn("could not look up mailer.SMTP_ADDR: %v", err)
|
||||
return make([]net.IP, 0)
|
||||
return nil
|
||||
}
|
||||
return ips
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ var (
|
||||
|
||||
LimitTotalOwnerCount int64
|
||||
LimitTotalOwnerSize int64
|
||||
LimitSizeAlpine int64
|
||||
LimitSizeCargo int64
|
||||
LimitSizeChef int64
|
||||
LimitSizeComposer int64
|
||||
@@ -32,6 +33,7 @@ var (
|
||||
LimitSizeContainer int64
|
||||
LimitSizeDebian int64
|
||||
LimitSizeGeneric int64
|
||||
LimitSizeGo int64
|
||||
LimitSizeHelm int64
|
||||
LimitSizeMaven int64
|
||||
LimitSizeNpm int64
|
||||
@@ -69,6 +71,7 @@ func loadPackagesFrom(rootCfg ConfigProvider) {
|
||||
}
|
||||
|
||||
Packages.LimitTotalOwnerSize = mustBytes(sec, "LIMIT_TOTAL_OWNER_SIZE")
|
||||
Packages.LimitSizeAlpine = mustBytes(sec, "LIMIT_SIZE_ALPINE")
|
||||
Packages.LimitSizeCargo = mustBytes(sec, "LIMIT_SIZE_CARGO")
|
||||
Packages.LimitSizeChef = mustBytes(sec, "LIMIT_SIZE_CHEF")
|
||||
Packages.LimitSizeComposer = mustBytes(sec, "LIMIT_SIZE_COMPOSER")
|
||||
@@ -77,6 +80,7 @@ func loadPackagesFrom(rootCfg ConfigProvider) {
|
||||
Packages.LimitSizeContainer = mustBytes(sec, "LIMIT_SIZE_CONTAINER")
|
||||
Packages.LimitSizeDebian = mustBytes(sec, "LIMIT_SIZE_DEBIAN")
|
||||
Packages.LimitSizeGeneric = mustBytes(sec, "LIMIT_SIZE_GENERIC")
|
||||
Packages.LimitSizeGo = mustBytes(sec, "LIMIT_SIZE_GO")
|
||||
Packages.LimitSizeHelm = mustBytes(sec, "LIMIT_SIZE_HELM")
|
||||
Packages.LimitSizeMaven = mustBytes(sec, "LIMIT_SIZE_MAVEN")
|
||||
Packages.LimitSizeNpm = mustBytes(sec, "LIMIT_SIZE_NPM")
|
||||
|
||||
@@ -3,21 +3,23 @@
|
||||
|
||||
package setting
|
||||
|
||||
// settings
|
||||
// Avatar settings
|
||||
|
||||
var (
|
||||
// Picture settings
|
||||
Avatar = struct {
|
||||
Storage
|
||||
|
||||
MaxWidth int
|
||||
MaxHeight int
|
||||
MaxFileSize int64
|
||||
MaxOriginSize int64
|
||||
RenderedSizeFactor int
|
||||
}{
|
||||
MaxWidth: 4096,
|
||||
MaxHeight: 3072,
|
||||
MaxHeight: 4096,
|
||||
MaxFileSize: 1048576,
|
||||
RenderedSizeFactor: 3,
|
||||
MaxOriginSize: 262144,
|
||||
RenderedSizeFactor: 2,
|
||||
}
|
||||
|
||||
GravatarSource string
|
||||
@@ -44,9 +46,10 @@ func loadPictureFrom(rootCfg ConfigProvider) {
|
||||
Avatar.Storage = getStorage(rootCfg, "avatars", storageType, avatarSec)
|
||||
|
||||
Avatar.MaxWidth = sec.Key("AVATAR_MAX_WIDTH").MustInt(4096)
|
||||
Avatar.MaxHeight = sec.Key("AVATAR_MAX_HEIGHT").MustInt(3072)
|
||||
Avatar.MaxHeight = sec.Key("AVATAR_MAX_HEIGHT").MustInt(4096)
|
||||
Avatar.MaxFileSize = sec.Key("AVATAR_MAX_FILE_SIZE").MustInt64(1048576)
|
||||
Avatar.RenderedSizeFactor = sec.Key("AVATAR_RENDERED_SIZE_FACTOR").MustInt(3)
|
||||
Avatar.MaxOriginSize = sec.Key("AVATAR_MAX_ORIGIN_SIZE").MustInt64(262144)
|
||||
Avatar.RenderedSizeFactor = sec.Key("AVATAR_RENDERED_SIZE_FACTOR").MustInt(2)
|
||||
|
||||
switch source := sec.Key("GRAVATAR_SOURCE").MustString("gravatar"); source {
|
||||
case "duoshuo":
|
||||
@@ -94,5 +97,5 @@ func loadRepoAvatarFrom(rootCfg ConfigProvider) {
|
||||
RepoAvatar.Storage = getStorage(rootCfg, "repo-avatars", storageType, repoAvatarSec)
|
||||
|
||||
RepoAvatar.Fallback = sec.Key("REPOSITORY_AVATAR_FALLBACK").MustString("none")
|
||||
RepoAvatar.FallbackImage = sec.Key("REPOSITORY_AVATAR_FALLBACK_IMAGE").MustString("/assets/img/repo_default.png")
|
||||
RepoAvatar.FallbackImage = sec.Key("REPOSITORY_AVATAR_FALLBACK_IMAGE").MustString(AppSubURL + "/assets/img/repo_default.png")
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ var (
|
||||
DisableHTTPGit bool
|
||||
AccessControlAllowOrigin string
|
||||
UseCompatSSHURI bool
|
||||
GoGetCloneURLProtocol string
|
||||
DefaultCloseIssuesViaCommitsInAnyBranch bool
|
||||
EnablePushCreateUser bool
|
||||
EnablePushCreateOrg bool
|
||||
@@ -307,6 +308,7 @@ func loadRepositoryFrom(rootCfg ConfigProvider) {
|
||||
|
||||
Repository.DisableHTTPGit = sec.Key("DISABLE_HTTP_GIT").MustBool()
|
||||
Repository.UseCompatSSHURI = sec.Key("USE_COMPAT_SSH_URI").MustBool()
|
||||
Repository.GoGetCloneURLProtocol = sec.Key("GO_GET_CLONE_URL_PROTOCOL").MustString("https")
|
||||
Repository.MaxCreationLimit = sec.Key("MAX_CREATION_LIMIT").MustInt(-1)
|
||||
Repository.DefaultBranch = sec.Key("DEFAULT_BRANCH").MustString(Repository.DefaultBranch)
|
||||
RepoRootPath = sec.Key("ROOT").MustString(path.Join(AppDataPath, "gitea-repositories"))
|
||||
|
||||
Reference in New Issue
Block a user