diff --git a/.vscode/launch.json b/.vscode/launch.json index c18360f6..fb60435b 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -6,7 +6,7 @@ "type": "go", "request": "launch", "mode": "exec", - "program": "${fileDirname}/__debug_bin", + "program": "${workspaceFolder}/.vscode/__debug_bin", "preLaunchTask": "go: build (debug)", "cwd": "${workspaceFolder}" } diff --git a/go.mod b/go.mod index 9c657e0d..5345947a 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/afocus/captcha v0.0.0-20191010092841-4bd1f21c8868 github.com/alimy/cfg v0.3.0 github.com/alimy/mir/v3 v3.1.1 - github.com/aliyun/aliyun-oss-go-sdk v2.2.6+incompatible + github.com/aliyun/aliyun-oss-go-sdk v2.2.7+incompatible github.com/allegro/bigcache/v3 v3.0.2 github.com/bytedance/sonic v1.8.5 github.com/disintegration/imaging v1.6.2 @@ -23,25 +23,25 @@ require ( github.com/json-iterator/go v1.1.12 github.com/meilisearch/meilisearch-go v0.21.0 github.com/minio/minio-go/v7 v7.0.49 - github.com/onsi/ginkgo/v2 v2.9.1 + github.com/onsi/ginkgo/v2 v2.9.2 github.com/onsi/gomega v1.27.4 github.com/pyroscope-io/client v0.6.0 github.com/redis/go-redis/v9 v9.0.2 github.com/sirupsen/logrus v1.9.0 github.com/smartwalle/alipay/v3 v3.2.0 - github.com/sourcegraph/conc v0.2.0 + github.com/sourcegraph/conc v0.3.0 github.com/spf13/viper v1.15.0 github.com/tencentyun/cos-go-sdk-v5 v0.7.41 github.com/yinheli/mahonia v0.0.0-20131226213531-0eef680515cc go.uber.org/automaxprocs v1.5.2 google.golang.org/grpc v1.53.0 - google.golang.org/protobuf v1.28.1 + google.golang.org/protobuf v1.30.0 gopkg.in/natefinch/lumberjack.v2 v2.2.1 gopkg.in/resty.v1 v1.12.0 gorm.io/driver/mysql v1.4.7 - gorm.io/driver/postgres v1.4.8 + gorm.io/driver/postgres v1.5.0 gorm.io/driver/sqlite v1.4.4 - gorm.io/gorm v1.24.6 + gorm.io/gorm v1.24.7-0.20230306060331-85eaf9eeda11 gorm.io/plugin/dbresolver v1.4.1 gorm.io/plugin/soft_delete v1.2.0 modernc.org/sqlite v1.21.0 @@ -61,7 +61,7 @@ require ( github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-playground/validator/v10 v10.11.2 // indirect github.com/go-sql-driver/mysql v1.7.0 // indirect - github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect + github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/google/go-cmp v0.5.9 // indirect diff --git a/go.sum b/go.sum index 53ef8ce1..5e846ff6 100644 --- a/go.sum +++ b/go.sum @@ -127,8 +127,8 @@ github.com/alimy/cfg v0.3.0 h1:9xgA0QWVCPSq9fFNRcYahVCAX22IL9ts2wrTQPfAStY= github.com/alimy/cfg v0.3.0/go.mod h1:rOxbasTH2srl6StAjNF5Vyi8bfrdkl3fLGmOYtSw81c= github.com/alimy/mir/v3 v3.1.1 h1:3tz7uGOwuA1IKU0BysyBvGbyqKtEVMuhPBD/APk1ANw= github.com/alimy/mir/v3 v3.1.1/go.mod h1:ybhT2ijOiDn0lLwWzIY6vXdv+uzZrctS7VFfczcXBWU= -github.com/aliyun/aliyun-oss-go-sdk v2.2.6+incompatible h1:KXeJoM1wo9I/6xPTyt6qCxoSZnmASiAjlrr0dyTUKt8= -github.com/aliyun/aliyun-oss-go-sdk v2.2.6+incompatible/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8= +github.com/aliyun/aliyun-oss-go-sdk v2.2.7+incompatible h1:KpbJFXwhVeuxNtBJ74MCGbIoaBok2uZvkD7QXp2+Wis= +github.com/aliyun/aliyun-oss-go-sdk v2.2.7+incompatible/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8= github.com/allegro/bigcache/v3 v3.0.2 h1:AKZCw+5eAaVyNTBmI2fgyPVJhHkdWder3O9IrprcQfI= github.com/allegro/bigcache/v3 v3.0.2/go.mod h1:aPyh7jEvrog9zAwx5N7+JUQX5dZTSGpxF1LAR4dr35I= github.com/andybalholm/brotli v1.0.4 h1:V7DdXeJtZscaqfNuAdSRuRFzuiKlHSC/Zh3zl9qY3JY= @@ -513,8 +513,9 @@ github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LB github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc= github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8WdvHunIJ9dAyjPVtrBPhSr3KT2yUst43I= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= +github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= +github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= github.com/gobuffalo/attrs v0.0.0-20190224210810-a9411de4debd/go.mod h1:4duuawTqi2wkkpB4ePgWMaai6/Kc6WEz83bhFwpHzj0= github.com/gobuffalo/depgen v0.0.0-20190329151759-d478694a28d3/go.mod h1:3STtPUQYuzV0gBVOY3vy6CfMm/ljR4pABfrTeHNLHUY= github.com/gobuffalo/depgen v0.1.0/go.mod h1:+ifsuy7fhi15RWncXQQKjWS9JPkdah5sZvtHc2RXGlg= @@ -995,8 +996,8 @@ github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108 github.com/onsi/ginkgo v1.13.0/go.mod h1:+REjRxOmWfHCjfv9TTWB1jD1Frx4XydAD3zm1lskyM0= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= -github.com/onsi/ginkgo/v2 v2.9.1 h1:zie5Ly042PD3bsCvsSOPvRnFwyo3rKe64TJlD6nu0mk= -github.com/onsi/ginkgo/v2 v2.9.1/go.mod h1:FEcmzVcCHl+4o9bQZVab+4dC9+j+91t2FHSzmGAPfuo= +github.com/onsi/ginkgo/v2 v2.9.2 h1:BA2GMJOtfGAfagzYtrAlufIP0lq6QERkFmHLMLPwFSU= +github.com/onsi/ginkgo/v2 v2.9.2/go.mod h1:WHcJJG2dIlcCqVfBAwUCrJxSPFb6v4azBwgxeMeDuts= github.com/onsi/gomega v0.0.0-20151007035656-2152b45fa28a/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= @@ -1159,8 +1160,8 @@ github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9 github.com/snowflakedb/gosnowflake v1.6.3/go.mod h1:6hLajn6yxuJ4xUHZegMekpq9rnQbGJ7TMwXjgTmA6lg= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/soheilhy/cmux v0.1.5/go.mod h1:T7TcVDs9LWfQgPlPsdngu6I6QIoyIFZDDC6sNE1GqG0= -github.com/sourcegraph/conc v0.2.0 h1:96VpOCAtXDCQ8Oycz0ftHqdPyMi8w12ltN4L2noYg7s= -github.com/sourcegraph/conc v0.2.0/go.mod h1:8lmPpTLA0hsWqw4lw7wS1e694U2tMjRrc1Asvupb4QM= +github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= +github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= @@ -1942,8 +1943,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= -google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= +google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -1990,8 +1991,8 @@ gorm.io/driver/mysql v1.4.3/go.mod h1:sSIebwZAVPiT+27jK9HIwvsqOGKx3YMPmrA3mBJR10 gorm.io/driver/mysql v1.4.7 h1:rY46lkCspzGHn7+IYsNpSfEv9tA+SU4SkkB+GFX125Y= gorm.io/driver/mysql v1.4.7/go.mod h1:SxzItlnT1cb6e1e4ZRpgJN2VYtcqJgqnHxWr4wsP8oc= gorm.io/driver/postgres v1.0.8/go.mod h1:4eOzrI1MUfm6ObJU/UcmbXyiHSs8jSwH95G5P5dxcAg= -gorm.io/driver/postgres v1.4.8 h1:NDWizaclb7Q2aupT0jkwK8jx1HVCNzt+PQ8v/VnxviA= -gorm.io/driver/postgres v1.4.8/go.mod h1:O9MruWGNLUBUWVYfWuBClpf3HeGjOoybY0SNmCs3wsw= +gorm.io/driver/postgres v1.5.0 h1:u2FXTy14l45qc3UeCJ7QaAXZmZfDDv0YrthvmRq1l0U= +gorm.io/driver/postgres v1.5.0/go.mod h1:FUZXzO+5Uqg5zzwzv4KK49R8lvGIyscBOqYrtI1Ce9A= gorm.io/driver/sqlite v1.1.3/go.mod h1:AKDgRWk8lcSQSw+9kxCJnX/yySj8G3rdwYlU57cB45c= gorm.io/driver/sqlite v1.4.4 h1:gIufGoR0dQzjkyqDyYSCvsYR6fba1Gw5YKDqKeChxFc= gorm.io/driver/sqlite v1.4.4/go.mod h1:0Aq3iPO+v9ZKbcdiz8gLWRw5VOPcBOPUQJFLq5e2ecI= @@ -2001,10 +2002,9 @@ gorm.io/gorm v1.21.4/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= gorm.io/gorm v1.23.0/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= gorm.io/gorm v1.23.8/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= gorm.io/gorm v1.24.0/go.mod h1:DVrVomtaYTbqs7gB/x2uVvqnXzv0nqjB396B8cG4dBA= -gorm.io/gorm v1.24.2/go.mod h1:DVrVomtaYTbqs7gB/x2uVvqnXzv0nqjB396B8cG4dBA= gorm.io/gorm v1.24.3/go.mod h1:DVrVomtaYTbqs7gB/x2uVvqnXzv0nqjB396B8cG4dBA= -gorm.io/gorm v1.24.6 h1:wy98aq9oFEetsc4CAbKD2SoBCdMzsbSIvSUUFJuHi5s= -gorm.io/gorm v1.24.6/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k= +gorm.io/gorm v1.24.7-0.20230306060331-85eaf9eeda11 h1:9qNbmu21nNThCNnF5i2R3kw2aL27U8ZwbzccNjOmW0g= +gorm.io/gorm v1.24.7-0.20230306060331-85eaf9eeda11/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k= gorm.io/plugin/dbresolver v1.4.1 h1:Ug4LcoPhrvqq71UhxtF346f+skTYoCa/nEsdjvHwEzk= gorm.io/plugin/dbresolver v1.4.1/go.mod h1:CTbCtMWhsjXSiJqiW2R8POvJ2cq18RVOl4WGyT5nhNc= gorm.io/plugin/soft_delete v1.2.0 h1:txWHRMqLPqfXUFytXCdxb/jthRe3CrG4R5XOdagut6Q= diff --git a/mirc/admin/v1/user.go b/mirc/admin/v1/user.go index 6f0dcb79..0924ca84 100644 --- a/mirc/admin/v1/user.go +++ b/mirc/admin/v1/user.go @@ -35,8 +35,8 @@ type LoginResp struct { } type User struct { - Chain Chain `mir:"-"` - Group Group `mir:"m/v1"` + Chain `mir:"-"` + Group `mir:"m/v1"` Login func(Post, LoginReq) LoginResp `mir:"/user/login/"` Logout func(Post) `mir:"/user/logout/"` } diff --git a/mirc/bot/v1/user.go b/mirc/bot/v1/user.go index a4839673..e9f614b6 100644 --- a/mirc/bot/v1/user.go +++ b/mirc/bot/v1/user.go @@ -35,8 +35,8 @@ type LoginResp struct { } type User struct { - Chain Chain `mir:"-"` - Group Group `mir:"r/v1"` + Chain `mir:"-"` + Group `mir:"r/v1"` Login func(Post, LoginReq) LoginResp `mir:"/user/login/"` Logout func(Post) `mir:"/user/logout/"` } diff --git a/mirc/localoss/v1/user.go b/mirc/localoss/v1/user.go index 555ff6d7..481d70a5 100644 --- a/mirc/localoss/v1/user.go +++ b/mirc/localoss/v1/user.go @@ -35,7 +35,7 @@ type LoginResp struct { } type User struct { - Group Group `mir:"s/v1"` + Group `mir:"s/v1"` Index func(Get) `mir:"/index/"` Login func(Post, LoginReq) LoginResp `mir:"/user/login/"` Logout func(Post) `mir:"/user/logout/"` diff --git a/mirc/space/v1/user.go b/mirc/space/v1/user.go index 8dd49fa5..f3193c7f 100644 --- a/mirc/space/v1/user.go +++ b/mirc/space/v1/user.go @@ -35,8 +35,8 @@ type LoginResp struct { } type User struct { - Chain Chain `mir:"-"` - Group Group `mir:"x/v1"` + Chain `mir:"-"` + Group `mir:"x/v1"` Login func(Post, LoginReq) LoginResp `mir:"/user/login/"` Logout func(Post) `mir:"/user/logout/"` } diff --git a/mirc/web/v1/admin.go b/mirc/web/v1/admin.go index 4a1d8655..c8126ba3 100644 --- a/mirc/web/v1/admin.go +++ b/mirc/web/v1/admin.go @@ -12,8 +12,8 @@ func init() { // Admin 运维相关服务 type Admin struct { - Chain Chain `mir:"-"` - Group Group `mir:"v1"` + Chain `mir:"-"` + Group `mir:"v1"` // ChangeUserStatus 管理·禁言/解封用户 ChangeUserStatus func(Post, web.ChangeUserStatusReq) `mir:"/admin/user/status"` diff --git a/mirc/web/v1/alipay.go b/mirc/web/v1/alipay.go index 63b763a3..b012c568 100644 --- a/mirc/web/v1/alipay.go +++ b/mirc/web/v1/alipay.go @@ -12,7 +12,7 @@ func init() { // AlipayPub 支付宝相关不用授权的服务 type AlipayPub struct { - Group Group `mir:"v1"` + Group `mir:"v1"` // AlipayNotify 支付宝回调 AlipayNotify func(Post, web.AlipayNotifyReq) `mir:"/alipay/notify"` diff --git a/mirc/web/v1/core.go b/mirc/web/v1/core.go index af835074..70d9c1a5 100644 --- a/mirc/web/v1/core.go +++ b/mirc/web/v1/core.go @@ -12,8 +12,8 @@ func init() { // Core 核心服务,需要授权访问 type Core struct { - Chain Chain `mir:"-"` - Group Group `mir:"v1"` + Chain `mir:"-"` + Group `mir:"v1"` // SyncSearchIndex 同步索引 SyncSearchIndex func(Get, web.SyncSearchIndexReq) `mir:"/sync/index"` diff --git a/mirc/web/v1/followship.go b/mirc/web/v1/followship.go index 99c0dba6..456fd5eb 100644 --- a/mirc/web/v1/followship.go +++ b/mirc/web/v1/followship.go @@ -12,8 +12,8 @@ func init() { // Followship 关注者模式 服务 type Followship struct { - Chain Chain `mir:"-"` - Group Group `mir:"v1"` + Chain `mir:"-"` + Group `mir:"v1"` // AddFollowing 添加关注 AddFollowing func(Post, web.AddFollowingReq) `mir:"/following/add"` diff --git a/mirc/web/v1/friendship.go b/mirc/web/v1/friendship.go index 1013a894..b753eee3 100644 --- a/mirc/web/v1/friendship.go +++ b/mirc/web/v1/friendship.go @@ -12,8 +12,8 @@ func init() { // Friendship 好友模式 服务 type Friendship struct { - Chain Chain `mir:"-"` - Group Group `mir:"v1"` + Chain `mir:"-"` + Group `mir:"v1"` // RequestingFriend 请求添加朋友 RequestingFriend func(Post, web.RequestingFriendReq) `mir:"/friend/requesting"` diff --git a/mirc/web/v1/loose.go b/mirc/web/v1/loose.go index 887e3c9b..977ca649 100644 --- a/mirc/web/v1/loose.go +++ b/mirc/web/v1/loose.go @@ -12,8 +12,8 @@ func init() { // Loose 宽松授权的服务 type Loose struct { - Chain Chain `mir:"-"` - Group Group `mir:"v1"` + Chain `mir:"-"` + Group `mir:"v1"` // Timeline 获取广场流 Timeline func(Get, web.TimelineReq) web.TimelineResp `mir:"/posts"` diff --git a/mirc/web/v1/priv.go b/mirc/web/v1/priv.go index 132e56b0..5e473539 100644 --- a/mirc/web/v1/priv.go +++ b/mirc/web/v1/priv.go @@ -12,8 +12,8 @@ func init() { // Priv 私有授权的服务 type Priv struct { - Chain Chain `mir:"-"` - Group Group `mir:"v1"` + Chain `mir:"-"` + Group `mir:"v1"` // UploadAttachment 上传资源 UploadAttachment func(Post, web.UploadAttachmentReq) web.UploadAttachmentResp `mir:"/attachment"` diff --git a/mirc/web/v1/pub.go b/mirc/web/v1/pub.go index 2364f223..aadc5e48 100644 --- a/mirc/web/v1/pub.go +++ b/mirc/web/v1/pub.go @@ -12,7 +12,7 @@ func init() { // Pub 不用授权的公开服务 type Pub struct { - Group Group `mir:"v1"` + Group `mir:"v1"` // Version 获取后台版本信息 Version func(Get) web.VersionResp `mir:"/"`