Skip to content

Commit 404ab33

Browse files
authored
Merge branch 'main' into feature/board_color
2 parents e64812b + eaa791b commit 404ab33

File tree

14 files changed

+100
-14
lines changed

14 files changed

+100
-14
lines changed

CHANGELOG.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,37 @@ 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-rc3](https://github.com/go-gitea/gitea/releases/tag/v1.15.0-rc3) - 2021-08-06
8+
9+
* BREAKING
10+
* Upgrade to the latest version of golang-jwt and increase minimum go to 1.15 (#16590) (#16606)
11+
* SECURITY
12+
* Upgrade to the latest version of golang-jwt and increase minimum go to 1.15 (#16590) (#16606)
13+
* Correctly create of git-daemon-export-ok files (#16508) (#16514)
14+
* Don't show private user's repo in explore view (#16550) (#16554)
15+
* Update node tar dependency to 6.1.6 (#16622) (#16623)
16+
* API
17+
* Swagger AccessToken fixes (#16574) (#16597)
18+
* Set AllowedHeaders on API CORS handler (#16524) (#16618)
19+
* BUGFIXES
20+
* Restore Accessibility for Dropdown (#16576) (#16617)
21+
* Pass down SignedUserName down to AccessLogger context (#16605) (#16616)
22+
* Fix table alignment in markdown (#16596) (#16602)
23+
* Fix 500 on first wiki page (#16586) (#16598)
24+
* Lock goth/gothic and Re-attempt OAuth2 registration on login if registration failed at startup (#16564) (#16570)
25+
* Upgrade levelqueue to v0.4.0 (#16560) (#16561)
26+
* Handle too long PR titles correctly (#16517) (#16549)
27+
* Fix data race in bleve indexer (#16474) (#16509)
28+
* Restore CORS on git smart http protocol (#16496) (#16506)
29+
* Fix race in log (#16490) (#16505)
30+
* Fix prepareWikiFileName to respect existing unescaped files (#16487) (#16498)
31+
* Make cancel from CatFileBatch and CatFileBatchCheck wait for the command to end (#16479) (#16480)
32+
* Update notification table with only latest data (#16445) (#16469)
33+
* Revert to use alpine 3.13 (#16451) (#16452)
34+
* Fix crash following ldap authentication update (#16447) (#16448)
35+
* Fix direct creation of external users on admin page (partial #16612) (#16613)
36+
* Prevent 500 on draft releases without tag (#16634) (#16636)
37+
738
## [1.15.0-rc2](https://github.com/go-gitea/gitea/releases/tag/v1.15.0-rc2) - 2021-07-22
839

940
* BUGFIXES

custom/conf/app.example.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -993,6 +993,9 @@ PATH =
993993
;;
994994
;; allow request with credentials
995995
;ALLOW_CREDENTIALS = false
996+
;;
997+
;; set X-FRAME-OPTIONS header
998+
;X_FRAME_OPTIONS = SAMEORIGIN
996999

9971000
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9981001
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

docs/content/doc/advanced/config-cheat-sheet.en-us.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ The following configuration set `Content-Type: application/vnd.android.package-a
162162
- `METHODS`: **GET,HEAD,POST,PUT,PATCH,DELETE,OPTIONS**: list of methods allowed to request
163163
- `MAX_AGE`: **10m**: max time to cache response
164164
- `ALLOW_CREDENTIALS`: **false**: allow request with credentials
165+
- `X_FRAME_OPTIONS`: **SAMEORIGIN**: Set the `X-Frame-Options` header value.
165166

166167
## UI (`ui`)
167168

docs/content/doc/features/authentication.en-us.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ To configure PAM, set the 'PAM Service Name' to a filename in `/etc/pam.d/`. To
170170
work with normal Linux passwords, the user running Gitea must have read access
171171
to `/etc/shadow`.
172172

173+
**Note**: PAM support is added via [build-time flags](https://docs.gitea.io/en-us/install-from-source/#build), and the official binaries provided do not have this enabled.
174+
173175
## SMTP (Simple Mail Transfer Protocol)
174176

175177
This option allows Gitea to log in to an SMTP host as a Gitea user. To

models/migrations/migrations.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,9 @@ var migrations = []Migration{
327327
NewMigration("Drop unneeded webhook related columns", dropWebhookColumns),
328328
// v188 -> v189
329329
NewMigration("Add key is verified to gpg key", addKeyIsVerified),
330+
331+
// Gitea 1.15.0 ends at v189
332+
330333
// v189 -> v190
331334
NewMigration("Unwrap ldap.Sources", unwrapLDAPSourceCfg),
332335
// v190 -> v191
@@ -842,7 +845,7 @@ func dropTableColumns(sess *xorm.Session, tableName string, columnNames ...strin
842845
}
843846
cols += "`" + strings.ToLower(col) + "`"
844847
}
845-
sql := fmt.Sprintf("SELECT Name FROM SYS.DEFAULT_CONSTRAINTS WHERE PARENT_OBJECT_ID = OBJECT_ID('%[1]s') AND PARENT_COLUMN_ID IN (SELECT column_id FROM sys.columns WHERE lower(NAME) IN (%[2]s) AND object_id = OBJECT_ID('%[1]s'))",
848+
sql := fmt.Sprintf("SELECT Name FROM sys.default_constraints WHERE parent_object_id = OBJECT_ID('%[1]s') AND parent_column_id IN (SELECT column_id FROM sys.columns WHERE LOWER(name) IN (%[2]s) AND object_id = OBJECT_ID('%[1]s'))",
846849
tableName, strings.ReplaceAll(cols, "`", "'"))
847850
constraints := make([]string, 0)
848851
if err := sess.SQL(sql).Find(&constraints); err != nil {
@@ -853,17 +856,14 @@ func dropTableColumns(sess *xorm.Session, tableName string, columnNames ...strin
853856
return fmt.Errorf("Drop table `%s` default constraint `%s`: %v", tableName, constraint, err)
854857
}
855858
}
856-
sql = fmt.Sprintf("SELECT DISTINCT Name FROM SYS.INDEXES INNER JOIN SYS.INDEX_COLUMNS ON INDEXES.INDEX_ID = INDEX_COLUMNS.INDEX_ID AND INDEXES.OBJECT_ID = INDEX_COLUMNS.OBJECT_ID WHERE INDEXES.OBJECT_ID = OBJECT_ID('%[1]s') AND INDEX_COLUMNS.COLUMN_ID IN (SELECT column_id FROM sys.columns WHERE lower(NAME) IN (%[2]s) AND object_id = OBJECT_ID('%[1]s'))",
859+
sql = fmt.Sprintf("SELECT DISTINCT Name FROM sys.indexes INNER JOIN sys.index_columns ON indexes.index_id = index_columns.index_id AND indexes.object_id = index_columns.object_id WHERE indexes.object_id = OBJECT_ID('%[1]s') AND index_columns.column_id IN (SELECT column_id FROM sys.columns WHERE LOWER(name) IN (%[2]s) AND object_id = OBJECT_ID('%[1]s'))",
857860
tableName, strings.ReplaceAll(cols, "`", "'"))
858861
constraints = make([]string, 0)
859862
if err := sess.SQL(sql).Find(&constraints); err != nil {
860863
return fmt.Errorf("Find constraints: %v", err)
861864
}
862865
for _, constraint := range constraints {
863-
if _, err := sess.Exec(fmt.Sprintf("ALTER TABLE `%s` DROP CONSTRAINT IF EXISTS `%s`", tableName, constraint)); err != nil {
864-
return fmt.Errorf("Drop table `%s` index constraint `%s`: %v", tableName, constraint, err)
865-
}
866-
if _, err := sess.Exec(fmt.Sprintf("DROP INDEX IF EXISTS `%[2]s` ON `%[1]s`", tableName, constraint)); err != nil {
866+
if _, err := sess.Exec(fmt.Sprintf("DROP INDEX `%[2]s` ON `%[1]s`", tableName, constraint)); err != nil {
867867
return fmt.Errorf("Drop index `%[2]s` on `%[1]s`: %v", tableName, constraint, err)
868868
}
869869
}

models/models.go

100644100755
Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,8 @@ type Statistic struct {
272272
Counter struct {
273273
User, Org, PublicKey,
274274
Repo, Watch, Star, Action, Access,
275-
Issue, Comment, Oauth, Follow,
275+
Issue, IssueClosed, IssueOpen,
276+
Comment, Oauth, Follow,
276277
Mirror, Release, LoginSource, Webhook,
277278
Milestone, Label, HookTask,
278279
Team, UpdateTask, Attachment int64
@@ -289,7 +290,24 @@ func GetStatistic() (stats Statistic) {
289290
stats.Counter.Star, _ = x.Count(new(Star))
290291
stats.Counter.Action, _ = x.Count(new(Action))
291292
stats.Counter.Access, _ = x.Count(new(Access))
292-
stats.Counter.Issue, _ = x.Count(new(Issue))
293+
294+
type IssueCount struct {
295+
Count int64
296+
IsClosed bool
297+
}
298+
issueCounts := []IssueCount{}
299+
300+
_ = x.Select("COUNT(*) AS count, is_closed").Table("issue").GroupBy("is_closed").Find(&issueCounts)
301+
for _, c := range issueCounts {
302+
if c.IsClosed {
303+
stats.Counter.IssueClosed = c.Count
304+
} else {
305+
stats.Counter.IssueOpen = c.Count
306+
}
307+
}
308+
309+
stats.Counter.Issue = stats.Counter.IssueClosed + stats.Counter.IssueOpen
310+
293311
stats.Counter.Comment, _ = x.Count(new(Comment))
294312
stats.Counter.Oauth = 0
295313
stats.Counter.Follow, _ = x.Count(new(Follow))

modules/context/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ func APIContexter() func(http.Handler) http.Handler {
270270
}
271271
}
272272

273-
ctx.Resp.Header().Set(`X-Frame-Options`, `SAMEORIGIN`)
273+
ctx.Resp.Header().Set(`X-Frame-Options`, setting.CORSConfig.XFrameOptions)
274274

275275
ctx.Data["CsrfToken"] = html.EscapeString(ctx.csrf.GetToken())
276276

modules/context/context.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ func Contexter() func(next http.Handler) http.Handler {
729729
}
730730
}
731731

732-
ctx.Resp.Header().Set(`X-Frame-Options`, `SAMEORIGIN`)
732+
ctx.Resp.Header().Set(`X-Frame-Options`, setting.CORSConfig.XFrameOptions)
733733

734734
ctx.Data["CsrfToken"] = html.EscapeString(ctx.csrf.GetToken())
735735
ctx.Data["CsrfTokenHtml"] = template.HTML(`<input type="hidden" name="_csrf" value="` + ctx.Data["CsrfToken"].(string) + `">`)

modules/metrics/collector.go

100644100755
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ type Collector struct {
2222
Follows *prometheus.Desc
2323
HookTasks *prometheus.Desc
2424
Issues *prometheus.Desc
25+
IssuesOpen *prometheus.Desc
26+
IssuesClosed *prometheus.Desc
2527
Labels *prometheus.Desc
2628
LoginSources *prometheus.Desc
2729
Milestones *prometheus.Desc
@@ -77,6 +79,16 @@ func NewCollector() Collector {
7779
"Number of Issues",
7880
nil, nil,
7981
),
82+
IssuesOpen: prometheus.NewDesc(
83+
namespace+"issues_open",
84+
"Number of open Issues",
85+
nil, nil,
86+
),
87+
IssuesClosed: prometheus.NewDesc(
88+
namespace+"issues_closed",
89+
"Number of closed Issues",
90+
nil, nil,
91+
),
8092
Labels: prometheus.NewDesc(
8193
namespace+"labels",
8294
"Number of Labels",
@@ -165,6 +177,8 @@ func (c Collector) Describe(ch chan<- *prometheus.Desc) {
165177
ch <- c.Follows
166178
ch <- c.HookTasks
167179
ch <- c.Issues
180+
ch <- c.IssuesOpen
181+
ch <- c.IssuesClosed
168182
ch <- c.Labels
169183
ch <- c.LoginSources
170184
ch <- c.Milestones
@@ -221,6 +235,16 @@ func (c Collector) Collect(ch chan<- prometheus.Metric) {
221235
prometheus.GaugeValue,
222236
float64(stats.Counter.Issue),
223237
)
238+
ch <- prometheus.MustNewConstMetric(
239+
c.IssuesClosed,
240+
prometheus.GaugeValue,
241+
float64(stats.Counter.IssueClosed),
242+
)
243+
ch <- prometheus.MustNewConstMetric(
244+
c.IssuesOpen,
245+
prometheus.GaugeValue,
246+
float64(stats.Counter.IssueOpen),
247+
)
224248
ch <- prometheus.MustNewConstMetric(
225249
c.Labels,
226250
prometheus.GaugeValue,

modules/setting/cors.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ var (
2020
Methods []string
2121
MaxAge time.Duration
2222
AllowCredentials bool
23+
XFrameOptions string
2324
}{
24-
Enabled: false,
25-
MaxAge: 10 * time.Minute,
25+
Enabled: false,
26+
MaxAge: 10 * time.Minute,
27+
XFrameOptions: "SAMEORIGIN",
2628
}
2729
)
2830

0 commit comments

Comments
 (0)