Skip to content

Commit d8fe118

Browse files
authored
Merge branch 'main' into fix-16507-long-commit-messages
2 parents 6424efd + d717c69 commit d8fe118

File tree

214 files changed

+4687
-3415
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

214 files changed

+4687
-3415
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,19 @@ This changelog goes through all the changes that have been made in each release
44
without substantial changes to our git log; to see the highlights of what has
55
been added to each release, please refer to the [blog](https://blog.gitea.io).
66

7+
## [1.15.0-rc2](https://github.com/go-gitea/gitea/releases/tag/v1.15.0-rc2) - 2021-07-22
8+
9+
* BUGFIXES
10+
* Restore creation of git-daemon-export-ok files (#16508) (#16514)
11+
* Fix data race in bleve indexer (#16474) (#16509)
12+
* Restore CORS on git smart http protocol (#16496) (#16506)
13+
* Fix race in log (#16490) (#16505)
14+
* Fix prepareWikiFileName to respect existing unescaped files (#16487) (#16498)
15+
* Make cancel from CatFileBatch and CatFileBatchCheck wait for the command to end (#16479) (#16480)
16+
* Update notification table with only latest data (#16445) (#16469)
17+
* Revert to use alpine 3.13 to fix multiple seccomp related issues with Docker <20 (#16451) (#16452)
18+
* Fix crash following ldap authentication update (#16447) (#16448)
19+
720
## [1.15.0-rc1](https://github.com/go-gitea/gitea/releases/tag/v1.15.0-rc1) - 2021-07-15
821

922
* BREAKING

build/generate-emoji.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"strings"
2121
"unicode/utf8"
2222

23-
jsoniter "github.com/json-iterator/go"
23+
"code.gitea.io/gitea/modules/json"
2424
)
2525

2626
const (
@@ -51,7 +51,6 @@ func (e Emoji) MarshalJSON() ([]byte, error) {
5151
x.UnicodeVersion = ""
5252
x.Description = ""
5353
x.SkinTones = false
54-
json := jsoniter.ConfigCompatibleWithStandardLibrary
5554
return json.Marshal(x)
5655
}
5756

@@ -103,7 +102,6 @@ func generate() ([]byte, error) {
103102

104103
// unmarshal
105104
var data Gemoji
106-
json := jsoniter.ConfigCompatibleWithStandardLibrary
107105
err = json.Unmarshal(body, &data)
108106
if err != nil {
109107
return nil, err

cmd/admin.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ import (
1414
"text/tabwriter"
1515

1616
"code.gitea.io/gitea/models"
17-
"code.gitea.io/gitea/modules/auth/oauth2"
1817
"code.gitea.io/gitea/modules/git"
1918
"code.gitea.io/gitea/modules/graceful"
2019
"code.gitea.io/gitea/modules/log"
2120
pwd "code.gitea.io/gitea/modules/password"
2221
repo_module "code.gitea.io/gitea/modules/repository"
2322
"code.gitea.io/gitea/modules/setting"
2423
"code.gitea.io/gitea/modules/storage"
24+
"code.gitea.io/gitea/services/auth/source/oauth2"
2525

2626
"github.com/urfave/cli"
2727
)
@@ -597,7 +597,7 @@ func runRegenerateKeys(_ *cli.Context) error {
597597
return models.RewriteAllPublicKeys()
598598
}
599599

600-
func parseOAuth2Config(c *cli.Context) *models.OAuth2Config {
600+
func parseOAuth2Config(c *cli.Context) *oauth2.Source {
601601
var customURLMapping *oauth2.CustomURLMapping
602602
if c.IsSet("use-custom-urls") {
603603
customURLMapping = &oauth2.CustomURLMapping{
@@ -609,7 +609,7 @@ func parseOAuth2Config(c *cli.Context) *models.OAuth2Config {
609609
} else {
610610
customURLMapping = nil
611611
}
612-
return &models.OAuth2Config{
612+
return &oauth2.Source{
613613
Provider: c.String("provider"),
614614
ClientID: c.String("key"),
615615
ClientSecret: c.String("secret"),
@@ -625,10 +625,10 @@ func runAddOauth(c *cli.Context) error {
625625
}
626626

627627
return models.CreateLoginSource(&models.LoginSource{
628-
Type: models.LoginOAuth2,
629-
Name: c.String("name"),
630-
IsActived: true,
631-
Cfg: parseOAuth2Config(c),
628+
Type: models.LoginOAuth2,
629+
Name: c.String("name"),
630+
IsActive: true,
631+
Cfg: parseOAuth2Config(c),
632632
})
633633
}
634634

@@ -646,7 +646,7 @@ func runUpdateOauth(c *cli.Context) error {
646646
return err
647647
}
648648

649-
oAuth2Config := source.OAuth2()
649+
oAuth2Config := source.Cfg.(*oauth2.Source)
650650

651651
if c.IsSet("name") {
652652
source.Name = c.String("name")
@@ -728,7 +728,7 @@ func runListAuth(c *cli.Context) error {
728728
w := tabwriter.NewWriter(os.Stdout, c.Int("min-width"), c.Int("tab-width"), c.Int("padding"), padChar, flags)
729729
fmt.Fprintf(w, "ID\tName\tType\tEnabled\n")
730730
for _, source := range loginSources {
731-
fmt.Fprintf(w, "%d\t%s\t%s\t%t\n", source.ID, source.Name, models.LoginNames[source.Type], source.IsActived)
731+
fmt.Fprintf(w, "%d\t%s\t%s\t%t\n", source.ID, source.Name, models.LoginNames[source.Type], source.IsActive)
732732
}
733733
w.Flush()
734734

cmd/admin_auth_ldap.go

Lines changed: 36 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"strings"
1010

1111
"code.gitea.io/gitea/models"
12-
"code.gitea.io/gitea/modules/auth/ldap"
12+
"code.gitea.io/gitea/services/auth/source/ldap"
1313

1414
"github.com/urfave/cli"
1515
)
@@ -172,86 +172,86 @@ func parseLoginSource(c *cli.Context, loginSource *models.LoginSource) {
172172
loginSource.Name = c.String("name")
173173
}
174174
if c.IsSet("not-active") {
175-
loginSource.IsActived = !c.Bool("not-active")
175+
loginSource.IsActive = !c.Bool("not-active")
176176
}
177177
if c.IsSet("synchronize-users") {
178178
loginSource.IsSyncEnabled = c.Bool("synchronize-users")
179179
}
180180
}
181181

182182
// parseLdapConfig assigns values on config according to command line flags.
183-
func parseLdapConfig(c *cli.Context, config *models.LDAPConfig) error {
183+
func parseLdapConfig(c *cli.Context, config *ldap.Source) error {
184184
if c.IsSet("name") {
185-
config.Source.Name = c.String("name")
185+
config.Name = c.String("name")
186186
}
187187
if c.IsSet("host") {
188-
config.Source.Host = c.String("host")
188+
config.Host = c.String("host")
189189
}
190190
if c.IsSet("port") {
191-
config.Source.Port = c.Int("port")
191+
config.Port = c.Int("port")
192192
}
193193
if c.IsSet("security-protocol") {
194194
p, ok := findLdapSecurityProtocolByName(c.String("security-protocol"))
195195
if !ok {
196196
return fmt.Errorf("Unknown security protocol name: %s", c.String("security-protocol"))
197197
}
198-
config.Source.SecurityProtocol = p
198+
config.SecurityProtocol = p
199199
}
200200
if c.IsSet("skip-tls-verify") {
201-
config.Source.SkipVerify = c.Bool("skip-tls-verify")
201+
config.SkipVerify = c.Bool("skip-tls-verify")
202202
}
203203
if c.IsSet("bind-dn") {
204-
config.Source.BindDN = c.String("bind-dn")
204+
config.BindDN = c.String("bind-dn")
205205
}
206206
if c.IsSet("user-dn") {
207-
config.Source.UserDN = c.String("user-dn")
207+
config.UserDN = c.String("user-dn")
208208
}
209209
if c.IsSet("bind-password") {
210-
config.Source.BindPassword = c.String("bind-password")
210+
config.BindPassword = c.String("bind-password")
211211
}
212212
if c.IsSet("user-search-base") {
213-
config.Source.UserBase = c.String("user-search-base")
213+
config.UserBase = c.String("user-search-base")
214214
}
215215
if c.IsSet("username-attribute") {
216-
config.Source.AttributeUsername = c.String("username-attribute")
216+
config.AttributeUsername = c.String("username-attribute")
217217
}
218218
if c.IsSet("firstname-attribute") {
219-
config.Source.AttributeName = c.String("firstname-attribute")
219+
config.AttributeName = c.String("firstname-attribute")
220220
}
221221
if c.IsSet("surname-attribute") {
222-
config.Source.AttributeSurname = c.String("surname-attribute")
222+
config.AttributeSurname = c.String("surname-attribute")
223223
}
224224
if c.IsSet("email-attribute") {
225-
config.Source.AttributeMail = c.String("email-attribute")
225+
config.AttributeMail = c.String("email-attribute")
226226
}
227227
if c.IsSet("attributes-in-bind") {
228-
config.Source.AttributesInBind = c.Bool("attributes-in-bind")
228+
config.AttributesInBind = c.Bool("attributes-in-bind")
229229
}
230230
if c.IsSet("public-ssh-key-attribute") {
231-
config.Source.AttributeSSHPublicKey = c.String("public-ssh-key-attribute")
231+
config.AttributeSSHPublicKey = c.String("public-ssh-key-attribute")
232232
}
233233
if c.IsSet("page-size") {
234-
config.Source.SearchPageSize = uint32(c.Uint("page-size"))
234+
config.SearchPageSize = uint32(c.Uint("page-size"))
235235
}
236236
if c.IsSet("user-filter") {
237-
config.Source.Filter = c.String("user-filter")
237+
config.Filter = c.String("user-filter")
238238
}
239239
if c.IsSet("admin-filter") {
240-
config.Source.AdminFilter = c.String("admin-filter")
240+
config.AdminFilter = c.String("admin-filter")
241241
}
242242
if c.IsSet("restricted-filter") {
243-
config.Source.RestrictedFilter = c.String("restricted-filter")
243+
config.RestrictedFilter = c.String("restricted-filter")
244244
}
245245
if c.IsSet("allow-deactivate-all") {
246-
config.Source.AllowDeactivateAll = c.Bool("allow-deactivate-all")
246+
config.AllowDeactivateAll = c.Bool("allow-deactivate-all")
247247
}
248248
return nil
249249
}
250250

251251
// findLdapSecurityProtocolByName finds security protocol by its name ignoring case.
252252
// It returns the value of the security protocol and if it was found.
253253
func findLdapSecurityProtocolByName(name string) (ldap.SecurityProtocol, bool) {
254-
for i, n := range models.SecurityProtocolNames {
254+
for i, n := range ldap.SecurityProtocolNames {
255255
if strings.EqualFold(name, n) {
256256
return i, true
257257
}
@@ -289,17 +289,15 @@ func (a *authService) addLdapBindDn(c *cli.Context) error {
289289
}
290290

291291
loginSource := &models.LoginSource{
292-
Type: models.LoginLDAP,
293-
IsActived: true, // active by default
294-
Cfg: &models.LDAPConfig{
295-
Source: &ldap.Source{
296-
Enabled: true, // always true
297-
},
292+
Type: models.LoginLDAP,
293+
IsActive: true, // active by default
294+
Cfg: &ldap.Source{
295+
Enabled: true, // always true
298296
},
299297
}
300298

301299
parseLoginSource(c, loginSource)
302-
if err := parseLdapConfig(c, loginSource.LDAP()); err != nil {
300+
if err := parseLdapConfig(c, loginSource.Cfg.(*ldap.Source)); err != nil {
303301
return err
304302
}
305303

@@ -318,7 +316,7 @@ func (a *authService) updateLdapBindDn(c *cli.Context) error {
318316
}
319317

320318
parseLoginSource(c, loginSource)
321-
if err := parseLdapConfig(c, loginSource.LDAP()); err != nil {
319+
if err := parseLdapConfig(c, loginSource.Cfg.(*ldap.Source)); err != nil {
322320
return err
323321
}
324322

@@ -336,17 +334,15 @@ func (a *authService) addLdapSimpleAuth(c *cli.Context) error {
336334
}
337335

338336
loginSource := &models.LoginSource{
339-
Type: models.LoginDLDAP,
340-
IsActived: true, // active by default
341-
Cfg: &models.LDAPConfig{
342-
Source: &ldap.Source{
343-
Enabled: true, // always true
344-
},
337+
Type: models.LoginDLDAP,
338+
IsActive: true, // active by default
339+
Cfg: &ldap.Source{
340+
Enabled: true, // always true
345341
},
346342
}
347343

348344
parseLoginSource(c, loginSource)
349-
if err := parseLdapConfig(c, loginSource.LDAP()); err != nil {
345+
if err := parseLdapConfig(c, loginSource.Cfg.(*ldap.Source)); err != nil {
350346
return err
351347
}
352348

@@ -365,7 +361,7 @@ func (a *authService) updateLdapSimpleAuth(c *cli.Context) error {
365361
}
366362

367363
parseLoginSource(c, loginSource)
368-
if err := parseLdapConfig(c, loginSource.LDAP()); err != nil {
364+
if err := parseLdapConfig(c, loginSource.Cfg.(*ldap.Source)); err != nil {
369365
return err
370366
}
371367

0 commit comments

Comments
 (0)