mirror of
https://github.com/go-gitea/gitea.git
synced 2025-11-15 12:33:45 +09:00
Compare commits
31 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7e084341fe | ||
|
|
7d75eede04 | ||
|
|
3db98bef99 | ||
|
|
484fe075f4 | ||
|
|
de3216ee55 | ||
|
|
353d88a42e | ||
|
|
a17fce31a9 | ||
|
|
71e1ebfa60 | ||
|
|
afe9d2cadd | ||
|
|
012e45a4c1 | ||
|
|
d25ff0d695 | ||
|
|
6eaebda1b5 | ||
|
|
6100935a77 | ||
|
|
6de75224de | ||
|
|
9086916eb7 | ||
|
|
877040e652 | ||
|
|
91f5be889a | ||
|
|
a818a48c76 | ||
|
|
76e1c130fb | ||
|
|
148a417774 | ||
|
|
6081948ef0 | ||
|
|
48bd54286c | ||
|
|
c69b3b65f3 | ||
|
|
fe91d9617b | ||
|
|
711ca52f1f | ||
|
|
a15f0cb010 | ||
|
|
2051f850ef | ||
|
|
3ae4c4898b | ||
|
|
3a77465e4e | ||
|
|
fc8c23edb7 | ||
|
|
31df892059 |
37
CHANGELOG.md
37
CHANGELOG.md
@@ -4,6 +4,43 @@ 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.15.9](https://github.com/go-gitea/gitea/releases/tag/v1.15.9) - 2021-12-30
|
||||||
|
|
||||||
|
* BUGFIXES
|
||||||
|
* Fix wrong redirect on org labels (#18128) (#18134)
|
||||||
|
* Fix: unstable sort skips/duplicates issues across pages (#18094) (#18095)
|
||||||
|
* Revert "Fix delete u2f keys bug (#18042)" (#18107)
|
||||||
|
* Migrating wiki don't require token, so we should move it out of the require form (#17645) (#18104)
|
||||||
|
* Prevent NPE if gitea uploader fails to open url (#18080) (#18101)
|
||||||
|
* Reset locale on login (#17734) (#18100)
|
||||||
|
* Correctly handle failed migrations (#17575) (#18099)
|
||||||
|
* Instead of using routerCtx just escape the url before routing (#18086) (#18098)
|
||||||
|
* Quote references to the user table in consistency checks (#18072) (#18073)
|
||||||
|
* Add NotFound handler (#18062) (#18067)
|
||||||
|
* Ensure that git repository is closed before transfer (#18049) (#18057)
|
||||||
|
* Use common sessioner for API and web routes (#18114)
|
||||||
|
* TRANSLATION
|
||||||
|
* Fix code search result hint on zh-CN (#18053)
|
||||||
|
|
||||||
|
## [1.15.8](https://github.com/go-gitea/gitea/releases/tag/v1.15.8) - 2021-12-20
|
||||||
|
|
||||||
|
* BUGFIXES
|
||||||
|
* Move POST /{username}/action/{action} to simply POST /{username} (#18045) (#18046)
|
||||||
|
* Fix delete u2f keys bug (#18040) (#18042)
|
||||||
|
* Reset Session ID on login (#18018) (#18041)
|
||||||
|
* Prevent off-by-one error on comments on newly appended lines (#18029) (#18035)
|
||||||
|
* Stop printing 03d after escaped characters in logs (#18030) (#18034)
|
||||||
|
* Reset locale on login (#18023) (#18025)
|
||||||
|
* Fix reset password email template (#17025) (#18022)
|
||||||
|
* Fix outType on gitea dump (#18000) (#18016)
|
||||||
|
* Ensure complexity, minlength and isPwned are checked on password setting (#18005) (#18015)
|
||||||
|
* Fix rename notification bug (#18011)
|
||||||
|
* Prevent double decoding of % in url params (#17997) (#18001)
|
||||||
|
* Prevent hang in git cat-file if the repository is not a valid repository (Partial #17991) (#17992)
|
||||||
|
* Prevent deadlock in create issue (#17970) (#17982)
|
||||||
|
* TESTING
|
||||||
|
* Use non-expiring key. (#17984) (#17985)
|
||||||
|
|
||||||
## [1.15.7](https://github.com/go-gitea/gitea/releases/tag/v1.15.7) - 2021-12-01
|
## [1.15.7](https://github.com/go-gitea/gitea/releases/tag/v1.15.7) - 2021-12-01
|
||||||
|
|
||||||
* ENHANCEMENTS
|
* ENHANCEMENTS
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
###################################
|
###################################
|
||||||
#Build stage
|
#Build stage
|
||||||
FROM golang:1.16-alpine3.13 AS build-env
|
FROM techknowlogick/go:1.16-alpine3.13 AS build-env
|
||||||
|
|
||||||
ARG GOPROXY
|
ARG GOPROXY
|
||||||
ENV GOPROXY ${GOPROXY:-direct}
|
ENV GOPROXY ${GOPROXY:-direct}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
###################################
|
###################################
|
||||||
#Build stage
|
#Build stage
|
||||||
FROM golang:1.16-alpine3.13 AS build-env
|
FROM techknowlogick/go:1.16-alpine3.13 AS build-env
|
||||||
|
|
||||||
ARG GOPROXY
|
ARG GOPROXY
|
||||||
ENV GOPROXY ${GOPROXY:-direct}
|
ENV GOPROXY ${GOPROXY:-direct}
|
||||||
|
|||||||
@@ -335,6 +335,10 @@ func runChangePassword(c *cli.Context) error {
|
|||||||
if err := initDB(); err != nil {
|
if err := initDB(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if len(c.String("password")) < setting.MinPasswordLength {
|
||||||
|
return fmt.Errorf("Password is not long enough. Needs to be at least %d", setting.MinPasswordLength)
|
||||||
|
}
|
||||||
|
|
||||||
if !pwd.IsComplexEnough(c.String("password")) {
|
if !pwd.IsComplexEnough(c.String("password")) {
|
||||||
return errors.New("Password does not meet complexity requirements")
|
return errors.New("Password does not meet complexity requirements")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ func (o outputType) String() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var outputTypeEnum = &outputType{
|
var outputTypeEnum = &outputType{
|
||||||
Enum: []string{"zip", "tar", "tar.gz", "tar.xz", "tar.bz2"},
|
Enum: []string{"zip", "rar", "tar", "sz", "tar.gz", "tar.xz", "tar.bz2", "tar.br", "tar.lz4"},
|
||||||
Default: "zip",
|
Default: "zip",
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,12 +153,16 @@ func fatal(format string, args ...interface{}) {
|
|||||||
func runDump(ctx *cli.Context) error {
|
func runDump(ctx *cli.Context) error {
|
||||||
var file *os.File
|
var file *os.File
|
||||||
fileName := ctx.String("file")
|
fileName := ctx.String("file")
|
||||||
|
outType := ctx.String("type")
|
||||||
if fileName == "-" {
|
if fileName == "-" {
|
||||||
file = os.Stdout
|
file = os.Stdout
|
||||||
err := log.DelLogger("console")
|
err := log.DelLogger("console")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fatal("Deleting default logger failed. Can not write to stdout: %v", err)
|
fatal("Deleting default logger failed. Can not write to stdout: %v", err)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
fileName = strings.TrimSuffix(fileName, path.Ext(fileName))
|
||||||
|
fileName += "." + outType
|
||||||
}
|
}
|
||||||
setting.NewContext()
|
setting.NewContext()
|
||||||
// make sure we are logging to the console no matter what the configuration tells us do to
|
// make sure we are logging to the console no matter what the configuration tells us do to
|
||||||
@@ -197,7 +201,6 @@ func runDump(ctx *cli.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
verbose := ctx.Bool("verbose")
|
verbose := ctx.Bool("verbose")
|
||||||
outType := ctx.String("type")
|
|
||||||
var iface interface{}
|
var iface interface{}
|
||||||
if fileName == "-" {
|
if fileName == "-" {
|
||||||
iface, err = archiver.ByExtension(fmt.Sprintf(".%s", outType))
|
iface, err = archiver.ByExtension(fmt.Sprintf(".%s", outType))
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ params:
|
|||||||
description: Git with a cup of tea
|
description: Git with a cup of tea
|
||||||
author: The Gitea Authors
|
author: The Gitea Authors
|
||||||
website: https://docs.gitea.io
|
website: https://docs.gitea.io
|
||||||
version: 1.14.6
|
version: 1.15.8
|
||||||
minGoVersion: 1.16
|
minGoVersion: 1.16
|
||||||
goVersion: 1.16
|
goVersion: 1.17
|
||||||
minNodeVersion: 12.17
|
minNodeVersion: 12.17
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
|
|||||||
2
go.mod
2
go.mod
@@ -9,7 +9,7 @@ require (
|
|||||||
gitea.com/go-chi/binding v0.0.0-20210301195521-1fe1c9a555e7
|
gitea.com/go-chi/binding v0.0.0-20210301195521-1fe1c9a555e7
|
||||||
gitea.com/go-chi/cache v0.0.0-20210110083709-82c4c9ce2d5e
|
gitea.com/go-chi/cache v0.0.0-20210110083709-82c4c9ce2d5e
|
||||||
gitea.com/go-chi/captcha v0.0.0-20210110083842-e7696c336a1e
|
gitea.com/go-chi/captcha v0.0.0-20210110083842-e7696c336a1e
|
||||||
gitea.com/go-chi/session v0.0.0-20210108030337-0cb48c5ba8ee
|
gitea.com/go-chi/session v0.0.0-20211218221615-e3605d8b28b8
|
||||||
gitea.com/lunny/levelqueue v0.4.1
|
gitea.com/lunny/levelqueue v0.4.1
|
||||||
github.com/Microsoft/go-winio v0.5.0 // indirect
|
github.com/Microsoft/go-winio v0.5.0 // indirect
|
||||||
github.com/NYTimes/gziphandler v1.1.1
|
github.com/NYTimes/gziphandler v1.1.1
|
||||||
|
|||||||
7
go.sum
7
go.sum
@@ -47,8 +47,8 @@ gitea.com/go-chi/cache v0.0.0-20210110083709-82c4c9ce2d5e h1:zgPGaf3kXP0cVm9J0l8
|
|||||||
gitea.com/go-chi/cache v0.0.0-20210110083709-82c4c9ce2d5e/go.mod h1:k2V/gPDEtXGjjMGuBJiapffAXTv76H4snSmlJRLUhH0=
|
gitea.com/go-chi/cache v0.0.0-20210110083709-82c4c9ce2d5e/go.mod h1:k2V/gPDEtXGjjMGuBJiapffAXTv76H4snSmlJRLUhH0=
|
||||||
gitea.com/go-chi/captcha v0.0.0-20210110083842-e7696c336a1e h1:YjaQU6XFicdhPN+MlGolcXO8seYY2+EY5g7vZPB17CQ=
|
gitea.com/go-chi/captcha v0.0.0-20210110083842-e7696c336a1e h1:YjaQU6XFicdhPN+MlGolcXO8seYY2+EY5g7vZPB17CQ=
|
||||||
gitea.com/go-chi/captcha v0.0.0-20210110083842-e7696c336a1e/go.mod h1:nfA7JaGv3hbGQ1ktdhAsZhdS84qKffI8NMlHr+Opsog=
|
gitea.com/go-chi/captcha v0.0.0-20210110083842-e7696c336a1e/go.mod h1:nfA7JaGv3hbGQ1ktdhAsZhdS84qKffI8NMlHr+Opsog=
|
||||||
gitea.com/go-chi/session v0.0.0-20210108030337-0cb48c5ba8ee h1:9U6HuKUBt/cGK6T/64dEuz0r7Yp97WAAEJvXHDlY3ws=
|
gitea.com/go-chi/session v0.0.0-20211218221615-e3605d8b28b8 h1:tJQRXgZigkLeeW9LPlps9G9aMoE6LAmqigLA+wxmd1Q=
|
||||||
gitea.com/go-chi/session v0.0.0-20210108030337-0cb48c5ba8ee/go.mod h1:Ozg8IchVNb/Udg+ui39iHRYqVHSvf3C99ixdpLR8Vu0=
|
gitea.com/go-chi/session v0.0.0-20211218221615-e3605d8b28b8/go.mod h1:fc/pjt5EqNKgqQXYzcas1Z5L5whkZHyOvTA7OzWVJck=
|
||||||
gitea.com/lunny/levelqueue v0.4.1 h1:RZ+AFx5gBsZuyqCvofhAkPQ9uaVDPJnsULoJZIYaJNw=
|
gitea.com/lunny/levelqueue v0.4.1 h1:RZ+AFx5gBsZuyqCvofhAkPQ9uaVDPJnsULoJZIYaJNw=
|
||||||
gitea.com/lunny/levelqueue v0.4.1/go.mod h1:HBqmLbz56JWpfEGG0prskAV97ATNRoj5LDmPicD22hU=
|
gitea.com/lunny/levelqueue v0.4.1/go.mod h1:HBqmLbz56JWpfEGG0prskAV97ATNRoj5LDmPicD22hU=
|
||||||
gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a h1:lSA0F4e9A2NcQSqGqTOXqu2aRi/XEQxDCBwM8yJtE6s=
|
gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a h1:lSA0F4e9A2NcQSqGqTOXqu2aRi/XEQxDCBwM8yJtE6s=
|
||||||
@@ -325,8 +325,9 @@ github.com/go-asn1-ber/asn1-ber v1.5.3/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkPro
|
|||||||
github.com/go-chi/chi v1.5.1/go.mod h1:REp24E+25iKvxgeTfHmdUoL5x15kBiDBlnIl5bCwe2k=
|
github.com/go-chi/chi v1.5.1/go.mod h1:REp24E+25iKvxgeTfHmdUoL5x15kBiDBlnIl5bCwe2k=
|
||||||
github.com/go-chi/chi v1.5.4 h1:QHdzF2szwjqVV4wmByUnTcsbIg7UGaQ0tPF2t5GcAIs=
|
github.com/go-chi/chi v1.5.4 h1:QHdzF2szwjqVV4wmByUnTcsbIg7UGaQ0tPF2t5GcAIs=
|
||||||
github.com/go-chi/chi v1.5.4/go.mod h1:uaf8YgoFazUOkPBG7fxPftUylNumIev9awIWOENIuEg=
|
github.com/go-chi/chi v1.5.4/go.mod h1:uaf8YgoFazUOkPBG7fxPftUylNumIev9awIWOENIuEg=
|
||||||
github.com/go-chi/chi/v5 v5.0.1 h1:ALxjCrTf1aflOlkhMnCUP86MubbWFrzB3gkRPReLpTo=
|
|
||||||
github.com/go-chi/chi/v5 v5.0.1/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
|
github.com/go-chi/chi/v5 v5.0.1/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
|
||||||
|
github.com/go-chi/chi/v5 v5.0.4 h1:5e494iHzsYBiyXQAHHuI4tyJS9M3V84OuX3ufIIGHFo=
|
||||||
|
github.com/go-chi/chi/v5 v5.0.4/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
|
||||||
github.com/go-chi/cors v1.2.0 h1:tV1g1XENQ8ku4Bq3K9ub2AtgG+p16SmzeMSGTwrOKdE=
|
github.com/go-chi/cors v1.2.0 h1:tV1g1XENQ8ku4Bq3K9ub2AtgG+p16SmzeMSGTwrOKdE=
|
||||||
github.com/go-chi/cors v1.2.0/go.mod h1:sSbTewc+6wYHBBCW7ytsFSn836hqM7JxpglAy2Vzc58=
|
github.com/go-chi/cors v1.2.0/go.mod h1:sSbTewc+6wYHBBCW7ytsFSn836hqM7JxpglAy2Vzc58=
|
||||||
github.com/go-enry/go-enry/v2 v2.7.1 h1:WCqtfyteIz61GYk9lRVy8HblvIv4cP9GIiwm/6txCbU=
|
github.com/go-enry/go-enry/v2 v2.7.1 h1:WCqtfyteIz61GYk9lRVy8HblvIv4cP9GIiwm/6txCbU=
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +1 @@
|
|||||||
3a810dbf6b96afaa8c5f69a8b6ec1dabfca7368b
|
59e2c41e8f5140bb0182acebec17c8ad9831cc62
|
||||||
|
|||||||
@@ -251,6 +251,26 @@ func prepareTestEnv(t testing.TB, skip ...int) func() {
|
|||||||
assert.NoError(t, util.RemoveAll(setting.RepoRootPath))
|
assert.NoError(t, util.RemoveAll(setting.RepoRootPath))
|
||||||
|
|
||||||
assert.NoError(t, util.CopyDir(path.Join(filepath.Dir(setting.AppPath), "integrations/gitea-repositories-meta"), setting.RepoRootPath))
|
assert.NoError(t, util.CopyDir(path.Join(filepath.Dir(setting.AppPath), "integrations/gitea-repositories-meta"), setting.RepoRootPath))
|
||||||
|
ownerDirs, err := os.ReadDir(setting.RepoRootPath)
|
||||||
|
if err != nil {
|
||||||
|
assert.NoError(t, err, "unable to read the new repo root: %v\n", err)
|
||||||
|
}
|
||||||
|
for _, ownerDir := range ownerDirs {
|
||||||
|
if !ownerDir.Type().IsDir() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
repoDirs, err := os.ReadDir(filepath.Join(setting.RepoRootPath, ownerDir.Name()))
|
||||||
|
if err != nil {
|
||||||
|
assert.NoError(t, err, "unable to read the new repo root: %v\n", err)
|
||||||
|
}
|
||||||
|
for _, repoDir := range repoDirs {
|
||||||
|
_ = os.MkdirAll(filepath.Join(setting.RepoRootPath, ownerDir.Name(), repoDir.Name(), "objects", "pack"), 0755)
|
||||||
|
_ = os.MkdirAll(filepath.Join(setting.RepoRootPath, ownerDir.Name(), repoDir.Name(), "objects", "info"), 0755)
|
||||||
|
_ = os.MkdirAll(filepath.Join(setting.RepoRootPath, ownerDir.Name(), repoDir.Name(), "refs", "heads"), 0755)
|
||||||
|
_ = os.MkdirAll(filepath.Join(setting.RepoRootPath, ownerDir.Name(), repoDir.Name(), "refs", "tag"), 0755)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return deferFn
|
return deferFn
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -529,4 +549,23 @@ func resetFixtures(t *testing.T) {
|
|||||||
assert.NoError(t, models.LoadFixtures())
|
assert.NoError(t, models.LoadFixtures())
|
||||||
assert.NoError(t, util.RemoveAll(setting.RepoRootPath))
|
assert.NoError(t, util.RemoveAll(setting.RepoRootPath))
|
||||||
assert.NoError(t, util.CopyDir(path.Join(filepath.Dir(setting.AppPath), "integrations/gitea-repositories-meta"), setting.RepoRootPath))
|
assert.NoError(t, util.CopyDir(path.Join(filepath.Dir(setting.AppPath), "integrations/gitea-repositories-meta"), setting.RepoRootPath))
|
||||||
|
ownerDirs, err := os.ReadDir(setting.RepoRootPath)
|
||||||
|
if err != nil {
|
||||||
|
assert.NoError(t, err, "unable to read the new repo root: %v\n", err)
|
||||||
|
}
|
||||||
|
for _, ownerDir := range ownerDirs {
|
||||||
|
if !ownerDir.Type().IsDir() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
repoDirs, err := os.ReadDir(filepath.Join(setting.RepoRootPath, ownerDir.Name()))
|
||||||
|
if err != nil {
|
||||||
|
assert.NoError(t, err, "unable to read the new repo root: %v\n", err)
|
||||||
|
}
|
||||||
|
for _, repoDir := range repoDirs {
|
||||||
|
_ = os.MkdirAll(filepath.Join(setting.RepoRootPath, ownerDir.Name(), repoDir.Name(), "objects", "pack"), 0755)
|
||||||
|
_ = os.MkdirAll(filepath.Join(setting.RepoRootPath, ownerDir.Name(), repoDir.Name(), "objects", "info"), 0755)
|
||||||
|
_ = os.MkdirAll(filepath.Join(setting.RepoRootPath, ownerDir.Name(), repoDir.Name(), "refs", "heads"), 0755)
|
||||||
|
_ = os.MkdirAll(filepath.Join(setting.RepoRootPath, ownerDir.Name(), repoDir.Name(), "refs", "tag"), 0755)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ func TestLinksNoLogin(t *testing.T) {
|
|||||||
"/user/forgot_password",
|
"/user/forgot_password",
|
||||||
"/api/swagger",
|
"/api/swagger",
|
||||||
"/user2/repo1",
|
"/user2/repo1",
|
||||||
|
"/user2/repo1/",
|
||||||
"/user2/repo1/projects",
|
"/user2/repo1/projects",
|
||||||
"/user2/repo1/projects/1",
|
"/user2/repo1/projects/1",
|
||||||
"/assets/img/404.png",
|
"/assets/img/404.png",
|
||||||
|
|||||||
@@ -61,6 +61,25 @@ func initMigrationTest(t *testing.T) func() {
|
|||||||
assert.True(t, len(setting.RepoRootPath) != 0)
|
assert.True(t, len(setting.RepoRootPath) != 0)
|
||||||
assert.NoError(t, util.RemoveAll(setting.RepoRootPath))
|
assert.NoError(t, util.RemoveAll(setting.RepoRootPath))
|
||||||
assert.NoError(t, util.CopyDir(path.Join(filepath.Dir(setting.AppPath), "integrations/gitea-repositories-meta"), setting.RepoRootPath))
|
assert.NoError(t, util.CopyDir(path.Join(filepath.Dir(setting.AppPath), "integrations/gitea-repositories-meta"), setting.RepoRootPath))
|
||||||
|
ownerDirs, err := os.ReadDir(setting.RepoRootPath)
|
||||||
|
if err != nil {
|
||||||
|
assert.NoError(t, err, "unable to read the new repo root: %v\n", err)
|
||||||
|
}
|
||||||
|
for _, ownerDir := range ownerDirs {
|
||||||
|
if !ownerDir.Type().IsDir() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
repoDirs, err := os.ReadDir(filepath.Join(setting.RepoRootPath, ownerDir.Name()))
|
||||||
|
if err != nil {
|
||||||
|
assert.NoError(t, err, "unable to read the new repo root: %v\n", err)
|
||||||
|
}
|
||||||
|
for _, repoDir := range repoDirs {
|
||||||
|
_ = os.MkdirAll(filepath.Join(setting.RepoRootPath, ownerDir.Name(), repoDir.Name(), "objects", "pack"), 0755)
|
||||||
|
_ = os.MkdirAll(filepath.Join(setting.RepoRootPath, ownerDir.Name(), repoDir.Name(), "objects", "info"), 0755)
|
||||||
|
_ = os.MkdirAll(filepath.Join(setting.RepoRootPath, ownerDir.Name(), repoDir.Name(), "refs", "heads"), 0755)
|
||||||
|
_ = os.MkdirAll(filepath.Join(setting.RepoRootPath, ownerDir.Name(), repoDir.Name(), "refs", "tag"), 0755)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
git.CheckLFSVersion()
|
git.CheckLFSVersion()
|
||||||
setting.InitDBConfig()
|
setting.InitDBConfig()
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ package integrations
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"path"
|
"path"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
@@ -83,7 +84,7 @@ func TestNonasciiBranches(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
from: "Plus+Is+Not+Space/Файл.md",
|
from: "Plus+Is+Not+Space/Файл.md",
|
||||||
to: "branch/Plus+Is+Not+Space/%d0%a4%d0%b0%d0%b9%d0%bb.md",
|
to: "branch/Plus+Is+Not+Space/%D0%A4%D0%B0%D0%B9%D0%BB.md",
|
||||||
status: http.StatusOK,
|
status: http.StatusOK,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -114,7 +115,7 @@ func TestNonasciiBranches(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
from: "タグ/ファイル.md",
|
from: "タグ/ファイル.md",
|
||||||
to: "tag/%e3%82%bf%e3%82%b0/%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab.md",
|
to: "tag/%e3%82%bf%e3%82%b0/%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB.md",
|
||||||
status: http.StatusOK,
|
status: http.StatusOK,
|
||||||
},
|
},
|
||||||
// Files
|
// Files
|
||||||
@@ -125,12 +126,12 @@ func TestNonasciiBranches(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
from: "Файл.md",
|
from: "Файл.md",
|
||||||
to: "branch/Plus+Is+Not+Space/%d0%a4%d0%b0%d0%b9%d0%bb.md",
|
to: "branch/Plus+Is+Not+Space/%D0%A4%D0%B0%D0%B9%D0%BB.md",
|
||||||
status: http.StatusOK,
|
status: http.StatusOK,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
from: "ファイル.md",
|
from: "ファイル.md",
|
||||||
to: "branch/Plus+Is+Not+Space/%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab.md",
|
to: "branch/Plus+Is+Not+Space/%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB.md",
|
||||||
status: http.StatusNotFound, // it's not on default branch
|
status: http.StatusNotFound, // it's not on default branch
|
||||||
},
|
},
|
||||||
// Same but url-encoded (few tests)
|
// Same but url-encoded (few tests)
|
||||||
@@ -146,7 +147,7 @@ func TestNonasciiBranches(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
from: "%D0%A4%D0%B0%D0%B9%D0%BB.md",
|
from: "%D0%A4%D0%B0%D0%B9%D0%BB.md",
|
||||||
to: "branch/Plus+Is+Not+Space/%d0%a4%d0%b0%d0%b9%d0%bb.md",
|
to: "branch/Plus+Is+Not+Space/%D0%A4%D0%B0%D0%B9%D0%BB.md",
|
||||||
status: http.StatusOK,
|
status: http.StatusOK,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -159,6 +160,41 @@ func TestNonasciiBranches(t *testing.T) {
|
|||||||
to: "tag/%d0%81/%e4%ba%ba",
|
to: "tag/%d0%81/%e4%ba%ba",
|
||||||
status: http.StatusOK,
|
status: http.StatusOK,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
from: "Plus+Is+Not+Space/%25%252525mightnotplaywell",
|
||||||
|
to: "branch/Plus+Is+Not+Space/%25%252525mightnotplaywell",
|
||||||
|
status: http.StatusOK,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
from: "Plus+Is+Not+Space/%25253Fisnotaquestion%25253F",
|
||||||
|
to: "branch/Plus+Is+Not+Space/%25253Fisnotaquestion%25253F",
|
||||||
|
status: http.StatusOK,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
from: "Plus+Is+Not+Space/" + url.PathEscape("%3Fis?and#afile"),
|
||||||
|
to: "branch/Plus+Is+Not+Space/" + url.PathEscape("%3Fis?and#afile"),
|
||||||
|
status: http.StatusOK,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
from: "Plus+Is+Not+Space/10%25.md",
|
||||||
|
to: "branch/Plus+Is+Not+Space/10%25.md",
|
||||||
|
status: http.StatusOK,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
from: "Plus+Is+Not+Space/" + url.PathEscape("This+file%20has 1space"),
|
||||||
|
to: "branch/Plus+Is+Not+Space/" + url.PathEscape("This+file%20has 1space"),
|
||||||
|
status: http.StatusOK,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
from: "Plus+Is+Not+Space/" + url.PathEscape("This+file%2520has 2 spaces"),
|
||||||
|
to: "branch/Plus+Is+Not+Space/" + url.PathEscape("This+file%2520has 2 spaces"),
|
||||||
|
status: http.StatusOK,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
from: "Plus+Is+Not+Space/" + url.PathEscape("£15&$6.txt"),
|
||||||
|
to: "branch/Plus+Is+Not+Space/" + url.PathEscape("£15&$6.txt"),
|
||||||
|
status: http.StatusOK,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
defer prepareTestEnv(t)()
|
defer prepareTestEnv(t)()
|
||||||
|
|||||||
@@ -1,128 +1,81 @@
|
|||||||
-----BEGIN PGP PRIVATE KEY BLOCK-----
|
-----BEGIN PGP PRIVATE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aJyxwBqDRGaFY+3TVArB1b+kG1JsAvV5dag=
|
|
||||||
=511T
|
|
||||||
-----END PGP PRIVATE KEY BLOCK-----
|
-----END PGP PRIVATE KEY BLOCK-----
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ func TestSignOut(t *testing.T) {
|
|||||||
session.MakeRequest(t, req, http.StatusFound)
|
session.MakeRequest(t, req, http.StatusFound)
|
||||||
|
|
||||||
// try to view a private repo, should fail
|
// try to view a private repo, should fail
|
||||||
req = NewRequest(t, "GET", "/user2/repo2/")
|
req = NewRequest(t, "GET", "/user2/repo2")
|
||||||
session.MakeRequest(t, req, http.StatusNotFound)
|
session.MakeRequest(t, req, http.StatusNotFound)
|
||||||
|
|
||||||
// invalidate cached cookies for user2, for subsequent tests
|
// invalidate cached cookies for user2, for subsequent tests
|
||||||
|
|||||||
@@ -1145,17 +1145,17 @@ type IssuesOptions struct {
|
|||||||
func sortIssuesSession(sess *xorm.Session, sortType string, priorityRepoID int64) {
|
func sortIssuesSession(sess *xorm.Session, sortType string, priorityRepoID int64) {
|
||||||
switch sortType {
|
switch sortType {
|
||||||
case "oldest":
|
case "oldest":
|
||||||
sess.Asc("issue.created_unix")
|
sess.Asc("issue.created_unix").Asc("issue.id")
|
||||||
case "recentupdate":
|
case "recentupdate":
|
||||||
sess.Desc("issue.updated_unix")
|
sess.Desc("issue.updated_unix").Desc("issue.created_unix").Desc("issue.id")
|
||||||
case "leastupdate":
|
case "leastupdate":
|
||||||
sess.Asc("issue.updated_unix")
|
sess.Asc("issue.updated_unix").Asc("issue.created_unix").Asc("issue.id")
|
||||||
case "mostcomment":
|
case "mostcomment":
|
||||||
sess.Desc("issue.num_comments")
|
sess.Desc("issue.num_comments").Desc("issue.created_unix").Desc("issue.id")
|
||||||
case "leastcomment":
|
case "leastcomment":
|
||||||
sess.Asc("issue.num_comments")
|
sess.Asc("issue.num_comments").Desc("issue.created_unix").Desc("issue.id")
|
||||||
case "priority":
|
case "priority":
|
||||||
sess.Desc("issue.priority")
|
sess.Desc("issue.priority").Desc("issue.created_unix").Desc("issue.id")
|
||||||
case "nearduedate":
|
case "nearduedate":
|
||||||
// 253370764800 is 01/01/9999 @ 12:00am (UTC)
|
// 253370764800 is 01/01/9999 @ 12:00am (UTC)
|
||||||
sess.Join("LEFT", "milestone", "issue.milestone_id = milestone.id").
|
sess.Join("LEFT", "milestone", "issue.milestone_id = milestone.id").
|
||||||
@@ -1163,17 +1163,25 @@ func sortIssuesSession(sess *xorm.Session, sortType string, priorityRepoID int64
|
|||||||
"WHEN issue.deadline_unix = 0 AND (milestone.deadline_unix = 0 OR milestone.deadline_unix IS NULL) THEN 253370764800 " +
|
"WHEN issue.deadline_unix = 0 AND (milestone.deadline_unix = 0 OR milestone.deadline_unix IS NULL) THEN 253370764800 " +
|
||||||
"WHEN milestone.deadline_unix = 0 OR milestone.deadline_unix IS NULL THEN issue.deadline_unix " +
|
"WHEN milestone.deadline_unix = 0 OR milestone.deadline_unix IS NULL THEN issue.deadline_unix " +
|
||||||
"WHEN milestone.deadline_unix < issue.deadline_unix OR issue.deadline_unix = 0 THEN milestone.deadline_unix " +
|
"WHEN milestone.deadline_unix < issue.deadline_unix OR issue.deadline_unix = 0 THEN milestone.deadline_unix " +
|
||||||
"ELSE issue.deadline_unix END ASC")
|
"ELSE issue.deadline_unix END ASC").
|
||||||
|
Desc("issue.created_unix").
|
||||||
|
Desc("issue.id")
|
||||||
case "farduedate":
|
case "farduedate":
|
||||||
sess.Join("LEFT", "milestone", "issue.milestone_id = milestone.id").
|
sess.Join("LEFT", "milestone", "issue.milestone_id = milestone.id").
|
||||||
OrderBy("CASE " +
|
OrderBy("CASE " +
|
||||||
"WHEN milestone.deadline_unix IS NULL THEN issue.deadline_unix " +
|
"WHEN milestone.deadline_unix IS NULL THEN issue.deadline_unix " +
|
||||||
"WHEN milestone.deadline_unix < issue.deadline_unix OR issue.deadline_unix = 0 THEN milestone.deadline_unix " +
|
"WHEN milestone.deadline_unix < issue.deadline_unix OR issue.deadline_unix = 0 THEN milestone.deadline_unix " +
|
||||||
"ELSE issue.deadline_unix END DESC")
|
"ELSE issue.deadline_unix END DESC").
|
||||||
|
Desc("issue.created_unix").
|
||||||
|
Desc("issue.id")
|
||||||
case "priorityrepo":
|
case "priorityrepo":
|
||||||
sess.OrderBy("CASE WHEN issue.repo_id = " + strconv.FormatInt(priorityRepoID, 10) + " THEN 1 ELSE 2 END, issue.created_unix DESC")
|
sess.OrderBy("CASE " +
|
||||||
|
"WHEN issue.repo_id = " + strconv.FormatInt(priorityRepoID, 10) + " THEN 1 " +
|
||||||
|
"ELSE 2 END ASC").
|
||||||
|
Desc("issue.created_unix").
|
||||||
|
Desc("issue.id")
|
||||||
default:
|
default:
|
||||||
sess.Desc("issue.created_unix")
|
sess.Desc("issue.created_unix").Desc("issue.id")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -205,6 +205,25 @@ func prepareTestEnv(t *testing.T, skip int, syncModels ...interface{}) (*xorm.En
|
|||||||
|
|
||||||
assert.NoError(t, com.CopyDir(path.Join(filepath.Dir(setting.AppPath), "integrations/gitea-repositories-meta"),
|
assert.NoError(t, com.CopyDir(path.Join(filepath.Dir(setting.AppPath), "integrations/gitea-repositories-meta"),
|
||||||
setting.RepoRootPath))
|
setting.RepoRootPath))
|
||||||
|
ownerDirs, err := os.ReadDir(setting.RepoRootPath)
|
||||||
|
if err != nil {
|
||||||
|
assert.NoError(t, err, "unable to read the new repo root: %v\n", err)
|
||||||
|
}
|
||||||
|
for _, ownerDir := range ownerDirs {
|
||||||
|
if !ownerDir.Type().IsDir() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
repoDirs, err := os.ReadDir(filepath.Join(setting.RepoRootPath, ownerDir.Name()))
|
||||||
|
if err != nil {
|
||||||
|
assert.NoError(t, err, "unable to read the new repo root: %v\n", err)
|
||||||
|
}
|
||||||
|
for _, repoDir := range repoDirs {
|
||||||
|
_ = os.MkdirAll(filepath.Join(setting.RepoRootPath, ownerDir.Name(), repoDir.Name(), "objects", "pack"), 0755)
|
||||||
|
_ = os.MkdirAll(filepath.Join(setting.RepoRootPath, ownerDir.Name(), repoDir.Name(), "objects", "info"), 0755)
|
||||||
|
_ = os.MkdirAll(filepath.Join(setting.RepoRootPath, ownerDir.Name(), repoDir.Name(), "refs", "heads"), 0755)
|
||||||
|
_ = os.MkdirAll(filepath.Join(setting.RepoRootPath, ownerDir.Name(), repoDir.Name(), "refs", "tag"), 0755)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if err := deleteDB(); err != nil {
|
if err := deleteDB(); err != nil {
|
||||||
t.Errorf("unable to reset database: %v", err)
|
t.Errorf("unable to reset database: %v", err)
|
||||||
|
|||||||
@@ -21,13 +21,18 @@ func (repo *Repository) CanEnableTimetracker() bool {
|
|||||||
|
|
||||||
// IsTimetrackerEnabled returns whether or not the timetracker is enabled. It returns the default value from config if an error occurs.
|
// IsTimetrackerEnabled returns whether or not the timetracker is enabled. It returns the default value from config if an error occurs.
|
||||||
func (repo *Repository) IsTimetrackerEnabled() bool {
|
func (repo *Repository) IsTimetrackerEnabled() bool {
|
||||||
|
return repo.isTimetrackerEnabled(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsTimetrackerEnabled returns whether or not the timetracker is enabled. It returns the default value from config if an error occurs.
|
||||||
|
func (repo *Repository) isTimetrackerEnabled(e Engine) bool {
|
||||||
if !setting.Service.EnableTimetracking {
|
if !setting.Service.EnableTimetracking {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
var u *RepoUnit
|
var u *RepoUnit
|
||||||
var err error
|
var err error
|
||||||
if u, err = repo.GetUnit(UnitTypeIssues); err != nil {
|
if u, err = repo.getUnit(e, UnitTypeIssues); err != nil {
|
||||||
return setting.Service.DefaultEnableTimetracking
|
return setting.Service.DefaultEnableTimetracking
|
||||||
}
|
}
|
||||||
return u.IssuesConfig().EnableTimetracker
|
return u.IssuesConfig().EnableTimetracker
|
||||||
|
|||||||
@@ -87,6 +87,26 @@ func MainTest(m *testing.M, pathToGiteaRoot string) {
|
|||||||
fatalTestError("util.CopyDir: %v\n", err)
|
fatalTestError("util.CopyDir: %v\n", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ownerDirs, err := os.ReadDir(setting.RepoRootPath)
|
||||||
|
if err != nil {
|
||||||
|
fatalTestError("unable to read the new repo root: %v\n", err)
|
||||||
|
}
|
||||||
|
for _, ownerDir := range ownerDirs {
|
||||||
|
if !ownerDir.Type().IsDir() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
repoDirs, err := os.ReadDir(filepath.Join(setting.RepoRootPath, ownerDir.Name()))
|
||||||
|
if err != nil {
|
||||||
|
fatalTestError("unable to read the new repo root: %v\n", err)
|
||||||
|
}
|
||||||
|
for _, repoDir := range repoDirs {
|
||||||
|
_ = os.MkdirAll(filepath.Join(setting.RepoRootPath, ownerDir.Name(), repoDir.Name(), "objects", "pack"), 0755)
|
||||||
|
_ = os.MkdirAll(filepath.Join(setting.RepoRootPath, ownerDir.Name(), repoDir.Name(), "objects", "info"), 0755)
|
||||||
|
_ = os.MkdirAll(filepath.Join(setting.RepoRootPath, ownerDir.Name(), repoDir.Name(), "refs", "heads"), 0755)
|
||||||
|
_ = os.MkdirAll(filepath.Join(setting.RepoRootPath, ownerDir.Name(), repoDir.Name(), "refs", "tag"), 0755)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
exitStatus := m.Run()
|
exitStatus := m.Run()
|
||||||
if err = util.RemoveAll(setting.RepoRootPath); err != nil {
|
if err = util.RemoveAll(setting.RepoRootPath); err != nil {
|
||||||
fatalTestError("util.RemoveAll: %v\n", err)
|
fatalTestError("util.RemoveAll: %v\n", err)
|
||||||
@@ -128,6 +148,23 @@ func PrepareTestEnv(t testing.TB) {
|
|||||||
assert.NoError(t, util.RemoveAll(setting.RepoRootPath))
|
assert.NoError(t, util.RemoveAll(setting.RepoRootPath))
|
||||||
metaPath := filepath.Join(giteaRoot, "integrations", "gitea-repositories-meta")
|
metaPath := filepath.Join(giteaRoot, "integrations", "gitea-repositories-meta")
|
||||||
assert.NoError(t, util.CopyDir(metaPath, setting.RepoRootPath))
|
assert.NoError(t, util.CopyDir(metaPath, setting.RepoRootPath))
|
||||||
|
|
||||||
|
ownerDirs, err := os.ReadDir(setting.RepoRootPath)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
for _, ownerDir := range ownerDirs {
|
||||||
|
if !ownerDir.Type().IsDir() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
repoDirs, err := os.ReadDir(filepath.Join(setting.RepoRootPath, ownerDir.Name()))
|
||||||
|
assert.NoError(t, err)
|
||||||
|
for _, repoDir := range repoDirs {
|
||||||
|
_ = os.MkdirAll(filepath.Join(setting.RepoRootPath, ownerDir.Name(), repoDir.Name(), "objects", "pack"), 0755)
|
||||||
|
_ = os.MkdirAll(filepath.Join(setting.RepoRootPath, ownerDir.Name(), repoDir.Name(), "objects", "info"), 0755)
|
||||||
|
_ = os.MkdirAll(filepath.Join(setting.RepoRootPath, ownerDir.Name(), repoDir.Name(), "refs", "heads"), 0755)
|
||||||
|
_ = os.MkdirAll(filepath.Join(setting.RepoRootPath, ownerDir.Name(), repoDir.Name(), "refs", "tag"), 0755)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
base.SetupGiteaRoot() // Makes sure GITEA_ROOT is set
|
base.SetupGiteaRoot() // Makes sure GITEA_ROOT is set
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -223,6 +223,9 @@ func APIAuth(authMethod auth.Auth) func(*APIContext) {
|
|||||||
// Get user from session if logged in.
|
// Get user from session if logged in.
|
||||||
ctx.User = authMethod.Verify(ctx.Req, ctx.Resp, ctx, ctx.Session)
|
ctx.User = authMethod.Verify(ctx.Req, ctx.Resp, ctx, ctx.Session)
|
||||||
if ctx.User != nil {
|
if ctx.User != nil {
|
||||||
|
if ctx.Locale.Language() != ctx.User.Language {
|
||||||
|
ctx.Locale = middleware.Locale(ctx.Resp, ctx.Req)
|
||||||
|
}
|
||||||
ctx.IsBasicAuth = ctx.Data["AuthedMethod"].(string) == new(auth.Basic).Name()
|
ctx.IsBasicAuth = ctx.Data["AuthedMethod"].(string) == new(auth.Basic).Name()
|
||||||
ctx.IsSigned = true
|
ctx.IsSigned = true
|
||||||
ctx.Data["IsSigned"] = ctx.IsSigned
|
ctx.Data["IsSigned"] = ctx.IsSigned
|
||||||
|
|||||||
@@ -642,6 +642,9 @@ func Auth(authMethod auth.Auth) func(*Context) {
|
|||||||
return func(ctx *Context) {
|
return func(ctx *Context) {
|
||||||
ctx.User = authMethod.Verify(ctx.Req, ctx.Resp, ctx, ctx.Session)
|
ctx.User = authMethod.Verify(ctx.Req, ctx.Resp, ctx, ctx.Session)
|
||||||
if ctx.User != nil {
|
if ctx.User != nil {
|
||||||
|
if ctx.Locale.Language() != ctx.User.Language {
|
||||||
|
ctx.Locale = middleware.Locale(ctx.Resp, ctx.Req)
|
||||||
|
}
|
||||||
ctx.IsBasicAuth = ctx.Data["AuthedMethod"].(string) == new(auth.Basic).Name()
|
ctx.IsBasicAuth = ctx.Data["AuthedMethod"].(string) == new(auth.Basic).Name()
|
||||||
ctx.IsSigned = true
|
ctx.IsSigned = true
|
||||||
ctx.Data["IsSigned"] = ctx.IsSigned
|
ctx.Data["IsSigned"] = ctx.IsSigned
|
||||||
@@ -669,6 +672,7 @@ func Contexter() func(next http.Handler) http.Handler {
|
|||||||
var locale = middleware.Locale(resp, req)
|
var locale = middleware.Locale(resp, req)
|
||||||
var startTime = time.Now()
|
var startTime = time.Now()
|
||||||
var link = setting.AppSubURL + strings.TrimSuffix(req.URL.EscapedPath(), "/")
|
var link = setting.AppSubURL + strings.TrimSuffix(req.URL.EscapedPath(), "/")
|
||||||
|
|
||||||
var ctx = Context{
|
var ctx = Context{
|
||||||
Resp: NewResponse(resp),
|
Resp: NewResponse(resp),
|
||||||
Cache: mc.GetCache(),
|
Cache: mc.GetCache(),
|
||||||
|
|||||||
@@ -833,7 +833,7 @@ func RepoRefByType(refType RepoRefType, ignoreNotExistErr ...bool) func(*Context
|
|||||||
setting.AppSubURL,
|
setting.AppSubURL,
|
||||||
strings.TrimSuffix(ctx.Req.URL.Path, ctx.Params("*")),
|
strings.TrimSuffix(ctx.Req.URL.Path, ctx.Params("*")),
|
||||||
ctx.Repo.BranchNameSubURL(),
|
ctx.Repo.BranchNameSubURL(),
|
||||||
ctx.Repo.TreePath))
|
util.PathEscapeSegments(ctx.Repo.TreePath)))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,13 +159,13 @@ func checkDBConsistency(logger log.Logger, autofix bool) error {
|
|||||||
"lfs_lock", "repository", "lfs_lock.repo_id=repository.id"),
|
"lfs_lock", "repository", "lfs_lock.repo_id=repository.id"),
|
||||||
// find collaborations without users
|
// find collaborations without users
|
||||||
genericOrphanCheck("Collaborations without existing user",
|
genericOrphanCheck("Collaborations without existing user",
|
||||||
"collaboration", "user", "collaboration.user_id=user.id"),
|
"collaboration", "user", "collaboration.user_id=`user`.id"),
|
||||||
// find collaborations without repository
|
// find collaborations without repository
|
||||||
genericOrphanCheck("Collaborations without existing repository",
|
genericOrphanCheck("Collaborations without existing repository",
|
||||||
"collaboration", "repository", "collaboration.repo_id=repository.id"),
|
"collaboration", "repository", "collaboration.repo_id=repository.id"),
|
||||||
// find access without users
|
// find access without users
|
||||||
genericOrphanCheck("Access entries without existing user",
|
genericOrphanCheck("Access entries without existing user",
|
||||||
"access", "user", "access.user_id=user.id"),
|
"access", "user", "access.user_id=`user`.id"),
|
||||||
// find access without repository
|
// find access without repository
|
||||||
genericOrphanCheck("Access entries without existing repository",
|
genericOrphanCheck("Access entries without existing repository",
|
||||||
"access", "repository", "access.repo_id=repository.id"),
|
"access", "repository", "access.repo_id=repository.id"),
|
||||||
|
|||||||
@@ -27,6 +27,20 @@ type WriteCloserError interface {
|
|||||||
CloseWithError(err error) error
|
CloseWithError(err error) error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// EnsureValidGitRepository runs git rev-parse in the repository path - thus ensuring that the repository is a valid repository.
|
||||||
|
// Run before opening git cat-file.
|
||||||
|
// This is needed otherwise the git cat-file will hang for invalid repositories.
|
||||||
|
func EnsureValidGitRepository(ctx context.Context, repoPath string) error {
|
||||||
|
stderr := strings.Builder{}
|
||||||
|
err := NewCommandContext(ctx, "rev-parse").
|
||||||
|
SetDescription(fmt.Sprintf("%s rev-parse [repo_path: %s]", GitExecutable, repoPath)).
|
||||||
|
RunInDirFullPipeline(repoPath, nil, &stderr, nil)
|
||||||
|
if err != nil {
|
||||||
|
return ConcatenateError(err, (&stderr).String())
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// CatFileBatchCheck opens git cat-file --batch-check in the provided repo and returns a stdin pipe, a stdout reader and cancel function
|
// CatFileBatchCheck opens git cat-file --batch-check in the provided repo and returns a stdin pipe, a stdout reader and cancel function
|
||||||
func CatFileBatchCheck(repoPath string) (WriteCloserError, *bufio.Reader, func()) {
|
func CatFileBatchCheck(repoPath string) (WriteCloserError, *bufio.Reader, func()) {
|
||||||
batchStdinReader, batchStdinWriter := io.Pipe()
|
batchStdinReader, batchStdinWriter := io.Pipe()
|
||||||
|
|||||||
@@ -218,6 +218,8 @@ func CutDiffAroundLine(originalDiff io.Reader, line int64, old bool, numbersOfLi
|
|||||||
} else {
|
} else {
|
||||||
otherLine++
|
otherLine++
|
||||||
}
|
}
|
||||||
|
case '\\':
|
||||||
|
// FIXME: handle `\ No newline at end of file`
|
||||||
default:
|
default:
|
||||||
currentLine++
|
currentLine++
|
||||||
otherLine++
|
otherLine++
|
||||||
|
|||||||
@@ -42,6 +42,57 @@ index d8e4c92..19dc8ad 100644
|
|||||||
/
|
/
|
||||||
`
|
`
|
||||||
|
|
||||||
|
var issue17875Diff = `diff --git a/Geschäftsordnung.md b/Geschäftsordnung.md
|
||||||
|
index d46c152..a7d2d55 100644
|
||||||
|
--- a/Geschäftsordnung.md
|
||||||
|
+++ b/Geschäftsordnung.md
|
||||||
|
@@ -1,5 +1,5 @@
|
||||||
|
---
|
||||||
|
-date: "23.01.2021"
|
||||||
|
+date: "30.11.2021"
|
||||||
|
...
|
||||||
|
` + `
|
||||||
|
# Geschäftsordnung
|
||||||
|
@@ -16,4 +16,22 @@ Diese Geschäftsordnung regelt alle Prozesse des Vereins, solange diese nicht du
|
||||||
|
` + `
|
||||||
|
## § 3 Datenschutzverantwortlichkeit
|
||||||
|
` + `
|
||||||
|
-1. Der Verein bestellt eine datenschutzverantwortliche Person mit den Aufgaben nach Artikel 39 DSGVO.
|
||||||
|
\ No newline at end of file
|
||||||
|
+1. Der Verein bestellt eine datenschutzverantwortliche Person mit den Aufgaben nach Artikel 39 DSGVO.
|
||||||
|
+
|
||||||
|
+## §4 Umgang mit der SARS-Cov-2-Pandemie
|
||||||
|
+
|
||||||
|
+1. Der Vorstand hat die Befugnis, in Rücksprache mit den Vereinsmitgliedern, verschiedene Hygienemaßnahmen für Präsenzveranstaltungen zu beschließen.
|
||||||
|
+
|
||||||
|
+2. Die Einführung, Änderung und Abschaffung dieser Maßnahmen sind nur zum Zweck der Eindämmung der SARS-Cov-2-Pandemie zulässig.
|
||||||
|
+
|
||||||
|
+3. Die Einführung, Änderung und Abschaffung von Maßnahmen nach Abs. 2 bedarf einer wissenschaftlichen Grundlage.
|
||||||
|
+
|
||||||
|
+4. Die Maßnahmen nach Abs. 2 setzen sich aus den folgenden Bausteinen inklusive einer ihrer Ausprägungen zusammen.
|
||||||
|
+
|
||||||
|
+ 1. Maskenpflicht: Keine; Maskenpflicht, außer am Platz, oder wo Abstände nicht eingehalten werden können; Maskenpflicht, wenn Abstände nicht eingehalten werden können; Maskenpflicht
|
||||||
|
+
|
||||||
|
+ 2. Geimpft-, Genesen- oder Testnachweis: Kein Nachweis notwendig; Nachweis, dass Person geimpft, genesen oder tagesaktuell getestet ist (3G); Nachweis, dass Person geimpft oder genesen ist (2G); Nachweis, dass Person geimpft bzw. genesen und tagesaktuell getestet ist (2G+)
|
||||||
|
+
|
||||||
|
+ 3. Online-Veranstaltung: Keine, parallele Online-Veranstaltung, ausschließlich Online-Veranstaltung
|
||||||
|
+
|
||||||
|
+5. Bei Präsenzveranstungen gelten außerdem die Hygienevorschriften des Veranstaltungsorts. Bei Regelkollision greift die restriktivere Regel.
|
||||||
|
\ No newline at end of file`
|
||||||
|
|
||||||
|
func TestCutDiffAroundLineIssue17875(t *testing.T) {
|
||||||
|
result, err := CutDiffAroundLine(strings.NewReader(issue17875Diff), 23, false, 3)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
expected := `diff --git a/Geschäftsordnung.md b/Geschäftsordnung.md
|
||||||
|
--- a/Geschäftsordnung.md
|
||||||
|
+++ b/Geschäftsordnung.md
|
||||||
|
@@ -20,0 +21,3 @@
|
||||||
|
+## §4 Umgang mit der SARS-Cov-2-Pandemie
|
||||||
|
+
|
||||||
|
+1. Der Vorstand hat die Befugnis, in Rücksprache mit den Vereinsmitgliedern, verschiedene Hygienemaßnahmen für Präsenzveranstaltungen zu beschließen.`
|
||||||
|
assert.Equal(t, expected, result)
|
||||||
|
}
|
||||||
|
|
||||||
func TestCutDiffAroundLine(t *testing.T) {
|
func TestCutDiffAroundLine(t *testing.T) {
|
||||||
result, err := CutDiffAroundLine(strings.NewReader(exampleDiff), 4, false, 3)
|
result, err := CutDiffAroundLine(strings.NewReader(exampleDiff), 4, false, 3)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|||||||
@@ -43,6 +43,11 @@ func OpenRepository(repoPath string) (*Repository, error) {
|
|||||||
return nil, errors.New("no such file or directory")
|
return nil, errors.New("no such file or directory")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Now because of some insanity with git cat-file not immediately failing if not run in a valid git directory we need to run git rev-parse first!
|
||||||
|
if err := EnsureValidGitRepository(DefaultContext, repoPath); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
repo := &Repository{
|
repo := &Repository{
|
||||||
Path: repoPath,
|
Path: repoPath,
|
||||||
tagCache: newObjectCache(),
|
tagCache: newObjectCache(),
|
||||||
|
|||||||
@@ -38,7 +38,10 @@ func (repo *Repository) ResolveReference(name string) (string, error) {
|
|||||||
func (repo *Repository) GetRefCommitID(name string) (string, error) {
|
func (repo *Repository) GetRefCommitID(name string) (string, error) {
|
||||||
wr, rd, cancel := repo.CatFileBatchCheck()
|
wr, rd, cancel := repo.CatFileBatchCheck()
|
||||||
defer cancel()
|
defer cancel()
|
||||||
_, _ = wr.Write([]byte(name + "\n"))
|
_, err := wr.Write([]byte(name + "\n"))
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
shaBs, _, _, err := ReadBatchLine(rd)
|
shaBs, _, _, err := ReadBatchLine(rd)
|
||||||
if IsErrNotExist(err) {
|
if IsErrNotExist(err) {
|
||||||
return "", ErrNotExist{name, ""}
|
return "", ErrNotExist{name, ""}
|
||||||
|
|||||||
@@ -276,6 +276,12 @@ func (b *BleveIndexer) Index(repo *models.Repository, sha string, changes *repoC
|
|||||||
batch := gitea_bleve.NewFlushingBatch(b.indexer, maxBatchSize)
|
batch := gitea_bleve.NewFlushingBatch(b.indexer, maxBatchSize)
|
||||||
if len(changes.Updates) > 0 {
|
if len(changes.Updates) > 0 {
|
||||||
|
|
||||||
|
// Now because of some insanity with git cat-file not immediately failing if not run in a valid git directory we need to run git rev-parse first!
|
||||||
|
if err := git.EnsureValidGitRepository(git.DefaultContext, repo.RepoPath()); err != nil {
|
||||||
|
log.Error("Unable to open git repo: %s for %-v: %v", repo.RepoPath(), repo, err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
batchWriter, batchReader, cancel := git.CatFileBatch(repo.RepoPath())
|
batchWriter, batchReader, cancel := git.CatFileBatch(repo.RepoPath())
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
|
|||||||
@@ -248,6 +248,11 @@ func (b *ElasticSearchIndexer) addDelete(filename string, repo *models.Repositor
|
|||||||
func (b *ElasticSearchIndexer) Index(repo *models.Repository, sha string, changes *repoChanges) error {
|
func (b *ElasticSearchIndexer) Index(repo *models.Repository, sha string, changes *repoChanges) error {
|
||||||
reqs := make([]elastic.BulkableRequest, 0)
|
reqs := make([]elastic.BulkableRequest, 0)
|
||||||
if len(changes.Updates) > 0 {
|
if len(changes.Updates) > 0 {
|
||||||
|
// Now because of some insanity with git cat-file not immediately failing if not run in a valid git directory we need to run git rev-parse first!
|
||||||
|
if err := git.EnsureValidGitRepository(git.DefaultContext, repo.RepoPath()); err != nil {
|
||||||
|
log.Error("Unable to open git repo: %s for %-v: %v", repo.RepoPath(), repo, err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
batchWriter, batchReader, cancel := git.CatFileBatch(repo.RepoPath())
|
batchWriter, batchReader, cancel := git.CatFileBatch(repo.RepoPath())
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|||||||
@@ -259,7 +259,7 @@ normalLoop:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Process naughty character
|
// Process naughty character
|
||||||
if _, err := fmt.Fprintf(c.w, `\%#o03d`, bytes[i]); err != nil {
|
if _, err := fmt.Fprintf(c.w, `\%#03o`, bytes[i]); err != nil {
|
||||||
return totalWritten, err
|
return totalWritten, err
|
||||||
}
|
}
|
||||||
i++
|
i++
|
||||||
|
|||||||
@@ -148,8 +148,6 @@ func (a *actionNotifier) NotifyNewPullRequest(pull *models.PullRequest, mentions
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *actionNotifier) NotifyRenameRepository(doer *models.User, repo *models.Repository, oldRepoName string) {
|
func (a *actionNotifier) NotifyRenameRepository(doer *models.User, repo *models.Repository, oldRepoName string) {
|
||||||
log.Trace("action.ChangeRepositoryName: %s/%s", doer.Name, repo.Name)
|
|
||||||
|
|
||||||
if err := models.NotifyWatchers(&models.Action{
|
if err := models.NotifyWatchers(&models.Action{
|
||||||
ActUserID: doer.ID,
|
ActUserID: doer.ID,
|
||||||
ActUser: doer,
|
ActUser: doer,
|
||||||
|
|||||||
@@ -4,9 +4,21 @@
|
|||||||
|
|
||||||
package session
|
package session
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"gitea.com/go-chi/session"
|
||||||
|
)
|
||||||
|
|
||||||
// Store represents a session store
|
// Store represents a session store
|
||||||
type Store interface {
|
type Store interface {
|
||||||
Get(interface{}) interface{}
|
Get(interface{}) interface{}
|
||||||
Set(interface{}, interface{}) error
|
Set(interface{}, interface{}) error
|
||||||
Delete(interface{}) error
|
Delete(interface{}) error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RegenerateSession regenerates the underlying session and returns the new store
|
||||||
|
func RegenerateSession(resp http.ResponseWriter, req *http.Request) (Store, error) {
|
||||||
|
s, err := session.RegenerateSession(resp, req)
|
||||||
|
return s, err
|
||||||
|
}
|
||||||
|
|||||||
@@ -58,6 +58,9 @@ func runMigrateTask(t *models.Task) (err error) {
|
|||||||
t.EndTime = timeutil.TimeStampNow()
|
t.EndTime = timeutil.TimeStampNow()
|
||||||
t.Status = structs.TaskStatusFailed
|
t.Status = structs.TaskStatusFailed
|
||||||
t.Message = err.Error()
|
t.Message = err.Error()
|
||||||
|
// Ensure that the repo loaded before we zero out the repo ID from the task - thus ensuring that we can delete it
|
||||||
|
_ = t.LoadRepo()
|
||||||
|
|
||||||
t.RepoID = 0
|
t.RepoID = 0
|
||||||
if err := t.UpdateCols("status", "errors", "repo_id", "end_time"); err != nil {
|
if err := t.UpdateCols("status", "errors", "repo_id", "end_time"); err != nil {
|
||||||
log.Error("Task UpdateCols failed: %v", err)
|
log.Error("Task UpdateCols failed: %v", err)
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ func CreateMigrateTask(doer, u *models.User, opts base.MigrateOptions) (*models.
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var task = models.Task{
|
var task = &models.Task{
|
||||||
DoerID: doer.ID,
|
DoerID: doer.ID,
|
||||||
OwnerID: u.ID,
|
OwnerID: u.ID,
|
||||||
Type: structs.TaskTypeMigrateRepo,
|
Type: structs.TaskTypeMigrateRepo,
|
||||||
@@ -100,7 +100,7 @@ func CreateMigrateTask(doer, u *models.User, opts base.MigrateOptions) (*models.
|
|||||||
PayloadContent: string(bs),
|
PayloadContent: string(bs),
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := models.CreateTask(&task); err != nil {
|
if err := models.CreateTask(task); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,5 +128,5 @@ func CreateMigrateTask(doer, u *models.User, opts base.MigrateOptions) (*models.
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return &task, nil
|
return task, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,10 @@ func Open(uriStr string) (io.ReadCloser, error) {
|
|||||||
switch strings.ToLower(u.Scheme) {
|
switch strings.ToLower(u.Scheme) {
|
||||||
case "http", "https":
|
case "http", "https":
|
||||||
f, err := http.Get(uriStr)
|
f, err := http.Get(uriStr)
|
||||||
return f.Body, err
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return f.Body, nil
|
||||||
case "file":
|
case "file":
|
||||||
return os.Open(u.Path)
|
return os.Open(u.Path)
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -896,11 +896,12 @@ migrate.migrate = Migrate From %s
|
|||||||
migrate.migrating = Migrating from <b>%s</b> ...
|
migrate.migrating = Migrating from <b>%s</b> ...
|
||||||
migrate.migrating_failed = Migrating from <b>%s</b> failed.
|
migrate.migrating_failed = Migrating from <b>%s</b> failed.
|
||||||
migrate.migrating_failed.error = Error: %s
|
migrate.migrating_failed.error = Error: %s
|
||||||
migrate.github.description = Migrating data from Github.com or Github Enterprise.
|
migrate.github.description = Migrate data from github.com or other Github instances.
|
||||||
migrate.git.description = Migrating or Mirroring git data from Git services
|
migrate.git.description = Migrate a repository only from any Git service.
|
||||||
migrate.gitlab.description = Migrating data from GitLab.com or Self-Hosted gitlab server.
|
migrate.gitlab.description = Migrate data from gitlab.com or other GitLab instances.
|
||||||
migrate.gitea.description = Migrating data from Gitea.com or Self-Hosted Gitea server.
|
migrate.gitea.description = Migrate data from gitea.com or other Gitea instances.
|
||||||
migrate.gogs.description = Migrating data from notabug.org or other Self-Hosted Gogs server.
|
migrate.gogs.description = Migrate data from notabug.org or other Gogs instances.
|
||||||
|
migrate.onedev.description = Migrate data from code.onedev.io or other OneDev instances.
|
||||||
migrate.migrating_git = Migrating Git Data
|
migrate.migrating_git = Migrating Git Data
|
||||||
migrate.migrating_topics = Migrating Topics
|
migrate.migrating_topics = Migrating Topics
|
||||||
migrate.migrating_milestones = Migrating Milestones
|
migrate.migrating_milestones = Migrating Milestones
|
||||||
|
|||||||
@@ -1611,7 +1611,7 @@ search=搜索
|
|||||||
search.search_repo=搜索仓库...
|
search.search_repo=搜索仓库...
|
||||||
search.fuzzy=模糊
|
search.fuzzy=模糊
|
||||||
search.match=匹配
|
search.match=匹配
|
||||||
search.results=在 <a href="%s"> %s </a> 中搜索 "%s" 的结果
|
search.results=在 <a href="%[2]s"> %[3]s </a> 中搜索 "%[1]s" 的结果
|
||||||
|
|
||||||
settings=设置
|
settings=设置
|
||||||
settings.desc=设置是你可以管理仓库设置的地方
|
settings.desc=设置是你可以管理仓库设置的地方
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import (
|
|||||||
"code.gitea.io/gitea/modules/convert"
|
"code.gitea.io/gitea/modules/convert"
|
||||||
"code.gitea.io/gitea/modules/log"
|
"code.gitea.io/gitea/modules/log"
|
||||||
"code.gitea.io/gitea/modules/password"
|
"code.gitea.io/gitea/modules/password"
|
||||||
|
"code.gitea.io/gitea/modules/setting"
|
||||||
api "code.gitea.io/gitea/modules/structs"
|
api "code.gitea.io/gitea/modules/structs"
|
||||||
"code.gitea.io/gitea/modules/web"
|
"code.gitea.io/gitea/modules/web"
|
||||||
"code.gitea.io/gitea/routers/api/v1/user"
|
"code.gitea.io/gitea/routers/api/v1/user"
|
||||||
@@ -167,6 +168,10 @@ func EditUser(ctx *context.APIContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(form.Password) != 0 {
|
if len(form.Password) != 0 {
|
||||||
|
if len(form.Password) < setting.MinPasswordLength {
|
||||||
|
ctx.Error(http.StatusBadRequest, "PasswordTooShort", fmt.Errorf("password must be at least %d characters", setting.MinPasswordLength))
|
||||||
|
return
|
||||||
|
}
|
||||||
if !password.IsComplexEnough(form.Password) {
|
if !password.IsComplexEnough(form.Password) {
|
||||||
err := errors.New("PasswordComplexity")
|
err := errors.New("PasswordComplexity")
|
||||||
ctx.Error(http.StatusBadRequest, "PasswordComplexity", err)
|
ctx.Error(http.StatusBadRequest, "PasswordComplexity", err)
|
||||||
|
|||||||
@@ -87,7 +87,6 @@ import (
|
|||||||
"code.gitea.io/gitea/services/forms"
|
"code.gitea.io/gitea/services/forms"
|
||||||
|
|
||||||
"gitea.com/go-chi/binding"
|
"gitea.com/go-chi/binding"
|
||||||
"gitea.com/go-chi/session"
|
|
||||||
"github.com/go-chi/cors"
|
"github.com/go-chi/cors"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -547,20 +546,10 @@ func bind(obj interface{}) http.HandlerFunc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Routes registers all v1 APIs routes to web application.
|
// Routes registers all v1 APIs routes to web application.
|
||||||
func Routes() *web.Route {
|
func Routes(sessioner func(next http.Handler) http.Handler) *web.Route {
|
||||||
var m = web.NewRoute()
|
var m = web.NewRoute()
|
||||||
|
|
||||||
m.Use(session.Sessioner(session.Options{
|
m.Use(sessioner)
|
||||||
Provider: setting.SessionConfig.Provider,
|
|
||||||
ProviderConfig: setting.SessionConfig.ProviderConfig,
|
|
||||||
CookieName: setting.SessionConfig.CookieName,
|
|
||||||
CookiePath: setting.SessionConfig.CookiePath,
|
|
||||||
Gclifetime: setting.SessionConfig.Gclifetime,
|
|
||||||
Maxlifetime: setting.SessionConfig.Maxlifetime,
|
|
||||||
Secure: setting.SessionConfig.Secure,
|
|
||||||
SameSite: setting.SessionConfig.SameSite,
|
|
||||||
Domain: setting.SessionConfig.Domain,
|
|
||||||
}))
|
|
||||||
m.Use(securityHeaders())
|
m.Use(securityHeaders())
|
||||||
if setting.CORSConfig.Enabled {
|
if setting.CORSConfig.Enabled {
|
||||||
m.Use(cors.Handler(cors.Options{
|
m.Use(cors.Handler(cors.Options{
|
||||||
|
|||||||
@@ -96,6 +96,11 @@ func Transfer(ctx *context.APIContext) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ctx.Repo.GitRepo != nil {
|
||||||
|
ctx.Repo.GitRepo.Close()
|
||||||
|
ctx.Repo.GitRepo = nil
|
||||||
|
}
|
||||||
|
|
||||||
if err := repo_service.StartRepositoryTransfer(ctx.User, newOwner, ctx.Repo.Repository, teams); err != nil {
|
if err := repo_service.StartRepositoryTransfer(ctx.User, newOwner, ctx.Repo.Repository, teams); err != nil {
|
||||||
if models.IsErrRepoTransferInProgress(err) {
|
if models.IsErrRepoTransferInProgress(err) {
|
||||||
ctx.Error(http.StatusConflict, "CreatePendingRepositoryTransfer", err)
|
ctx.Error(http.StatusConflict, "CreatePendingRepositoryTransfer", err)
|
||||||
|
|||||||
@@ -22,6 +22,9 @@ func Middlewares() []func(http.Handler) http.Handler {
|
|||||||
var handlers = []func(http.Handler) http.Handler{
|
var handlers = []func(http.Handler) http.Handler{
|
||||||
func(next http.Handler) http.Handler {
|
func(next http.Handler) http.Handler {
|
||||||
return http.HandlerFunc(func(resp http.ResponseWriter, req *http.Request) {
|
return http.HandlerFunc(func(resp http.ResponseWriter, req *http.Request) {
|
||||||
|
// First of all escape the URL RawPath to ensure that all routing is done using a correctly escaped URL
|
||||||
|
req.URL.RawPath = req.URL.EscapedPath()
|
||||||
|
|
||||||
next.ServeHTTP(context.NewResponse(resp), req)
|
next.ServeHTTP(context.NewResponse(resp), req)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ import (
|
|||||||
pull_service "code.gitea.io/gitea/services/pull"
|
pull_service "code.gitea.io/gitea/services/pull"
|
||||||
"code.gitea.io/gitea/services/repository"
|
"code.gitea.io/gitea/services/repository"
|
||||||
"code.gitea.io/gitea/services/webhook"
|
"code.gitea.io/gitea/services/webhook"
|
||||||
|
|
||||||
|
"gitea.com/go-chi/session"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewServices init new services
|
// NewServices init new services
|
||||||
@@ -144,8 +146,20 @@ func NormalRoutes() *web.Route {
|
|||||||
r.Use(middle)
|
r.Use(middle)
|
||||||
}
|
}
|
||||||
|
|
||||||
r.Mount("/", web_routers.Routes())
|
sessioner := session.Sessioner(session.Options{
|
||||||
r.Mount("/api/v1", apiv1.Routes())
|
Provider: setting.SessionConfig.Provider,
|
||||||
|
ProviderConfig: setting.SessionConfig.ProviderConfig,
|
||||||
|
CookieName: setting.SessionConfig.CookieName,
|
||||||
|
CookiePath: setting.SessionConfig.CookiePath,
|
||||||
|
Gclifetime: setting.SessionConfig.Gclifetime,
|
||||||
|
Maxlifetime: setting.SessionConfig.Maxlifetime,
|
||||||
|
Secure: setting.SessionConfig.Secure,
|
||||||
|
SameSite: setting.SessionConfig.SameSite,
|
||||||
|
Domain: setting.SessionConfig.Domain,
|
||||||
|
})
|
||||||
|
|
||||||
|
r.Mount("/", web_routers.Routes(sessioner))
|
||||||
|
r.Mount("/api/v1", apiv1.Routes(sessioner))
|
||||||
r.Mount("/api/internal", private.Routes())
|
r.Mount("/api/internal", private.Routes())
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ func DeleteLabel(ctx *context.Context) {
|
|||||||
func InitializeLabels(ctx *context.Context) {
|
func InitializeLabels(ctx *context.Context) {
|
||||||
form := web.GetForm(ctx).(*forms.InitializeLabelsForm)
|
form := web.GetForm(ctx).(*forms.InitializeLabelsForm)
|
||||||
if ctx.HasError() {
|
if ctx.HasError() {
|
||||||
ctx.Redirect(ctx.Repo.RepoLink + "/labels")
|
ctx.Redirect(ctx.Org.OrgLink + "/labels")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -319,6 +319,11 @@ func acceptOrRejectRepoTransfer(ctx *context.Context, accept bool) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if accept {
|
if accept {
|
||||||
|
if ctx.Repo.GitRepo != nil {
|
||||||
|
ctx.Repo.GitRepo.Close()
|
||||||
|
ctx.Repo.GitRepo = nil
|
||||||
|
}
|
||||||
|
|
||||||
if err := repo_service.TransferOwnership(repoTransfer.Doer, repoTransfer.Recipient, ctx.Repo.Repository, repoTransfer.Teams); err != nil {
|
if err := repo_service.TransferOwnership(repoTransfer.Doer, repoTransfer.Recipient, ctx.Repo.Repository, repoTransfer.Teams); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -619,6 +619,13 @@ func Home(ctx *context.Context) {
|
|||||||
if ctx.Repo.Repository.IsBeingCreated() {
|
if ctx.Repo.Repository.IsBeingCreated() {
|
||||||
task, err := models.GetMigratingTask(ctx.Repo.Repository.ID)
|
task, err := models.GetMigratingTask(ctx.Repo.Repository.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if models.IsErrTaskDoesNotExist(err) {
|
||||||
|
ctx.Data["Repo"] = ctx.Repo
|
||||||
|
ctx.Data["CloneAddr"] = ""
|
||||||
|
ctx.Data["Failed"] = true
|
||||||
|
ctx.HTML(http.StatusOK, tplMigrating)
|
||||||
|
return
|
||||||
|
}
|
||||||
ctx.ServerError("models.GetMigratingTask", err)
|
ctx.ServerError("models.GetMigratingTask", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import (
|
|||||||
"code.gitea.io/gitea/modules/log"
|
"code.gitea.io/gitea/modules/log"
|
||||||
"code.gitea.io/gitea/modules/password"
|
"code.gitea.io/gitea/modules/password"
|
||||||
"code.gitea.io/gitea/modules/recaptcha"
|
"code.gitea.io/gitea/modules/recaptcha"
|
||||||
|
"code.gitea.io/gitea/modules/session"
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
"code.gitea.io/gitea/modules/timeutil"
|
"code.gitea.io/gitea/modules/timeutil"
|
||||||
"code.gitea.io/gitea/modules/web"
|
"code.gitea.io/gitea/modules/web"
|
||||||
@@ -87,6 +88,10 @@ func AutoSignIn(ctx *context.Context) (bool, error) {
|
|||||||
|
|
||||||
isSucceed = true
|
isSucceed = true
|
||||||
|
|
||||||
|
if _, err := session.RegenerateSession(ctx.Resp, ctx.Req); err != nil {
|
||||||
|
return false, fmt.Errorf("unable to RegenerateSession: Error: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
// Set session IDs
|
// Set session IDs
|
||||||
if err := ctx.Session.Set("uid", u.ID); err != nil {
|
if err := ctx.Session.Set("uid", u.ID); err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
@@ -98,10 +103,33 @@ func AutoSignIn(ctx *context.Context) (bool, error) {
|
|||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := resetLocale(ctx, u); err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
middleware.DeleteCSRFCookie(ctx.Resp)
|
middleware.DeleteCSRFCookie(ctx.Resp)
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func resetLocale(ctx *context.Context, u *models.User) error {
|
||||||
|
// Language setting of the user overwrites the one previously set
|
||||||
|
// If the user does not have a locale set, we save the current one.
|
||||||
|
if len(u.Language) == 0 {
|
||||||
|
u.Language = ctx.Locale.Language()
|
||||||
|
if err := models.UpdateUserCols(u, "language"); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
middleware.SetLocaleCookie(ctx.Resp, u.Language, 0)
|
||||||
|
|
||||||
|
if ctx.Locale.Language() != u.Language {
|
||||||
|
ctx.Locale = middleware.Locale(ctx.Resp, ctx.Req)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func checkAutoLogin(ctx *context.Context) bool {
|
func checkAutoLogin(ctx *context.Context) bool {
|
||||||
// Check auto-login.
|
// Check auto-login.
|
||||||
isSucceed, err := AutoSignIn(ctx)
|
isSucceed, err := AutoSignIn(ctx)
|
||||||
@@ -212,6 +240,11 @@ func SignInPost(ctx *context.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if _, err := session.RegenerateSession(ctx.Resp, ctx.Req); err != nil {
|
||||||
|
ctx.ServerError("UserSignIn: Unable to set regenerate session", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// User needs to use 2FA, save data and redirect to 2FA page.
|
// User needs to use 2FA, save data and redirect to 2FA page.
|
||||||
if err := ctx.Session.Set("twofaUid", u.ID); err != nil {
|
if err := ctx.Session.Set("twofaUid", u.ID); err != nil {
|
||||||
ctx.ServerError("UserSignIn: Unable to set twofaUid in session", err)
|
ctx.ServerError("UserSignIn: Unable to set twofaUid in session", err)
|
||||||
@@ -372,6 +405,9 @@ func TwoFactorScratchPost(ctx *context.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleSignInFull(ctx, u, remember, false)
|
handleSignInFull(ctx, u, remember, false)
|
||||||
|
if ctx.Written() {
|
||||||
|
return
|
||||||
|
}
|
||||||
ctx.Flash.Info(ctx.Tr("auth.twofa_scratch_used"))
|
ctx.Flash.Info(ctx.Tr("auth.twofa_scratch_used"))
|
||||||
ctx.Redirect(setting.AppSubURL + "/user/settings/security")
|
ctx.Redirect(setting.AppSubURL + "/user/settings/security")
|
||||||
return
|
return
|
||||||
@@ -482,6 +518,9 @@ func U2FSign(ctx *context.Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
redirect := handleSignInFull(ctx, user, remember, false)
|
redirect := handleSignInFull(ctx, user, remember, false)
|
||||||
|
if ctx.Written() {
|
||||||
|
return
|
||||||
|
}
|
||||||
if redirect == "" {
|
if redirect == "" {
|
||||||
redirect = setting.AppSubURL + "/"
|
redirect = setting.AppSubURL + "/"
|
||||||
}
|
}
|
||||||
@@ -494,7 +533,11 @@ func U2FSign(ctx *context.Context) {
|
|||||||
|
|
||||||
// This handles the final part of the sign-in process of the user.
|
// This handles the final part of the sign-in process of the user.
|
||||||
func handleSignIn(ctx *context.Context, u *models.User, remember bool) {
|
func handleSignIn(ctx *context.Context, u *models.User, remember bool) {
|
||||||
handleSignInFull(ctx, u, remember, true)
|
redirect := handleSignInFull(ctx, u, remember, true)
|
||||||
|
if ctx.Written() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ctx.Redirect(redirect)
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleSignInFull(ctx *context.Context, u *models.User, remember bool, obeyRedirect bool) string {
|
func handleSignInFull(ctx *context.Context, u *models.User, remember bool, obeyRedirect bool) string {
|
||||||
@@ -505,6 +548,12 @@ func handleSignInFull(ctx *context.Context, u *models.User, remember bool, obeyR
|
|||||||
setting.CookieRememberName, u.Name, days)
|
setting.CookieRememberName, u.Name, days)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if _, err := session.RegenerateSession(ctx.Resp, ctx.Req); err != nil {
|
||||||
|
ctx.ServerError("RegenerateSession", err)
|
||||||
|
return setting.AppSubURL + "/"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete the openid, 2fa and linkaccount data
|
||||||
_ = ctx.Session.Delete("openid_verified_uri")
|
_ = ctx.Session.Delete("openid_verified_uri")
|
||||||
_ = ctx.Session.Delete("openid_signin_remember")
|
_ = ctx.Session.Delete("openid_signin_remember")
|
||||||
_ = ctx.Session.Delete("openid_determined_email")
|
_ = ctx.Session.Delete("openid_determined_email")
|
||||||
@@ -528,13 +577,17 @@ func handleSignInFull(ctx *context.Context, u *models.User, remember bool, obeyR
|
|||||||
if len(u.Language) == 0 {
|
if len(u.Language) == 0 {
|
||||||
u.Language = ctx.Locale.Language()
|
u.Language = ctx.Locale.Language()
|
||||||
if err := models.UpdateUserCols(u, "language"); err != nil {
|
if err := models.UpdateUserCols(u, "language"); err != nil {
|
||||||
log.Error(fmt.Sprintf("Error updating user language [user: %d, locale: %s]", u.ID, u.Language))
|
ctx.ServerError("UpdateUserCols Language", fmt.Errorf("Error updating user language [user: %d, locale: %s]", u.ID, u.Language))
|
||||||
return setting.AppSubURL + "/"
|
return setting.AppSubURL + "/"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
middleware.SetLocaleCookie(ctx.Resp, u.Language, 0)
|
middleware.SetLocaleCookie(ctx.Resp, u.Language, 0)
|
||||||
|
|
||||||
|
if ctx.Locale.Language() != u.Language {
|
||||||
|
ctx.Locale = middleware.Locale(ctx.Resp, ctx.Req)
|
||||||
|
}
|
||||||
|
|
||||||
// Clear whatever CSRF has right now, force to generate a new one
|
// Clear whatever CSRF has right now, force to generate a new one
|
||||||
middleware.DeleteCSRFCookie(ctx.Resp)
|
middleware.DeleteCSRFCookie(ctx.Resp)
|
||||||
|
|
||||||
@@ -674,6 +727,11 @@ func getUserName(gothUser *goth.User) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func showLinkingLogin(ctx *context.Context, gothUser goth.User) {
|
func showLinkingLogin(ctx *context.Context, gothUser goth.User) {
|
||||||
|
if _, err := session.RegenerateSession(ctx.Resp, ctx.Req); err != nil {
|
||||||
|
ctx.ServerError("RegenerateSession", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if err := ctx.Session.Set("linkAccountGothUser", gothUser); err != nil {
|
if err := ctx.Session.Set("linkAccountGothUser", gothUser); err != nil {
|
||||||
log.Error("Error setting linkAccountGothUser in session: %v", err)
|
log.Error("Error setting linkAccountGothUser in session: %v", err)
|
||||||
}
|
}
|
||||||
@@ -713,6 +771,11 @@ func handleOAuth2SignIn(ctx *context.Context, u *models.User, gothUser goth.User
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if _, err := session.RegenerateSession(ctx.Resp, ctx.Req); err != nil {
|
||||||
|
ctx.ServerError("RegenerateSession", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if err := ctx.Session.Set("uid", u.ID); err != nil {
|
if err := ctx.Session.Set("uid", u.ID); err != nil {
|
||||||
log.Error("Error setting uid in session: %v", err)
|
log.Error("Error setting uid in session: %v", err)
|
||||||
}
|
}
|
||||||
@@ -738,6 +801,11 @@ func handleOAuth2SignIn(ctx *context.Context, u *models.User, gothUser goth.User
|
|||||||
log.Error("UpdateExternalUser failed: %v", err)
|
log.Error("UpdateExternalUser failed: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := resetLocale(ctx, u); err != nil {
|
||||||
|
ctx.ServerError("resetLocale", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if redirectTo := ctx.GetCookie("redirect_to"); len(redirectTo) > 0 {
|
if redirectTo := ctx.GetCookie("redirect_to"); len(redirectTo) > 0 {
|
||||||
middleware.DeleteRedirectToCookie(ctx.Resp)
|
middleware.DeleteRedirectToCookie(ctx.Resp)
|
||||||
ctx.RedirectToFirst(redirectTo)
|
ctx.RedirectToFirst(redirectTo)
|
||||||
@@ -748,6 +816,11 @@ func handleOAuth2SignIn(ctx *context.Context, u *models.User, gothUser goth.User
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if _, err := session.RegenerateSession(ctx.Resp, ctx.Req); err != nil {
|
||||||
|
ctx.ServerError("RegenerateSession", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// User needs to use 2FA, save data and redirect to 2FA page.
|
// User needs to use 2FA, save data and redirect to 2FA page.
|
||||||
if err := ctx.Session.Set("twofaUid", u.ID); err != nil {
|
if err := ctx.Session.Set("twofaUid", u.ID); err != nil {
|
||||||
log.Error("Error setting twofaUid in session: %v", err)
|
log.Error("Error setting twofaUid in session: %v", err)
|
||||||
@@ -937,6 +1010,11 @@ func linkAccount(ctx *context.Context, u *models.User, gothUser goth.User, remem
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if _, err := session.RegenerateSession(ctx.Resp, ctx.Req); err != nil {
|
||||||
|
ctx.ServerError("RegenerateSession", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// User needs to use 2FA, save data and redirect to 2FA page.
|
// User needs to use 2FA, save data and redirect to 2FA page.
|
||||||
if err := ctx.Session.Set("twofaUid", u.ID); err != nil {
|
if err := ctx.Session.Set("twofaUid", u.ID); err != nil {
|
||||||
log.Error("Error setting twofaUid in session: %v", err)
|
log.Error("Error setting twofaUid in session: %v", err)
|
||||||
@@ -1074,7 +1152,7 @@ func LinkAccountPostRegister(ctx *context.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Redirect(setting.AppSubURL + "/user/login")
|
handleSignIn(ctx, u, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
// HandleSignOut resets the session and sets the cookies
|
// HandleSignOut resets the session and sets the cookies
|
||||||
@@ -1216,7 +1294,7 @@ func SignUpPost(ctx *context.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ctx.Flash.Success(ctx.Tr("auth.sign_up_successful"))
|
ctx.Flash.Success(ctx.Tr("auth.sign_up_successful"))
|
||||||
handleSignInFull(ctx, u, false, true)
|
handleSignIn(ctx, u, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
// createAndHandleCreatedUser calls createUserInContext and
|
// createAndHandleCreatedUser calls createUserInContext and
|
||||||
@@ -1437,6 +1515,13 @@ func handleAccountActivation(ctx *context.Context, user *models.User) {
|
|||||||
|
|
||||||
log.Trace("User activated: %s", user.Name)
|
log.Trace("User activated: %s", user.Name)
|
||||||
|
|
||||||
|
if _, err := session.RegenerateSession(ctx.Resp, ctx.Req); err != nil {
|
||||||
|
log.Error("Unable to regenerate session for user: %-v with email: %s: %v", user, user.Email, err)
|
||||||
|
ctx.ServerError("ActivateUserEmail", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set session IDs
|
||||||
if err := ctx.Session.Set("uid", user.ID); err != nil {
|
if err := ctx.Session.Set("uid", user.ID); err != nil {
|
||||||
log.Error("Error setting uid in session[%s]: %v", ctx.Session.ID(), err)
|
log.Error("Error setting uid in session[%s]: %v", ctx.Session.ID(), err)
|
||||||
}
|
}
|
||||||
@@ -1447,6 +1532,11 @@ func handleAccountActivation(ctx *context.Context, user *models.User) {
|
|||||||
log.Error("Error storing session[%s]: %v", ctx.Session.ID(), err)
|
log.Error("Error storing session[%s]: %v", ctx.Session.ID(), err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := resetLocale(ctx, user); err != nil {
|
||||||
|
ctx.ServerError("resetLocale", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
ctx.Flash.Success(ctx.Tr("auth.account_activated"))
|
ctx.Flash.Success(ctx.Tr("auth.account_activated"))
|
||||||
ctx.Redirect(setting.AppSubURL + "/")
|
ctx.Redirect(setting.AppSubURL + "/")
|
||||||
}
|
}
|
||||||
@@ -1704,11 +1794,14 @@ func ResetPasswdPost(ctx *context.Context) {
|
|||||||
|
|
||||||
handleSignInFull(ctx, u, remember, false)
|
handleSignInFull(ctx, u, remember, false)
|
||||||
ctx.Flash.Info(ctx.Tr("auth.twofa_scratch_used"))
|
ctx.Flash.Info(ctx.Tr("auth.twofa_scratch_used"))
|
||||||
|
if ctx.Written() {
|
||||||
|
return
|
||||||
|
}
|
||||||
ctx.Redirect(setting.AppSubURL + "/user/settings/security")
|
ctx.Redirect(setting.AppSubURL + "/user/settings/security")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
handleSignInFull(ctx, u, remember, true)
|
handleSignIn(ctx, u, remember)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MustChangePassword renders the page to change a user's password
|
// MustChangePassword renders the page to change a user's password
|
||||||
@@ -1748,8 +1841,23 @@ func MustChangePasswordPost(ctx *context.Context) {
|
|||||||
ctx.RenderWithErr(ctx.Tr("auth.password_too_short", setting.MinPasswordLength), tplMustChangePassword, &form)
|
ctx.RenderWithErr(ctx.Tr("auth.password_too_short", setting.MinPasswordLength), tplMustChangePassword, &form)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if !password.IsComplexEnough(form.Password) {
|
||||||
|
ctx.Data["Err_Password"] = true
|
||||||
|
ctx.RenderWithErr(password.BuildComplexityError(ctx), tplMustChangePassword, &form)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
pwned, err := password.IsPwned(ctx, form.Password)
|
||||||
|
if pwned {
|
||||||
|
ctx.Data["Err_Password"] = true
|
||||||
|
errMsg := ctx.Tr("auth.password_pwned")
|
||||||
|
if err != nil {
|
||||||
|
log.Error(err.Error())
|
||||||
|
errMsg = ctx.Tr("auth.password_pwned_err")
|
||||||
|
}
|
||||||
|
ctx.RenderWithErr(errMsg, tplMustChangePassword, &form)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
var err error
|
|
||||||
if err = u.SetPassword(form.Password); err != nil {
|
if err = u.SetPassword(form.Password); err != nil {
|
||||||
ctx.ServerError("UpdateUser", err)
|
ctx.ServerError("UpdateUser", err)
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import (
|
|||||||
"code.gitea.io/gitea/modules/hcaptcha"
|
"code.gitea.io/gitea/modules/hcaptcha"
|
||||||
"code.gitea.io/gitea/modules/log"
|
"code.gitea.io/gitea/modules/log"
|
||||||
"code.gitea.io/gitea/modules/recaptcha"
|
"code.gitea.io/gitea/modules/recaptcha"
|
||||||
|
"code.gitea.io/gitea/modules/session"
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
"code.gitea.io/gitea/modules/util"
|
"code.gitea.io/gitea/modules/util"
|
||||||
"code.gitea.io/gitea/modules/web"
|
"code.gitea.io/gitea/modules/web"
|
||||||
@@ -231,6 +232,11 @@ func signInOpenIDVerify(ctx *context.Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if _, err := session.RegenerateSession(ctx.Resp, ctx.Req); err != nil {
|
||||||
|
ctx.ServerError("RegenerateSession", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if err := ctx.Session.Set("openid_verified_uri", id); err != nil {
|
if err := ctx.Session.Set("openid_verified_uri", id); err != nil {
|
||||||
log.Error("signInOpenIDVerify: Could not set openid_verified_uri in session: %v", err)
|
log.Error("signInOpenIDVerify: Could not set openid_verified_uri in session: %v", err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -321,7 +321,7 @@ func Action(ctx *context.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
switch ctx.Params(":action") {
|
switch ctx.Query("action") {
|
||||||
case "follow":
|
case "follow":
|
||||||
err = models.FollowUser(ctx.User.ID, u.ID)
|
err = models.FollowUser(ctx.User.ID, u.ID)
|
||||||
case "unfollow":
|
case "unfollow":
|
||||||
@@ -329,7 +329,7 @@ func Action(ctx *context.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.ServerError(fmt.Sprintf("Action (%s)", ctx.Params(":action")), err)
|
ctx.ServerError(fmt.Sprintf("Action (%s)", ctx.Query("action")), err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ package user
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
"code.gitea.io/gitea/models"
|
"code.gitea.io/gitea/models"
|
||||||
"code.gitea.io/gitea/modules/context"
|
"code.gitea.io/gitea/modules/context"
|
||||||
@@ -16,6 +17,12 @@ import (
|
|||||||
func TaskStatus(ctx *context.Context) {
|
func TaskStatus(ctx *context.Context) {
|
||||||
task, opts, err := models.GetMigratingTaskByID(ctx.ParamsInt64("task"), ctx.User.ID)
|
task, opts, err := models.GetMigratingTaskByID(ctx.ParamsInt64("task"), ctx.User.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if models.IsErrTaskDoesNotExist(err) {
|
||||||
|
ctx.JSON(http.StatusNotFound, map[string]interface{}{
|
||||||
|
"error": "task `" + strconv.FormatInt(ctx.ParamsInt64("task"), 10) + "` does not exist",
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
ctx.JSON(http.StatusInternalServerError, map[string]interface{}{
|
ctx.JSON(http.StatusInternalServerError, map[string]interface{}{
|
||||||
"err": err,
|
"err": err,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ import (
|
|||||||
_ "code.gitea.io/gitea/modules/session"
|
_ "code.gitea.io/gitea/modules/session"
|
||||||
|
|
||||||
"gitea.com/go-chi/captcha"
|
"gitea.com/go-chi/captcha"
|
||||||
"gitea.com/go-chi/session"
|
|
||||||
"github.com/NYTimes/gziphandler"
|
"github.com/NYTimes/gziphandler"
|
||||||
"github.com/go-chi/chi/middleware"
|
"github.com/go-chi/chi/middleware"
|
||||||
"github.com/go-chi/cors"
|
"github.com/go-chi/cors"
|
||||||
@@ -71,7 +70,7 @@ func CorsHandler() func(next http.Handler) http.Handler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Routes returns all web routes
|
// Routes returns all web routes
|
||||||
func Routes() *web.Route {
|
func Routes(sessioner func(next http.Handler) http.Handler) *web.Route {
|
||||||
routes := web.NewRoute()
|
routes := web.NewRoute()
|
||||||
|
|
||||||
routes.Use(public.AssetsHandler(&public.Options{
|
routes.Use(public.AssetsHandler(&public.Options{
|
||||||
@@ -80,17 +79,7 @@ func Routes() *web.Route {
|
|||||||
CorsHandler: CorsHandler(),
|
CorsHandler: CorsHandler(),
|
||||||
}))
|
}))
|
||||||
|
|
||||||
routes.Use(session.Sessioner(session.Options{
|
routes.Use(sessioner)
|
||||||
Provider: setting.SessionConfig.Provider,
|
|
||||||
ProviderConfig: setting.SessionConfig.ProviderConfig,
|
|
||||||
CookieName: setting.SessionConfig.CookieName,
|
|
||||||
CookiePath: setting.SessionConfig.CookiePath,
|
|
||||||
Gclifetime: setting.SessionConfig.Gclifetime,
|
|
||||||
Maxlifetime: setting.SessionConfig.Maxlifetime,
|
|
||||||
Secure: setting.SessionConfig.Secure,
|
|
||||||
SameSite: setting.SessionConfig.SameSite,
|
|
||||||
Domain: setting.SessionConfig.Domain,
|
|
||||||
}))
|
|
||||||
|
|
||||||
routes.Use(Recovery())
|
routes.Use(Recovery())
|
||||||
|
|
||||||
@@ -461,9 +450,7 @@ func RegisterRoutes(m *web.Route) {
|
|||||||
m.Get("/attachments/{uuid}", repo.GetAttachment)
|
m.Get("/attachments/{uuid}", repo.GetAttachment)
|
||||||
}, ignSignIn)
|
}, ignSignIn)
|
||||||
|
|
||||||
m.Group("/{username}", func() {
|
m.Post("/{username}", reqSignIn, user.Action)
|
||||||
m.Post("/action/{action}", user.Action)
|
|
||||||
}, reqSignIn)
|
|
||||||
|
|
||||||
if !setting.IsProd() {
|
if !setting.IsProd() {
|
||||||
m.Get("/template/*", dev.TemplatePreview)
|
m.Get("/template/*", dev.TemplatePreview)
|
||||||
@@ -1038,4 +1025,9 @@ func RegisterRoutes(m *web.Route) {
|
|||||||
if setting.API.EnableSwagger {
|
if setting.API.EnableSwagger {
|
||||||
m.Get("/swagger.v1.json", SwaggerV1Json)
|
m.Get("/swagger.v1.json", SwaggerV1Json)
|
||||||
}
|
}
|
||||||
|
m.NotFound(func(w http.ResponseWriter, req *http.Request) {
|
||||||
|
ctx := context.GetContext(req)
|
||||||
|
ctx.NotFound("", nil)
|
||||||
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import (
|
|||||||
|
|
||||||
"code.gitea.io/gitea/models"
|
"code.gitea.io/gitea/models"
|
||||||
"code.gitea.io/gitea/modules/log"
|
"code.gitea.io/gitea/modules/log"
|
||||||
|
"code.gitea.io/gitea/modules/session"
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
"code.gitea.io/gitea/modules/web/middleware"
|
"code.gitea.io/gitea/modules/web/middleware"
|
||||||
)
|
)
|
||||||
@@ -95,6 +96,14 @@ func isGitRawReleaseOrLFSPath(req *http.Request) bool {
|
|||||||
|
|
||||||
// handleSignIn clears existing session variables and stores new ones for the specified user object
|
// handleSignIn clears existing session variables and stores new ones for the specified user object
|
||||||
func handleSignIn(resp http.ResponseWriter, req *http.Request, sess SessionStore, user *models.User) {
|
func handleSignIn(resp http.ResponseWriter, req *http.Request, sess SessionStore, user *models.User) {
|
||||||
|
// We need to regenerate the session...
|
||||||
|
newSess, err := session.RegenerateSession(resp, req)
|
||||||
|
if err != nil {
|
||||||
|
log.Error(fmt.Sprintf("Error regenerating session: %v", err))
|
||||||
|
} else {
|
||||||
|
sess = newSess
|
||||||
|
}
|
||||||
|
|
||||||
_ = sess.Delete("openid_verified_uri")
|
_ = sess.Delete("openid_verified_uri")
|
||||||
_ = sess.Delete("openid_signin_remember")
|
_ = sess.Delete("openid_signin_remember")
|
||||||
_ = sess.Delete("openid_determined_email")
|
_ = sess.Delete("openid_determined_email")
|
||||||
@@ -103,7 +112,7 @@ func handleSignIn(resp http.ResponseWriter, req *http.Request, sess SessionStore
|
|||||||
_ = sess.Delete("twofaRemember")
|
_ = sess.Delete("twofaRemember")
|
||||||
_ = sess.Delete("u2fChallenge")
|
_ = sess.Delete("u2fChallenge")
|
||||||
_ = sess.Delete("linkAccount")
|
_ = sess.Delete("linkAccount")
|
||||||
err := sess.Set("uid", user.ID)
|
err = sess.Set("uid", user.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(fmt.Sprintf("Error setting session: %v", err))
|
log.Error(fmt.Sprintf("Error setting session: %v", err))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -713,7 +713,8 @@ func GetIssuesLastCommitStatus(issues models.IssueList) (map[int64]*models.Commi
|
|||||||
if !ok {
|
if !ok {
|
||||||
gitRepo, err = git.OpenRepository(issue.Repo.RepoPath())
|
gitRepo, err = git.OpenRepository(issue.Repo.RepoPath())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
log.Error("Cannot open git repository %-v for issue #%d[%d]. Error: %v", issue.Repo, issue.Index, issue.ID, err)
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
gitRepos[issue.RepoID] = gitRepo
|
gitRepos[issue.RepoID] = gitRepo
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"code.gitea.io/gitea/models"
|
"code.gitea.io/gitea/models"
|
||||||
|
"code.gitea.io/gitea/modules/log"
|
||||||
"code.gitea.io/gitea/modules/notification"
|
"code.gitea.io/gitea/modules/notification"
|
||||||
"code.gitea.io/gitea/modules/sync"
|
"code.gitea.io/gitea/modules/sync"
|
||||||
)
|
)
|
||||||
@@ -53,6 +54,8 @@ func TransferOwnership(doer, newOwner *models.User, repo *models.Repository, tea
|
|||||||
|
|
||||||
// ChangeRepositoryName changes all corresponding setting from old repository name to new one.
|
// ChangeRepositoryName changes all corresponding setting from old repository name to new one.
|
||||||
func ChangeRepositoryName(doer *models.User, repo *models.Repository, newRepoName string) error {
|
func ChangeRepositoryName(doer *models.User, repo *models.Repository, newRepoName string) error {
|
||||||
|
log.Trace("ChangeRepositoryName: %s/%s -> %s", doer.Name, repo.Name, newRepoName)
|
||||||
|
|
||||||
oldRepoName := repo.Name
|
oldRepoName := repo.Name
|
||||||
|
|
||||||
// Change repository directory name. We must lock the local copy of the
|
// Change repository directory name. We must lock the local copy of the
|
||||||
@@ -66,6 +69,7 @@ func ChangeRepositoryName(doer *models.User, repo *models.Repository, newRepoNam
|
|||||||
}
|
}
|
||||||
repoWorkingPool.CheckOut(fmt.Sprint(repo.ID))
|
repoWorkingPool.CheckOut(fmt.Sprint(repo.ID))
|
||||||
|
|
||||||
|
repo.Name = newRepoName
|
||||||
notification.NotifyRenameRepository(doer, repo, oldRepoName)
|
notification.NotifyRenameRepository(doer, repo, oldRepoName)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
<body>
|
<body>
|
||||||
<p>{{.i18n.Tr "mail.hi_user_x" .DisplayName | Str2html}}</p><br>
|
<p>{{.i18n.Tr "mail.hi_user_x" .DisplayName | Str2html}}</p><br>
|
||||||
<p>{{.i18n.Tr "mail.reset_password.text" .ResetPwdCodeLives | Str2html}}</p><p><a href="{{$recover_url}}">{{$recover_url}}</a></p><br>
|
<p>{{.i18n.Tr "mail.reset_password.text" .ResetPwdCodeLives | Str2html}}</p><p><a href="{{$recover_url}}">{{$recover_url}}</a></p><br>
|
||||||
<p>{{.i18n.Tr "mail.link_not_working_do_paste" .DisplayName AppName | Str2html}}</p>
|
<p>{{.i18n.Tr "mail.link_not_working_do_paste"}}</p>
|
||||||
|
|
||||||
<p>© <a target="_blank" rel="noopener noreferrer" href="{{AppUrl}}">{{AppName}}</a></p>
|
<p>© <a target="_blank" rel="noopener noreferrer" href="{{AppUrl}}">{{AppName}}</a></p>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -26,19 +26,16 @@
|
|||||||
|
|
||||||
{{template "repo/migrate/options" .}}
|
{{template "repo/migrate/options" .}}
|
||||||
|
|
||||||
<span class="help">{{.i18n.Tr "repo.migrate.migrate_items_options"}}</span>
|
|
||||||
<div id="migrate_items">
|
|
||||||
<div class="inline field">
|
<div class="inline field">
|
||||||
<label>{{.i18n.Tr "repo.migrate_items"}}</label>
|
<label>{{.i18n.Tr "repo.migrate_items"}}</label>
|
||||||
<div class="ui checkbox">
|
<div class="ui checkbox">
|
||||||
<input name="wiki" type="checkbox" {{if .wiki}} checked{{end}}>
|
<input name="wiki" type="checkbox" {{if .wiki}} checked{{end}}>
|
||||||
<label>{{.i18n.Tr "repo.migrate_items_wiki" | Safe}}</label>
|
<label>{{.i18n.Tr "repo.migrate_items_wiki" | Safe}}</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="ui checkbox">
|
|
||||||
<input name="milestones" type="checkbox" {{if .milestones}} checked{{end}}>
|
|
||||||
<label>{{.i18n.Tr "repo.migrate_items_milestones" | Safe}}</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="migrate_items">
|
||||||
|
<span class="help">{{.i18n.Tr "repo.migrate.migrate_items_options"}}</span>
|
||||||
<div class="inline field">
|
<div class="inline field">
|
||||||
<label></label>
|
<label></label>
|
||||||
<div class="ui checkbox">
|
<div class="ui checkbox">
|
||||||
@@ -61,6 +58,13 @@
|
|||||||
<label>{{.i18n.Tr "repo.migrate_items_releases" | Safe}}</label>
|
<label>{{.i18n.Tr "repo.migrate_items_releases" | Safe}}</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="inline field">
|
||||||
|
<label></label>
|
||||||
|
<div class="ui checkbox">
|
||||||
|
<input name="milestones" type="checkbox" {{if .milestones}} checked{{end}}>
|
||||||
|
<label>{{.i18n.Tr "repo.migrate_items_milestones" | Safe}}</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ui divider"></div>
|
<div class="ui divider"></div>
|
||||||
|
|||||||
@@ -26,19 +26,15 @@
|
|||||||
|
|
||||||
{{template "repo/migrate/options" .}}
|
{{template "repo/migrate/options" .}}
|
||||||
|
|
||||||
<span class="help">{{.i18n.Tr "repo.migrate.migrate_items_options"}}</span>
|
|
||||||
<div id="migrate_items">
|
|
||||||
<div class="inline field">
|
<div class="inline field">
|
||||||
<label>{{.i18n.Tr "repo.migrate_items"}}</label>
|
<label>{{.i18n.Tr "repo.migrate_items"}}</label>
|
||||||
<div class="ui checkbox">
|
<div class="ui checkbox">
|
||||||
<input name="wiki" type="checkbox" {{if .wiki}}checked{{end}}>
|
<input name="wiki" type="checkbox" {{if .wiki}}checked{{end}}>
|
||||||
<label>{{.i18n.Tr "repo.migrate_items_wiki" | Safe}}</label>
|
<label>{{.i18n.Tr "repo.migrate_items_wiki" | Safe}}</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="ui checkbox">
|
|
||||||
<input name="milestones" type="checkbox" {{if .milestones}}checked{{end}}>
|
|
||||||
<label>{{.i18n.Tr "repo.migrate_items_milestones" | Safe}}</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div id="migrate_items">
|
||||||
|
<span class="help">{{.i18n.Tr "repo.migrate.migrate_items_options"}}</span>
|
||||||
<div class="inline field">
|
<div class="inline field">
|
||||||
<label></label>
|
<label></label>
|
||||||
<div class="ui checkbox">
|
<div class="ui checkbox">
|
||||||
@@ -61,6 +57,13 @@
|
|||||||
<label>{{.i18n.Tr "repo.migrate_items_releases" | Safe}}</label>
|
<label>{{.i18n.Tr "repo.migrate_items_releases" | Safe}}</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="inline field">
|
||||||
|
<label></label>
|
||||||
|
<div class="ui checkbox">
|
||||||
|
<input name="milestones" type="checkbox" {{if .milestones}}checked{{end}}>
|
||||||
|
<label>{{.i18n.Tr "repo.migrate_items_milestones" | Safe}}</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ui divider"></div>
|
<div class="ui divider"></div>
|
||||||
|
|||||||
@@ -26,19 +26,15 @@
|
|||||||
|
|
||||||
{{template "repo/migrate/options" .}}
|
{{template "repo/migrate/options" .}}
|
||||||
|
|
||||||
<span class="help">{{.i18n.Tr "repo.migrate.migrate_items_options"}}</span>
|
|
||||||
<div id="migrate_items">
|
|
||||||
<div class="inline field">
|
<div class="inline field">
|
||||||
<label>{{.i18n.Tr "repo.migrate_items"}}</label>
|
<label>{{.i18n.Tr "repo.migrate_items"}}</label>
|
||||||
<div class="ui checkbox">
|
<div class="ui checkbox">
|
||||||
<input name="wiki" type="checkbox" {{if .wiki}}checked{{end}}>
|
<input name="wiki" type="checkbox" {{if .wiki}}checked{{end}}>
|
||||||
<label>{{.i18n.Tr "repo.migrate_items_wiki" | Safe}}</label>
|
<label>{{.i18n.Tr "repo.migrate_items_wiki" | Safe}}</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="ui checkbox">
|
|
||||||
<input name="milestones" type="checkbox" {{if .milestones}}checked{{end}}>
|
|
||||||
<label>{{.i18n.Tr "repo.migrate_items_milestones" | Safe}}</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div id="migrate_items">
|
||||||
|
<span class="help">{{.i18n.Tr "repo.migrate.migrate_items_options"}}</span>
|
||||||
<div class="inline field">
|
<div class="inline field">
|
||||||
<label></label>
|
<label></label>
|
||||||
<div class="ui checkbox">
|
<div class="ui checkbox">
|
||||||
@@ -61,6 +57,13 @@
|
|||||||
<label>{{.i18n.Tr "repo.migrate_items_releases" | Safe}}</label>
|
<label>{{.i18n.Tr "repo.migrate_items_releases" | Safe}}</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="inline field">
|
||||||
|
<label></label>
|
||||||
|
<div class="ui checkbox">
|
||||||
|
<input name="milestones" type="checkbox" {{if .milestones}}checked{{end}}>
|
||||||
|
<label>{{.i18n.Tr "repo.migrate_items_milestones" | Safe}}</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ui divider"></div>
|
<div class="ui divider"></div>
|
||||||
|
|||||||
@@ -26,19 +26,16 @@
|
|||||||
|
|
||||||
{{template "repo/migrate/options" .}}
|
{{template "repo/migrate/options" .}}
|
||||||
|
|
||||||
<span class="help">{{.i18n.Tr "repo.migrate.migrate_items_options"}}</span>
|
|
||||||
<div id="migrate_items">
|
|
||||||
<div class="inline field">
|
<div class="inline field">
|
||||||
<label>{{.i18n.Tr "repo.migrate_items"}}</label>
|
<label>{{.i18n.Tr "repo.migrate_items"}}</label>
|
||||||
<div class="ui checkbox">
|
<div class="ui checkbox">
|
||||||
<input name="wiki" type="checkbox" {{if .wiki}} checked{{end}}>
|
<input name="wiki" type="checkbox" {{if .wiki}} checked{{end}}>
|
||||||
<label>{{.i18n.Tr "repo.migrate_items_wiki" | Safe}}</label>
|
<label>{{.i18n.Tr "repo.migrate_items_wiki" | Safe}}</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="ui checkbox">
|
|
||||||
<input name="milestones" type="checkbox" {{if .milestones}} checked{{end}}>
|
|
||||||
<label>{{.i18n.Tr "repo.migrate_items_milestones" | Safe}}</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="migrate_items">
|
||||||
|
<span class="help">{{.i18n.Tr "repo.migrate.migrate_items_options"}}</span>
|
||||||
<div class="inline field">
|
<div class="inline field">
|
||||||
<label></label>
|
<label></label>
|
||||||
<div class="ui checkbox">
|
<div class="ui checkbox">
|
||||||
@@ -50,6 +47,13 @@
|
|||||||
<label>{{.i18n.Tr "repo.migrate_items_issues" | Safe}}</label>
|
<label>{{.i18n.Tr "repo.migrate_items_issues" | Safe}}</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="inline field">
|
||||||
|
<label></label>
|
||||||
|
<div class="ui checkbox">
|
||||||
|
<input name="milestones" type="checkbox" {{if .milestones}} checked{{end}}>
|
||||||
|
<label>{{.i18n.Tr "repo.migrate_items_milestones" | Safe}}</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<!-- Gogs do not support it
|
<!-- Gogs do not support it
|
||||||
<div class="inline field">
|
<div class="inline field">
|
||||||
<label></label>
|
<label></label>
|
||||||
|
|||||||
@@ -25,7 +25,11 @@
|
|||||||
<p id="repo_migrating_progress_message"></p>
|
<p id="repo_migrating_progress_message"></p>
|
||||||
</div>
|
</div>
|
||||||
<div id="repo_migrating_failed" hidden>
|
<div id="repo_migrating_failed" hidden>
|
||||||
|
{{if .CloneAddr}}
|
||||||
<p>{{.i18n.Tr "repo.migrate.migrating_failed" .CloneAddr | Safe}}</p>
|
<p>{{.i18n.Tr "repo.migrate.migrating_failed" .CloneAddr | Safe}}</p>
|
||||||
|
{{else}}
|
||||||
|
<p>{{.i18n.Tr "repo.migrate.migrating_failed" "<nil>" | Safe}}</p>
|
||||||
|
{{end}}
|
||||||
<p id="repo_migrating_failed_error"></p>
|
<p id="repo_migrating_failed_error"></p>
|
||||||
</div>
|
</div>
|
||||||
{{if and .Failed .Permission.IsAdmin}}
|
{{if and .Failed .Permission.IsAdmin}}
|
||||||
|
|||||||
@@ -66,12 +66,12 @@
|
|||||||
{{if and .IsSigned (ne .SignedUserName .Owner.Name)}}
|
{{if and .IsSigned (ne .SignedUserName .Owner.Name)}}
|
||||||
<li class="follow">
|
<li class="follow">
|
||||||
{{if .SignedUser.IsFollowing .Owner.ID}}
|
{{if .SignedUser.IsFollowing .Owner.ID}}
|
||||||
<form method="post" action="{{.Link}}/action/unfollow?redirect_to={{$.Link}}">
|
<form method="post" action="{{.Link}}?action=unfollow&redirect_to={{$.Link}}">
|
||||||
{{$.CsrfTokenHtml}}
|
{{$.CsrfTokenHtml}}
|
||||||
<button type="submit" class="ui basic red button">{{svg "octicon-person"}} {{.i18n.Tr "user.unfollow"}}</button>
|
<button type="submit" class="ui basic red button">{{svg "octicon-person"}} {{.i18n.Tr "user.unfollow"}}</button>
|
||||||
</form>
|
</form>
|
||||||
{{else}}
|
{{else}}
|
||||||
<form method="post" action="{{.Link}}/action/follow?redirect_to={{$.Link}}">
|
<form method="post" action="{{.Link}}?action=follow&redirect_to={{$.Link}}">
|
||||||
{{$.CsrfTokenHtml}}
|
{{$.CsrfTokenHtml}}
|
||||||
<button type="submit" class="ui basic green button">{{svg "octicon-person"}} {{.i18n.Tr "user.follow"}}</button>
|
<button type="submit" class="ui basic green button">{{svg "octicon-person"}} {{.i18n.Tr "user.follow"}}</button>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
4
vendor/gitea.com/go-chi/session/README.md
generated
vendored
4
vendor/gitea.com/go-chi/session/README.md
generated
vendored
@@ -1,6 +1,6 @@
|
|||||||
# Session
|
# Session
|
||||||
|
|
||||||
Middleware session provides session management which copied from [Macaron Session](https://gitea.com/go-chi/session) for [go-chi](https://github.com/go-chi/chi). It can use many session providers, including memory, file, Redis, Memcache, PostgreSQL, MySQL, Couchbase, Ledis and Nodb.
|
Middleware session provides session management which based on a [fork](https://gitea.com/macaron/session) of [Macaron Session](https://github.com/go-macaron/session) for [go-chi](https://github.com/go-chi/chi). It can use many session providers, including memory, file, Redis, Memcache, PostgreSQL, MySQL, Couchbase, Ledis and Nodb.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@ go get gitea.com/go-chi/session
|
|||||||
|
|
||||||
## Credits
|
## Credits
|
||||||
|
|
||||||
This package is a modified version of [go-macaron/session](github.com/go-macaron/session).
|
This package is a modified version of [go-macaron/session](https://github.com/go-macaron/session).
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|||||||
2
vendor/gitea.com/go-chi/session/go.mod
generated
vendored
2
vendor/gitea.com/go-chi/session/go.mod
generated
vendored
@@ -9,7 +9,7 @@ require (
|
|||||||
github.com/couchbase/goutils v0.0.0-20201030094643-5e82bb967e67 // indirect
|
github.com/couchbase/goutils v0.0.0-20201030094643-5e82bb967e67 // indirect
|
||||||
github.com/cupcake/rdb v0.0.0-20161107195141-43ba34106c76 // indirect
|
github.com/cupcake/rdb v0.0.0-20161107195141-43ba34106c76 // indirect
|
||||||
github.com/edsrzf/mmap-go v1.0.0 // indirect
|
github.com/edsrzf/mmap-go v1.0.0 // indirect
|
||||||
github.com/go-chi/chi v1.5.1
|
github.com/go-chi/chi/v5 v5.0.4
|
||||||
github.com/go-redis/redis/v8 v8.4.0
|
github.com/go-redis/redis/v8 v8.4.0
|
||||||
github.com/go-sql-driver/mysql v1.4.1
|
github.com/go-sql-driver/mysql v1.4.1
|
||||||
github.com/lib/pq v1.2.0
|
github.com/lib/pq v1.2.0
|
||||||
|
|||||||
12
vendor/gitea.com/go-chi/session/go.sum
generated
vendored
12
vendor/gitea.com/go-chi/session/go.sum
generated
vendored
@@ -10,7 +10,6 @@ github.com/couchbase/goutils v0.0.0-20201030094643-5e82bb967e67 h1:NCqJ6fwen6YP0
|
|||||||
github.com/couchbase/goutils v0.0.0-20201030094643-5e82bb967e67/go.mod h1:BQwMFlJzDjFDG3DJUdU0KORxn88UlsOULuxLExMh3Hs=
|
github.com/couchbase/goutils v0.0.0-20201030094643-5e82bb967e67/go.mod h1:BQwMFlJzDjFDG3DJUdU0KORxn88UlsOULuxLExMh3Hs=
|
||||||
github.com/cupcake/rdb v0.0.0-20161107195141-43ba34106c76 h1:Lgdd/Qp96Qj8jqLpq2cI1I1X7BJnu06efS+XkhRoLUQ=
|
github.com/cupcake/rdb v0.0.0-20161107195141-43ba34106c76 h1:Lgdd/Qp96Qj8jqLpq2cI1I1X7BJnu06efS+XkhRoLUQ=
|
||||||
github.com/cupcake/rdb v0.0.0-20161107195141-43ba34106c76/go.mod h1:vYwsqCOLxGiisLwp9rITslkFNpZD5rz43tf41QFkTWY=
|
github.com/cupcake/rdb v0.0.0-20161107195141-43ba34106c76/go.mod h1:vYwsqCOLxGiisLwp9rITslkFNpZD5rz43tf41QFkTWY=
|
||||||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
@@ -18,18 +17,16 @@ github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/r
|
|||||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
|
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
|
||||||
github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw=
|
github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw=
|
||||||
github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
|
github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
|
||||||
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
|
|
||||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||||
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
|
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
|
||||||
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
|
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
|
||||||
github.com/go-chi/chi v1.5.1 h1:kfTK3Cxd/dkMu/rKs5ZceWYp+t5CtiE7vmaTv3LjC6w=
|
github.com/go-chi/chi/v5 v5.0.4 h1:5e494iHzsYBiyXQAHHuI4tyJS9M3V84OuX3ufIIGHFo=
|
||||||
github.com/go-chi/chi v1.5.1/go.mod h1:REp24E+25iKvxgeTfHmdUoL5x15kBiDBlnIl5bCwe2k=
|
github.com/go-chi/chi/v5 v5.0.4/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
|
||||||
github.com/go-redis/redis/v8 v8.4.0 h1:J5NCReIgh3QgUJu398hUncxDExN4gMOHI11NVbVicGQ=
|
github.com/go-redis/redis/v8 v8.4.0 h1:J5NCReIgh3QgUJu398hUncxDExN4gMOHI11NVbVicGQ=
|
||||||
github.com/go-redis/redis/v8 v8.4.0/go.mod h1:A1tbYoHSa1fXwN+//ljcCYYJeLmVrwL9hbQN45Jdy0M=
|
github.com/go-redis/redis/v8 v8.4.0/go.mod h1:A1tbYoHSa1fXwN+//ljcCYYJeLmVrwL9hbQN45Jdy0M=
|
||||||
github.com/go-sql-driver/mysql v1.4.1 h1:g24URVg0OFbNUTx9qqY1IRZ9D9z3iPyi5zKhQZpNwpA=
|
github.com/go-sql-driver/mysql v1.4.1 h1:g24URVg0OFbNUTx9qqY1IRZ9D9z3iPyi5zKhQZpNwpA=
|
||||||
github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
|
github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
|
||||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg=
|
|
||||||
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
|
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
|
||||||
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
|
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
|
||||||
@@ -48,7 +45,6 @@ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
|
|||||||
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||||
github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e h1:JKmoR8x90Iww1ks85zJ1lfDGgIiMDuIptTOhJq+zKyg=
|
github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e h1:JKmoR8x90Iww1ks85zJ1lfDGgIiMDuIptTOhJq+zKyg=
|
||||||
github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||||
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
|
|
||||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||||
github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
|
github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
|
||||||
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
|
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
|
||||||
@@ -58,12 +54,10 @@ github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
|||||||
github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78=
|
github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78=
|
||||||
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
|
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
|
||||||
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||||
github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs=
|
|
||||||
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||||
github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
|
github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
|
||||||
github.com/onsi/ginkgo v1.14.2 h1:8mVmC9kjFFmA8H4pKMUhcblgifdkOIXPvbhN1T36q1M=
|
github.com/onsi/ginkgo v1.14.2 h1:8mVmC9kjFFmA8H4pKMUhcblgifdkOIXPvbhN1T36q1M=
|
||||||
github.com/onsi/ginkgo v1.14.2/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY=
|
github.com/onsi/ginkgo v1.14.2/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY=
|
||||||
github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU=
|
|
||||||
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||||
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
|
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
|
||||||
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
|
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
|
||||||
@@ -118,7 +112,6 @@ golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7w
|
|||||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA=
|
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA=
|
||||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
|
|
||||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||||
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
|
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
|
||||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
@@ -137,7 +130,6 @@ google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyz
|
|||||||
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
|
|
||||||
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||||
gopkg.in/ini.v1 v1.62.0 h1:duBzk771uxoUuOlyRLkHsygud9+5lrlGjdFBb4mSKDU=
|
gopkg.in/ini.v1 v1.62.0 h1:duBzk771uxoUuOlyRLkHsygud9+5lrlGjdFBb4mSKDU=
|
||||||
gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||||
|
|||||||
53
vendor/gitea.com/go-chi/session/session.go
generated
vendored
53
vendor/gitea.com/go-chi/session/session.go
generated
vendored
@@ -23,6 +23,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"reflect"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -259,7 +260,7 @@ func Sessioner(options ...Options) func(next http.Handler) http.Handler {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = sess.Release(); err != nil {
|
if err = s.RawStore.Release(); err != nil {
|
||||||
panic("session(release): " + err.Error())
|
panic("session(release): " + err.Error())
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -273,6 +274,26 @@ func GetSession(req *http.Request) Store {
|
|||||||
return sess
|
return sess
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RegenerateSession
|
||||||
|
func RegenerateSession(resp http.ResponseWriter, req *http.Request) (Store, error) {
|
||||||
|
sess, ok := GetSession(req).(*store)
|
||||||
|
if !ok {
|
||||||
|
return nil, fmt.Errorf("no session in request context")
|
||||||
|
}
|
||||||
|
|
||||||
|
oldRawStore := sess.RawStore
|
||||||
|
if err := oldRawStore.Release(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
store, err := sess.RegenerateID(resp, req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
sess.RawStore = store
|
||||||
|
return sess, nil
|
||||||
|
}
|
||||||
|
|
||||||
// Provider is the interface that provides session manipulations.
|
// Provider is the interface that provides session manipulations.
|
||||||
type Provider interface {
|
type Provider interface {
|
||||||
// Init initializes session provider.
|
// Init initializes session provider.
|
||||||
@@ -291,17 +312,34 @@ type Provider interface {
|
|||||||
GC()
|
GC()
|
||||||
}
|
}
|
||||||
|
|
||||||
var providers = make(map[string]Provider)
|
var providers = make(map[string]func() Provider)
|
||||||
|
|
||||||
// Register registers a provider.
|
// Register registers a provider.
|
||||||
func Register(name string, provider Provider) {
|
func Register(name string, provider Provider) {
|
||||||
if provider == nil {
|
if reflect.TypeOf(provider).Kind() == reflect.Ptr {
|
||||||
|
// Pointer:
|
||||||
|
RegisterFn(name, func() Provider {
|
||||||
|
return reflect.New(reflect.ValueOf(provider).Elem().Type()).Interface().(Provider)
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Not a Pointer
|
||||||
|
RegisterFn(name, func() Provider {
|
||||||
|
return reflect.New(reflect.TypeOf(provider)).Elem().Interface().(Provider)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterFn registers a provider function.
|
||||||
|
func RegisterFn(name string, providerfn func() Provider) {
|
||||||
|
if providerfn == nil {
|
||||||
panic("session: cannot register provider with nil value")
|
panic("session: cannot register provider with nil value")
|
||||||
}
|
}
|
||||||
if _, dup := providers[name]; dup {
|
if _, dup := providers[name]; dup {
|
||||||
panic(fmt.Errorf("session: cannot register provider '%s' twice", name))
|
panic(fmt.Errorf("session: cannot register provider '%s' twice", name))
|
||||||
}
|
}
|
||||||
providers[name] = provider
|
|
||||||
|
providers[name] = providerfn
|
||||||
}
|
}
|
||||||
|
|
||||||
// _____
|
// _____
|
||||||
@@ -318,12 +356,15 @@ type Manager struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewManager creates and returns a new session manager by given provider name and configuration.
|
// NewManager creates and returns a new session manager by given provider name and configuration.
|
||||||
// It panics when given provider isn't registered.
|
// It returns an error when requested provider name isn't registered.
|
||||||
func NewManager(name string, opt Options) (*Manager, error) {
|
func NewManager(name string, opt Options) (*Manager, error) {
|
||||||
p, ok := providers[name]
|
fn, ok := providers[name]
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, fmt.Errorf("session: unknown provider '%s'(forgotten import?)", name)
|
return nil, fmt.Errorf("session: unknown provider '%s'(forgotten import?)", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p := fn()
|
||||||
|
|
||||||
return &Manager{p, opt}, p.Init(opt.Maxlifetime, opt.ProviderConfig)
|
return &Manager{p, opt}, p.Init(opt.Maxlifetime, opt.ProviderConfig)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@@ -18,7 +18,7 @@ gitea.com/go-chi/cache/memcache
|
|||||||
# gitea.com/go-chi/captcha v0.0.0-20210110083842-e7696c336a1e
|
# gitea.com/go-chi/captcha v0.0.0-20210110083842-e7696c336a1e
|
||||||
## explicit
|
## explicit
|
||||||
gitea.com/go-chi/captcha
|
gitea.com/go-chi/captcha
|
||||||
# gitea.com/go-chi/session v0.0.0-20210108030337-0cb48c5ba8ee
|
# gitea.com/go-chi/session v0.0.0-20211218221615-e3605d8b28b8
|
||||||
## explicit
|
## explicit
|
||||||
gitea.com/go-chi/session
|
gitea.com/go-chi/session
|
||||||
gitea.com/go-chi/session/couchbase
|
gitea.com/go-chi/session/couchbase
|
||||||
|
|||||||
@@ -135,7 +135,6 @@ textarea:focus,
|
|||||||
.form {
|
.form {
|
||||||
.help {
|
.help {
|
||||||
color: #999999;
|
color: #999999;
|
||||||
padding-top: .6em;
|
|
||||||
padding-bottom: .6em;
|
padding-bottom: .6em;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user