mirror of
https://github.com/go-gitea/gitea.git
synced 2025-11-13 02:02:53 +09:00
Compare commits
8 Commits
v1.11.6
...
release/v1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
34fe3d390b | ||
|
|
ce51c2bdf6 | ||
|
|
7937f1463a | ||
|
|
dbe9c11238 | ||
|
|
313ace93d0 | ||
|
|
f79a2e193f | ||
|
|
5d4251eb78 | ||
|
|
88008b681d |
14
CHANGELOG.md
14
CHANGELOG.md
@@ -4,6 +4,20 @@ This changelog goes through all the changes that have been made in each release
|
|||||||
without substantial changes to our git log; to see the highlights of what has
|
without substantial changes to our git log; to see the highlights of what has
|
||||||
been added to each release, please refer to the [blog](https://blog.gitea.io).
|
been added to each release, please refer to the [blog](https://blog.gitea.io).
|
||||||
|
|
||||||
|
## [1.11.8](https://github.com/go-gitea/gitea/releases/tag/v1.11.8) - 2020-06-21
|
||||||
|
|
||||||
|
* BUGFIXES
|
||||||
|
* Really fix __webpack_public_path__ for 1.11 (#11961)
|
||||||
|
|
||||||
|
## [1.11.7](https://github.com/go-gitea/gitea/releases/tag/v1.11.7) - 2020-06-18
|
||||||
|
|
||||||
|
* BUGFIXES
|
||||||
|
* Use ID or Where to instead directly use Get when load object from database (#11925) (#11935)
|
||||||
|
* Fix __webpack_public_path__ for 1.11 (#11907)
|
||||||
|
* Fix verification of subkeys of default gpg key (#11713) (#11902)
|
||||||
|
* Remove unnecessary parentheses in wiki/view template (#11781)
|
||||||
|
* Doctor fix xorm.Count nil on sqlite error (#11741)
|
||||||
|
|
||||||
## [1.11.6](https://github.com/go-gitea/gitea/releases/tag/v1.11.6) - 2020-05-30
|
## [1.11.6](https://github.com/go-gitea/gitea/releases/tag/v1.11.6) - 2020-05-30
|
||||||
|
|
||||||
* SECURITY
|
* SECURITY
|
||||||
|
|||||||
@@ -502,33 +502,21 @@ func runDoctorScriptType(ctx *cli.Context) ([]string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func runDoctorCheckDBConsistency(ctx *cli.Context) ([]string, error) {
|
func runDoctorCheckDBConsistency(ctx *cli.Context) ([]string, error) {
|
||||||
|
var results []string
|
||||||
|
|
||||||
// make sure DB version is uptodate
|
// make sure DB version is uptodate
|
||||||
if err := models.NewEngine(context.Background(), migrations.EnsureUpToDate); err != nil {
|
if err := models.NewEngine(context.Background(), migrations.EnsureUpToDate); err != nil {
|
||||||
return nil, fmt.Errorf("model version on the database does not match the current Gitea version. Model consistency will not be checked until the database is upgraded")
|
return nil, fmt.Errorf("model version on the database does not match the current Gitea version. Model consistency will not be checked until the database is upgraded")
|
||||||
}
|
}
|
||||||
_, committer, err := models.TxDBContext()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
sess := committer.(models.Engine)
|
|
||||||
defer committer.Close()
|
|
||||||
var results []string
|
|
||||||
|
|
||||||
//find tracked times without existing issues/pulls
|
//find tracked times without existing issues/pulls
|
||||||
count, err := sess.Table("tracked_time").
|
count, err := models.CountOrphanedObjects("tracked_time", "issue", "tracked_time.issue_id=issue.id")
|
||||||
Join("LEFT", "issue", "tracked_time.issue_id=issue.id").
|
|
||||||
Where("issue.id is NULL").
|
|
||||||
Count("id")
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if count > 0 {
|
if count > 0 {
|
||||||
if ctx.Bool("fix") {
|
if ctx.Bool("fix") {
|
||||||
if _, err = sess.In("id", builder.Select("tracked_time.id").
|
if err = models.DeleteOrphanedObjects("tracked_time", "issue", "tracked_time.issue_id=issue.id"); err != nil {
|
||||||
From("tracked_time").
|
|
||||||
Join("LEFT", "issue", "tracked_time.issue_id=issue.id").
|
|
||||||
Where(builder.IsNull{"issue.id"})).
|
|
||||||
Delete(models.TrackedTime{}); err != nil {
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
results = append(results, fmt.Sprintf("%d tracked times without existing issue deleted", count))
|
results = append(results, fmt.Sprintf("%d tracked times without existing issue deleted", count))
|
||||||
@@ -537,8 +525,5 @@ func runDoctorCheckDBConsistency(ctx *cli.Context) ([]string, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ctx.Bool("fix") {
|
|
||||||
return results, committer.Commit()
|
|
||||||
}
|
|
||||||
return results, nil
|
return results, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,6 +76,53 @@ nARUPZ9SqaUmRm+KGsSyoYnvN9apiDk5KVQoyfrmweNN7DCIIcoh/B9Ax8nmouKz
|
|||||||
yBB2fjCM/bJNtN/AsgYbZIScuYK/xqTkwNtbe5WdCyD/QJOHTsPJzx59hgSVo6gf
|
yBB2fjCM/bJNtN/AsgYbZIScuYK/xqTkwNtbe5WdCyD/QJOHTsPJzx59hgSVo6gf
|
||||||
Fe8VBnxHtrY8gPSUU3gkhYLvLzyVX+YLNzRcffobd8gJbfumwFJUkz91oGvYz7xg
|
Fe8VBnxHtrY8gPSUU3gkhYLvLzyVX+YLNzRcffobd8gJbfumwFJUkz91oGvYz7xg
|
||||||
XN2qmsgBNCbTIzWZMpRDMAbY+n2QFImGf+EJZlMdj6gOrIYq8N4+nMW1FwJivsOb
|
XN2qmsgBNCbTIzWZMpRDMAbY+n2QFImGf+EJZlMdj6gOrIYq8N4+nMW1FwJivsOb
|
||||||
muqySyjZnD2AYjEA6OYPXfCVhaB5fTfhQXbIrZbgsEh4ob/eIdM=
|
muqySyjZnD2AYjEA6OYPXfCVhaB5fTfhQXbIrZbgsEh4ob/eIdOdBVgEXta5egEM
|
||||||
=oSDR
|
AMYlmZ47NqBMBeaN0o/ahYMe8eIMaroWkufMfC9VRBSMAkpbDl34oNp0cflmnMYo
|
||||||
|
AFAl8ucRMFTiUnjiWpo27q14tjSyDVsn/CqwbnrgJgCFNV/MGsYsToEkb4JwDIRC
|
||||||
|
bky+1BvqvI8RMlO3MlwzrlIaMrlQfx5NtUb9TyO7S4xZTz864+Ty5p3HhRwbdZMe
|
||||||
|
Ko8sfXF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Vo1jPoXDteZU1qYiCoxLHhGhHL7ivtD1ygEi6w
|
||||||
|
/cMbbOEB5Le1vOWIwqazs8dDcAYyy1PKthRl0ygvh8CpqPwy+AK3uLm0TVwetQAp
|
||||||
|
taux0bDYWCb5Aft1r1nlV44gU4RiC131TDo+TKd754+UuI+UHk1D+LjTmZxRX2S6
|
||||||
|
fXgoMXzrWmthGPdqvVOgKWm7Ef18hmaBECvPnp/tUJeDVVe02KrYQi8Bf2kxveSd
|
||||||
|
8T0N/ExcydU9HgzTL8MuyPI+yp086elQzKJu6vb9tpgxCcglQZrUNT9Uy82pzTRY
|
||||||
|
z9MmhnCDI2SD5L/CW5PsNpPTPy7s3f9DOV0G5Vka4LTSBOCK64NvAGBmRf8rFjJU
|
||||||
|
lPtRPhC7h6uHdUIx3Q550Xogvq5sQm8UBCsbG8OJDADT3FJSIulR9Sh96OsES3sc
|
||||||
|
H09juN4KcbpS03MAeUFwXqw3jBMhDoGKlsjX17Jf31qh/nI/XjigS3XWyj1BLSMG
|
||||||
|
rJfH0NyYoGDCnff37tf+8lD9km9TlnV4Qjd9ujYbDRsefhaSjLVcy/gqdxZEuNBC
|
||||||
|
BWmGwsmLI3nyZ4KDtNsa5JUHUNNZLBN20hvmE41Eszmz4Yg9Ho9DxKiFKvzUULMc
|
||||||
|
bnMHaVHseHHq6+NVUnN1SAcOA0ygjnEid8D57RtdBCD90LXjLB7vlR+HaSMZYOnr
|
||||||
|
DtseivHvqqy4+rxhwV2S3avnls9vRwE4bV6GCiqhoBnWIZRrARLZc2OTBIya82vS
|
||||||
|
BIS1eyhjif1mE7Lqhs6aPD+eqQK2mBtQ/sidN8P/IfKfVF5siXfFbuGZLz5nRIho
|
||||||
|
Yp1z7oO3OZ09lpUk0G1h+ouIFF6goDP48M/AKtbvs9OWk3QKxnOUZD8sRncq95x6
|
||||||
|
m4q1MVb+aJyxwBqDRGaFY+3TVArB1b+kG1JsAvV5dag=
|
||||||
|
=511T
|
||||||
-----END PGP PRIVATE KEY BLOCK-----
|
-----END PGP PRIVATE KEY BLOCK-----
|
||||||
|
|||||||
@@ -136,9 +136,8 @@ func GetAttachmentByID(id int64) (*Attachment, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getAttachmentByID(e Engine, id int64) (*Attachment, error) {
|
func getAttachmentByID(e Engine, id int64) (*Attachment, error) {
|
||||||
attach := &Attachment{ID: id}
|
attach := &Attachment{}
|
||||||
|
if has, err := e.ID(id).Get(attach); err != nil {
|
||||||
if has, err := e.Get(attach); err != nil {
|
|
||||||
return nil, err
|
return nil, err
|
||||||
} else if !has {
|
} else if !has {
|
||||||
return nil, ErrAttachmentNotExist{ID: id, UUID: ""}
|
return nil, ErrAttachmentNotExist{ID: id, UUID: ""}
|
||||||
@@ -147,8 +146,8 @@ func getAttachmentByID(e Engine, id int64) (*Attachment, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getAttachmentByUUID(e Engine, uuid string) (*Attachment, error) {
|
func getAttachmentByUUID(e Engine, uuid string) (*Attachment, error) {
|
||||||
attach := &Attachment{UUID: uuid}
|
attach := &Attachment{}
|
||||||
has, err := e.Get(attach)
|
has, err := e.Where("uuid=?", uuid).Get(attach)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else if !has {
|
} else if !has {
|
||||||
|
|||||||
@@ -231,8 +231,8 @@ func getProtectedBranchBy(e Engine, repoID int64, branchName string) (*Protected
|
|||||||
|
|
||||||
// GetProtectedBranchByID getting protected branch by ID
|
// GetProtectedBranchByID getting protected branch by ID
|
||||||
func GetProtectedBranchByID(id int64) (*ProtectedBranch, error) {
|
func GetProtectedBranchByID(id int64) (*ProtectedBranch, error) {
|
||||||
rel := &ProtectedBranch{ID: id}
|
rel := &ProtectedBranch{}
|
||||||
has, err := x.Get(rel)
|
has, err := x.ID(id).Get(rel)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -521,9 +521,9 @@ func (repo *Repository) GetDeletedBranches() ([]*DeletedBranch, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetDeletedBranchByID get a deleted branch by its ID
|
// GetDeletedBranchByID get a deleted branch by its ID
|
||||||
func (repo *Repository) GetDeletedBranchByID(ID int64) (*DeletedBranch, error) {
|
func (repo *Repository) GetDeletedBranchByID(id int64) (*DeletedBranch, error) {
|
||||||
deletedBranch := &DeletedBranch{ID: ID}
|
deletedBranch := &DeletedBranch{}
|
||||||
has, err := x.Get(deletedBranch)
|
has, err := x.ID(id).Get(deletedBranch)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
"xorm.io/builder"
|
||||||
)
|
)
|
||||||
|
|
||||||
// consistencyCheckable a type that can be tested for database consistency
|
// consistencyCheckable a type that can be tested for database consistency
|
||||||
@@ -167,3 +168,23 @@ func (action *Action) checkForConsistency(t *testing.T) {
|
|||||||
repo := AssertExistsAndLoadBean(t, &Repository{ID: action.RepoID}).(*Repository)
|
repo := AssertExistsAndLoadBean(t, &Repository{ID: action.RepoID}).(*Repository)
|
||||||
assert.Equal(t, repo.IsPrivate, action.IsPrivate, "action: %+v", action)
|
assert.Equal(t, repo.IsPrivate, action.IsPrivate, "action: %+v", action)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CountOrphanedObjects count subjects with have no existing refobject anymore
|
||||||
|
func CountOrphanedObjects(subject, refobject, joinCond string) (int64, error) {
|
||||||
|
var ids []int64
|
||||||
|
|
||||||
|
return int64(len(ids)), x.Table("`"+subject+"`").
|
||||||
|
Join("LEFT", refobject, joinCond).
|
||||||
|
Where(builder.IsNull{"`" + refobject + "`.id"}).
|
||||||
|
Select("id").Find(&ids)
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteOrphanedObjects delete subjects with have no existing refobject anymore
|
||||||
|
func DeleteOrphanedObjects(subject, refobject, joinCond string) error {
|
||||||
|
_, err := x.In("id", builder.Select("`"+subject+"`.id").
|
||||||
|
From("`"+subject+"`").
|
||||||
|
Join("LEFT", "`"+refobject+"`", joinCond).
|
||||||
|
Where(builder.IsNull{"`" + refobject + "`.id"})).
|
||||||
|
Delete("`" + subject + "`")
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|||||||
@@ -736,6 +736,21 @@ func verifyWithGPGSettings(gpgSettings *git.GPGSettings, sig *packet.Signature,
|
|||||||
CanSign: pubkey.CanSign(),
|
CanSign: pubkey.CanSign(),
|
||||||
KeyID: pubkey.KeyIdString(),
|
KeyID: pubkey.KeyIdString(),
|
||||||
}
|
}
|
||||||
|
for _, subKey := range ekey.Subkeys {
|
||||||
|
content, err := base64EncPubKey(subKey.PublicKey)
|
||||||
|
if err != nil {
|
||||||
|
return &CommitVerification{
|
||||||
|
CommittingUser: committer,
|
||||||
|
Verified: false,
|
||||||
|
Reason: "gpg.error.generate_hash",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
k.SubsKey = append(k.SubsKey, &GPGKey{
|
||||||
|
Content: content,
|
||||||
|
CanSign: subKey.PublicKey.CanSign(),
|
||||||
|
KeyID: subKey.PublicKey.KeyIdString(),
|
||||||
|
})
|
||||||
|
}
|
||||||
if commitVerification := hashAndVerifyWithSubKeys(sig, payload, k, committer, &User{
|
if commitVerification := hashAndVerifyWithSubKeys(sig, payload, k, committer, &User{
|
||||||
Name: gpgSettings.Name,
|
Name: gpgSettings.Name,
|
||||||
Email: gpgSettings.Email,
|
Email: gpgSettings.Email,
|
||||||
|
|||||||
@@ -212,11 +212,8 @@ func getLabelInRepoByName(e Engine, repoID int64, labelName string) (*Label, err
|
|||||||
return nil, ErrLabelNotExist{0, repoID}
|
return nil, ErrLabelNotExist{0, repoID}
|
||||||
}
|
}
|
||||||
|
|
||||||
l := &Label{
|
l := &Label{}
|
||||||
Name: labelName,
|
has, err := e.Where("name=? AND repo_id=?", labelName, repoID).Get(l)
|
||||||
RepoID: repoID,
|
|
||||||
}
|
|
||||||
has, err := e.Get(l)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else if !has {
|
} else if !has {
|
||||||
|
|||||||
@@ -300,7 +300,7 @@ func (source *LoginSource) SSPI() *SSPIConfig {
|
|||||||
// CreateLoginSource inserts a LoginSource in the DB if not already
|
// CreateLoginSource inserts a LoginSource in the DB if not already
|
||||||
// existing with the given name.
|
// existing with the given name.
|
||||||
func CreateLoginSource(source *LoginSource) error {
|
func CreateLoginSource(source *LoginSource) error {
|
||||||
has, err := x.Get(&LoginSource{Name: source.Name})
|
has, err := x.Where("name=?", source.Name).Exist(new(LoginSource))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
} else if has {
|
} else if has {
|
||||||
|
|||||||
@@ -142,8 +142,8 @@ func UpdateTwoFactor(t *TwoFactor) error {
|
|||||||
// GetTwoFactorByUID returns the two-factor authentication token associated with
|
// GetTwoFactorByUID returns the two-factor authentication token associated with
|
||||||
// the user, if any.
|
// the user, if any.
|
||||||
func GetTwoFactorByUID(uid int64) (*TwoFactor, error) {
|
func GetTwoFactorByUID(uid int64) (*TwoFactor, error) {
|
||||||
twofa := &TwoFactor{UID: uid}
|
twofa := &TwoFactor{}
|
||||||
has, err := x.Get(twofa)
|
has, err := x.Where("uid=?", uid).Get(twofa)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else if !has {
|
} else if !has {
|
||||||
|
|||||||
@@ -76,8 +76,8 @@ func NewUpload(name string, buf []byte, file multipart.File) (_ *Upload, err err
|
|||||||
|
|
||||||
// GetUploadByUUID returns the Upload by UUID
|
// GetUploadByUUID returns the Upload by UUID
|
||||||
func GetUploadByUUID(uuid string) (*Upload, error) {
|
func GetUploadByUUID(uuid string) (*Upload, error) {
|
||||||
upload := &Upload{UUID: uuid}
|
upload := &Upload{}
|
||||||
has, err := x.Get(upload)
|
has, err := x.Where("uuid=?", uuid).Get(upload)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else if !has {
|
} else if !has {
|
||||||
|
|||||||
@@ -1457,8 +1457,8 @@ func GetUserByEmail(email string) (*User, error) {
|
|||||||
// Finally, if email address is the protected email address:
|
// Finally, if email address is the protected email address:
|
||||||
if strings.HasSuffix(email, fmt.Sprintf("@%s", setting.Service.NoReplyAddress)) {
|
if strings.HasSuffix(email, fmt.Sprintf("@%s", setting.Service.NoReplyAddress)) {
|
||||||
username := strings.TrimSuffix(email, fmt.Sprintf("@%s", setting.Service.NoReplyAddress))
|
username := strings.TrimSuffix(email, fmt.Sprintf("@%s", setting.Service.NoReplyAddress))
|
||||||
user := &User{LowerName: username}
|
user := &User{}
|
||||||
has, err := x.Get(user)
|
has, err := x.Where("lower_name=?", username).Get(user)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,8 +71,8 @@ func GetEmailAddresses(uid int64) ([]*EmailAddress, error) {
|
|||||||
// GetEmailAddressByID gets a user's email address by ID
|
// GetEmailAddressByID gets a user's email address by ID
|
||||||
func GetEmailAddressByID(uid, id int64) (*EmailAddress, error) {
|
func GetEmailAddressByID(uid, id int64) (*EmailAddress, error) {
|
||||||
// User ID is required for security reasons
|
// User ID is required for security reasons
|
||||||
email := &EmailAddress{ID: id, UID: uid}
|
email := &EmailAddress{UID: uid}
|
||||||
if has, err := x.Get(email); err != nil {
|
if has, err := x.ID(id).Get(email); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else if !has {
|
} else if !has {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
@@ -126,7 +126,7 @@ func isEmailUsed(e Engine, email string) (bool, error) {
|
|||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return e.Get(&EmailAddress{Email: email})
|
return e.Where("email=?", email).Get(&EmailAddress{})
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsEmailUsed returns true if the email has been used.
|
// IsEmailUsed returns true if the email has been used.
|
||||||
@@ -251,8 +251,8 @@ func MakeEmailPrimary(email *EmailAddress) error {
|
|||||||
return ErrEmailNotActivated
|
return ErrEmailNotActivated
|
||||||
}
|
}
|
||||||
|
|
||||||
user := &User{ID: email.UID}
|
user := &User{}
|
||||||
has, err = x.Get(user)
|
has, err = x.ID(email.UID).Get(user)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
} else if !has {
|
} else if !has {
|
||||||
|
|||||||
@@ -111,8 +111,8 @@ func GetUserByOpenID(uri string) (*User, error) {
|
|||||||
log.Trace("Normalized OpenID URI: " + uri)
|
log.Trace("Normalized OpenID URI: " + uri)
|
||||||
|
|
||||||
// Otherwise, check in openid table
|
// Otherwise, check in openid table
|
||||||
oid := &UserOpenID{URI: uri}
|
oid := &UserOpenID{}
|
||||||
has, err := x.Get(oid)
|
has, err := x.Where("uri=?", uri).Get(oid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@
|
|||||||
{{else if and (not $.DisableSSH) (or $.IsSigned $.ExposeAnonSSH)}}
|
{{else if and (not $.DisableSSH) (or $.IsSigned $.ExposeAnonSSH)}}
|
||||||
<input id="repo-clone-url" value="{{$.WikiCloneLink.SSH}}" readonly>
|
<input id="repo-clone-url" value="{{$.WikiCloneLink.SSH}}" readonly>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{if or ((not $.DisableHTTP) (and (not $.DisableSSH) (or $.IsSigned $.ExposeAnonSSH)))}}
|
{{if or (not $.DisableHTTP) (and (not $.DisableSSH) (or $.IsSigned $.ExposeAnonSSH))}}
|
||||||
<button class="ui basic icon button poping up clipboard" id="clipboard-btn" data-original="{{.i18n.Tr "repo.copy_link"}}" data-success="{{.i18n.Tr "repo.copy_link_success"}}" data-error="{{.i18n.Tr "repo.copy_link_error"}}" data-content="{{.i18n.Tr "repo.copy_link"}}" data-variation="inverted tiny" data-clipboard-target="#repo-clone-url">
|
<button class="ui basic icon button poping up clipboard" id="clipboard-btn" data-original="{{.i18n.Tr "repo.copy_link"}}" data-success="{{.i18n.Tr "repo.copy_link_success"}}" data-error="{{.i18n.Tr "repo.copy_link_error"}}" data-content="{{.i18n.Tr "repo.copy_link"}}" data-variation="inverted tiny" data-clipboard-target="#repo-clone-url">
|
||||||
<i class="octicon octicon-clippy"></i>
|
<i class="octicon octicon-clippy"></i>
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
const { StaticUrlPrefix } = window.config;
|
const { StaticUrlPrefix } = window.config;
|
||||||
|
|
||||||
if (StaticUrlPrefix) {
|
if (StaticUrlPrefix) {
|
||||||
__webpack_public_path__ = StaticUrlPrefix.endsWith('/') ? StaticUrlPrefix : `${StaticUrlPrefix}/`;
|
__webpack_public_path__ = `${StaticUrlPrefix.endsWith('/') ? StaticUrlPrefix : `${StaticUrlPrefix}/`}js/`;
|
||||||
} else if (document.currentScript && document.currentScript.src) {
|
} else if (document.currentScript && document.currentScript.src) {
|
||||||
const url = new URL(document.currentScript.src);
|
const url = new URL(document.currentScript.src);
|
||||||
__webpack_public_path__ = `${url.pathname.replace(/\/[^/]*$/, '')}/`;
|
__webpack_public_path__ = `${url.pathname.replace(/\/[^/]*$/, '')}/`;
|
||||||
|
|||||||
Reference in New Issue
Block a user