mirror of https://github.com/go-gitea/gitea.git
Migrate to use jsoniter instead of encoding/json (#14841)
* Migrate to use jsoniter * fix tests * update gitea.com/go-chi/binding Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
parent
59fd641d1f
commit
f0e15250b9
|
@ -8,7 +8,6 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"go/format"
|
"go/format"
|
||||||
|
@ -20,6 +19,8 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"unicode/utf8"
|
"unicode/utf8"
|
||||||
|
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -50,6 +51,7 @@ func (e Emoji) MarshalJSON() ([]byte, error) {
|
||||||
x.UnicodeVersion = ""
|
x.UnicodeVersion = ""
|
||||||
x.Description = ""
|
x.Description = ""
|
||||||
x.SkinTones = false
|
x.SkinTones = false
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
return json.Marshal(x)
|
return json.Marshal(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,6 +103,7 @@ func generate() ([]byte, error) {
|
||||||
|
|
||||||
// unmarshal
|
// unmarshal
|
||||||
var data Gemoji
|
var data Gemoji
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
err = json.Unmarshal(body, &data)
|
err = json.Unmarshal(body, &data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
|
@ -22,6 +21,7 @@ import (
|
||||||
"code.gitea.io/gitea/modules/util"
|
"code.gitea.io/gitea/modules/util"
|
||||||
|
|
||||||
"gitea.com/go-chi/session"
|
"gitea.com/go-chi/session"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
archiver "github.com/mholt/archiver/v3"
|
archiver "github.com/mholt/archiver/v3"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
@ -296,6 +296,7 @@ func runDump(ctx *cli.Context) error {
|
||||||
var excludes []string
|
var excludes []string
|
||||||
if setting.Cfg.Section("session").Key("PROVIDER").Value() == "file" {
|
if setting.Cfg.Section("session").Key("PROVIDER").Value() == "file" {
|
||||||
var opts session.Options
|
var opts session.Options
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
if err = json.Unmarshal([]byte(setting.SessionConfig.ProviderConfig), &opts); err != nil {
|
if err = json.Unmarshal([]byte(setting.SessionConfig.ProviderConfig), &opts); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
@ -25,6 +24,7 @@ import (
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
|
|
||||||
"github.com/dgrijalva/jwt-go"
|
"github.com/dgrijalva/jwt-go"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
"github.com/kballard/go-shellquote"
|
"github.com/kballard/go-shellquote"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
@ -255,6 +255,7 @@ func runServ(c *cli.Context) error {
|
||||||
}
|
}
|
||||||
tokenAuthentication.Header["Authorization"] = fmt.Sprintf("Bearer %s", tokenString)
|
tokenAuthentication.Header["Authorization"] = fmt.Sprintf("Bearer %s", tokenString)
|
||||||
|
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
enc := json.NewEncoder(os.Stdout)
|
enc := json.NewEncoder(os.Stdout)
|
||||||
err = enc.Encode(tokenAuthentication)
|
err = enc.Encode(tokenAuthentication)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
3
go.mod
3
go.mod
|
@ -6,7 +6,7 @@ require (
|
||||||
cloud.google.com/go v0.78.0 // indirect
|
cloud.google.com/go v0.78.0 // indirect
|
||||||
code.gitea.io/gitea-vet v0.2.1
|
code.gitea.io/gitea-vet v0.2.1
|
||||||
code.gitea.io/sdk/gitea v0.13.2
|
code.gitea.io/sdk/gitea v0.13.2
|
||||||
gitea.com/go-chi/binding v0.0.0-20210113025129-03f1d313373c
|
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-20210108030337-0cb48c5ba8ee
|
||||||
|
@ -66,6 +66,7 @@ require (
|
||||||
github.com/issue9/assert v1.3.2 // indirect
|
github.com/issue9/assert v1.3.2 // indirect
|
||||||
github.com/issue9/identicon v1.0.1
|
github.com/issue9/identicon v1.0.1
|
||||||
github.com/jaytaylor/html2text v0.0.0-20200412013138-3577fbdbcff7
|
github.com/jaytaylor/html2text v0.0.0-20200412013138-3577fbdbcff7
|
||||||
|
github.com/json-iterator/go v1.1.10
|
||||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
|
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
|
||||||
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 // indirect
|
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 // indirect
|
||||||
github.com/keybase/go-crypto v0.0.0-20200123153347-de78d2cb44f4
|
github.com/keybase/go-crypto v0.0.0-20200123153347-de78d2cb44f4
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -41,8 +41,8 @@ code.gitea.io/gitea-vet v0.2.1/go.mod h1:zcNbT/aJEmivCAhfmkHOlT645KNOf9W2KnkLgFj
|
||||||
code.gitea.io/sdk/gitea v0.13.2 h1:wAnT/J7Z62q3fJXbgnecoaOBh8CM1Qq0/DakWxiv4yA=
|
code.gitea.io/sdk/gitea v0.13.2 h1:wAnT/J7Z62q3fJXbgnecoaOBh8CM1Qq0/DakWxiv4yA=
|
||||||
code.gitea.io/sdk/gitea v0.13.2/go.mod h1:lee2y8LeV3kQb2iK+hHlMqoadL4bp27QOkOV/hawLKg=
|
code.gitea.io/sdk/gitea v0.13.2/go.mod h1:lee2y8LeV3kQb2iK+hHlMqoadL4bp27QOkOV/hawLKg=
|
||||||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
||||||
gitea.com/go-chi/binding v0.0.0-20210113025129-03f1d313373c h1:NTtrGYjR40WUdkCdn26Y5LGFT52rIkFPkjmtgCAyiTs=
|
gitea.com/go-chi/binding v0.0.0-20210301195521-1fe1c9a555e7 h1:xCVJPY823C8RWpgMabTw2kOglDrg0iS3GcQU6wdwHkU=
|
||||||
gitea.com/go-chi/binding v0.0.0-20210113025129-03f1d313373c/go.mod h1:9bGA9dIsrz+wVQKH1DzvxuAvrudHaQ8Wx8hLme/GVGQ=
|
gitea.com/go-chi/binding v0.0.0-20210301195521-1fe1c9a555e7/go.mod h1:AyfTrwtfYN54R/HmVvMYPnSTenH5bVoyh8x6tBluxEA=
|
||||||
gitea.com/go-chi/cache v0.0.0-20210110083709-82c4c9ce2d5e h1:zgPGaf3kXP0cVm9J0l8ZA2+XDzILYATg0CXbihR6N+o=
|
gitea.com/go-chi/cache v0.0.0-20210110083709-82c4c9ce2d5e h1:zgPGaf3kXP0cVm9J0l8ZA2+XDzILYATg0CXbihR6N+o=
|
||||||
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=
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
package integrations
|
package integrations
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -13,6 +12,7 @@ import (
|
||||||
"code.gitea.io/gitea/models"
|
"code.gitea.io/gitea/models"
|
||||||
api "code.gitea.io/gitea/modules/structs"
|
api "code.gitea.io/gitea/modules/structs"
|
||||||
|
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -190,6 +190,7 @@ func TestAPIEditUser(t *testing.T) {
|
||||||
resp := session.MakeRequest(t, req, http.StatusUnprocessableEntity)
|
resp := session.MakeRequest(t, req, http.StatusUnprocessableEntity)
|
||||||
|
|
||||||
errMap := make(map[string]interface{})
|
errMap := make(map[string]interface{})
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
json.Unmarshal(resp.Body.Bytes(), &errMap)
|
json.Unmarshal(resp.Body.Bytes(), &errMap)
|
||||||
assert.EqualValues(t, "email is not allowed to be empty string", errMap["message"].(string))
|
assert.EqualValues(t, "email is not allowed to be empty string", errMap["message"].(string))
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ package integrations
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -18,6 +17,7 @@ import (
|
||||||
"code.gitea.io/gitea/modules/queue"
|
"code.gitea.io/gitea/modules/queue"
|
||||||
api "code.gitea.io/gitea/modules/structs"
|
api "code.gitea.io/gitea/modules/structs"
|
||||||
|
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -212,6 +212,8 @@ func doAPICreatePullRequest(ctx APITestContext, owner, repo, baseBranch, headBra
|
||||||
expected = ctx.ExpectedCode
|
expected = ctx.ExpectedCode
|
||||||
}
|
}
|
||||||
resp := ctx.Session.MakeRequest(t, req, expected)
|
resp := ctx.Session.MakeRequest(t, req, expected)
|
||||||
|
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
decoder := json.NewDecoder(resp.Body)
|
decoder := json.NewDecoder(resp.Body)
|
||||||
pr := api.PullRequest{}
|
pr := api.PullRequest{}
|
||||||
err := decoder.Decode(&pr)
|
err := decoder.Decode(&pr)
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
package integrations
|
package integrations
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
|
@ -18,6 +17,7 @@ import (
|
||||||
"code.gitea.io/gitea/routers/routes"
|
"code.gitea.io/gitea/routers/routes"
|
||||||
|
|
||||||
"gitea.com/go-chi/session"
|
"gitea.com/go-chi/session"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -62,6 +62,8 @@ func TestSessionFileCreation(t *testing.T) {
|
||||||
}()
|
}()
|
||||||
|
|
||||||
var config session.Options
|
var config session.Options
|
||||||
|
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
err := json.Unmarshal([]byte(oldSessionConfig), &config)
|
err := json.Unmarshal([]byte(oldSessionConfig), &config)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -36,6 +35,7 @@ import (
|
||||||
"code.gitea.io/gitea/routers/routes"
|
"code.gitea.io/gitea/routers/routes"
|
||||||
|
|
||||||
"github.com/PuerkitoBio/goquery"
|
"github.com/PuerkitoBio/goquery"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -376,6 +376,8 @@ func NewRequestWithValues(t testing.TB, method, urlStr string, values map[string
|
||||||
|
|
||||||
func NewRequestWithJSON(t testing.TB, method, urlStr string, v interface{}) *http.Request {
|
func NewRequestWithJSON(t testing.TB, method, urlStr string, v interface{}) *http.Request {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
|
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
jsonBytes, err := json.Marshal(v)
|
jsonBytes, err := json.Marshal(v)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
req := NewRequestWithBody(t, method, urlStr, bytes.NewBuffer(jsonBytes))
|
req := NewRequestWithBody(t, method, urlStr, bytes.NewBuffer(jsonBytes))
|
||||||
|
@ -453,6 +455,8 @@ func logUnexpectedResponse(t testing.TB, recorder *httptest.ResponseRecorder) {
|
||||||
|
|
||||||
func DecodeJSON(t testing.TB, resp *httptest.ResponseRecorder, v interface{}) {
|
func DecodeJSON(t testing.TB, resp *httptest.ResponseRecorder, v interface{}) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
|
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
decoder := json.NewDecoder(resp.Body)
|
decoder := json.NewDecoder(resp.Body)
|
||||||
assert.NoError(t, decoder.Decode(v))
|
assert.NoError(t, decoder.Decode(v))
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,12 +6,12 @@ package integrations
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
|
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -70,6 +70,8 @@ func TestAccessTokenExchange(t *testing.T) {
|
||||||
RefreshToken string `json:"refresh_token"`
|
RefreshToken string `json:"refresh_token"`
|
||||||
}
|
}
|
||||||
parsed := new(response)
|
parsed := new(response)
|
||||||
|
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
assert.NoError(t, json.Unmarshal(resp.Body.Bytes(), parsed))
|
assert.NoError(t, json.Unmarshal(resp.Body.Bytes(), parsed))
|
||||||
assert.True(t, len(parsed.AccessToken) > 10)
|
assert.True(t, len(parsed.AccessToken) > 10)
|
||||||
assert.True(t, len(parsed.RefreshToken) > 10)
|
assert.True(t, len(parsed.RefreshToken) > 10)
|
||||||
|
@ -93,6 +95,8 @@ func TestAccessTokenExchangeWithoutPKCE(t *testing.T) {
|
||||||
RefreshToken string `json:"refresh_token"`
|
RefreshToken string `json:"refresh_token"`
|
||||||
}
|
}
|
||||||
parsed := new(response)
|
parsed := new(response)
|
||||||
|
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
assert.NoError(t, json.Unmarshal(resp.Body.Bytes(), parsed))
|
assert.NoError(t, json.Unmarshal(resp.Body.Bytes(), parsed))
|
||||||
assert.True(t, len(parsed.AccessToken) > 10)
|
assert.True(t, len(parsed.AccessToken) > 10)
|
||||||
assert.True(t, len(parsed.RefreshToken) > 10)
|
assert.True(t, len(parsed.RefreshToken) > 10)
|
||||||
|
@ -181,6 +185,8 @@ func TestAccessTokenExchangeWithBasicAuth(t *testing.T) {
|
||||||
RefreshToken string `json:"refresh_token"`
|
RefreshToken string `json:"refresh_token"`
|
||||||
}
|
}
|
||||||
parsed := new(response)
|
parsed := new(response)
|
||||||
|
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
assert.NoError(t, json.Unmarshal(resp.Body.Bytes(), parsed))
|
assert.NoError(t, json.Unmarshal(resp.Body.Bytes(), parsed))
|
||||||
assert.True(t, len(parsed.AccessToken) > 10)
|
assert.True(t, len(parsed.AccessToken) > 10)
|
||||||
assert.True(t, len(parsed.RefreshToken) > 10)
|
assert.True(t, len(parsed.RefreshToken) > 10)
|
||||||
|
@ -223,6 +229,8 @@ func TestRefreshTokenInvalidation(t *testing.T) {
|
||||||
RefreshToken string `json:"refresh_token"`
|
RefreshToken string `json:"refresh_token"`
|
||||||
}
|
}
|
||||||
parsed := new(response)
|
parsed := new(response)
|
||||||
|
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
assert.NoError(t, json.Unmarshal(resp.Body.Bytes(), parsed))
|
assert.NoError(t, json.Unmarshal(resp.Body.Bytes(), parsed))
|
||||||
|
|
||||||
// test without invalidation
|
// test without invalidation
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
package integrations
|
package integrations
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"path"
|
"path"
|
||||||
|
@ -14,6 +13,7 @@ import (
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
api "code.gitea.io/gitea/modules/structs"
|
api "code.gitea.io/gitea/modules/structs"
|
||||||
|
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -82,6 +82,7 @@ func doTestRepoCommitWithStatus(t *testing.T, state string, classes ...string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func testRepoCommitsWithStatus(t *testing.T, resp *httptest.ResponseRecorder, state string) {
|
func testRepoCommitsWithStatus(t *testing.T, resp *httptest.ResponseRecorder, state string) {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
decoder := json.NewDecoder(resp.Body)
|
decoder := json.NewDecoder(resp.Body)
|
||||||
statuses := []*api.CommitStatus{}
|
statuses := []*api.CommitStatus{}
|
||||||
assert.NoError(t, decoder.Decode(&statuses))
|
assert.NoError(t, decoder.Decode(&statuses))
|
||||||
|
|
|
@ -6,7 +6,6 @@ package integrations
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
@ -17,6 +16,7 @@ import (
|
||||||
|
|
||||||
"code.gitea.io/gitea/modules/log"
|
"code.gitea.io/gitea/modules/log"
|
||||||
"code.gitea.io/gitea/modules/queue"
|
"code.gitea.io/gitea/modules/queue"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -158,6 +158,7 @@ func NewTestLogger() log.LoggerProvider {
|
||||||
// Init inits connection writer with json config.
|
// Init inits connection writer with json config.
|
||||||
// json config only need key "level".
|
// json config only need key "level".
|
||||||
func (log *TestLogger) Init(config string) error {
|
func (log *TestLogger) Init(config string) error {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
err := json.Unmarshal([]byte(config), log)
|
err := json.Unmarshal([]byte(config), log)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -8,7 +8,6 @@ package models
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"container/list"
|
"container/list"
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
@ -21,6 +20,7 @@ import (
|
||||||
"code.gitea.io/gitea/modules/references"
|
"code.gitea.io/gitea/modules/references"
|
||||||
"code.gitea.io/gitea/modules/structs"
|
"code.gitea.io/gitea/modules/structs"
|
||||||
"code.gitea.io/gitea/modules/timeutil"
|
"code.gitea.io/gitea/modules/timeutil"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
|
|
||||||
"xorm.io/builder"
|
"xorm.io/builder"
|
||||||
"xorm.io/xorm"
|
"xorm.io/xorm"
|
||||||
|
@ -655,6 +655,7 @@ func (c *Comment) LoadPushCommits() (err error) {
|
||||||
|
|
||||||
var data PushActionContent
|
var data PushActionContent
|
||||||
|
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
err = json.Unmarshal([]byte(c.Content), &data)
|
err = json.Unmarshal([]byte(c.Content), &data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
|
@ -1241,6 +1242,8 @@ func CreatePushPullComment(pusher *User, pr *PullRequest, oldCommitID, newCommit
|
||||||
}
|
}
|
||||||
|
|
||||||
ops.Issue = pr.Issue
|
ops.Issue = pr.Issue
|
||||||
|
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
dataJSON, err := json.Marshal(data)
|
dataJSON, err := json.Marshal(data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
@ -7,7 +7,6 @@ package models
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"encoding/json"
|
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/smtp"
|
"net/smtp"
|
||||||
|
@ -22,6 +21,7 @@ import (
|
||||||
"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/util"
|
"code.gitea.io/gitea/modules/util"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
|
|
||||||
"xorm.io/xorm"
|
"xorm.io/xorm"
|
||||||
"xorm.io/xorm/convert"
|
"xorm.io/xorm/convert"
|
||||||
|
@ -75,11 +75,13 @@ type LDAPConfig struct {
|
||||||
|
|
||||||
// FromDB fills up a LDAPConfig from serialized format.
|
// FromDB fills up a LDAPConfig from serialized format.
|
||||||
func (cfg *LDAPConfig) FromDB(bs []byte) error {
|
func (cfg *LDAPConfig) FromDB(bs []byte) error {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
return json.Unmarshal(bs, &cfg)
|
return json.Unmarshal(bs, &cfg)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToDB exports a LDAPConfig to a serialized format.
|
// ToDB exports a LDAPConfig to a serialized format.
|
||||||
func (cfg *LDAPConfig) ToDB() ([]byte, error) {
|
func (cfg *LDAPConfig) ToDB() ([]byte, error) {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
return json.Marshal(cfg)
|
return json.Marshal(cfg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,11 +103,13 @@ type SMTPConfig struct {
|
||||||
|
|
||||||
// FromDB fills up an SMTPConfig from serialized format.
|
// FromDB fills up an SMTPConfig from serialized format.
|
||||||
func (cfg *SMTPConfig) FromDB(bs []byte) error {
|
func (cfg *SMTPConfig) FromDB(bs []byte) error {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
return json.Unmarshal(bs, cfg)
|
return json.Unmarshal(bs, cfg)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToDB exports an SMTPConfig to a serialized format.
|
// ToDB exports an SMTPConfig to a serialized format.
|
||||||
func (cfg *SMTPConfig) ToDB() ([]byte, error) {
|
func (cfg *SMTPConfig) ToDB() ([]byte, error) {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
return json.Marshal(cfg)
|
return json.Marshal(cfg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,11 +120,13 @@ type PAMConfig struct {
|
||||||
|
|
||||||
// FromDB fills up a PAMConfig from serialized format.
|
// FromDB fills up a PAMConfig from serialized format.
|
||||||
func (cfg *PAMConfig) FromDB(bs []byte) error {
|
func (cfg *PAMConfig) FromDB(bs []byte) error {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
return json.Unmarshal(bs, &cfg)
|
return json.Unmarshal(bs, &cfg)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToDB exports a PAMConfig to a serialized format.
|
// ToDB exports a PAMConfig to a serialized format.
|
||||||
func (cfg *PAMConfig) ToDB() ([]byte, error) {
|
func (cfg *PAMConfig) ToDB() ([]byte, error) {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
return json.Marshal(cfg)
|
return json.Marshal(cfg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,11 +142,13 @@ type OAuth2Config struct {
|
||||||
|
|
||||||
// FromDB fills up an OAuth2Config from serialized format.
|
// FromDB fills up an OAuth2Config from serialized format.
|
||||||
func (cfg *OAuth2Config) FromDB(bs []byte) error {
|
func (cfg *OAuth2Config) FromDB(bs []byte) error {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
return json.Unmarshal(bs, cfg)
|
return json.Unmarshal(bs, cfg)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToDB exports an SMTPConfig to a serialized format.
|
// ToDB exports an SMTPConfig to a serialized format.
|
||||||
func (cfg *OAuth2Config) ToDB() ([]byte, error) {
|
func (cfg *OAuth2Config) ToDB() ([]byte, error) {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
return json.Marshal(cfg)
|
return json.Marshal(cfg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,11 +163,13 @@ type SSPIConfig struct {
|
||||||
|
|
||||||
// FromDB fills up an SSPIConfig from serialized format.
|
// FromDB fills up an SSPIConfig from serialized format.
|
||||||
func (cfg *SSPIConfig) FromDB(bs []byte) error {
|
func (cfg *SSPIConfig) FromDB(bs []byte) error {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
return json.Unmarshal(bs, cfg)
|
return json.Unmarshal(bs, cfg)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToDB exports an SSPIConfig to a serialized format.
|
// ToDB exports an SSPIConfig to a serialized format.
|
||||||
func (cfg *SSPIConfig) ToDB() ([]byte, error) {
|
func (cfg *SSPIConfig) ToDB() ([]byte, error) {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
return json.Marshal(cfg)
|
return json.Marshal(cfg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,9 +5,8 @@
|
||||||
package migrations
|
package migrations
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
|
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
|
|
||||||
"xorm.io/xorm"
|
"xorm.io/xorm"
|
||||||
)
|
)
|
||||||
|
@ -72,6 +71,7 @@ func expandWebhooks(x *xorm.Engine) error {
|
||||||
|
|
||||||
for _, res := range results {
|
for _, res := range results {
|
||||||
var events HookEvent
|
var events HookEvent
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
if err = json.Unmarshal([]byte(res.Events), &events); err != nil {
|
if err = json.Unmarshal([]byte(res.Events), &events); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,11 +5,11 @@
|
||||||
package models
|
package models
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"code.gitea.io/gitea/modules/timeutil"
|
"code.gitea.io/gitea/modules/timeutil"
|
||||||
|
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
"xorm.io/xorm"
|
"xorm.io/xorm"
|
||||||
"xorm.io/xorm/convert"
|
"xorm.io/xorm/convert"
|
||||||
)
|
)
|
||||||
|
@ -29,11 +29,13 @@ type UnitConfig struct {
|
||||||
|
|
||||||
// FromDB fills up a UnitConfig from serialized format.
|
// FromDB fills up a UnitConfig from serialized format.
|
||||||
func (cfg *UnitConfig) FromDB(bs []byte) error {
|
func (cfg *UnitConfig) FromDB(bs []byte) error {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
return json.Unmarshal(bs, &cfg)
|
return json.Unmarshal(bs, &cfg)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToDB exports a UnitConfig to a serialized format.
|
// ToDB exports a UnitConfig to a serialized format.
|
||||||
func (cfg *UnitConfig) ToDB() ([]byte, error) {
|
func (cfg *UnitConfig) ToDB() ([]byte, error) {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
return json.Marshal(cfg)
|
return json.Marshal(cfg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,11 +46,13 @@ type ExternalWikiConfig struct {
|
||||||
|
|
||||||
// FromDB fills up a ExternalWikiConfig from serialized format.
|
// FromDB fills up a ExternalWikiConfig from serialized format.
|
||||||
func (cfg *ExternalWikiConfig) FromDB(bs []byte) error {
|
func (cfg *ExternalWikiConfig) FromDB(bs []byte) error {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
return json.Unmarshal(bs, &cfg)
|
return json.Unmarshal(bs, &cfg)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToDB exports a ExternalWikiConfig to a serialized format.
|
// ToDB exports a ExternalWikiConfig to a serialized format.
|
||||||
func (cfg *ExternalWikiConfig) ToDB() ([]byte, error) {
|
func (cfg *ExternalWikiConfig) ToDB() ([]byte, error) {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
return json.Marshal(cfg)
|
return json.Marshal(cfg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,11 +65,13 @@ type ExternalTrackerConfig struct {
|
||||||
|
|
||||||
// FromDB fills up a ExternalTrackerConfig from serialized format.
|
// FromDB fills up a ExternalTrackerConfig from serialized format.
|
||||||
func (cfg *ExternalTrackerConfig) FromDB(bs []byte) error {
|
func (cfg *ExternalTrackerConfig) FromDB(bs []byte) error {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
return json.Unmarshal(bs, &cfg)
|
return json.Unmarshal(bs, &cfg)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToDB exports a ExternalTrackerConfig to a serialized format.
|
// ToDB exports a ExternalTrackerConfig to a serialized format.
|
||||||
func (cfg *ExternalTrackerConfig) ToDB() ([]byte, error) {
|
func (cfg *ExternalTrackerConfig) ToDB() ([]byte, error) {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
return json.Marshal(cfg)
|
return json.Marshal(cfg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,11 +84,13 @@ type IssuesConfig struct {
|
||||||
|
|
||||||
// FromDB fills up a IssuesConfig from serialized format.
|
// FromDB fills up a IssuesConfig from serialized format.
|
||||||
func (cfg *IssuesConfig) FromDB(bs []byte) error {
|
func (cfg *IssuesConfig) FromDB(bs []byte) error {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
return json.Unmarshal(bs, &cfg)
|
return json.Unmarshal(bs, &cfg)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToDB exports a IssuesConfig to a serialized format.
|
// ToDB exports a IssuesConfig to a serialized format.
|
||||||
func (cfg *IssuesConfig) ToDB() ([]byte, error) {
|
func (cfg *IssuesConfig) ToDB() ([]byte, error) {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
return json.Marshal(cfg)
|
return json.Marshal(cfg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,11 +105,13 @@ type PullRequestsConfig struct {
|
||||||
|
|
||||||
// FromDB fills up a PullRequestsConfig from serialized format.
|
// FromDB fills up a PullRequestsConfig from serialized format.
|
||||||
func (cfg *PullRequestsConfig) FromDB(bs []byte) error {
|
func (cfg *PullRequestsConfig) FromDB(bs []byte) error {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
return json.Unmarshal(bs, &cfg)
|
return json.Unmarshal(bs, &cfg)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToDB exports a PullRequestsConfig to a serialized format.
|
// ToDB exports a PullRequestsConfig to a serialized format.
|
||||||
func (cfg *PullRequestsConfig) ToDB() ([]byte, error) {
|
func (cfg *PullRequestsConfig) ToDB() ([]byte, error) {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
return json.Marshal(cfg)
|
return json.Marshal(cfg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,12 +5,12 @@
|
||||||
package models
|
package models
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
migration "code.gitea.io/gitea/modules/migrations/base"
|
migration "code.gitea.io/gitea/modules/migrations/base"
|
||||||
"code.gitea.io/gitea/modules/structs"
|
"code.gitea.io/gitea/modules/structs"
|
||||||
"code.gitea.io/gitea/modules/timeutil"
|
"code.gitea.io/gitea/modules/timeutil"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
|
|
||||||
"xorm.io/builder"
|
"xorm.io/builder"
|
||||||
)
|
)
|
||||||
|
@ -105,6 +105,7 @@ func (task *Task) UpdateCols(cols ...string) error {
|
||||||
func (task *Task) MigrateConfig() (*migration.MigrateOptions, error) {
|
func (task *Task) MigrateConfig() (*migration.MigrateOptions, error) {
|
||||||
if task.Type == structs.TaskTypeMigrateRepo {
|
if task.Type == structs.TaskTypeMigrateRepo {
|
||||||
var opts migration.MigrateOptions
|
var opts migration.MigrateOptions
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
err := json.Unmarshal([]byte(task.PayloadContent), &opts)
|
err := json.Unmarshal([]byte(task.PayloadContent), &opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -162,6 +163,7 @@ func GetMigratingTaskByID(id, doerID int64) (*Task, *migration.MigrateOptions, e
|
||||||
}
|
}
|
||||||
|
|
||||||
var opts migration.MigrateOptions
|
var opts migration.MigrateOptions
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
if err := json.Unmarshal([]byte(task.PayloadContent), &opts); err != nil {
|
if err := json.Unmarshal([]byte(task.PayloadContent), &opts); err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,10 @@
|
||||||
package models
|
package models
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -56,6 +56,7 @@ func TestGetUserHeatmapDataByUser(t *testing.T) {
|
||||||
assert.Equal(t, tc.CountResult, len(heatmap), fmt.Sprintf("testcase %d", i))
|
assert.Equal(t, tc.CountResult, len(heatmap), fmt.Sprintf("testcase %d", i))
|
||||||
|
|
||||||
//Test JSON rendering
|
//Test JSON rendering
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
jsonData, err := json.Marshal(heatmap)
|
jsonData, err := json.Marshal(heatmap)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, tc.JSONResult, string(jsonData))
|
assert.Equal(t, tc.JSONResult, string(jsonData))
|
||||||
|
|
|
@ -7,7 +7,6 @@ package models
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
@ -18,6 +17,7 @@ import (
|
||||||
"code.gitea.io/gitea/modules/timeutil"
|
"code.gitea.io/gitea/modules/timeutil"
|
||||||
|
|
||||||
gouuid "github.com/google/uuid"
|
gouuid "github.com/google/uuid"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
// HookContentType is the content type of a web hook
|
// HookContentType is the content type of a web hook
|
||||||
|
@ -145,6 +145,8 @@ type Webhook struct {
|
||||||
// AfterLoad updates the webhook object upon setting a column
|
// AfterLoad updates the webhook object upon setting a column
|
||||||
func (w *Webhook) AfterLoad() {
|
func (w *Webhook) AfterLoad() {
|
||||||
w.HookEvent = &HookEvent{}
|
w.HookEvent = &HookEvent{}
|
||||||
|
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
if err := json.Unmarshal([]byte(w.Events), w.HookEvent); err != nil {
|
if err := json.Unmarshal([]byte(w.Events), w.HookEvent); err != nil {
|
||||||
log.Error("Unmarshal[%d]: %v", w.ID, err)
|
log.Error("Unmarshal[%d]: %v", w.ID, err)
|
||||||
}
|
}
|
||||||
|
@ -157,6 +159,7 @@ func (w *Webhook) History(page int) ([]*HookTask, error) {
|
||||||
|
|
||||||
// UpdateEvent handles conversion from HookEvent to Events.
|
// UpdateEvent handles conversion from HookEvent to Events.
|
||||||
func (w *Webhook) UpdateEvent() error {
|
func (w *Webhook) UpdateEvent() error {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
data, err := json.Marshal(w.HookEvent)
|
data, err := json.Marshal(w.HookEvent)
|
||||||
w.Events = string(data)
|
w.Events = string(data)
|
||||||
return err
|
return err
|
||||||
|
@ -689,6 +692,7 @@ func (t *HookTask) AfterLoad() {
|
||||||
}
|
}
|
||||||
|
|
||||||
t.RequestInfo = &HookRequest{}
|
t.RequestInfo = &HookRequest{}
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
if err := json.Unmarshal([]byte(t.RequestContent), t.RequestInfo); err != nil {
|
if err := json.Unmarshal([]byte(t.RequestContent), t.RequestInfo); err != nil {
|
||||||
log.Error("Unmarshal RequestContent[%d]: %v", t.ID, err)
|
log.Error("Unmarshal RequestContent[%d]: %v", t.ID, err)
|
||||||
}
|
}
|
||||||
|
@ -702,6 +706,7 @@ func (t *HookTask) AfterLoad() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *HookTask) simpleMarshalJSON(v interface{}) string {
|
func (t *HookTask) simpleMarshalJSON(v interface{}) string {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
p, err := json.Marshal(v)
|
p, err := json.Marshal(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Marshal [%d]: %v", t.ID, err)
|
log.Error("Marshal [%d]: %v", t.ID, err)
|
||||||
|
|
|
@ -6,12 +6,12 @@ package models
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
api "code.gitea.io/gitea/modules/structs"
|
api "code.gitea.io/gitea/modules/structs"
|
||||||
|
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -58,6 +58,7 @@ func TestWebhook_UpdateEvent(t *testing.T) {
|
||||||
assert.NoError(t, webhook.UpdateEvent())
|
assert.NoError(t, webhook.UpdateEvent())
|
||||||
assert.NotEmpty(t, webhook.Events)
|
assert.NotEmpty(t, webhook.Events)
|
||||||
actualHookEvent := &HookEvent{}
|
actualHookEvent := &HookEvent{}
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
assert.NoError(t, json.Unmarshal([]byte(webhook.Events), actualHookEvent))
|
assert.NoError(t, json.Unmarshal([]byte(webhook.Events), actualHookEvent))
|
||||||
assert.Equal(t, *hookEvent, *actualHookEvent)
|
assert.Equal(t, *hookEvent, *actualHookEvent)
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"html"
|
"html"
|
||||||
"html/template"
|
"html/template"
|
||||||
|
@ -34,6 +33,7 @@ import (
|
||||||
"gitea.com/go-chi/cache"
|
"gitea.com/go-chi/cache"
|
||||||
"gitea.com/go-chi/session"
|
"gitea.com/go-chi/session"
|
||||||
"github.com/go-chi/chi"
|
"github.com/go-chi/chi"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
"github.com/unknwon/com"
|
"github.com/unknwon/com"
|
||||||
"github.com/unknwon/i18n"
|
"github.com/unknwon/i18n"
|
||||||
"github.com/unrolled/render"
|
"github.com/unrolled/render"
|
||||||
|
@ -370,6 +370,7 @@ func (ctx *Context) Error(status int, contents ...string) {
|
||||||
func (ctx *Context) JSON(status int, content interface{}) {
|
func (ctx *Context) JSON(status int, content interface{}) {
|
||||||
ctx.Resp.Header().Set("Content-Type", "application/json;charset=utf-8")
|
ctx.Resp.Header().Set("Content-Type", "application/json;charset=utf-8")
|
||||||
ctx.Resp.WriteHeader(status)
|
ctx.Resp.WriteHeader(status)
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
if err := json.NewEncoder(ctx.Resp).Encode(content); err != nil {
|
if err := json.NewEncoder(ctx.Resp).Encode(content); err != nil {
|
||||||
ctx.ServerError("Render JSON failed", err)
|
ctx.ServerError("Render JSON failed", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,11 +6,12 @@ package eventsource
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
func wrapNewlines(w io.Writer, prefix []byte, value []byte) (sum int64, err error) {
|
func wrapNewlines(w io.Writer, prefix []byte, value []byte) (sum int64, err error) {
|
||||||
|
@ -79,6 +80,7 @@ func (e *Event) WriteTo(w io.Writer) (int64, error) {
|
||||||
data = []byte(v)
|
data = []byte(v)
|
||||||
default:
|
default:
|
||||||
var err error
|
var err error
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
data, err = json.Marshal(e.Data)
|
data, err = json.Marshal(e.Data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return sum, err
|
return sum, err
|
||||||
|
|
|
@ -8,7 +8,6 @@ package httplib
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"encoding/json"
|
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
@ -23,6 +22,8 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
var defaultSetting = Settings{false, "GiteaServer", 60 * time.Second, 60 * time.Second, nil, nil, nil, false}
|
var defaultSetting = Settings{false, "GiteaServer", 60 * time.Second, 60 * time.Second, nil, nil, nil, false}
|
||||||
|
@ -434,6 +435,7 @@ func (r *Request) ToJSON(v interface{}) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
err = json.Unmarshal(data, v)
|
err = json.Unmarshal(data, v)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ package code
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -22,6 +21,7 @@ import (
|
||||||
"code.gitea.io/gitea/modules/timeutil"
|
"code.gitea.io/gitea/modules/timeutil"
|
||||||
|
|
||||||
"github.com/go-enry/go-enry/v2"
|
"github.com/go-enry/go-enry/v2"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
"github.com/olivere/elastic/v7"
|
"github.com/olivere/elastic/v7"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -300,6 +300,7 @@ func convertResult(searchResult *elastic.SearchResult, kw string, pageSize int)
|
||||||
|
|
||||||
repoID, fileName := parseIndexerID(hit.Id)
|
repoID, fileName := parseIndexerID(hit.Id)
|
||||||
var res = make(map[string]interface{})
|
var res = make(map[string]interface{})
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
if err := json.Unmarshal(hit.Source, &res); err != nil {
|
if err := json.Unmarshal(hit.Source, &res); err != nil {
|
||||||
return 0, nil, nil, err
|
return 0, nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
package lfs
|
package lfs
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
@ -15,6 +14,7 @@ import (
|
||||||
"code.gitea.io/gitea/modules/log"
|
"code.gitea.io/gitea/modules/log"
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
api "code.gitea.io/gitea/modules/structs"
|
api "code.gitea.io/gitea/modules/structs"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
//checkIsValidRequest check if it a valid request in case of bad request it write the response to ctx.
|
//checkIsValidRequest check if it a valid request in case of bad request it write the response to ctx.
|
||||||
|
@ -184,6 +184,7 @@ func PostLockHandler(ctx *context.Context) {
|
||||||
var req api.LFSLockRequest
|
var req api.LFSLockRequest
|
||||||
bodyReader := ctx.Req.Body
|
bodyReader := ctx.Req.Body
|
||||||
defer bodyReader.Close()
|
defer bodyReader.Close()
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
dec := json.NewDecoder(bodyReader)
|
dec := json.NewDecoder(bodyReader)
|
||||||
if err := dec.Decode(&req); err != nil {
|
if err := dec.Decode(&req); err != nil {
|
||||||
log.Warn("Failed to decode lock request as json. Error: %v", err)
|
log.Warn("Failed to decode lock request as json. Error: %v", err)
|
||||||
|
@ -319,6 +320,7 @@ func UnLockHandler(ctx *context.Context) {
|
||||||
var req api.LFSLockDeleteRequest
|
var req api.LFSLockDeleteRequest
|
||||||
bodyReader := ctx.Req.Body
|
bodyReader := ctx.Req.Body
|
||||||
defer bodyReader.Close()
|
defer bodyReader.Close()
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
dec := json.NewDecoder(bodyReader)
|
dec := json.NewDecoder(bodyReader)
|
||||||
if err := dec.Decode(&req); err != nil {
|
if err := dec.Decode(&req); err != nil {
|
||||||
log.Warn("Failed to decode lock request as json. Error: %v", err)
|
log.Warn("Failed to decode lock request as json. Error: %v", err)
|
||||||
|
|
|
@ -6,7 +6,6 @@ package lfs
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -23,6 +22,7 @@ import (
|
||||||
"code.gitea.io/gitea/modules/storage"
|
"code.gitea.io/gitea/modules/storage"
|
||||||
|
|
||||||
"github.com/dgrijalva/jwt-go"
|
"github.com/dgrijalva/jwt-go"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -233,6 +233,7 @@ func getMetaHandler(ctx *context.Context) {
|
||||||
ctx.Resp.Header().Set("Content-Type", metaMediaType)
|
ctx.Resp.Header().Set("Content-Type", metaMediaType)
|
||||||
|
|
||||||
if ctx.Req.Method == "GET" {
|
if ctx.Req.Method == "GET" {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
enc := json.NewEncoder(ctx.Resp)
|
enc := json.NewEncoder(ctx.Resp)
|
||||||
if err := enc.Encode(Represent(rv, meta, true, false)); err != nil {
|
if err := enc.Encode(Represent(rv, meta, true, false)); err != nil {
|
||||||
log.Error("Failed to encode representation as json. Error: %v", err)
|
log.Error("Failed to encode representation as json. Error: %v", err)
|
||||||
|
@ -304,6 +305,7 @@ func PostHandler(ctx *context.Context) {
|
||||||
}
|
}
|
||||||
ctx.Resp.WriteHeader(sentStatus)
|
ctx.Resp.WriteHeader(sentStatus)
|
||||||
|
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
enc := json.NewEncoder(ctx.Resp)
|
enc := json.NewEncoder(ctx.Resp)
|
||||||
if err := enc.Encode(Represent(rv, meta, meta.Existing, true)); err != nil {
|
if err := enc.Encode(Represent(rv, meta, meta.Existing, true)); err != nil {
|
||||||
log.Error("Failed to encode representation as json. Error: %v", err)
|
log.Error("Failed to encode representation as json. Error: %v", err)
|
||||||
|
@ -394,6 +396,7 @@ func BatchHandler(ctx *context.Context) {
|
||||||
|
|
||||||
respobj := &BatchResponse{Objects: responseObjects}
|
respobj := &BatchResponse{Objects: responseObjects}
|
||||||
|
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
enc := json.NewEncoder(ctx.Resp)
|
enc := json.NewEncoder(ctx.Resp)
|
||||||
if err := enc.Encode(respobj); err != nil {
|
if err := enc.Encode(respobj); err != nil {
|
||||||
log.Error("Failed to encode representation as json. Error: %v", err)
|
log.Error("Failed to encode representation as json. Error: %v", err)
|
||||||
|
@ -531,6 +534,7 @@ func unpack(ctx *context.Context) *RequestVars {
|
||||||
var p RequestVars
|
var p RequestVars
|
||||||
bodyReader := r.Body
|
bodyReader := r.Body
|
||||||
defer bodyReader.Close()
|
defer bodyReader.Close()
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
dec := json.NewDecoder(bodyReader)
|
dec := json.NewDecoder(bodyReader)
|
||||||
err := dec.Decode(&p)
|
err := dec.Decode(&p)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -554,6 +558,7 @@ func unpackbatch(ctx *context.Context) *BatchVars {
|
||||||
|
|
||||||
bodyReader := r.Body
|
bodyReader := r.Body
|
||||||
defer bodyReader.Close()
|
defer bodyReader.Close()
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
dec := json.NewDecoder(bodyReader)
|
dec := json.NewDecoder(bodyReader)
|
||||||
err := dec.Decode(&bv)
|
err := dec.Decode(&bv)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -6,9 +6,11 @@
|
||||||
package log
|
package log
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net"
|
"net"
|
||||||
|
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
type connWriter struct {
|
type connWriter struct {
|
||||||
|
@ -104,9 +106,10 @@ func NewConn() LoggerProvider {
|
||||||
// Init inits connection writer with json config.
|
// Init inits connection writer with json config.
|
||||||
// json config only need key "level".
|
// json config only need key "level".
|
||||||
func (log *ConnLogger) Init(jsonconfig string) error {
|
func (log *ConnLogger) Init(jsonconfig string) error {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
err := json.Unmarshal([]byte(jsonconfig), log)
|
err := json.Unmarshal([]byte(jsonconfig), log)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return fmt.Errorf("Unable to parse JSON: %v", err)
|
||||||
}
|
}
|
||||||
log.NewWriterLogger(&connWriter{
|
log.NewWriterLogger(&connWriter{
|
||||||
ReconnectOnMsg: log.ReconnectOnMsg,
|
ReconnectOnMsg: log.ReconnectOnMsg,
|
||||||
|
|
|
@ -98,7 +98,8 @@ func TestConnLoggerBadConfig(t *testing.T) {
|
||||||
logger := NewConn()
|
logger := NewConn()
|
||||||
|
|
||||||
err := logger.Init("{")
|
err := logger.Init("{")
|
||||||
assert.Equal(t, "unexpected end of JSON input", err.Error())
|
assert.Error(t, err)
|
||||||
|
assert.Contains(t, err.Error(), "Unable to parse JSON")
|
||||||
logger.Close()
|
logger.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,9 +6,11 @@
|
||||||
package log
|
package log
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CanColorStdout reports if we can color the Stdout
|
// CanColorStdout reports if we can color the Stdout
|
||||||
|
@ -50,9 +52,10 @@ func NewConsoleLogger() LoggerProvider {
|
||||||
// Init inits connection writer with json config.
|
// Init inits connection writer with json config.
|
||||||
// json config only need key "level".
|
// json config only need key "level".
|
||||||
func (log *ConsoleLogger) Init(config string) error {
|
func (log *ConsoleLogger) Init(config string) error {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
err := json.Unmarshal([]byte(config), log)
|
err := json.Unmarshal([]byte(config), log)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return fmt.Errorf("Unable to parse JSON: %v", err)
|
||||||
}
|
}
|
||||||
if log.Stderr {
|
if log.Stderr {
|
||||||
log.NewWriterLogger(&nopWriteCloser{
|
log.NewWriterLogger(&nopWriteCloser{
|
||||||
|
|
|
@ -17,7 +17,8 @@ func TestConsoleLoggerBadConfig(t *testing.T) {
|
||||||
logger := NewConsoleLogger()
|
logger := NewConsoleLogger()
|
||||||
|
|
||||||
err := logger.Init("{")
|
err := logger.Init("{")
|
||||||
assert.Equal(t, "unexpected end of JSON input", err.Error())
|
assert.Error(t, err)
|
||||||
|
assert.Contains(t, err.Error(), "Unable to parse JSON")
|
||||||
logger.Close()
|
logger.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ package log
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"compress/gzip"
|
"compress/gzip"
|
||||||
"encoding/json"
|
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
@ -17,6 +16,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"code.gitea.io/gitea/modules/util"
|
"code.gitea.io/gitea/modules/util"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
// FileLogger implements LoggerProvider.
|
// FileLogger implements LoggerProvider.
|
||||||
|
@ -101,8 +101,9 @@ func NewFileLogger() LoggerProvider {
|
||||||
// "rotate":true
|
// "rotate":true
|
||||||
// }
|
// }
|
||||||
func (log *FileLogger) Init(config string) error {
|
func (log *FileLogger) Init(config string) error {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
if err := json.Unmarshal([]byte(config), log); err != nil {
|
if err := json.Unmarshal([]byte(config), log); err != nil {
|
||||||
return err
|
return fmt.Errorf("Unable to parse JSON: %v", err)
|
||||||
}
|
}
|
||||||
if len(log.Filename) == 0 {
|
if len(log.Filename) == 0 {
|
||||||
return errors.New("config must have filename")
|
return errors.New("config must have filename")
|
||||||
|
|
|
@ -6,10 +6,11 @@ package log
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Level is the level of the logger
|
// Level is the level of the logger
|
||||||
|
@ -103,6 +104,7 @@ func FromString(level string) Level {
|
||||||
// UnmarshalJSON takes text and turns it into a Level
|
// UnmarshalJSON takes text and turns it into a Level
|
||||||
func (l *Level) UnmarshalJSON(b []byte) error {
|
func (l *Level) UnmarshalJSON(b []byte) error {
|
||||||
var tmp interface{}
|
var tmp interface{}
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
err := json.Unmarshal(b, &tmp)
|
err := json.Unmarshal(b, &tmp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "Err: %v", err)
|
fmt.Fprintf(os.Stderr, "Err: %v", err)
|
||||||
|
|
|
@ -5,10 +5,10 @@
|
||||||
package log
|
package log
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ type testLevel struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestLevelMarshalUnmarshalJSON(t *testing.T) {
|
func TestLevelMarshalUnmarshalJSON(t *testing.T) {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
levelBytes, err := json.Marshal(testLevel{
|
levelBytes, err := json.Marshal(testLevel{
|
||||||
Level: INFO,
|
Level: INFO,
|
||||||
})
|
})
|
||||||
|
|
|
@ -6,9 +6,11 @@
|
||||||
package log
|
package log
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"fmt"
|
||||||
"net/smtp"
|
"net/smtp"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
type smtpWriter struct {
|
type smtpWriter struct {
|
||||||
|
@ -55,9 +57,10 @@ func NewSMTPLogger() LoggerProvider {
|
||||||
// "level":LevelError
|
// "level":LevelError
|
||||||
// }
|
// }
|
||||||
func (log *SMTPLogger) Init(jsonconfig string) error {
|
func (log *SMTPLogger) Init(jsonconfig string) error {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
err := json.Unmarshal([]byte(jsonconfig), log)
|
err := json.Unmarshal([]byte(jsonconfig), log)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return fmt.Errorf("Unable to parse JSON: %v", err)
|
||||||
}
|
}
|
||||||
log.NewWriterLogger(&smtpWriter{
|
log.NewWriterLogger(&smtpWriter{
|
||||||
owner: log,
|
owner: log,
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
package action
|
package action
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"path"
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -14,6 +13,7 @@ import (
|
||||||
"code.gitea.io/gitea/modules/log"
|
"code.gitea.io/gitea/modules/log"
|
||||||
"code.gitea.io/gitea/modules/notification/base"
|
"code.gitea.io/gitea/modules/notification/base"
|
||||||
"code.gitea.io/gitea/modules/repository"
|
"code.gitea.io/gitea/modules/repository"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
type actionNotifier struct {
|
type actionNotifier struct {
|
||||||
|
@ -296,6 +296,7 @@ func (*actionNotifier) NotifyPullRevieweDismiss(doer *models.User, review *model
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *actionNotifier) NotifyPushCommits(pusher *models.User, repo *models.Repository, opts *repository.PushUpdateOptions, commits *repository.PushCommits) {
|
func (a *actionNotifier) NotifyPushCommits(pusher *models.User, repo *models.Repository, opts *repository.PushUpdateOptions, commits *repository.PushCommits) {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
data, err := json.Marshal(commits)
|
data, err := json.Marshal(commits)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Marshal: %v", err)
|
log.Error("Marshal: %v", err)
|
||||||
|
@ -365,6 +366,7 @@ func (a *actionNotifier) NotifyDeleteRef(doer *models.User, repo *models.Reposit
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *actionNotifier) NotifySyncPushCommits(pusher *models.User, repo *models.Repository, opts *repository.PushUpdateOptions, commits *repository.PushCommits) {
|
func (a *actionNotifier) NotifySyncPushCommits(pusher *models.User, repo *models.Repository, opts *repository.PushUpdateOptions, commits *repository.PushCommits) {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
data, err := json.Marshal(commits)
|
data, err := json.Marshal(commits)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("json.Marshal: %v", err)
|
log.Error("json.Marshal: %v", err)
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
package private
|
package private
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
@ -13,6 +12,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Git environment variables
|
// Git environment variables
|
||||||
|
@ -80,6 +80,7 @@ func HookPreReceive(ownerName, repoName string, opts HookOptions) (int, string)
|
||||||
)
|
)
|
||||||
req := newInternalRequest(reqURL, "POST")
|
req := newInternalRequest(reqURL, "POST")
|
||||||
req = req.Header("Content-Type", "application/json")
|
req = req.Header("Content-Type", "application/json")
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
jsonBytes, _ := json.Marshal(opts)
|
jsonBytes, _ := json.Marshal(opts)
|
||||||
req.Body(jsonBytes)
|
req.Body(jsonBytes)
|
||||||
req.SetTimeout(60*time.Second, time.Duration(60+len(opts.OldCommitIDs))*time.Second)
|
req.SetTimeout(60*time.Second, time.Duration(60+len(opts.OldCommitIDs))*time.Second)
|
||||||
|
@ -106,6 +107,7 @@ func HookPostReceive(ownerName, repoName string, opts HookOptions) (*HookPostRec
|
||||||
req := newInternalRequest(reqURL, "POST")
|
req := newInternalRequest(reqURL, "POST")
|
||||||
req = req.Header("Content-Type", "application/json")
|
req = req.Header("Content-Type", "application/json")
|
||||||
req.SetTimeout(60*time.Second, time.Duration(60+len(opts.OldCommitIDs))*time.Second)
|
req.SetTimeout(60*time.Second, time.Duration(60+len(opts.OldCommitIDs))*time.Second)
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
jsonBytes, _ := json.Marshal(opts)
|
jsonBytes, _ := json.Marshal(opts)
|
||||||
req.Body(jsonBytes)
|
req.Body(jsonBytes)
|
||||||
resp, err := req.Response()
|
resp, err := req.Response()
|
||||||
|
|
|
@ -6,13 +6,13 @@ package private
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"code.gitea.io/gitea/modules/httplib"
|
"code.gitea.io/gitea/modules/httplib"
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
func newRequest(url, method string) *httplib.Request {
|
func newRequest(url, method string) *httplib.Request {
|
||||||
|
@ -27,6 +27,7 @@ type Response struct {
|
||||||
|
|
||||||
func decodeJSONError(resp *http.Response) *Response {
|
func decodeJSONError(resp *http.Response) *Response {
|
||||||
var res Response
|
var res Response
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
err := json.NewDecoder(resp.Body).Decode(&res)
|
err := json.NewDecoder(resp.Body).Decode(&res)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
res.Err = err.Error()
|
res.Err = err.Error()
|
||||||
|
|
|
@ -5,12 +5,12 @@
|
||||||
package private
|
package private
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Email structure holds a data for sending general emails
|
// Email structure holds a data for sending general emails
|
||||||
|
@ -32,6 +32,7 @@ func SendEmail(subject, message string, to []string) (int, string) {
|
||||||
|
|
||||||
req := newInternalRequest(reqURL, "POST")
|
req := newInternalRequest(reqURL, "POST")
|
||||||
req = req.Header("Content-Type", "application/json")
|
req = req.Header("Content-Type", "application/json")
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
jsonBytes, _ := json.Marshal(Email{
|
jsonBytes, _ := json.Marshal(Email{
|
||||||
Subject: subject,
|
Subject: subject,
|
||||||
Message: message,
|
Message: message,
|
||||||
|
|
|
@ -5,13 +5,13 @@
|
||||||
package private
|
package private
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Shutdown calls the internal shutdown function
|
// Shutdown calls the internal shutdown function
|
||||||
|
@ -65,6 +65,7 @@ func FlushQueues(timeout time.Duration, nonBlocking bool) (int, string) {
|
||||||
req.SetTimeout(timeout+10*time.Second, timeout+10*time.Second)
|
req.SetTimeout(timeout+10*time.Second, timeout+10*time.Second)
|
||||||
}
|
}
|
||||||
req = req.Header("Content-Type", "application/json")
|
req = req.Header("Content-Type", "application/json")
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
jsonBytes, _ := json.Marshal(FlushOptions{
|
jsonBytes, _ := json.Marshal(FlushOptions{
|
||||||
Timeout: timeout,
|
Timeout: timeout,
|
||||||
NonBlocking: nonBlocking,
|
NonBlocking: nonBlocking,
|
||||||
|
@ -151,6 +152,7 @@ func AddLogger(group, name, mode string, config map[string]interface{}) (int, st
|
||||||
|
|
||||||
req := newInternalRequest(reqURL, "POST")
|
req := newInternalRequest(reqURL, "POST")
|
||||||
req = req.Header("Content-Type", "application/json")
|
req = req.Header("Content-Type", "application/json")
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
jsonBytes, _ := json.Marshal(LoggerOptions{
|
jsonBytes, _ := json.Marshal(LoggerOptions{
|
||||||
Group: group,
|
Group: group,
|
||||||
Name: name,
|
Name: name,
|
||||||
|
|
|
@ -5,13 +5,13 @@
|
||||||
package private
|
package private
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"code.gitea.io/gitea/models"
|
"code.gitea.io/gitea/models"
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
// KeyAndOwner is the response from ServNoCommand
|
// KeyAndOwner is the response from ServNoCommand
|
||||||
|
@ -34,6 +34,7 @@ func ServNoCommand(keyID int64) (*models.PublicKey, *models.User, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var keyAndOwner KeyAndOwner
|
var keyAndOwner KeyAndOwner
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
if err := json.NewDecoder(resp.Body).Decode(&keyAndOwner); err != nil {
|
if err := json.NewDecoder(resp.Body).Decode(&keyAndOwner); err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
@ -90,6 +91,7 @@ func ServCommand(keyID int64, ownerName, repoName string, mode models.AccessMode
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
if resp.StatusCode != http.StatusOK {
|
if resp.StatusCode != http.StatusOK {
|
||||||
var errServCommand ErrServCommand
|
var errServCommand ErrServCommand
|
||||||
if err := json.NewDecoder(resp.Body).Decode(&errServCommand); err != nil {
|
if err := json.NewDecoder(resp.Body).Decode(&errServCommand); err != nil {
|
||||||
|
|
|
@ -5,8 +5,9 @@
|
||||||
package queue
|
package queue
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Mappable represents an interface that can MapTo another interface
|
// Mappable represents an interface that can MapTo another interface
|
||||||
|
@ -19,6 +20,7 @@ type Mappable interface {
|
||||||
// It will tolerate the cfg being passed as a []byte or string of a json representation of the
|
// It will tolerate the cfg being passed as a []byte or string of a json representation of the
|
||||||
// exemplar or the correct type of the exemplar itself
|
// exemplar or the correct type of the exemplar itself
|
||||||
func toConfig(exemplar, cfg interface{}) (interface{}, error) {
|
func toConfig(exemplar, cfg interface{}) (interface{}, error) {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
|
|
||||||
// First of all check if we've got the same type as the exemplar - if so it's all fine.
|
// First of all check if we've got the same type as the exemplar - if so it's all fine.
|
||||||
if reflect.TypeOf(cfg).AssignableTo(reflect.TypeOf(exemplar)) {
|
if reflect.TypeOf(cfg).AssignableTo(reflect.TypeOf(exemplar)) {
|
||||||
|
@ -66,6 +68,7 @@ func toConfig(exemplar, cfg interface{}) (interface{}, error) {
|
||||||
|
|
||||||
// unmarshalAs will attempt to unmarshal provided bytes as the provided exemplar
|
// unmarshalAs will attempt to unmarshal provided bytes as the provided exemplar
|
||||||
func unmarshalAs(bs []byte, exemplar interface{}) (data Data, err error) {
|
func unmarshalAs(bs []byte, exemplar interface{}) (data Data, err error) {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
if exemplar != nil {
|
if exemplar != nil {
|
||||||
t := reflect.TypeOf(exemplar)
|
t := reflect.TypeOf(exemplar)
|
||||||
n := reflect.New(t)
|
n := reflect.New(t)
|
||||||
|
|
|
@ -6,7 +6,6 @@ package queue
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
"sort"
|
"sort"
|
||||||
|
@ -14,6 +13,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"code.gitea.io/gitea/modules/log"
|
"code.gitea.io/gitea/modules/log"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
var manager *Manager
|
var manager *Manager
|
||||||
|
@ -110,6 +110,7 @@ func (m *Manager) Add(managed interface{},
|
||||||
configuration,
|
configuration,
|
||||||
exemplar interface{}) int64 {
|
exemplar interface{}) int64 {
|
||||||
|
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
cfg, _ := json.Marshal(configuration)
|
cfg, _ := json.Marshal(configuration)
|
||||||
mq := &ManagedQueue{
|
mq := &ManagedQueue{
|
||||||
Type: t,
|
Type: t,
|
||||||
|
|
|
@ -6,12 +6,12 @@ package queue
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"code.gitea.io/gitea/modules/log"
|
"code.gitea.io/gitea/modules/log"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ByteFIFOQueueConfiguration is the configuration for a ByteFIFOQueue
|
// ByteFIFOQueueConfiguration is the configuration for a ByteFIFOQueue
|
||||||
|
@ -71,6 +71,7 @@ func (q *ByteFIFOQueue) PushFunc(data Data, fn func() error) error {
|
||||||
if !assignableTo(data, q.exemplar) {
|
if !assignableTo(data, q.exemplar) {
|
||||||
return fmt.Errorf("Unable to assign data: %v to same type as exemplar: %v in %s", data, q.exemplar, q.name)
|
return fmt.Errorf("Unable to assign data: %v to same type as exemplar: %v in %s", data, q.exemplar, q.name)
|
||||||
}
|
}
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
bs, err := json.Marshal(data)
|
bs, err := json.Marshal(data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -229,6 +230,7 @@ func (q *ByteFIFOUniqueQueue) Has(data Data) (bool, error) {
|
||||||
if !assignableTo(data, q.exemplar) {
|
if !assignableTo(data, q.exemplar) {
|
||||||
return false, fmt.Errorf("Unable to assign data: %v to same type as exemplar: %v in %s", data, q.exemplar, q.name)
|
return false, fmt.Errorf("Unable to assign data: %v to same type as exemplar: %v in %s", data, q.exemplar, q.name)
|
||||||
}
|
}
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
bs, err := json.Marshal(data)
|
bs, err := json.Marshal(data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
package queue
|
package queue
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ func TestToConfig(t *testing.T) {
|
||||||
assert.NotEqual(t, cfg2, exemplar)
|
assert.NotEqual(t, cfg2, exemplar)
|
||||||
assert.Equal(t, &cfg, &cfg2)
|
assert.Equal(t, &cfg, &cfg2)
|
||||||
|
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
cfgString, err := json.Marshal(cfg)
|
cfgString, err := json.Marshal(cfg)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
|
|
|
@ -5,12 +5,12 @@
|
||||||
package queue
|
package queue
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"code.gitea.io/gitea/modules/log"
|
"code.gitea.io/gitea/modules/log"
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
func validType(t string) (Type, error) {
|
func validType(t string) (Type, error) {
|
||||||
|
@ -28,6 +28,7 @@ func validType(t string) (Type, error) {
|
||||||
func getQueueSettings(name string) (setting.QueueSettings, []byte) {
|
func getQueueSettings(name string) (setting.QueueSettings, []byte) {
|
||||||
q := setting.GetQueueSettings(name)
|
q := setting.GetQueueSettings(name)
|
||||||
|
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
cfg, err := json.Marshal(q)
|
cfg, err := json.Marshal(q)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Unable to marshall generic options: %v Error: %v", q, err)
|
log.Error("Unable to marshall generic options: %v Error: %v", q, err)
|
||||||
|
|
|
@ -6,7 +6,6 @@ package recaptcha
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -15,6 +14,7 @@ import (
|
||||||
|
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
"code.gitea.io/gitea/modules/util"
|
"code.gitea.io/gitea/modules/util"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Response is the structure of JSON returned from API
|
// Response is the structure of JSON returned from API
|
||||||
|
@ -51,6 +51,7 @@ func Verify(ctx context.Context, response string) (bool, error) {
|
||||||
return false, fmt.Errorf("Failed to read CAPTCHA response: %s", err)
|
return false, fmt.Errorf("Failed to read CAPTCHA response: %s", err)
|
||||||
}
|
}
|
||||||
var jsonResponse Response
|
var jsonResponse Response
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
err = json.Unmarshal(body, &jsonResponse)
|
err = json.Unmarshal(body, &jsonResponse)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, fmt.Errorf("Failed to parse CAPTCHA response: %s", err)
|
return false, fmt.Errorf("Failed to parse CAPTCHA response: %s", err)
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
package session
|
package session
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
@ -14,6 +13,7 @@ import (
|
||||||
memcache "gitea.com/go-chi/session/memcache"
|
memcache "gitea.com/go-chi/session/memcache"
|
||||||
mysql "gitea.com/go-chi/session/mysql"
|
mysql "gitea.com/go-chi/session/mysql"
|
||||||
postgres "gitea.com/go-chi/session/postgres"
|
postgres "gitea.com/go-chi/session/postgres"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
// VirtualSessionProvider represents a shadowed session provider implementation.
|
// VirtualSessionProvider represents a shadowed session provider implementation.
|
||||||
|
@ -25,6 +25,7 @@ type VirtualSessionProvider struct {
|
||||||
// Init initializes the cookie session provider with given root path.
|
// Init initializes the cookie session provider with given root path.
|
||||||
func (o *VirtualSessionProvider) Init(gclifetime int64, config string) error {
|
func (o *VirtualSessionProvider) Init(gclifetime int64, config string) error {
|
||||||
var opts session.Options
|
var opts session.Options
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
if err := json.Unmarshal([]byte(config), &opts); err != nil {
|
if err := json.Unmarshal([]byte(config), &opts); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
package setting
|
package setting
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
golog "log"
|
golog "log"
|
||||||
"os"
|
"os"
|
||||||
|
@ -15,6 +14,7 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"code.gitea.io/gitea/modules/log"
|
"code.gitea.io/gitea/modules/log"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
|
|
||||||
ini "gopkg.in/ini.v1"
|
ini "gopkg.in/ini.v1"
|
||||||
)
|
)
|
||||||
|
@ -205,6 +205,7 @@ func generateLogConfig(sec *ini.Section, name string, defaults defaultLogOptions
|
||||||
|
|
||||||
logConfig["colorize"] = sec.Key("COLORIZE").MustBool(false)
|
logConfig["colorize"] = sec.Key("COLORIZE").MustBool(false)
|
||||||
|
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
byteConfig, err := json.Marshal(logConfig)
|
byteConfig, err := json.Marshal(logConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Failed to marshal log configuration: %v %v", logConfig, err)
|
log.Error("Failed to marshal log configuration: %v %v", logConfig, err)
|
||||||
|
|
|
@ -5,12 +5,12 @@
|
||||||
package setting
|
package setting
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"code.gitea.io/gitea/modules/log"
|
"code.gitea.io/gitea/modules/log"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -53,6 +53,7 @@ func newSessionService() {
|
||||||
SessionConfig.Maxlifetime = sec.Key("SESSION_LIFE_TIME").MustInt64(86400)
|
SessionConfig.Maxlifetime = sec.Key("SESSION_LIFE_TIME").MustInt64(86400)
|
||||||
SessionConfig.Domain = sec.Key("DOMAIN").String()
|
SessionConfig.Domain = sec.Key("DOMAIN").String()
|
||||||
|
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
shadowConfig, err := json.Marshal(SessionConfig)
|
shadowConfig, err := json.Marshal(SessionConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal("Can't shadow session config: %v", err)
|
log.Fatal("Can't shadow session config: %v", err)
|
||||||
|
|
|
@ -7,7 +7,6 @@ package setting
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
@ -28,6 +27,7 @@ import (
|
||||||
"code.gitea.io/gitea/modules/user"
|
"code.gitea.io/gitea/modules/user"
|
||||||
"code.gitea.io/gitea/modules/util"
|
"code.gitea.io/gitea/modules/util"
|
||||||
|
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
shellquote "github.com/kballard/go-shellquote"
|
shellquote "github.com/kballard/go-shellquote"
|
||||||
"github.com/unknwon/com"
|
"github.com/unknwon/com"
|
||||||
gossh "golang.org/x/crypto/ssh"
|
gossh "golang.org/x/crypto/ssh"
|
||||||
|
@ -1111,6 +1111,7 @@ func MakeManifestData(appName string, appURL string, absoluteAssetURL string) []
|
||||||
Icons []manifestIcon `json:"icons"`
|
Icons []manifestIcon `json:"icons"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
bytes, err := json.Marshal(&manifestJSON{
|
bytes, err := json.Marshal(&manifestJSON{
|
||||||
Name: appName,
|
Name: appName,
|
||||||
ShortName: appName,
|
ShortName: appName,
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
package setting
|
package setting
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -28,5 +28,6 @@ func TestMakeAbsoluteAssetURL(t *testing.T) {
|
||||||
|
|
||||||
func TestMakeManifestData(t *testing.T) {
|
func TestMakeManifestData(t *testing.T) {
|
||||||
jsonBytes := MakeManifestData(`Example App '\"`, "https://example.com", "https://example.com/foo/bar")
|
jsonBytes := MakeManifestData(`Example App '\"`, "https://example.com", "https://example.com/foo/bar")
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
assert.True(t, json.Valid(jsonBytes))
|
assert.True(t, json.Valid(jsonBytes))
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,9 @@
|
||||||
package storage
|
package storage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Mappable represents an interface that can MapTo another interface
|
// Mappable represents an interface that can MapTo another interface
|
||||||
|
@ -19,6 +20,7 @@ type Mappable interface {
|
||||||
// It will tolerate the cfg being passed as a []byte or string of a json representation of the
|
// It will tolerate the cfg being passed as a []byte or string of a json representation of the
|
||||||
// exemplar or the correct type of the exemplar itself
|
// exemplar or the correct type of the exemplar itself
|
||||||
func toConfig(exemplar, cfg interface{}) (interface{}, error) {
|
func toConfig(exemplar, cfg interface{}) (interface{}, error) {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
|
|
||||||
// First of all check if we've got the same type as the exemplar - if so it's all fine.
|
// First of all check if we've got the same type as the exemplar - if so it's all fine.
|
||||||
if reflect.TypeOf(cfg).AssignableTo(reflect.TypeOf(exemplar)) {
|
if reflect.TypeOf(cfg).AssignableTo(reflect.TypeOf(exemplar)) {
|
||||||
|
|
|
@ -6,10 +6,11 @@
|
||||||
package structs
|
package structs
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"errors"
|
"errors"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -138,12 +139,14 @@ func (p *CreatePayload) SetSecret(secret string) {
|
||||||
|
|
||||||
// JSONPayload return payload information
|
// JSONPayload return payload information
|
||||||
func (p *CreatePayload) JSONPayload() ([]byte, error) {
|
func (p *CreatePayload) JSONPayload() ([]byte, error) {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
return json.MarshalIndent(p, "", " ")
|
return json.MarshalIndent(p, "", " ")
|
||||||
}
|
}
|
||||||
|
|
||||||
// ParseCreateHook parses create event hook content.
|
// ParseCreateHook parses create event hook content.
|
||||||
func ParseCreateHook(raw []byte) (*CreatePayload, error) {
|
func ParseCreateHook(raw []byte) (*CreatePayload, error) {
|
||||||
hook := new(CreatePayload)
|
hook := new(CreatePayload)
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
if err := json.Unmarshal(raw, hook); err != nil {
|
if err := json.Unmarshal(raw, hook); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -193,6 +196,7 @@ func (p *DeletePayload) SetSecret(secret string) {
|
||||||
|
|
||||||
// JSONPayload implements Payload
|
// JSONPayload implements Payload
|
||||||
func (p *DeletePayload) JSONPayload() ([]byte, error) {
|
func (p *DeletePayload) JSONPayload() ([]byte, error) {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
return json.MarshalIndent(p, "", " ")
|
return json.MarshalIndent(p, "", " ")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,6 +222,7 @@ func (p *ForkPayload) SetSecret(secret string) {
|
||||||
|
|
||||||
// JSONPayload implements Payload
|
// JSONPayload implements Payload
|
||||||
func (p *ForkPayload) JSONPayload() ([]byte, error) {
|
func (p *ForkPayload) JSONPayload() ([]byte, error) {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
return json.MarshalIndent(p, "", " ")
|
return json.MarshalIndent(p, "", " ")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,6 +255,7 @@ func (p *IssueCommentPayload) SetSecret(secret string) {
|
||||||
|
|
||||||
// JSONPayload implements Payload
|
// JSONPayload implements Payload
|
||||||
func (p *IssueCommentPayload) JSONPayload() ([]byte, error) {
|
func (p *IssueCommentPayload) JSONPayload() ([]byte, error) {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
return json.MarshalIndent(p, "", " ")
|
return json.MarshalIndent(p, "", " ")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,6 +292,7 @@ func (p *ReleasePayload) SetSecret(secret string) {
|
||||||
|
|
||||||
// JSONPayload implements Payload
|
// JSONPayload implements Payload
|
||||||
func (p *ReleasePayload) JSONPayload() ([]byte, error) {
|
func (p *ReleasePayload) JSONPayload() ([]byte, error) {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
return json.MarshalIndent(p, "", " ")
|
return json.MarshalIndent(p, "", " ")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,12 +324,14 @@ func (p *PushPayload) SetSecret(secret string) {
|
||||||
|
|
||||||
// JSONPayload FIXME
|
// JSONPayload FIXME
|
||||||
func (p *PushPayload) JSONPayload() ([]byte, error) {
|
func (p *PushPayload) JSONPayload() ([]byte, error) {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
return json.MarshalIndent(p, "", " ")
|
return json.MarshalIndent(p, "", " ")
|
||||||
}
|
}
|
||||||
|
|
||||||
// ParsePushHook parses push event hook content.
|
// ParsePushHook parses push event hook content.
|
||||||
func ParsePushHook(raw []byte) (*PushPayload, error) {
|
func ParsePushHook(raw []byte) (*PushPayload, error) {
|
||||||
hook := new(PushPayload)
|
hook := new(PushPayload)
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
if err := json.Unmarshal(raw, hook); err != nil {
|
if err := json.Unmarshal(raw, hook); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -396,6 +405,7 @@ func (p *IssuePayload) SetSecret(secret string) {
|
||||||
|
|
||||||
// JSONPayload encodes the IssuePayload to JSON, with an indentation of two spaces.
|
// JSONPayload encodes the IssuePayload to JSON, with an indentation of two spaces.
|
||||||
func (p *IssuePayload) JSONPayload() ([]byte, error) {
|
func (p *IssuePayload) JSONPayload() ([]byte, error) {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
return json.MarshalIndent(p, "", " ")
|
return json.MarshalIndent(p, "", " ")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -437,6 +447,7 @@ func (p *PullRequestPayload) SetSecret(secret string) {
|
||||||
|
|
||||||
// JSONPayload FIXME
|
// JSONPayload FIXME
|
||||||
func (p *PullRequestPayload) JSONPayload() ([]byte, error) {
|
func (p *PullRequestPayload) JSONPayload() ([]byte, error) {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
return json.MarshalIndent(p, "", " ")
|
return json.MarshalIndent(p, "", " ")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -479,5 +490,6 @@ func (p *RepositoryPayload) SetSecret(secret string) {
|
||||||
|
|
||||||
// JSONPayload JSON representation of the payload
|
// JSONPayload JSON representation of the payload
|
||||||
func (p *RepositoryPayload) JSONPayload() ([]byte, error) {
|
func (p *RepositoryPayload) JSONPayload() ([]byte, error) {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
return json.MarshalIndent(p, "", " ")
|
return json.MarshalIndent(p, "", " ")
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,9 @@
|
||||||
package structs
|
package structs
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
// User represents a user
|
// User represents a user
|
||||||
|
@ -38,6 +39,7 @@ type User struct {
|
||||||
func (u User) MarshalJSON() ([]byte, error) {
|
func (u User) MarshalJSON() ([]byte, error) {
|
||||||
// Re-declaring User to avoid recursion
|
// Re-declaring User to avoid recursion
|
||||||
type shadow User
|
type shadow User
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
return json.Marshal(struct {
|
return json.Marshal(struct {
|
||||||
shadow
|
shadow
|
||||||
CompatUserName string `json:"username"`
|
CompatUserName string `json:"username"`
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
package task
|
package task
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"code.gitea.io/gitea/models"
|
"code.gitea.io/gitea/models"
|
||||||
|
@ -16,6 +15,7 @@ import (
|
||||||
repo_module "code.gitea.io/gitea/modules/repository"
|
repo_module "code.gitea.io/gitea/modules/repository"
|
||||||
"code.gitea.io/gitea/modules/structs"
|
"code.gitea.io/gitea/modules/structs"
|
||||||
"code.gitea.io/gitea/modules/timeutil"
|
"code.gitea.io/gitea/modules/timeutil"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
// taskQueue is a global queue of tasks
|
// taskQueue is a global queue of tasks
|
||||||
|
@ -65,6 +65,7 @@ func MigrateRepository(doer, u *models.User, opts base.MigrateOptions) error {
|
||||||
|
|
||||||
// CreateMigrateTask creates a migrate task
|
// CreateMigrateTask creates a migrate task
|
||||||
func CreateMigrateTask(doer, u *models.User, opts base.MigrateOptions) (*models.Task, error) {
|
func CreateMigrateTask(doer, u *models.User, opts base.MigrateOptions) (*models.Task, error) {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
bs, err := json.Marshal(&opts)
|
bs, err := json.Marshal(&opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
@ -38,6 +38,7 @@ import (
|
||||||
mirror_service "code.gitea.io/gitea/services/mirror"
|
mirror_service "code.gitea.io/gitea/services/mirror"
|
||||||
|
|
||||||
"github.com/editorconfig/editorconfig-core-go/v2"
|
"github.com/editorconfig/editorconfig-core-go/v2"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Used from static.go && dynamic.go
|
// Used from static.go && dynamic.go
|
||||||
|
@ -45,6 +46,7 @@ var mailSubjectSplit = regexp.MustCompile(`(?m)^-{3,}[\s]*$`)
|
||||||
|
|
||||||
// NewFuncMap returns functions for injecting to templates
|
// NewFuncMap returns functions for injecting to templates
|
||||||
func NewFuncMap() []template.FuncMap {
|
func NewFuncMap() []template.FuncMap {
|
||||||
|
jsonED := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
return []template.FuncMap{map[string]interface{}{
|
return []template.FuncMap{map[string]interface{}{
|
||||||
"GoVer": func() string {
|
"GoVer": func() string {
|
||||||
return strings.Title(runtime.Version())
|
return strings.Title(runtime.Version())
|
||||||
|
@ -215,7 +217,7 @@ func NewFuncMap() []template.FuncMap {
|
||||||
return fmt.Sprintf("%f", float64(adds)/(float64(adds)+float64(dels))*100)
|
return fmt.Sprintf("%f", float64(adds)/(float64(adds)+float64(dels))*100)
|
||||||
},
|
},
|
||||||
"Json": func(in interface{}) string {
|
"Json": func(in interface{}) string {
|
||||||
out, err := json.Marshal(in)
|
out, err := jsonED.Marshal(in)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
@ -814,6 +816,8 @@ func ActionIcon(opType models.ActionType) string {
|
||||||
// ActionContent2Commits converts action content to push commits
|
// ActionContent2Commits converts action content to push commits
|
||||||
func ActionContent2Commits(act Actioner) *repository.PushCommits {
|
func ActionContent2Commits(act Actioner) *repository.PushCommits {
|
||||||
push := repository.NewPushCommits()
|
push := repository.NewPushCommits()
|
||||||
|
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
if err := json.Unmarshal([]byte(act.GetContent()), push); err != nil {
|
if err := json.Unmarshal([]byte(act.GetContent()), push); err != nil {
|
||||||
log.Error("json.Unmarshal:\n%s\nERROR: %v", act.GetContent(), err)
|
log.Error("json.Unmarshal:\n%s\nERROR: %v", act.GetContent(), err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
package admin
|
package admin
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
|
@ -28,6 +27,7 @@ import (
|
||||||
"code.gitea.io/gitea/modules/timeutil"
|
"code.gitea.io/gitea/modules/timeutil"
|
||||||
"code.gitea.io/gitea/modules/web"
|
"code.gitea.io/gitea/modules/web"
|
||||||
"code.gitea.io/gitea/services/mailer"
|
"code.gitea.io/gitea/services/mailer"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
|
|
||||||
"gitea.com/go-chi/session"
|
"gitea.com/go-chi/session"
|
||||||
)
|
)
|
||||||
|
@ -274,6 +274,7 @@ func Config(ctx *context.Context) {
|
||||||
sessionCfg := setting.SessionConfig
|
sessionCfg := setting.SessionConfig
|
||||||
if sessionCfg.Provider == "VirtualSession" {
|
if sessionCfg.Provider == "VirtualSession" {
|
||||||
var realSession session.Options
|
var realSession session.Options
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
if err := json.Unmarshal([]byte(sessionCfg.ProviderConfig), &realSession); err != nil {
|
if err := json.Unmarshal([]byte(sessionCfg.ProviderConfig), &realSession); err != nil {
|
||||||
log.Error("Unable to unmarshall session config for virtualed provider config: %s\nError: %v", sessionCfg.ProviderConfig, err)
|
log.Error("Unable to unmarshall session config for virtualed provider config: %s\nError: %v", sessionCfg.ProviderConfig, err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
package utils
|
package utils
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -17,6 +16,7 @@ import (
|
||||||
"code.gitea.io/gitea/modules/util"
|
"code.gitea.io/gitea/modules/util"
|
||||||
"code.gitea.io/gitea/routers/utils"
|
"code.gitea.io/gitea/routers/utils"
|
||||||
"code.gitea.io/gitea/services/webhook"
|
"code.gitea.io/gitea/services/webhook"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetOrgHook get an organization's webhook. If there is an error, write to
|
// GetOrgHook get an organization's webhook. If there is an error, write to
|
||||||
|
@ -147,6 +147,7 @@ func addHook(ctx *context.APIContext, form *api.CreateHookOption, orgID, repoID
|
||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
meta, err := json.Marshal(&webhook.SlackMeta{
|
meta, err := json.Marshal(&webhook.SlackMeta{
|
||||||
Channel: strings.TrimSpace(channel),
|
Channel: strings.TrimSpace(channel),
|
||||||
Username: form.Config["username"],
|
Username: form.Config["username"],
|
||||||
|
@ -221,6 +222,7 @@ func editHook(ctx *context.APIContext, form *api.EditHookOption, w *models.Webho
|
||||||
|
|
||||||
if w.Type == models.SLACK {
|
if w.Type == models.SLACK {
|
||||||
if channel, ok := form.Config["channel"]; ok {
|
if channel, ok := form.Config["channel"]; ok {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
meta, err := json.Marshal(&webhook.SlackMeta{
|
meta, err := json.Marshal(&webhook.SlackMeta{
|
||||||
Channel: channel,
|
Channel: channel,
|
||||||
Username: form.Config["username"],
|
Username: form.Config["username"],
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
package events
|
package events
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -17,6 +16,7 @@ import (
|
||||||
"code.gitea.io/gitea/modules/log"
|
"code.gitea.io/gitea/modules/log"
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
"code.gitea.io/gitea/routers/user"
|
"code.gitea.io/gitea/routers/user"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Events listens for events
|
// Events listens for events
|
||||||
|
@ -92,6 +92,7 @@ loop:
|
||||||
log.Error("Unable to APIFormat stopwatches: %v", err)
|
log.Error("Unable to APIFormat stopwatches: %v", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
dataBs, err := json.Marshal(apiSWs)
|
dataBs, err := json.Marshal(apiSWs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Unable to marshal stopwatches: %v", err)
|
log.Error("Unable to marshal stopwatches: %v", err)
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
package private
|
package private
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
@ -16,6 +15,7 @@ import (
|
||||||
"code.gitea.io/gitea/modules/private"
|
"code.gitea.io/gitea/modules/private"
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
"code.gitea.io/gitea/services/mailer"
|
"code.gitea.io/gitea/services/mailer"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SendEmail pushes messages to mail queue
|
// SendEmail pushes messages to mail queue
|
||||||
|
@ -32,6 +32,7 @@ func SendEmail(ctx *context.PrivateContext) {
|
||||||
var mail private.Email
|
var mail private.Email
|
||||||
rd := ctx.Req.Body
|
rd := ctx.Req.Body
|
||||||
defer rd.Close()
|
defer rd.Close()
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
if err := json.NewDecoder(rd).Decode(&mail); err != nil {
|
if err := json.NewDecoder(rd).Decode(&mail); err != nil {
|
||||||
log.Error("%v", err)
|
log.Error("%v", err)
|
||||||
ctx.JSON(http.StatusInternalServerError, map[string]interface{}{
|
ctx.JSON(http.StatusInternalServerError, map[string]interface{}{
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
package private
|
package private
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
@ -16,6 +15,7 @@ import (
|
||||||
"code.gitea.io/gitea/modules/queue"
|
"code.gitea.io/gitea/modules/queue"
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
"code.gitea.io/gitea/modules/web"
|
"code.gitea.io/gitea/modules/web"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
// FlushQueues flushes all the Queues
|
// FlushQueues flushes all the Queues
|
||||||
|
@ -130,6 +130,7 @@ func AddLogger(ctx *context.PrivateContext) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bufferLen := setting.Cfg.Section("log").Key("BUFFER_LEN").MustInt64(10000)
|
bufferLen := setting.Cfg.Section("log").Key("BUFFER_LEN").MustInt64(10000)
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
byteConfig, err := json.Marshal(opts.Config)
|
byteConfig, err := json.Marshal(opts.Config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Failed to marshal log configuration: %v %v", opts.Config, err)
|
log.Error("Failed to marshal log configuration: %v %v", opts.Config, err)
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
package repo
|
package repo
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"path"
|
"path"
|
||||||
|
@ -25,6 +24,7 @@ import (
|
||||||
"code.gitea.io/gitea/modules/util"
|
"code.gitea.io/gitea/modules/util"
|
||||||
"code.gitea.io/gitea/modules/web"
|
"code.gitea.io/gitea/modules/web"
|
||||||
"code.gitea.io/gitea/routers/utils"
|
"code.gitea.io/gitea/routers/utils"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -158,6 +158,7 @@ func GetEditorConfig(ctx *context.Context, treePath string) string {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
def, err := ec.GetDefinitionForFilename(treePath)
|
def, err := ec.GetDefinitionForFilename(treePath)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
jsonStr, _ := json.Marshal(def)
|
jsonStr, _ := json.Marshal(def)
|
||||||
return string(jsonStr)
|
return string(jsonStr)
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
package repo
|
package repo
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"path"
|
"path"
|
||||||
|
@ -23,6 +22,7 @@ import (
|
||||||
"code.gitea.io/gitea/modules/util"
|
"code.gitea.io/gitea/modules/util"
|
||||||
"code.gitea.io/gitea/modules/web"
|
"code.gitea.io/gitea/modules/web"
|
||||||
"code.gitea.io/gitea/services/webhook"
|
"code.gitea.io/gitea/services/webhook"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -305,6 +305,7 @@ func DiscordHooksNewPost(ctx *context.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
meta, err := json.Marshal(&webhook.DiscordMeta{
|
meta, err := json.Marshal(&webhook.DiscordMeta{
|
||||||
Username: form.Username,
|
Username: form.Username,
|
||||||
IconURL: form.IconURL,
|
IconURL: form.IconURL,
|
||||||
|
@ -400,6 +401,7 @@ func TelegramHooksNewPost(ctx *context.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
meta, err := json.Marshal(&webhook.TelegramMeta{
|
meta, err := json.Marshal(&webhook.TelegramMeta{
|
||||||
BotToken: form.BotToken,
|
BotToken: form.BotToken,
|
||||||
ChatID: form.ChatID,
|
ChatID: form.ChatID,
|
||||||
|
@ -452,6 +454,7 @@ func MatrixHooksNewPost(ctx *context.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
meta, err := json.Marshal(&webhook.MatrixMeta{
|
meta, err := json.Marshal(&webhook.MatrixMeta{
|
||||||
HomeserverURL: form.HomeserverURL,
|
HomeserverURL: form.HomeserverURL,
|
||||||
Room: form.RoomID,
|
Room: form.RoomID,
|
||||||
|
@ -556,6 +559,7 @@ func SlackHooksNewPost(ctx *context.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
meta, err := json.Marshal(&webhook.SlackMeta{
|
meta, err := json.Marshal(&webhook.SlackMeta{
|
||||||
Channel: strings.TrimSpace(form.Channel),
|
Channel: strings.TrimSpace(form.Channel),
|
||||||
Username: form.Username,
|
Username: form.Username,
|
||||||
|
@ -799,6 +803,7 @@ func SlackHooksEditPost(ctx *context.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
meta, err := json.Marshal(&webhook.SlackMeta{
|
meta, err := json.Marshal(&webhook.SlackMeta{
|
||||||
Channel: strings.TrimSpace(form.Channel),
|
Channel: strings.TrimSpace(form.Channel),
|
||||||
Username: form.Username,
|
Username: form.Username,
|
||||||
|
@ -844,6 +849,7 @@ func DiscordHooksEditPost(ctx *context.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
meta, err := json.Marshal(&webhook.DiscordMeta{
|
meta, err := json.Marshal(&webhook.DiscordMeta{
|
||||||
Username: form.Username,
|
Username: form.Username,
|
||||||
IconURL: form.IconURL,
|
IconURL: form.IconURL,
|
||||||
|
@ -919,6 +925,7 @@ func TelegramHooksEditPost(ctx *context.Context) {
|
||||||
ctx.HTML(200, orCtx.NewTemplate)
|
ctx.HTML(200, orCtx.NewTemplate)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
meta, err := json.Marshal(&webhook.TelegramMeta{
|
meta, err := json.Marshal(&webhook.TelegramMeta{
|
||||||
BotToken: form.BotToken,
|
BotToken: form.BotToken,
|
||||||
ChatID: form.ChatID,
|
ChatID: form.ChatID,
|
||||||
|
@ -960,6 +967,7 @@ func MatrixHooksEditPost(ctx *context.Context) {
|
||||||
ctx.HTML(200, orCtx.NewTemplate)
|
ctx.HTML(200, orCtx.NewTemplate)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
meta, err := json.Marshal(&webhook.MatrixMeta{
|
meta, err := json.Marshal(&webhook.MatrixMeta{
|
||||||
HomeserverURL: form.HomeserverURL,
|
HomeserverURL: form.HomeserverURL,
|
||||||
Room: form.RoomID,
|
Room: form.RoomID,
|
||||||
|
|
|
@ -7,7 +7,6 @@ package user
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"regexp"
|
"regexp"
|
||||||
"sort"
|
"sort"
|
||||||
|
@ -25,6 +24,7 @@ import (
|
||||||
issue_service "code.gitea.io/gitea/services/issue"
|
issue_service "code.gitea.io/gitea/services/issue"
|
||||||
pull_service "code.gitea.io/gitea/services/pull"
|
pull_service "code.gitea.io/gitea/services/pull"
|
||||||
|
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
"github.com/keybase/go-crypto/openpgp"
|
"github.com/keybase/go-crypto/openpgp"
|
||||||
"github.com/keybase/go-crypto/openpgp/armor"
|
"github.com/keybase/go-crypto/openpgp/armor"
|
||||||
"xorm.io/builder"
|
"xorm.io/builder"
|
||||||
|
@ -691,6 +691,7 @@ func buildIssueOverview(ctx *context.Context, unitType models.UnitType) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert []int64 to string
|
// Convert []int64 to string
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
reposParam, _ := json.Marshal(repoIDs)
|
reposParam, _ := json.Marshal(repoIDs)
|
||||||
|
|
||||||
ctx.Data["ReposParam"] = string(reposParam)
|
ctx.Data["ReposParam"] = string(reposParam)
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
package gitdiff
|
package gitdiff
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"html/template"
|
"html/template"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
@ -17,6 +16,7 @@ import (
|
||||||
"code.gitea.io/gitea/modules/git"
|
"code.gitea.io/gitea/modules/git"
|
||||||
"code.gitea.io/gitea/modules/highlight"
|
"code.gitea.io/gitea/modules/highlight"
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
dmp "github.com/sergi/go-diff/diffmatchpatch"
|
dmp "github.com/sergi/go-diff/diffmatchpatch"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"gopkg.in/ini.v1"
|
"gopkg.in/ini.v1"
|
||||||
|
@ -298,7 +298,8 @@ index 6961180..9ba1a00 100644
|
||||||
t.Errorf("ParsePatch(%q) error = %v, wantErr %v", testcase.name, err, testcase.wantErr)
|
t.Errorf("ParsePatch(%q) error = %v, wantErr %v", testcase.name, err, testcase.wantErr)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
gotMarshaled, _ := json.MarshalIndent(got, " ", " ")
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
|
gotMarshaled, _ := json.MarshalIndent(got, "", " ")
|
||||||
if got.NumFiles != 1 {
|
if got.NumFiles != 1 {
|
||||||
t.Errorf("ParsePath(%q) did not receive 1 file:\n%s", testcase.name, string(gotMarshaled))
|
t.Errorf("ParsePath(%q) did not receive 1 file:\n%s", testcase.name, string(gotMarshaled))
|
||||||
return
|
return
|
||||||
|
|
|
@ -8,7 +8,6 @@ import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -21,6 +20,7 @@ import (
|
||||||
"code.gitea.io/gitea/modules/notification"
|
"code.gitea.io/gitea/modules/notification"
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
issue_service "code.gitea.io/gitea/services/issue"
|
issue_service "code.gitea.io/gitea/services/issue"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewPullRequest creates new pull request with labels for repository.
|
// NewPullRequest creates new pull request with labels for repository.
|
||||||
|
@ -86,6 +86,7 @@ func NewPullRequest(repo *models.Repository, pull *models.Issue, labelIDs []int6
|
||||||
data.CommitIDs = append(data.CommitIDs, e.Value.(*git.Commit).ID.String())
|
data.CommitIDs = append(data.CommitIDs, e.Value.(*git.Commit).ID.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
dataJSON, err := json.Marshal(data)
|
dataJSON, err := json.Marshal(data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
package webhook
|
package webhook
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
@ -13,6 +12,7 @@ import (
|
||||||
"code.gitea.io/gitea/modules/git"
|
"code.gitea.io/gitea/modules/git"
|
||||||
api "code.gitea.io/gitea/modules/structs"
|
api "code.gitea.io/gitea/modules/structs"
|
||||||
|
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
dingtalk "github.com/lunny/dingtalk_webhook"
|
dingtalk "github.com/lunny/dingtalk_webhook"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ func (d *DingtalkPayload) SetSecret(_ string) {}
|
||||||
|
|
||||||
// JSONPayload Marshals the DingtalkPayload to json
|
// JSONPayload Marshals the DingtalkPayload to json
|
||||||
func (d *DingtalkPayload) JSONPayload() ([]byte, error) {
|
func (d *DingtalkPayload) JSONPayload() ([]byte, error) {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
data, err := json.MarshalIndent(d, "", " ")
|
data, err := json.MarshalIndent(d, "", " ")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return []byte{}, err
|
return []byte{}, err
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
package webhook
|
package webhook
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
@ -16,6 +15,7 @@ import (
|
||||||
"code.gitea.io/gitea/modules/log"
|
"code.gitea.io/gitea/modules/log"
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
api "code.gitea.io/gitea/modules/structs"
|
api "code.gitea.io/gitea/modules/structs"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
@ -68,6 +68,7 @@ type (
|
||||||
// GetDiscordHook returns discord metadata
|
// GetDiscordHook returns discord metadata
|
||||||
func GetDiscordHook(w *models.Webhook) *DiscordMeta {
|
func GetDiscordHook(w *models.Webhook) *DiscordMeta {
|
||||||
s := &DiscordMeta{}
|
s := &DiscordMeta{}
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
if err := json.Unmarshal([]byte(w.Meta), s); err != nil {
|
if err := json.Unmarshal([]byte(w.Meta), s); err != nil {
|
||||||
log.Error("webhook.GetDiscordHook(%d): %v", w.ID, err)
|
log.Error("webhook.GetDiscordHook(%d): %v", w.ID, err)
|
||||||
}
|
}
|
||||||
|
@ -101,6 +102,7 @@ func (d *DiscordPayload) SetSecret(_ string) {}
|
||||||
|
|
||||||
// JSONPayload Marshals the DiscordPayload to json
|
// JSONPayload Marshals the DiscordPayload to json
|
||||||
func (d *DiscordPayload) JSONPayload() ([]byte, error) {
|
func (d *DiscordPayload) JSONPayload() ([]byte, error) {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
data, err := json.MarshalIndent(d, "", " ")
|
data, err := json.MarshalIndent(d, "", " ")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return []byte{}, err
|
return []byte{}, err
|
||||||
|
@ -407,6 +409,7 @@ func GetDiscordPayload(p api.Payloader, event models.HookEventType, meta string)
|
||||||
s := new(DiscordPayload)
|
s := new(DiscordPayload)
|
||||||
|
|
||||||
discord := &DiscordMeta{}
|
discord := &DiscordMeta{}
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
if err := json.Unmarshal([]byte(meta), &discord); err != nil {
|
if err := json.Unmarshal([]byte(meta), &discord); err != nil {
|
||||||
return s, errors.New("GetDiscordPayload meta json:" + err.Error())
|
return s, errors.New("GetDiscordPayload meta json:" + err.Error())
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,13 +5,13 @@
|
||||||
package webhook
|
package webhook
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"code.gitea.io/gitea/models"
|
"code.gitea.io/gitea/models"
|
||||||
"code.gitea.io/gitea/modules/git"
|
"code.gitea.io/gitea/modules/git"
|
||||||
api "code.gitea.io/gitea/modules/structs"
|
api "code.gitea.io/gitea/modules/structs"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
@ -40,6 +40,7 @@ func (f *FeishuPayload) SetSecret(_ string) {}
|
||||||
|
|
||||||
// JSONPayload Marshals the FeishuPayload to json
|
// JSONPayload Marshals the FeishuPayload to json
|
||||||
func (f *FeishuPayload) JSONPayload() ([]byte, error) {
|
func (f *FeishuPayload) JSONPayload() ([]byte, error) {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
data, err := json.MarshalIndent(f, "", " ")
|
data, err := json.MarshalIndent(f, "", " ")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return []byte{}, err
|
return []byte{}, err
|
||||||
|
|
|
@ -6,7 +6,6 @@ package webhook
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/sha1"
|
"crypto/sha1"
|
||||||
"encoding/json"
|
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"html"
|
"html"
|
||||||
|
@ -19,6 +18,7 @@ import (
|
||||||
"code.gitea.io/gitea/modules/log"
|
"code.gitea.io/gitea/modules/log"
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
api "code.gitea.io/gitea/modules/structs"
|
api "code.gitea.io/gitea/modules/structs"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
const matrixPayloadSizeLimit = 1024 * 64
|
const matrixPayloadSizeLimit = 1024 * 64
|
||||||
|
@ -39,6 +39,7 @@ var messageTypeText = map[int]string{
|
||||||
// GetMatrixHook returns Matrix metadata
|
// GetMatrixHook returns Matrix metadata
|
||||||
func GetMatrixHook(w *models.Webhook) *MatrixMeta {
|
func GetMatrixHook(w *models.Webhook) *MatrixMeta {
|
||||||
s := &MatrixMeta{}
|
s := &MatrixMeta{}
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
if err := json.Unmarshal([]byte(w.Meta), s); err != nil {
|
if err := json.Unmarshal([]byte(w.Meta), s); err != nil {
|
||||||
log.Error("webhook.GetMatrixHook(%d): %v", w.ID, err)
|
log.Error("webhook.GetMatrixHook(%d): %v", w.ID, err)
|
||||||
}
|
}
|
||||||
|
@ -80,6 +81,7 @@ func (m *MatrixPayloadUnsafe) SetSecret(_ string) {}
|
||||||
|
|
||||||
// JSONPayload Marshals the MatrixPayloadUnsafe to json
|
// JSONPayload Marshals the MatrixPayloadUnsafe to json
|
||||||
func (m *MatrixPayloadUnsafe) JSONPayload() ([]byte, error) {
|
func (m *MatrixPayloadUnsafe) JSONPayload() ([]byte, error) {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
data, err := json.MarshalIndent(m, "", " ")
|
data, err := json.MarshalIndent(m, "", " ")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return []byte{}, err
|
return []byte{}, err
|
||||||
|
@ -229,6 +231,7 @@ func GetMatrixPayload(p api.Payloader, event models.HookEventType, meta string)
|
||||||
s := new(MatrixPayloadUnsafe)
|
s := new(MatrixPayloadUnsafe)
|
||||||
|
|
||||||
matrix := &MatrixMeta{}
|
matrix := &MatrixMeta{}
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
if err := json.Unmarshal([]byte(meta), &matrix); err != nil {
|
if err := json.Unmarshal([]byte(meta), &matrix); err != nil {
|
||||||
return s, errors.New("GetMatrixPayload meta json:" + err.Error())
|
return s, errors.New("GetMatrixPayload meta json:" + err.Error())
|
||||||
}
|
}
|
||||||
|
@ -262,6 +265,7 @@ func getMessageBody(htmlText string) string {
|
||||||
// The access_token is removed from t.PayloadContent
|
// The access_token is removed from t.PayloadContent
|
||||||
func getMatrixHookRequest(t *models.HookTask) (*http.Request, error) {
|
func getMatrixHookRequest(t *models.HookTask) (*http.Request, error) {
|
||||||
payloadunsafe := MatrixPayloadUnsafe{}
|
payloadunsafe := MatrixPayloadUnsafe{}
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
if err := json.Unmarshal([]byte(t.PayloadContent), &payloadunsafe); err != nil {
|
if err := json.Unmarshal([]byte(t.PayloadContent), &payloadunsafe); err != nil {
|
||||||
log.Error("Matrix Hook delivery failed: %v", err)
|
log.Error("Matrix Hook delivery failed: %v", err)
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
@ -5,13 +5,13 @@
|
||||||
package webhook
|
package webhook
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"code.gitea.io/gitea/models"
|
"code.gitea.io/gitea/models"
|
||||||
"code.gitea.io/gitea/modules/git"
|
"code.gitea.io/gitea/modules/git"
|
||||||
api "code.gitea.io/gitea/modules/structs"
|
api "code.gitea.io/gitea/modules/structs"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
@ -60,6 +60,7 @@ func (m *MSTeamsPayload) SetSecret(_ string) {}
|
||||||
|
|
||||||
// JSONPayload Marshals the MSTeamsPayload to json
|
// JSONPayload Marshals the MSTeamsPayload to json
|
||||||
func (m *MSTeamsPayload) JSONPayload() ([]byte, error) {
|
func (m *MSTeamsPayload) JSONPayload() ([]byte, error) {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
data, err := json.MarshalIndent(m, "", " ")
|
data, err := json.MarshalIndent(m, "", " ")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return []byte{}, err
|
return []byte{}, err
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
package webhook
|
package webhook
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -15,6 +14,7 @@ import (
|
||||||
"code.gitea.io/gitea/modules/log"
|
"code.gitea.io/gitea/modules/log"
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
api "code.gitea.io/gitea/modules/structs"
|
api "code.gitea.io/gitea/modules/structs"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SlackMeta contains the slack metadata
|
// SlackMeta contains the slack metadata
|
||||||
|
@ -28,6 +28,7 @@ type SlackMeta struct {
|
||||||
// GetSlackHook returns slack metadata
|
// GetSlackHook returns slack metadata
|
||||||
func GetSlackHook(w *models.Webhook) *SlackMeta {
|
func GetSlackHook(w *models.Webhook) *SlackMeta {
|
||||||
s := &SlackMeta{}
|
s := &SlackMeta{}
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
if err := json.Unmarshal([]byte(w.Meta), s); err != nil {
|
if err := json.Unmarshal([]byte(w.Meta), s); err != nil {
|
||||||
log.Error("webhook.GetSlackHook(%d): %v", w.ID, err)
|
log.Error("webhook.GetSlackHook(%d): %v", w.ID, err)
|
||||||
}
|
}
|
||||||
|
@ -60,6 +61,7 @@ func (s *SlackPayload) SetSecret(_ string) {}
|
||||||
|
|
||||||
// JSONPayload Marshals the SlackPayload to json
|
// JSONPayload Marshals the SlackPayload to json
|
||||||
func (s *SlackPayload) JSONPayload() ([]byte, error) {
|
func (s *SlackPayload) JSONPayload() ([]byte, error) {
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
data, err := json.MarshalIndent(s, "", " ")
|
data, err := json.MarshalIndent(s, "", " ")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return []byte{}, err
|
return []byte{}, err
|
||||||
|
@ -320,6 +322,7 @@ func GetSlackPayload(p api.Payloader, event models.HookEventType, meta string) (
|
||||||
s := new(SlackPayload)
|
s := new(SlackPayload)
|
||||||
|
|
||||||
slack := &SlackMeta{}
|
slack := &SlackMeta{}
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
if err := json.Unmarshal([]byte(meta), &slack); err != nil {
|
if err := json.Unmarshal([]byte(meta), &slack); err != nil {
|
||||||
return s, errors.New("GetSlackPayload meta json:" + err.Error())
|
return s, errors.New("GetSlackPayload meta json:" + err.Error())
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
package webhook
|
package webhook
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
@ -14,6 +13,7 @@ import (
|
||||||
"code.gitea.io/gitea/modules/log"
|
"code.gitea.io/gitea/modules/log"
|
||||||
"code.gitea.io/gitea/modules/markup"
|
"code.gitea.io/gitea/modules/markup"
|
||||||
api "code.gitea.io/gitea/modules/structs"
|
api "code.gitea.io/gitea/modules/structs"
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
@ -34,6 +34,7 @@ type (
|
||||||
// GetTelegramHook returns telegram metadata
|
// GetTelegramHook returns telegram metadata
|
||||||
func GetTelegramHook(w *models.Webhook) *TelegramMeta {
|
func GetTelegramHook(w *models.Webhook) *TelegramMeta {
|
||||||
s := &TelegramMeta{}
|
s := &TelegramMeta{}
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
if err := json.Unmarshal([]byte(w.Meta), s); err != nil {
|
if err := json.Unmarshal([]byte(w.Meta), s); err != nil {
|
||||||
log.Error("webhook.GetTelegramHook(%d): %v", w.ID, err)
|
log.Error("webhook.GetTelegramHook(%d): %v", w.ID, err)
|
||||||
}
|
}
|
||||||
|
@ -52,6 +53,7 @@ func (t *TelegramPayload) JSONPayload() ([]byte, error) {
|
||||||
t.ParseMode = "HTML"
|
t.ParseMode = "HTML"
|
||||||
t.DisableWebPreview = true
|
t.DisableWebPreview = true
|
||||||
t.Message = markup.Sanitize(t.Message)
|
t.Message = markup.Sanitize(t.Message)
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
data, err := json.MarshalIndent(t, "", " ")
|
data, err := json.MarshalIndent(t, "", " ")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return []byte{}, err
|
return []byte{}, err
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
package binding
|
package binding
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"mime/multipart"
|
"mime/multipart"
|
||||||
|
@ -30,6 +29,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"unicode/utf8"
|
"unicode/utf8"
|
||||||
|
|
||||||
|
jsoniter "github.com/json-iterator/go"
|
||||||
"github.com/unknwon/com"
|
"github.com/unknwon/com"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -89,6 +89,7 @@ func errorHandler(errs Errors, rw http.ResponseWriter) {
|
||||||
} else {
|
} else {
|
||||||
rw.WriteHeader(STATUS_UNPROCESSABLE_ENTITY)
|
rw.WriteHeader(STATUS_UNPROCESSABLE_ENTITY)
|
||||||
}
|
}
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
errOutput, _ := json.Marshal(errs)
|
errOutput, _ := json.Marshal(errs)
|
||||||
rw.Write(errOutput)
|
rw.Write(errOutput)
|
||||||
return
|
return
|
||||||
|
@ -171,6 +172,7 @@ func JSON(req *http.Request, jsonStruct interface{}) Errors {
|
||||||
|
|
||||||
if req.Body != nil {
|
if req.Body != nil {
|
||||||
defer req.Body.Close()
|
defer req.Body.Close()
|
||||||
|
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
err := json.NewDecoder(req.Body).Decode(jsonStruct)
|
err := json.NewDecoder(req.Body).Decode(jsonStruct)
|
||||||
if err != nil && err != io.EOF {
|
if err != nil && err != io.EOF {
|
||||||
errors.Add([]string{}, ERR_DESERIALIZATION, err.Error())
|
errors.Add([]string{}, ERR_DESERIALIZATION, err.Error())
|
||||||
|
|
|
@ -4,6 +4,7 @@ go 1.13
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/go-chi/chi v1.5.1
|
github.com/go-chi/chi v1.5.1
|
||||||
|
github.com/json-iterator/go v1.1.10
|
||||||
github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337
|
github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337
|
||||||
github.com/unknwon/com v0.0.0-20190804042917-757f69c95f3e
|
github.com/unknwon/com v0.0.0-20190804042917-757f69c95f3e
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,17 +1,32 @@
|
||||||
|
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/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/go-chi/chi v1.5.1 h1:kfTK3Cxd/dkMu/rKs5ZceWYp+t5CtiE7vmaTv3LjC6w=
|
github.com/go-chi/chi v1.5.1 h1:kfTK3Cxd/dkMu/rKs5ZceWYp+t5CtiE7vmaTv3LjC6w=
|
||||||
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/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||||
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/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68=
|
||||||
|
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||||
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=
|
||||||
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
|
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
|
||||||
|
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc=
|
||||||
|
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||||
|
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg=
|
||||||
|
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
||||||
github.com/smartystreets/assertions v0.0.0-20190116191733-b6c0e53d7304 h1:Jpy1PXuP99tXNrhbq2BaPz9B+jNAvH1JPQQpG/9GCXY=
|
github.com/smartystreets/assertions v0.0.0-20190116191733-b6c0e53d7304 h1:Jpy1PXuP99tXNrhbq2BaPz9B+jNAvH1JPQQpG/9GCXY=
|
||||||
github.com/smartystreets/assertions v0.0.0-20190116191733-b6c0e53d7304/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
github.com/smartystreets/assertions v0.0.0-20190116191733-b6c0e53d7304/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
||||||
github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s=
|
github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s=
|
||||||
github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337 h1:WN9BUFbdyOsSH/XohnWpXOlq9NBD5sGAB2FciQMUEe8=
|
github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337 h1:WN9BUFbdyOsSH/XohnWpXOlq9NBD5sGAB2FciQMUEe8=
|
||||||
github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||||
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
|
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
|
||||||
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
github.com/unknwon/com v0.0.0-20190804042917-757f69c95f3e h1:GSGeB9EAKY2spCABz6xOX5DbxZEXolK+nBSvmsQwRjM=
|
github.com/unknwon/com v0.0.0-20190804042917-757f69c95f3e h1:GSGeB9EAKY2spCABz6xOX5DbxZEXolK+nBSvmsQwRjM=
|
||||||
github.com/unknwon/com v0.0.0-20190804042917-757f69c95f3e/go.mod h1:tOOxU81rwgoCLoOVVPHb6T/wt8HZygqH5id+GNnlCXM=
|
github.com/unknwon/com v0.0.0-20190804042917-757f69c95f3e/go.mod h1:tOOxU81rwgoCLoOVVPHb6T/wt8HZygqH5id+GNnlCXM=
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M=
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M=
|
||||||
|
|
|
@ -8,7 +8,7 @@ code.gitea.io/gitea-vet/checks
|
||||||
# code.gitea.io/sdk/gitea v0.13.2
|
# code.gitea.io/sdk/gitea v0.13.2
|
||||||
## explicit
|
## explicit
|
||||||
code.gitea.io/sdk/gitea
|
code.gitea.io/sdk/gitea
|
||||||
# gitea.com/go-chi/binding v0.0.0-20210113025129-03f1d313373c
|
# gitea.com/go-chi/binding v0.0.0-20210301195521-1fe1c9a555e7
|
||||||
## explicit
|
## explicit
|
||||||
gitea.com/go-chi/binding
|
gitea.com/go-chi/binding
|
||||||
# gitea.com/go-chi/cache v0.0.0-20210110083709-82c4c9ce2d5e
|
# gitea.com/go-chi/cache v0.0.0-20210110083709-82c4c9ce2d5e
|
||||||
|
@ -483,6 +483,7 @@ github.com/jessevdk/go-flags
|
||||||
# github.com/josharian/intern v1.0.0
|
# github.com/josharian/intern v1.0.0
|
||||||
github.com/josharian/intern
|
github.com/josharian/intern
|
||||||
# github.com/json-iterator/go v1.1.10
|
# github.com/json-iterator/go v1.1.10
|
||||||
|
## explicit
|
||||||
github.com/json-iterator/go
|
github.com/json-iterator/go
|
||||||
# github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
|
# github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
|
||||||
## explicit
|
## explicit
|
||||||
|
|
Loading…
Reference in New Issue