Skip to content

Commit b7f53da

Browse files
authored
Merge branch 'main' into fix-deploy-key-write
2 parents 135f3d5 + 83a2f79 commit b7f53da

File tree

12 files changed

+62
-101
lines changed

12 files changed

+62
-101
lines changed

modules/git/repo.go

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,16 @@ func (repo *Repository) IsEmpty() (bool, error) {
9898

9999
// CloneRepoOptions options when clone a repository
100100
type CloneRepoOptions struct {
101-
Timeout time.Duration
102-
Mirror bool
103-
Bare bool
104-
Quiet bool
105-
Branch string
106-
Shared bool
107-
NoCheckout bool
108-
Depth int
109-
Filter string
101+
Timeout time.Duration
102+
Mirror bool
103+
Bare bool
104+
Quiet bool
105+
Branch string
106+
Shared bool
107+
NoCheckout bool
108+
Depth int
109+
Filter string
110+
SkipTLSVerify bool
110111
}
111112

112113
// Clone clones original repository to target path.
@@ -124,6 +125,9 @@ func CloneWithArgs(ctx context.Context, from, to string, args []string, opts Clo
124125
}
125126

126127
cmd := NewCommandContextNoGlobals(ctx, args...).AddArguments("clone")
128+
if opts.SkipTLSVerify {
129+
cmd.AddArguments("-c", "http.sslVerify=false")
130+
}
127131
if opts.Mirror {
128132
cmd.AddArguments("--mirror")
129133
}

modules/hostmatcher/hostmatcher.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import (
88
"net"
99
"path/filepath"
1010
"strings"
11-
12-
"code.gitea.io/gitea/modules/util"
1311
)
1412

1513
// HostMatchList is used to check if a host or IP is in a list.
@@ -104,11 +102,11 @@ func (hl *HostMatchList) checkIP(ip net.IP) bool {
104102
for _, builtin := range hl.builtins {
105103
switch builtin {
106104
case MatchBuiltinExternal:
107-
if ip.IsGlobalUnicast() && !util.IsIPPrivate(ip) {
105+
if ip.IsGlobalUnicast() && !ip.IsPrivate() {
108106
return true
109107
}
110108
case MatchBuiltinPrivate:
111-
if util.IsIPPrivate(ip) {
109+
if ip.IsPrivate() {
112110
return true
113111
}
114112
case MatchBuiltinLoopback:

modules/repository/repo.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,10 @@ func MigrateRepositoryGitData(ctx context.Context, u *user_model.User,
7272
}
7373

7474
if err = git.Clone(ctx, opts.CloneAddr, repoPath, git.CloneRepoOptions{
75-
Mirror: true,
76-
Quiet: true,
77-
Timeout: migrateTimeout,
75+
Mirror: true,
76+
Quiet: true,
77+
Timeout: migrateTimeout,
78+
SkipTLSVerify: setting.Migrations.SkipTLSVerify,
7879
}); err != nil {
7980
return repo, fmt.Errorf("Clone: %v", err)
8081
}
@@ -88,10 +89,11 @@ func MigrateRepositoryGitData(ctx context.Context, u *user_model.User,
8889
}
8990

9091
if err = git.Clone(ctx, wikiRemotePath, wikiPath, git.CloneRepoOptions{
91-
Mirror: true,
92-
Quiet: true,
93-
Timeout: migrateTimeout,
94-
Branch: "master",
92+
Mirror: true,
93+
Quiet: true,
94+
Timeout: migrateTimeout,
95+
Branch: "master",
96+
SkipTLSVerify: setting.Migrations.SkipTLSVerify,
9597
}); err != nil {
9698
log.Warn("Clone wiki: %v", err)
9799
if err := util.RemoveAll(wikiPath); err != nil {

modules/util/net.go

Lines changed: 0 additions & 13 deletions
This file was deleted.

modules/util/net_test.go

Lines changed: 0 additions & 56 deletions
This file was deleted.

options/license/mplus

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
These fonts are free softwares. Unlimited permission is
3+
granted to use, copy, and distribute it, with or without
4+
modification, either commercially and noncommercially.
5+
THESE FONTS ARE PROVIDED "AS IS" WITHOUT WARRANTY.
6+

routers/private/mail.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func SendEmail(ctx *context.PrivateContext) {
6060
}
6161
} else {
6262
err := user_model.IterateUser(func(user *user_model.User) error {
63-
if len(user.Email) > 0 {
63+
if len(user.Email) > 0 && user.IsActive {
6464
emails = append(emails, user.Email)
6565
}
6666
return nil

routers/web/web.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@ func Routes(sessioner func(http.Handler) http.Handler) *web.Route {
9999
http.Redirect(w, req, path.Join(setting.StaticURLPrefix, "/assets/img/apple-touch-icon.png"), 301)
100100
})
101101

102+
// redirect default favicon to the path of the custom favicon with a default as a fallback
103+
routes.Get("/favicon.ico", func(w http.ResponseWriter, req *http.Request) {
104+
http.Redirect(w, req, path.Join(setting.StaticURLPrefix, "/assets/img/favicon.png"), 301)
105+
})
106+
102107
common := []interface{}{}
103108

104109
if setting.EnableGzip {

services/mailer/mail.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ func SendActivateEmailMail(u *user_model.User, email *user_model.EmailAddress) {
146146

147147
// SendRegisterNotifyMail triggers a notify e-mail by admin created a account.
148148
func SendRegisterNotifyMail(u *user_model.User) {
149-
if setting.MailService == nil {
150-
// No mail service configured
149+
if setting.MailService == nil || !u.IsActive {
150+
// No mail service configured OR user is inactive
151151
return
152152
}
153153
locale := translation.NewLocale(u.Language)
@@ -176,8 +176,8 @@ func SendRegisterNotifyMail(u *user_model.User) {
176176

177177
// SendCollaboratorMail sends mail notification to new collaborator.
178178
func SendCollaboratorMail(u, doer *user_model.User, repo *repo_model.Repository) {
179-
if setting.MailService == nil {
180-
// No mail service configured
179+
if setting.MailService == nil || !u.IsActive {
180+
// No mail service configured OR the user is inactive
181181
return
182182
}
183183
locale := translation.NewLocale(u.Language)
@@ -405,6 +405,10 @@ func SendIssueAssignedMail(issue *models.Issue, doer *user_model.User, content s
405405

406406
langMap := make(map[string][]*user_model.User)
407407
for _, user := range recipients {
408+
if !user.IsActive {
409+
// don't send emails to inactive users
410+
continue
411+
}
408412
langMap[user.Language] = append(langMap[user.Language], user)
409413
}
410414

services/mailer/mail_issue.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ func mailIssueCommentBatch(ctx *mailCommentContext, users []*user_model.User, vi
126126

127127
langMap := make(map[string][]*user_model.User)
128128
for _, user := range users {
129+
if !user.IsActive {
130+
// Exclude deactivated users
131+
continue
132+
}
129133
// At this point we exclude:
130134
// user that don't have all mails enabled or users only get mail on mention and this is one ...
131135
if !(user.EmailNotificationsPreference == user_model.EmailNotificationsEnabled ||

services/mailer/mail_repo.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ func SendRepoTransferNotifyMail(doer, newOwner *user_model.User, repo *repo_mode
3131

3232
langMap := make(map[string][]string)
3333
for _, user := range users {
34+
if !user.IsActive {
35+
// don't send emails to inactive users
36+
continue
37+
}
3438
langMap[user.Language] = append(langMap[user.Language], user.Email)
3539
}
3640

services/migrations/dump.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"code.gitea.io/gitea/modules/log"
2323
base "code.gitea.io/gitea/modules/migration"
2424
"code.gitea.io/gitea/modules/repository"
25+
"code.gitea.io/gitea/modules/setting"
2526
"code.gitea.io/gitea/modules/structs"
2627

2728
"gopkg.in/yaml.v2"
@@ -149,9 +150,10 @@ func (g *RepositoryDumper) CreateRepo(repo *base.Repository, opts base.MigrateOp
149150
}
150151

151152
err = git.Clone(g.ctx, remoteAddr, repoPath, git.CloneRepoOptions{
152-
Mirror: true,
153-
Quiet: true,
154-
Timeout: migrateTimeout,
153+
Mirror: true,
154+
Quiet: true,
155+
Timeout: migrateTimeout,
156+
SkipTLSVerify: setting.Migrations.SkipTLSVerify,
155157
})
156158
if err != nil {
157159
return fmt.Errorf("Clone: %v", err)
@@ -166,10 +168,11 @@ func (g *RepositoryDumper) CreateRepo(repo *base.Repository, opts base.MigrateOp
166168
}
167169

168170
if err := git.Clone(g.ctx, wikiRemotePath, wikiPath, git.CloneRepoOptions{
169-
Mirror: true,
170-
Quiet: true,
171-
Timeout: migrateTimeout,
172-
Branch: "master",
171+
Mirror: true,
172+
Quiet: true,
173+
Timeout: migrateTimeout,
174+
Branch: "master",
175+
SkipTLSVerify: setting.Migrations.SkipTLSVerify,
173176
}); err != nil {
174177
log.Warn("Clone wiki: %v", err)
175178
if err := os.RemoveAll(wikiPath); err != nil {

0 commit comments

Comments
 (0)