Skip to content

Commit 8a238ed

Browse files
authored
Merge branch 'main' into oauth-client-type
2 parents 89626e2 + 9862936 commit 8a238ed

File tree

21 files changed

+142
-54
lines changed

21 files changed

+142
-54
lines changed

.gitpod.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
image: gitpod/workspace-full:latest
2+
3+
tasks:
4+
- name: Setup
5+
init: |
6+
make deps
7+
make build
8+
command: |
9+
gp sync-done setup
10+
exit 0
11+
- name: Run frontend
12+
command: |
13+
gp sync-await setup
14+
make watch-frontend
15+
- name: Run backend
16+
command: |
17+
gp sync-await setup
18+
mkdir -p custom/conf/
19+
echo -e "[server]\nROOT_URL=https://3000-$GITPOD_WORKSPACE_ID.${GITPOD_WORKSPACE_CLUSTER_HOST}/" > custom/conf/app.ini
20+
echo -e "\n[database]\nDB_TYPE = sqlite3\nPATH = /workspace/gitea/data/gitea.db" >> custom/conf/app.ini
21+
export TAGS="sqlite sqlite_unlock_notify"
22+
make watch-backend
23+
24+
vscode:
25+
extensions:
26+
- editorconfig.editorconfig
27+
- dbaeumer.vscode-eslint
28+
- golang.go
29+
- stylelint.vscode-stylelint
30+
- DavidAnson.vscode-markdownlint
31+
32+
ports:
33+
- name: Gitea
34+
port: 3000

contrib/systemd/gitea.service

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,8 @@ After=network.target
4949
###
5050

