Skip to content

Commit 521030e

Browse files
committed
Merge remote-tracking branch 'giteaofficial/main'
* giteaofficial/main: [skip ci] Updated licenses and gitignores Fix rename branch permission bug (go-gitea#32066) Fix artifact v4 upload above 8MB (go-gitea#31664) [skip ci] Updated translations via Crowdin Add bin to Composer Metadata (go-gitea#32099) Fix wrong last modify time (go-gitea#32102) Fix upload maven pacakge parallelly (go-gitea#31851) Repo Activity: count new issues that were closed (go-gitea#31776) Count typescript files as frontend for labeling (go-gitea#32088) Use camo.Always instead of camo.Allways (go-gitea#32097)
2 parents 19aa38d + 48cdde9 commit 521030e

File tree

22 files changed

+459
-61
lines changed

22 files changed

+459
-61
lines changed

.github/labeler.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,11 @@ modifies/go:
7070
- any-glob-to-any-file:
7171
- "**/*.go"
7272

73-
modifies/js:
73+
modifies/frontend:
7474
- changed-files:
7575
- any-glob-to-any-file:
7676
- "**/*.js"
77+
- "**/*.ts"
7778
- "**/*.vue"
7879

7980
docs-update-needed:

custom/conf/app.example.ini

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,8 @@ INTERNAL_TOKEN =
526526
;; HMAC to encode urls with, it **is required** if camo is enabled.
527527
;HMAC_KEY =
528528
;; Set to true to use camo for https too lese only non https urls are proxyed
529-
;ALLWAYS = false
529+
;; ALLWAYS is deprecated and will be removed in the future
530+
;ALWAYS = false
530531

531532
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
532533
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

models/activities/repo_activity.go

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ type ActivityStats struct {
3434
OpenedPRAuthorCount int64
3535
MergedPRs issues_model.PullRequestList
3636
MergedPRAuthorCount int64
37+
ActiveIssues issues_model.IssueList
3738
OpenedIssues issues_model.IssueList
3839
OpenedIssueAuthorCount int64
3940
ClosedIssues issues_model.IssueList
@@ -172,7 +173,7 @@ func (stats *ActivityStats) MergedPRPerc() int {
172173

173174
// ActiveIssueCount returns total active issue count
174175
func (stats *ActivityStats) ActiveIssueCount() int {
175-
return stats.OpenedIssueCount() + stats.ClosedIssueCount()
176+
return len(stats.ActiveIssues)
176177
}
177178

178179
// OpenedIssueCount returns open issue count
@@ -285,13 +286,21 @@ func (stats *ActivityStats) FillIssues(ctx context.Context, repoID int64, fromTi
285286
stats.ClosedIssueAuthorCount = count
286287

287288
// New issues
288-
sess = issuesForActivityStatement(ctx, repoID, fromTime, false, false)
289+
sess = newlyCreatedIssues(ctx, repoID, fromTime)
289290
sess.OrderBy("issue.created_unix ASC")
290291
stats.OpenedIssues = make(issues_model.IssueList, 0)
291292
if err = sess.Find(&stats.OpenedIssues); err != nil {
292293
return err
293294
}
294295

296+
// Active issues
297+
sess = activeIssues(ctx, repoID, fromTime)
298+
sess.OrderBy("issue.created_unix ASC")
299+
stats.ActiveIssues = make(issues_model.IssueList, 0)
300+
if err = sess.Find(&stats.ActiveIssues); err != nil {
301+
return err
302+
}
303+
295304
// Opened issue authors
296305
sess = issuesForActivityStatement(ctx, repoID, fromTime, false, false)
297306
if _, err = sess.Select("count(distinct issue.poster_id) as `count`").Table("issue").Get(&count); err != nil {
@@ -317,6 +326,23 @@ func (stats *ActivityStats) FillUnresolvedIssues(ctx context.Context, repoID int
317326
return sess.Find(&stats.UnresolvedIssues)
318327
}
319328

329+
func newlyCreatedIssues(ctx context.Context, repoID int64, fromTime time.Time) *xorm.Session {
330+
sess := db.GetEngine(ctx).Where("issue.repo_id = ?", repoID).
331+
And("issue.is_pull = ?", false). // Retain the is_pull check to exclude pull requests
332+
And("issue.created_unix >= ?", fromTime.Unix()) // Include all issues created after fromTime
333+
334+
return sess
335+
}
336+
337+
func activeIssues(ctx context.Context, repoID int64, fromTime time.Time) *xorm.Session {
338+
sess := db.GetEngine(ctx).Where("issue.repo_id = ?", repoID).
339+
And("issue.is_pull = ?", false).
340+
And("issue.created_unix >= ?", fromTime.Unix()).
341+
Or("issue.closed_unix >= ?", fromTime.Unix())
342+
343+
return sess
344+
}
345+
320346
func issuesForActivityStatement(ctx context.Context, repoID int64, fromTime time.Time, closed, unresolved bool) *xorm.Session {
321347
sess := db.GetEngine(ctx).Where("issue.repo_id = ?", repoID).
322348
And("issue.is_closed = ?", closed)

modules/httpcache/httpcache.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ func HandleGenericETagTimeCache(req *http.Request, w http.ResponseWriter, etag s
7575
w.Header().Set("Etag", etag)
7676
}
7777
if lastModified != nil && !lastModified.IsZero() {
78-
w.Header().Set("Last-Modified", lastModified.Format(http.TimeFormat))
78+
// http.TimeFormat required a UTC time, refer to https://pkg.go.dev/net/http#TimeFormat
79+
w.Header().Set("Last-Modified", lastModified.UTC().Format(http.TimeFormat))
7980
}
8081

8182
if len(etag) > 0 {

modules/httplib/serve.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ func ServeSetHeaders(w http.ResponseWriter, opts *ServeHeaderOptions) {
7979
httpcache.SetCacheControlInHeader(header, duration)
8080

8181
if !opts.LastModified.IsZero() {
82+
// http.TimeFormat required a UTC time, refer to https://pkg.go.dev/net/http#TimeFormat
8283
header.Set("Last-Modified", opts.LastModified.UTC().Format(http.TimeFormat))
8384
}
8485
}

modules/markup/camo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func camoHandleLink(link string) string {
3838
if setting.Camo.Enabled {
3939
lnkURL, err := url.Parse(link)
4040
if err == nil && lnkURL.IsAbs() && !strings.HasPrefix(link, setting.AppURL) &&
41-
(setting.Camo.Allways || lnkURL.Scheme != "https") {
41+
(setting.Camo.Always || lnkURL.Scheme != "https") {
4242
return CamoEncode(link)
4343
}
4444
}

modules/markup/camo_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func TestCamoHandleLink(t *testing.T) {
2828
"https://image.proxy/eivin43gJwGVIjR9MiYYtFIk0mw/aHR0cDovL3Rlc3RpbWFnZXMub3JnL2ltZy5qcGc",
2929
camoHandleLink("http://testimages.org/img.jpg"))
3030

31-
setting.Camo.Allways = true
31+
setting.Camo.Always = true
3232
assert.Equal(t,
3333
"https://gitea.com/img.jpg",
3434
camoHandleLink("https://gitea.com/img.jpg"))

modules/packages/composer/metadata.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ type Metadata struct {
4848
Homepage string `json:"homepage,omitempty"`
4949
License Licenses `json:"license,omitempty"`
5050
Authors []Author `json:"authors,omitempty"`
51+
Bin []string `json:"bin,omitempty"`
5152
Autoload map[string]any `json:"autoload,omitempty"`
5253
AutoloadDev map[string]any `json:"autoload-dev,omitempty"`
5354
Extra map[string]any `json:"extra,omitempty"`

modules/setting/camo.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,28 @@
33

44
package setting
55

6-
import "code.gitea.io/gitea/modules/log"
6+
import (
7+
"strconv"
8+
9+
"code.gitea.io/gitea/modules/log"
10+
)
711

812
var Camo = struct {
913
Enabled bool
1014
ServerURL string `ini:"SERVER_URL"`
1115
HMACKey string `ini:"HMAC_KEY"`
12-
Allways bool
16+
Always bool
1317
}{}
1418

1519
func loadCamoFrom(rootCfg ConfigProvider) {
1620
mustMapSetting(rootCfg, "camo", &Camo)
1721
if Camo.Enabled {
22+
oldValue := rootCfg.Section("camo").Key("ALLWAYS").MustString("")
23+
if oldValue != "" {
24+
log.Warn("camo.ALLWAYS is deprecated, use camo.ALWAYS instead")
25+
Camo.Always, _ = strconv.ParseBool(oldValue)
26+
}
27+
1828
if Camo.ServerURL == "" || Camo.HMACKey == "" {
1929
log.Fatal(`Camo settings require "SERVER_URL" and HMAC_KEY`)
2030
}

options/gitignore/Zig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.zig-cache/
2+
zig-out/

options/license/Boehm-GC-without-fee

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Copyright (c) 2000
2+
SWsoft company
3+
4+
Modifications copyright (c) 2001, 2013. Oracle and/or its affiliates.
5+
All rights reserved.
6+
7+
This material is provided "as is", with absolutely no warranty expressed
8+
or implied. Any use is at your own risk.
9+
10+
Permission to use or copy this software for any purpose is hereby granted
11+
without fee, provided the above notices are retained on all copies.
12+
Permission to modify the code and to distribute modified code is granted,
13+
provided the above notices are retained, and a notice that the code was
14+
modified is included with the above copyright notice.

0 commit comments

Comments
 (0)