Skip to content

Commit 0425fc9

Browse files
committed
Merge branch 'master' into route-lfs-internally-fix-go-gitea#732
2 parents a9ca61a + 1e8a616 commit 0425fc9

File tree

15 files changed

+168
-38
lines changed

15 files changed

+168
-38
lines changed

models/admin.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func RemoveAllWithNotice(title, path string) {
6363
func removeAllWithNotice(e Engine, title, path string) {
6464
if err := os.RemoveAll(path); err != nil {
6565
desc := fmt.Sprintf("%s [%s]: %v", title, path, err)
66-
log.Warn(desc)
66+
log.Warn(title+" [%s]: %v", path, err)
6767
if err = createNotice(e, NoticeRepository, desc); err != nil {
6868
log.Error("CreateRepositoryNotice: %v", err)
6969
}

models/issue_label.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,10 @@ type Label struct {
7676
// APIFormat converts a Label to the api.Label format
7777
func (label *Label) APIFormat() *api.Label {
7878
return &api.Label{
79-
ID: label.ID,
80-
Name: label.Name,
81-
Color: strings.TrimLeft(label.Color, "#"),
79+
ID: label.ID,
80+
Name: label.Name,
81+
Color: strings.TrimLeft(label.Color, "#"),
82+
Description: label.Description,
8283
}
8384
}
8485

models/repo.go

+1-4
Original file line numberDiff line numberDiff line change
@@ -1882,10 +1882,7 @@ func DeleteRepository(doer *User, uid, repoID int64) error {
18821882
}
18831883

18841884
oidPath := filepath.Join(v.Oid[0:2], v.Oid[2:4], v.Oid[4:len(v.Oid)])
1885-
err = os.Remove(filepath.Join(setting.LFS.ContentPath, oidPath))
1886-
if err != nil {
1887-
return err
1888-
}
1885+
removeAllWithNotice(sess, "Delete orphaned LFS file", oidPath)
18891886
}
18901887

18911888
if _, err := sess.Delete(&LFSMetaObject{RepositoryID: repoID}); err != nil {

models/ssh_key.go

+30-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// Copyright 2014 The Gogs Authors. All rights reserved.
2+
// Copyright 2019 The Gitea Authors. All rights reserved.
23
// Use of this source code is governed by a MIT-style
34
// license that can be found in the LICENSE file.
45

@@ -359,7 +360,7 @@ func checkKeyFingerprint(e Engine, fingerprint string) error {
359360
return nil
360361
}
361362

362-
func calcFingerprint(publicKeyContent string) (string, error) {
363+
func calcFingerprintSSHKeygen(publicKeyContent string) (string, error) {
363364
// Calculate fingerprint.
364365
tmpPath, err := writeTmpKeyFile(publicKeyContent)
365366
if err != nil {
@@ -375,6 +376,34 @@ func calcFingerprint(publicKeyContent string) (string, error) {
375376
return strings.Split(stdout, " ")[1], nil
376377
}
377378

379+
func calcFingerprintNative(publicKeyContent string) (string, error) {
380+
// Calculate fingerprint.
381+
pk, _, _, _, err := ssh.ParseAuthorizedKey([]byte(publicKeyContent))
382+
if err != nil {
383+
return "", err
384+
}
385+
return ssh.FingerprintSHA256(pk), nil
386+
}
387+
388+
func calcFingerprint(publicKeyContent string) (string, error) {
389+
//Call the method based on configuration
390+
var (
391+
fnName, fp string
392+
err error
393+
)
394+
if setting.SSH.StartBuiltinServer {
395+
fnName = "calcFingerprintNative"
396+
fp, err = calcFingerprintNative(publicKeyContent)
397+
} else {
398+
fnName = "calcFingerprintSSHKeygen"
399+
fp, err = calcFingerprintSSHKeygen(publicKeyContent)
400+
}
401+
if err != nil {
402+
return "", fmt.Errorf("%s: %v", fnName, err)
403+
}
404+
return fp, nil
405+
}
406+
378407
func addKey(e Engine, key *PublicKey) (err error) {
379408
if len(key.Fingerprint) == 0 {
380409
key.Fingerprint, err = calcFingerprint(key.Content)

models/ssh_key_test.go

+62-20
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// Copyright 2016 The Gogs Authors. All rights reserved.
2+
// Copyright 2019 The Gitea Authors. All rights reserved.
23
// Use of this source code is governed by a MIT-style
34
// license that can be found in the LICENSE file.
45

@@ -19,26 +20,67 @@ func init() {
1920
}
2021

2122
func Test_SSHParsePublicKey(t *testing.T) {
22-
test := func(name, keyType string, length int, content string) {
23-
keyTypeN, lengthN, err := SSHNativeParsePublicKey(content)
24-
assert.NoError(t, err)
25-
assert.Equal(t, keyType, keyTypeN)
26-
assert.EqualValues(t, length, lengthN)
27-
28-
keyTypeK, lengthK, err := SSHKeyGenParsePublicKey(content)
29-
if err != nil {
30-
// Some servers do not support ecdsa format.
31-
if !strings.Contains(err.Error(), "line 1 too long:") {
32-
assert.Fail(t, "%v", err)
33-
}
34-
}
35-
assert.Equal(t, keyType, keyTypeK)
36-
assert.EqualValues(t, length, lengthK)
23+
testCases := []struct {
24+
name string
25+
keyType string
26+
length int
27+
content string
28+
}{
29+
{"dsa-1024", "dsa", 1024, "ssh-dss AAAAB3NzaC1kc3MAAACBAOChCC7lf6Uo9n7BmZ6M8St19PZf4Tn59NriyboW2x/DZuYAz3ibZ2OkQ3S0SqDIa0HXSEJ1zaExQdmbO+Ux/wsytWZmCczWOVsaszBZSl90q8UnWlSH6P+/YA+RWJm5SFtuV9PtGIhyZgoNuz5kBQ7K139wuQsecdKktISwTakzAAAAFQCzKsO2JhNKlL+wwwLGOcLffoAmkwAAAIBpK7/3xvduajLBD/9vASqBQIHrgK2J+wiQnIb/Wzy0UsVmvfn8A+udRbBo+csM8xrSnlnlJnjkJS3qiM5g+eTwsLIV1IdKPEwmwB+VcP53Cw6lSyWyJcvhFb0N6s08NZysLzvj0N+ZC/FnhKTLzIyMtkHf/IrPCwlM+pV/M/96YgAAAIEAqQcGn9CKgzgPaguIZooTAOQdvBLMI5y0bQjOW6734XOpqQGf/Kra90wpoasLKZjSYKNPjE+FRUOrStLrxcNs4BeVKhy2PYTRnybfYVk1/dmKgH6P1YSRONsGKvTsH6c5IyCRG0ncCgYeF8tXppyd642982daopE7zQ/NPAnJfag= nocomment"},
30+
{"rsa-1024", "rsa", 1024, "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDAu7tvIvX6ZHrRXuZNfkR3XLHSsuCK9Zn3X58lxBcQzuo5xZgB6vRwwm/QtJuF+zZPtY5hsQILBLmF+BZ5WpKZp1jBeSjH2G7lxet9kbcH+kIVj0tPFEoyKI9wvWqIwC4prx/WVk2wLTJjzBAhyNxfEq7C9CeiX9pQEbEqJfkKCQ== nocomment\n"},
31+
{"rsa-2048", "rsa", 2048, "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDMZXh+1OBUwSH9D45wTaxErQIN9IoC9xl7MKJkqvTvv6O5RR9YW/IK9FbfjXgXsppYGhsCZo1hFOOsXHMnfOORqu/xMDx4yPuyvKpw4LePEcg4TDipaDFuxbWOqc/BUZRZcXu41QAWfDLrInwsltWZHSeG7hjhpacl4FrVv9V1pS6Oc5Q1NxxEzTzuNLS/8diZrTm/YAQQ/+B+mzWI3zEtF4miZjjAljWd1LTBPvU23d29DcBmmFahcZ441XZsTeAwGxG/Q6j8NgNXj9WxMeWwxXV2jeAX/EBSpZrCVlCQ1yJswT6xCp8TuBnTiGWYMBNTbOZvPC4e0WI2/yZW/s5F nocomment"},
32+
{"ecdsa-256", "ecdsa", 256, "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFQacN3PrOll7PXmN5B/ZNVahiUIqI05nbBlZk1KXsO3d06ktAWqbNflv2vEmA38bTFTfJ2sbn2B5ksT52cDDbA= nocomment"},
33+
{"ecdsa-384", "ecdsa", 384, "ecdsa-sha2-nistp384 AAAAE2VjZHNhLXNoYTItbmlzdHAzODQAAAAIbmlzdHAzODQAAABhBINmioV+XRX1Fm9Qk2ehHXJ2tfVxW30ypUWZw670Zyq5GQfBAH6xjygRsJ5wWsHXBsGYgFUXIHvMKVAG1tpw7s6ax9oA+dJOJ7tj+vhn8joFqT+sg3LYHgZkHrfqryRasQ== nocomment"},
3734
}
3835

39-
test("dsa-1024", "dsa", 1024, "ssh-dss AAAAB3NzaC1kc3MAAACBAOChCC7lf6Uo9n7BmZ6M8St19PZf4Tn59NriyboW2x/DZuYAz3ibZ2OkQ3S0SqDIa0HXSEJ1zaExQdmbO+Ux/wsytWZmCczWOVsaszBZSl90q8UnWlSH6P+/Y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PC4e0WI2/yZW/s5F nocomment")
42-
test("ecdsa-256", "ecdsa", 256, "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFQacN3PrOll7PXmN5B/ZNVahiUIqI05nbBlZk1KXsO3d06ktAWqbNflv2vEmA38bTFTfJ2sbn2B5ksT52cDDbA= nocomment")
43-
test("ecdsa-384", "ecdsa", 384, "ecdsa-sha2-nistp384 AAAAE2VjZHNhLXNoYTItbmlzdHAzODQAAAAIbmlzdHAzODQAAABhBINmioV+XRX1Fm9Qk2ehHXJ2tfVxW30ypUWZw670Zyq5GQfBAH6xjygRsJ5wWsHXBsGYgFUXIHvMKVAG1tpw7s6ax9oA+dJOJ7tj+vhn8joFqT+sg3LYHgZkHrfqryRasQ== nocomment")
36+
for _, tc := range testCases {
37+
t.Run(tc.name, func(t *testing.T) {
38+
t.Run("Native", func(t *testing.T) {
39+
keyTypeN, lengthN, err := SSHNativeParsePublicKey(tc.content)
40+
assert.NoError(t, err)
41+
assert.Equal(t, tc.keyType, keyTypeN)
42+
assert.EqualValues(t, tc.length, lengthN)
43+
})
44+
t.Run("SSHKeygen", func(t *testing.T) {
45+
keyTypeK, lengthK, err := SSHKeyGenParsePublicKey(tc.content)
46+
if err != nil {
47+
// Some servers do not support ecdsa format.
48+
if !strings.Contains(err.Error(), "line 1 too long:") {
49+
assert.Fail(t, "%v", err)
50+
}
51+
}
52+
assert.Equal(t, tc.keyType, keyTypeK)
53+
assert.EqualValues(t, tc.length, lengthK)
54+
})
55+
})
56+
}
57+
}
58+
59+
func Test_calcFingerprint(t *testing.T) {
60+
testCases := []struct {
61+
name string
62+
fp string
63+
content string
64+
}{
65+
{"dsa-1024", "SHA256:fSIHQlpKMDsGPVAXI8BPYfRp+e2sfvSt1sMrPsFiXrc", "ssh-dss AAAAB3NzaC1kc3MAAACBAOChCC7lf6Uo9n7BmZ6M8St19PZf4Tn59NriyboW2x/DZuYAz3ibZ2OkQ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xEzTzuNLS/8diZrTm/YAQQ/+B+mzWI3zEtF4miZjjAljWd1LTBPvU23d29DcBmmFahcZ441XZsTeAwGxG/Q6j8NgNXj9WxMeWwxXV2jeAX/EBSpZrCVlCQ1yJswT6xCp8TuBnTiGWYMBNTbOZvPC4e0WI2/yZW/s5F nocomment"},
68+
{"ecdsa-256", "SHA256:Bqx/xgWqRKLtkZ0Lr4iZpgb+5lYsFpSwXwVZbPwuTRw", "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFQacN3PrOll7PXmN5B/ZNVahiUIqI05nbBlZk1KXsO3d06ktAWqbNflv2vEmA38bTFTfJ2sbn2B5ksT52cDDbA= nocomment"},
69+
{"ecdsa-384", "SHA256:4qfJOgJDtUd8BrEjyVNdI8IgjiZKouztVde43aDhe1E", "ecdsa-sha2-nistp384 AAAAE2VjZHNhLXNoYTItbmlzdHAzODQAAAAIbmlzdHAzODQAAABhBINmioV+XRX1Fm9Qk2ehHXJ2tfVxW30ypUWZw670Zyq5GQfBAH6xjygRsJ5wWsHXBsGYgFUXIHvMKVAG1tpw7s6ax9oA+dJOJ7tj+vhn8joFqT+sg3LYHgZkHrfqryRasQ== nocomment"},
70+
}
71+
72+
for _, tc := range testCases {
73+
t.Run(tc.name, func(t *testing.T) {
74+
t.Run("Native", func(t *testing.T) {
75+
fpN, err := calcFingerprintNative(tc.content)
76+
assert.NoError(t, err)
77+
assert.Equal(t, tc.fp, fpN)
78+
})
79+
t.Run("SSHKeygen", func(t *testing.T) {
80+
fpK, err := calcFingerprintSSHKeygen(tc.content)
81+
assert.NoError(t, err)
82+
assert.Equal(t, tc.fp, fpK)
83+
})
84+
})
85+
}
4486
}

models/user.go

+2
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,8 @@ func (u *User) APIFormat() *api.User {
214214
AvatarURL: u.AvatarLink(),
215215
Language: u.Language,
216216
IsAdmin: u.IsAdmin,
217+
LastLogin: u.LastLoginUnix.AsTime(),
218+
Created: u.CreatedUnix.AsTime(),
217219
}
218220
}
219221

modules/setting/setting.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ func forcePathSeparator(path string) {
438438
// This check is ignored under Windows since SSH remote login is not the main
439439
// method to login on Windows.
440440
func IsRunUserMatchCurrentUser(runUser string) (string, bool) {
441-
if IsWindows {
441+
if IsWindows || SSH.StartBuiltinServer {
442442
return "", true
443443
}
444444

modules/structs/issue_label.go

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// Copyright 2016 The Gogs Authors. All rights reserved.
2+
// Copyright 2019 The Gitea Authors. All rights reserved.
23
// Use of this source code is governed by a MIT-style
34
// license that can be found in the LICENSE file.
45

@@ -10,8 +11,9 @@ type Label struct {
1011
ID int64 `json:"id"`
1112
Name string `json:"name"`
1213
// example: 00aabb
13-
Color string `json:"color"`
14-
URL string `json:"url"`
14+
Color string `json:"color"`
15+
Description string `json:"description"`
16+
URL string `json:"url"`
1517
}
1618

1719
// CreateLabelOption options for creating a label
@@ -20,13 +22,15 @@ type CreateLabelOption struct {
2022
Name string `json:"name" binding:"Required"`
2123
// required:true
2224
// example: #00aabb
23-
Color string `json:"color" binding:"Required;Size(7)"`
25+
Color string `json:"color" binding:"Required;Size(7)"`
26+
Description string `json:"description"`
2427
}
2528

2629
// EditLabelOption options for editing a label
2730
type EditLabelOption struct {
28-
Name *string `json:"name"`
29-
Color *string `json:"color"`
31+
Name *string `json:"name"`
32+
Color *string `json:"color"`
33+
Description *string `json:"description"`
3034
}
3135

3236
// IssueLabelsOption a collection of labels

modules/structs/user.go

+5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package structs
66

77
import (
88
"encoding/json"
9+
"time"
910
)
1011

1112
// User represents a user
@@ -25,6 +26,10 @@ type User struct {
2526
Language string `json:"language"`
2627
// Is the user an administrator
2728
IsAdmin bool `json:"is_admin"`
29+
// swagger:strfmt date-time
30+
LastLogin time.Time `json:"last_login,omitempty"`
31+
// swagger:strfmt date-time
32+
Created time.Time `json:"created,omitempty"`
2833
}
2934

3035
// MarshalJSON implements the json.Marshaler interface for User, adding field(s) for backward compatibility

options/locale/locale_en-US.ini

+5
Original file line numberDiff line numberDiff line change
@@ -1722,6 +1722,11 @@ config.ssh_keygen_path = Keygen ('ssh-keygen') Path
17221722
config.ssh_minimum_key_size_check = Minimum Key Size Check
17231723
config.ssh_minimum_key_sizes = Minimum Key Sizes
17241724
1725+
config.lfs_config = LFS Configuration
1726+
config.lfs_enabled = Enabled
1727+
config.lfs_content_path = LFS Content Path
1728+
config.lfs_http_auth_expiry = LFS HTTP Auth Expiry
1729+
17251730
config.db_config = Database Configuration
17261731
config.db_type = Type
17271732
config.db_host = Host

routers/admin/admin.go

+1
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ func Config(ctx *context.Context) {
225225
ctx.Data["ReverseProxyAuthEmail"] = setting.ReverseProxyAuthEmail
226226

227227
ctx.Data["SSH"] = setting.SSH
228+
ctx.Data["LFS"] = setting.LFS
228229

229230
ctx.Data["Service"] = setting.Service
230231
ctx.Data["DbCfg"] = models.DbCfg

routers/api/v1/convert/convert.go

+2
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,8 @@ func ToUser(user *models.User, signed, admin bool) *api.User {
236236
AvatarURL: user.AvatarLink(),
237237
FullName: markup.Sanitize(user.FullName),
238238
IsAdmin: user.IsAdmin,
239+
LastLogin: user.LastLoginUnix.AsTime(),
240+
Created: user.CreatedUnix.AsTime(),
239241
}
240242
if signed && (!user.KeepEmailPrivate || admin) {
241243
result.Email = user.Email

routers/api/v1/repo/label.go

+7-3
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,10 @@ func CreateLabel(ctx *context.APIContext, form api.CreateLabelOption) {
125125
// "201":
126126
// "$ref": "#/responses/Label"
127127
label := &models.Label{
128-
Name: form.Name,
129-
Color: form.Color,
130-
RepoID: ctx.Repo.Repository.ID,
128+
Name: form.Name,
129+
Color: form.Color,
130+
RepoID: ctx.Repo.Repository.ID,
131+
Description: form.Description,
131132
}
132133
if err := models.NewLabel(label); err != nil {
133134
ctx.Error(500, "NewLabel", err)
@@ -185,6 +186,9 @@ func EditLabel(ctx *context.APIContext, form api.EditLabelOption) {
185186
if form.Color != nil {
186187
label.Color = *form.Color
187188
}
189+
if form.Description != nil {
190+
label.Description = *form.Description
191+
}
188192
if err := models.UpdateLabel(label); err != nil {
189193
ctx.ServerError("UpdateLabel", err)
190194
return

templates/admin/config.tmpl

+16
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,22 @@
9696
</dl>
9797
</div>
9898

99+
<h4 class="ui top attached header">
100+
{{.i18n.Tr "admin.config.lfs_config"}}
101+
</h4>
102+
<div class="ui attached table segment">
103+
<dl class="dl-horizontal admin-dl-horizontal">
104+
<dt>{{.i18n.Tr "admin.config.lfs_enabled"}}</dt>
105+
<dd><i class="fa fa{{if .LFS.StartServer}}-check{{end}}-square-o"></i></dd>
106+
{{if .LFS.StartServer}}
107+
<dt>{{.i18n.Tr "admin.config.lfs_content_path"}}</dt>
108+
<dd>{{.LFS.ContentPath}}</dd>
109+
<dt>{{.i18n.Tr "admin.config.lfs_http_auth_expiry"}}</dt>
110+
<dd>{{.LFS.HTTPAuthExpiry}}</dd>
111+
{{end}}
112+
</dl>
113+
</div>
114+
99115
<h4 class="ui top attached header">
100116
{{.i18n.Tr "admin.config.db_config"}}
101117
</h4>

templates/swagger/v1_json.tmpl

+22
Original file line numberDiff line numberDiff line change
@@ -7245,6 +7245,10 @@
72457245
"x-go-name": "Color",
72467246
"example": "#00aabb"
72477247
},
7248+
"description": {
7249+
"type": "string",
7250+
"x-go-name": "Description"
7251+
},
72487252
"name": {
72497253
"type": "string",
72507254
"x-go-name": "Name"
@@ -7775,6 +7779,10 @@
77757779
"type": "string",
77767780
"x-go-name": "Color"
77777781
},
7782+
"description": {
7783+
"type": "string",
7784+
"x-go-name": "Description"
7785+
},
77787786
"name": {
77797787
"type": "string",
77807788
"x-go-name": "Name"
@@ -8663,6 +8671,10 @@
86638671
"x-go-name": "Color",
86648672
"example": "00aabb"
86658673
},
8674+
"description": {
8675+
"type": "string",
8676+
"x-go-name": "Description"
8677+
},
86668678
"id": {
86678679
"type": "integer",
86688680
"format": "int64",
@@ -9715,6 +9727,11 @@
97159727
"type": "string",
97169728
"x-go-name": "AvatarURL"
97179729
},
9730+
"created": {
9731+
"type": "string",
9732+
"format": "date-time",
9733+
"x-go-name": "Created"
9734+
},
97189735
"email": {
97199736
"type": "string",
97209737
"format": "email",
@@ -9741,6 +9758,11 @@
97419758
"type": "string",
97429759
"x-go-name": "Language"
97439760
},
9761+
"last_login": {
9762+
"type": "string",
9763+
"format": "date-time",
9764+
"x-go-name": "LastLogin"
9765+
},
97449766
"login": {
97459767
"description": "the user's username",
97469768
"type": "string",

0 commit comments

Comments
 (0)