5151
[Service]
52-
# Modify these two values and uncomment them if you have
53-
# repos with lots of files and get an HTTP error 500 because
54-
# of that
55-
###
56-
#LimitMEMLOCK=infinity
57-
#LimitNOFILE=65535
52+
# Uncomment the next line if you have repos with lots of files and get a HTTP 500 error because of that
53+
# LimitNOFILE=524288:524288
5854
RestartSec=2s
5955
Type=simple
6056
User=git

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -537,9 +537,9 @@ Certain queues have defaults that override the defaults set in `[queue]` (this o
537537
## Camo (`camo`)
538538

539539
- `ENABLED`: **false**: Enable media proxy, we support images only at the moment.
540-
- `SERVER_URL`: **<empty>**: url of camo server, it **is required** if camo is enabled.
541-
- `HMAC_KEY`: **<empty>**: Provide the HMAC key for encoding urls, it **is required** if camo is enabled.
542-
- `ALLWAYS`: **false**: Set to true to use camo for https too lese only non https urls are proxyed
540+
- `SERVER_URL`: **<empty>**: URL of camo server, it **is required** if camo is enabled.
541+
- `HMAC_KEY`: **<empty>**: Provide the HMAC key for encoding URLs, it **is required** if camo is enabled.
542+
- `ALLWAYS`: **false**: Set to true to use camo for both HTTP and HTTPS content, otherwise only non-HTTPS URLs are proxied
543543

544544
## OpenID (`openid`)
545545

File renamed without changes.

docs/content/doc/developers/hacking-on-gitea.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ server as mentioned above.
171171

172172
### Working on JS and CSS
173173

174-
Frontend development should follow [Guidelines for Frontend Development](./guidelines-frontend.md)
174+
Frontend development should follow [Guidelines for Frontend Development]({{< relref "doc/developers/guidelines-frontend.en-us.md" >}})
175175

176176
To build with frontend resources, either use the `watch-frontend` target mentioned above or just build once:
177177

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ require (
9898
golang.org/x/net v0.0.0-20220927171203-f486391704dc
9999
golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1
100100
golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec
101-
golang.org/x/text v0.3.7
101+
golang.org/x/text v0.3.8
102102
golang.org/x/tools v0.1.12
103103
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
104104
gopkg.in/ini.v1 v1.67.0

go.sum

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1891,8 +1891,9 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
18911891
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
18921892
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
18931893
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
1894-
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
18951894
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
1895+
golang.org/x/text v0.3.8 h1:nAL+RVCQ9uMn3vJZbV+MRnydTJFPf8qqY42YiA6MrqY=
1896+
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
18961897
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
18971898
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
18981899
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=

models/repo.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,15 +438,27 @@ func CheckRepoStats(ctx context.Context) error {
438438
repoStatsCorrectNumStars,
439439
"repository count 'num_stars'",
440440
},
441+
// Repository.NumIssues
442+
{
443+
statsQuery("SELECT repo.id FROM `repository` repo WHERE repo.num_issues!=(SELECT COUNT(*) FROM `issue` WHERE repo_id=repo.id AND is_closed=? AND is_pull=?)", false, false),
444+
repoStatsCorrectNumIssues,
445+
"repository count 'num_issues'",
446+
},
441447
// Repository.NumClosedIssues
442448
{
443449
statsQuery("SELECT repo.id FROM `repository` repo WHERE repo.num_closed_issues!=(SELECT COUNT(*) FROM `issue` WHERE repo_id=repo.id AND is_closed=? AND is_pull=?)", true, false),
444450
repoStatsCorrectNumClosedIssues,
445451
"repository count 'num_closed_issues'",
446452
},
453+
// Repository.NumPulls
454+
{
455+
statsQuery("SELECT repo.id FROM `repository` repo WHERE repo.num_pulls!=(SELECT COUNT(*) FROM `issue` WHERE repo_id=repo.id AND is_closed=? AND is_pull=?)", false, true),
456+
repoStatsCorrectNumPulls,
457+
"repository count 'num_pulls'",
458+
},
447459
// Repository.NumClosedPulls
448460
{
449-
statsQuery("SELECT repo.id FROM `repository` repo WHERE repo.num_closed_issues!=(SELECT COUNT(*) FROM `issue` WHERE repo_id=repo.id AND is_closed=? AND is_pull=?)", true, true),
461+
statsQuery("SELECT repo.id FROM `repository` repo WHERE repo.num_closed_pulls!=(SELECT COUNT(*) FROM `issue` WHERE repo_id=repo.id AND is_closed=? AND is_pull=?)", true, true),
450462
repoStatsCorrectNumClosedPulls,
451463
"repository count 'num_closed_pulls'",
452464
},

models/user/email_address.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ func (err ErrEmailCharIsNotSupported) Error() string {
4141
}
4242

4343
// ErrEmailInvalid represents an error where the email address does not comply with RFC 5322
44+
// or has a leading '-' character
4445
type ErrEmailInvalid struct {
4546
Email string
4647
}
@@ -134,9 +135,7 @@ func ValidateEmail(email string) error {
134135
return ErrEmailCharIsNotSupported{email}
135136
}
136137

137-
if !(email[0] >= 'a' && email[0] <= 'z') &&
138-
!(email[0] >= 'A' && email[0] <= 'Z') &&
139-
!(email[0] >= '0' && email[0] <= '9') {
138+
if email[0] == '-' {
140139
return ErrEmailInvalid{email}
141140
}
142141

models/user/email_address_test.go

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -281,23 +281,25 @@ func TestEmailAddressValidate(t *testing.T) {
281281
`first~last@iana.org`: nil,
282282
`first;last@iana.org`: user_model.ErrEmailCharIsNotSupported{`first;last@iana.org`},
283283
".233@qq.com": user_model.ErrEmailInvalid{".233@qq.com"},
284-
"!233@qq.com": user_model.ErrEmailInvalid{"!233@qq.com"},
285-
"#233@qq.com": user_model.ErrEmailInvalid{"#233@qq.com"},
286-
"$233@qq.com": user_model.ErrEmailInvalid{"$233@qq.com"},
287-
"%233@qq.com": user_model.ErrEmailInvalid{"%233@qq.com"},
288-
"&233@qq.com": user_model.ErrEmailInvalid{"&233@qq.com"},
289-
"'233@qq.com": user_model.ErrEmailInvalid{"'233@qq.com"},
290-
"*233@qq.com": user_model.ErrEmailInvalid{"*233@qq.com"},
291-
"+233@qq.com": user_model.ErrEmailInvalid{"+233@qq.com"},
292-
"/233@qq.com": user_model.ErrEmailInvalid{"/233@qq.com"},
293-
"=233@qq.com": user_model.ErrEmailInvalid{"=233@qq.com"},
294-
"?233@qq.com": user_model.ErrEmailInvalid{"?233@qq.com"},
295-
"^233@qq.com": user_model.ErrEmailInvalid{"^233@qq.com"},
296-
"`233@qq.com": user_model.ErrEmailInvalid{"`233@qq.com"},
297-
"{233@qq.com": user_model.ErrEmailInvalid{"{233@qq.com"},
298-
"|233@qq.com": user_model.ErrEmailInvalid{"|233@qq.com"},
299-
"}233@qq.com": user_model.ErrEmailInvalid{"}233@qq.com"},
300-
"~233@qq.com": user_model.ErrEmailInvalid{"~233@qq.com"},
284+
"!233@qq.com": nil,
285+
"#233@qq.com": nil,
286+
"$233@qq.com": nil,
287+
"%233@qq.com": nil,
288+
"&233@qq.com": nil,
289+
"'233@qq.com": nil,
290+
"*233@qq.com": nil,
291+
"+233@qq.com": nil,
292+
"-233@qq.com": user_model.ErrEmailInvalid{"-233@qq.com"},
293+
"/233@qq.com": nil,
294+
"=233@qq.com": nil,
295+
"?233@qq.com": nil,
296+
"^233@qq.com": nil,
297+
"_233@qq.com": nil,
298+
"`233@qq.com": nil,
299+
"{233@qq.com": nil,
300+
"|233@qq.com": nil,
301+
"}233@qq.com": nil,
302+
"~233@qq.com": nil,
301303
";233@qq.com": user_model.ErrEmailCharIsNotSupported{";233@qq.com"},
302304
"Foo <foo@bar.com>": user_model.ErrEmailCharIsNotSupported{"Foo <foo@bar.com>"},
303305
string([]byte{0xE2, 0x84, 0xAA}): user_model.ErrEmailCharIsNotSupported{string([]byte{0xE2, 0x84, 0xAA})},

0 commit comments

Comments
 (0)