diff --git a/go.mod b/go.mod index c9319d7..4a54e0f 100644 --- a/go.mod +++ b/go.mod @@ -9,8 +9,8 @@ require ( github.com/gin-gonic/gin v1.9.1 github.com/glebarez/sqlite v1.10.0 github.com/go-kratos/aegis v0.2.0 - github.com/go-kratos/kratos/contrib/registry/consul/v2 v2.0.0-20231219111544-85740b179b09 - github.com/go-kratos/kratos/contrib/registry/etcd/v2 v2.0.0-20231219111544-85740b179b09 + github.com/go-kratos/kratos/contrib/registry/consul/v2 v2.0.0-20240105030612-34d9666e0e1b + github.com/go-kratos/kratos/contrib/registry/etcd/v2 v2.0.0-20240105030612-34d9666e0e1b github.com/go-kratos/kratos/v2 v2.7.2 github.com/go-resty/resty/v2 v2.11.0 github.com/golang-jwt/jwt/v4 v4.5.0 @@ -30,7 +30,7 @@ require ( github.com/sirupsen/logrus v1.9.3 github.com/soheilhy/cmux v0.1.5 github.com/spf13/cobra v1.8.0 - github.com/synctv-org/vendors v0.2.2-0.20231227065102-90bfed7f8a05 + github.com/synctv-org/vendors v0.2.2-0.20240106150053-ea5b869ba675 github.com/ulule/limiter/v3 v3.11.2 github.com/zencoder/go-dash/v3 v3.0.3 github.com/zijiren233/gencontainer v0.0.0-20231231082035-2008befd9bc8 @@ -40,7 +40,7 @@ require ( github.com/zijiren233/yaml-comment v0.2.1 go.etcd.io/etcd/client/v3 v3.5.11 golang.org/x/crypto v0.17.0 - golang.org/x/exp v0.0.0-20231226003508-02704c960a9b + golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc golang.org/x/oauth2 v0.15.0 google.golang.org/grpc v1.60.1 google.golang.org/protobuf v1.32.0 @@ -64,7 +64,7 @@ require ( github.com/fatih/color v1.16.0 // indirect github.com/gabriel-vasile/mimetype v1.4.3 // indirect github.com/gin-contrib/sse v0.1.0 // indirect - github.com/glebarez/go-sqlite v1.21.2 // indirect + github.com/glebarez/go-sqlite v1.22.0 // indirect github.com/go-playground/form/v4 v4.2.1 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect @@ -75,7 +75,7 @@ require ( github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/google/go-querystring v1.1.0 // indirect - github.com/google/pprof v0.0.0-20231212022811-ec68065c825e // indirect + github.com/google/pprof v0.0.0-20231229205709-960ae82b1e42 // indirect github.com/google/wire v0.5.0 // indirect github.com/gorilla/mux v1.8.1 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect @@ -116,19 +116,19 @@ require ( go.uber.org/mock v0.4.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.26.0 // indirect - golang.org/x/arch v0.6.0 // indirect + golang.org/x/arch v0.7.0 // indirect golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect - golang.org/x/sync v0.5.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sync v0.6.0 // indirect + golang.org/x/sys v0.16.0 // indirect golang.org/x/text v0.14.0 // indirect golang.org/x/tools v0.16.1 // indirect google.golang.org/appengine v1.6.8 // indirect - google.golang.org/genproto v0.0.0-20231212172506-995d672761c0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20231212172506-995d672761c0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0 // indirect + google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 // indirect gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect - modernc.org/libc v1.38.0 // indirect + modernc.org/libc v1.38.1 // indirect modernc.org/mathutil v1.6.0 // indirect modernc.org/memory v1.7.2 // indirect modernc.org/sqlite v1.28.0 // indirect diff --git a/go.sum b/go.sum index 423b928..efafb45 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,4 @@ +cloud.google.com/go v0.111.0 h1:YHLKNupSD1KqjDbQ3+LVdQ81h/UJbJyZG203cEfnQgM= cloud.google.com/go/compute v1.23.3 h1:6sVlXXBmbd7jNX0Ipq0trII3e4n1/MsADLK6a+aiVlk= cloud.google.com/go/compute v1.23.3/go.mod h1:VCgBUoMnIVIR0CscqQiPJLAG25E3ZRZMzcFZeQ+h8CI= cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= @@ -73,6 +74,8 @@ github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg= github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL7YrpYKXt5YId3A/Tnip5kqbEAP+KLuI3SUcPTeU= github.com/glebarez/go-sqlite v1.21.2 h1:3a6LFC4sKahUunAmynQKLZceZCOzUthkRkEAl9gAXWo= github.com/glebarez/go-sqlite v1.21.2/go.mod h1:sfxdZyhQjTM2Wry3gVYWaW072Ri1WMdWJi0k6+3382k= +github.com/glebarez/go-sqlite v1.22.0 h1:uAcMJhaA6r3LHMTFgP0SifzgXg46yJkgxqyuyec+ruQ= +github.com/glebarez/go-sqlite v1.22.0/go.mod h1:PlBIdHe0+aUEFn+r2/uthrWq4FxbzugL0L8Li6yQJbc= github.com/glebarez/sqlite v1.10.0 h1:u4gt8y7OND/cCei/NMHmfbLxF6xP2wgKcT/BJf2pYkc= github.com/glebarez/sqlite v1.10.0/go.mod h1:IJ+lfSOmiekhQsFTJRx/lHtGYmCdtAiTaf5wI9u5uHA= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= @@ -81,8 +84,12 @@ github.com/go-kratos/aegis v0.2.0 h1:dObzCDWn3XVjUkgxyBp6ZeWtx/do0DPZ7LY3yNSJLUQ github.com/go-kratos/aegis v0.2.0/go.mod h1:v0R2m73WgEEYB3XYu6aE2WcMwsZkJ/Rzuf5eVccm7bI= github.com/go-kratos/kratos/contrib/registry/consul/v2 v2.0.0-20231219111544-85740b179b09 h1:CQLh4u2gVu4T6YqQTSw7Mg0tUAZpKpCbU9E43U9Ysew= github.com/go-kratos/kratos/contrib/registry/consul/v2 v2.0.0-20231219111544-85740b179b09/go.mod h1:yb9i4gq3jCW5zMFqzi50J0Xh3n4MRbcMlnuDBXYpvjs= +github.com/go-kratos/kratos/contrib/registry/consul/v2 v2.0.0-20240105030612-34d9666e0e1b h1:HZwjrnjkffDWa0sjFdMSmp2XNF3cObeqg66Vscq5OKg= +github.com/go-kratos/kratos/contrib/registry/consul/v2 v2.0.0-20240105030612-34d9666e0e1b/go.mod h1:yb9i4gq3jCW5zMFqzi50J0Xh3n4MRbcMlnuDBXYpvjs= github.com/go-kratos/kratos/contrib/registry/etcd/v2 v2.0.0-20231219111544-85740b179b09 h1:4EK4o8ZmXalxUy2lVhXWIE8+AnzBR0GaBHJXzc8NqSw= github.com/go-kratos/kratos/contrib/registry/etcd/v2 v2.0.0-20231219111544-85740b179b09/go.mod h1:CiTe7H5Lj8WB6dGvBwS4HFukcWnobfq+vFWedIGYftA= +github.com/go-kratos/kratos/contrib/registry/etcd/v2 v2.0.0-20240105030612-34d9666e0e1b h1:A80Ep0Ztgk6pTSSMoChv0g35DlNvTAhtgieQMhMUW5Y= +github.com/go-kratos/kratos/contrib/registry/etcd/v2 v2.0.0-20240105030612-34d9666e0e1b/go.mod h1:CiTe7H5Lj8WB6dGvBwS4HFukcWnobfq+vFWedIGYftA= github.com/go-kratos/kratos/v2 v2.7.2 h1:WVPGFNLKpv+0odMnCPxM4ZHa2hy9I5FOnwpG3Vv4w5c= github.com/go-kratos/kratos/v2 v2.7.2/go.mod h1:rppuc8+pGL2UtXA29bgFHWKqaaF6b6GB2XIYiDvFBRk= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= @@ -142,6 +149,8 @@ github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17 github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/pprof v0.0.0-20231212022811-ec68065c825e h1:bwOy7hAFd0C91URzMIEBfr6BAz29yk7Qj0cy6S7DJlU= github.com/google/pprof v0.0.0-20231212022811-ec68065c825e/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik= +github.com/google/pprof v0.0.0-20231229205709-960ae82b1e42 h1:dHLYa5D8/Ta0aLR2XcPsrkpAgGeFs6thhMcQK0oQ0n8= +github.com/google/pprof v0.0.0-20231229205709-960ae82b1e42/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik= github.com/google/subcommands v1.0.1/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU= github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -350,8 +359,8 @@ github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/synctv-org/vendors v0.2.2-0.20231227065102-90bfed7f8a05 h1:cWpk2uk9P6K1kuwnLy5Zay0GifYk3ss5bxUOMLb0yV4= -github.com/synctv-org/vendors v0.2.2-0.20231227065102-90bfed7f8a05/go.mod h1:Q+KEUh8ZgCSMjY5rCfz44+7POlHcGttZ/bYFiTDVBds= +github.com/synctv-org/vendors v0.2.2-0.20240106150053-ea5b869ba675 h1:Fgo48Te47WltcNqNg3Y+Gofmr4ZrFf7Oh8DceLplPHA= +github.com/synctv-org/vendors v0.2.2-0.20240106150053-ea5b869ba675/go.mod h1:b5IiS7zeXyCKV2WM4yLGVjEszm8RkOjjmp63TQjxy9o= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= @@ -364,8 +373,6 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/zencoder/go-dash/v3 v3.0.3 h1:xqwGJ2fJCSArwONGx6sY26Z1lxQ7zTURoxdRjCpuodM= github.com/zencoder/go-dash/v3 v3.0.3/go.mod h1:30R5bKy1aUYY45yesjtZ9l8trNc2TwNqbS17WVQmCzk= -github.com/zijiren233/gencontainer v0.0.0-20231213075414-f7f4c8261dca h1:mYxvu0DgfUFviM0GRqRIwC+nXBGZNV/WLnndTYGSwPA= -github.com/zijiren233/gencontainer v0.0.0-20231213075414-f7f4c8261dca/go.mod h1:V5oL7PrZxgisuLCblFWd89Jg99O8vM1n58llcxZ2hDY= github.com/zijiren233/gencontainer v0.0.0-20231231082035-2008befd9bc8 h1:kQ74VfoQx+9G3H7t8CkrdtMXYRsO5/jV0U5gquZe1Gc= github.com/zijiren233/gencontainer v0.0.0-20231231082035-2008befd9bc8/go.mod h1:V5oL7PrZxgisuLCblFWd89Jg99O8vM1n58llcxZ2hDY= github.com/zijiren233/go-colorable v0.0.0-20230930131441-997304c961cb h1:0DyOxf/TbbGodHhOVHNoPk+7v/YBJACs22gKpKlatWw= @@ -393,6 +400,8 @@ go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so= golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= golang.org/x/arch v0.6.0 h1:S0JTfE48HbRj80+4tbvZDYsJ3tGv6BUU3XxyZ7CirAc= golang.org/x/arch v0.6.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= +golang.org/x/arch v0.7.0 h1:pskyeJh/3AmoQ8CPE95vxHLqp1G1GfGNXTmcl9NEKTc= +golang.org/x/arch v0.7.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= @@ -404,6 +413,8 @@ golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/exp v0.0.0-20231226003508-02704c960a9b h1:kLiC65FbiHWFAOu+lxwNPujcsl8VYyTYYEZnsOO1WK4= golang.org/x/exp v0.0.0-20231226003508-02704c960a9b/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI= +golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc h1:ao2WRsKSzW6KuUY9IWPwWahcHCgR0s52IfwutMfEbdM= +golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= @@ -439,6 +450,8 @@ golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -471,6 +484,8 @@ golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= @@ -507,10 +522,16 @@ google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAs google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= google.golang.org/genproto v0.0.0-20231212172506-995d672761c0 h1:YJ5pD9rF8o9Qtta0Cmy9rdBwkSjrTCT6XTiUQVOtIos= google.golang.org/genproto v0.0.0-20231212172506-995d672761c0/go.mod h1:l/k7rMz0vFTBPy+tFSGvXEd3z+BcoG1k7EHbqm+YBsY= +google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917 h1:nz5NESFLZbJGPFxDT/HCn+V1mZ8JGNoY4nUpmW/Y2eg= +google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917/go.mod h1:pZqR+glSb11aJ+JQcczCvgf47+duRuzNSKqE8YAQnV0= google.golang.org/genproto/googleapis/api v0.0.0-20231212172506-995d672761c0 h1:s1w3X6gQxwrLEpxnLd/qXTVLgQE2yXwaOaoa6IlY/+o= google.golang.org/genproto/googleapis/api v0.0.0-20231212172506-995d672761c0/go.mod h1:CAny0tYF+0/9rmDB9fahA9YLzX3+AEVl1qXbv5hhj6c= +google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 h1:rcS6EyEaoCO52hQDupoSfrxI3R6C2Tq741is7X8OvnM= +google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917/go.mod h1:CmlNWB9lSezaYELKS5Ym1r44VrrbPUa7JTvw+6MbpJ0= google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0 h1:/jFB8jK5R3Sq3i/lmeZO0cATSzFfZaJq1J2Euan3XKU= google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0/go.mod h1:FUoWkonphQm3RhTS+kOEhF8h0iDpm4tdXolVCeZ9KKA= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 h1:6G8oQ016D88m1xAKljMlBOOGWDZkes4kMhgGFlf8WcQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917/go.mod h1:xtjpI3tXFPP051KaWnhvxkiubL/6dJ18vLVf7q2pTOU= google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU= google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= @@ -542,6 +563,8 @@ gorm.io/gorm v1.25.5 h1:zR9lOiiYf09VNh5Q1gphfyia1JpiClIWG9hQaxB/mls= gorm.io/gorm v1.25.5/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= modernc.org/libc v1.38.0 h1:o4Lpk0zNDSdsjfEXnF1FGXWQ9PDi1NOdWcLP5n13FGo= modernc.org/libc v1.38.0/go.mod h1:YAXkAZ8ktnkCKaN9sw/UDeUVkGYJ/YquGO4FTi5nmHE= +modernc.org/libc v1.38.1 h1:kLZYihFEUV2+T10Bt+AhugJlkSNA4JJ36vMCSe1Bexk= +modernc.org/libc v1.38.1/go.mod h1:YAXkAZ8ktnkCKaN9sw/UDeUVkGYJ/YquGO4FTi5nmHE= modernc.org/mathutil v1.6.0 h1:fRe9+AmYlaej+64JsEEhoWuAYBkOtQiMEU7n/XgfYi4= modernc.org/mathutil v1.6.0/go.mod h1:Ui5Q9q1TR2gFm0AQRqQUaBWFLAhQpCwNcuhBOSedWPo= modernc.org/memory v1.7.2 h1:Klh90S215mmH8c9gO98QxQFsY+W451E8AnzjoE2ee1E= diff --git a/internal/bootstrap/db.go b/internal/bootstrap/db.go index 88f1e75..f098348 100644 --- a/internal/bootstrap/db.go +++ b/internal/bootstrap/db.go @@ -28,9 +28,11 @@ func InitDatabase(ctx context.Context) (err error) { var opts []gorm.Option opts = append(opts, &gorm.Config{ - TranslateError: true, - Logger: newDBLogger(), - PrepareStmt: true, + TranslateError: true, + Logger: newDBLogger(), + PrepareStmt: true, + DisableForeignKeyConstraintWhenMigrating: true, + IgnoreRelationshipsWhenMigrating: true, }) d, err := gorm.Open(dialector, opts...) if err != nil { diff --git a/internal/db/update.go b/internal/db/update.go index a52a972..d0128ef 100644 --- a/internal/db/update.go +++ b/internal/db/update.go @@ -100,17 +100,17 @@ func autoMigrate(dst ...any) error { log.Info("migrating database...") switch conf.Conf.Database.Type { case conf.DatabaseTypeMysql: - if conf.Conf.Database.Type == conf.DatabaseTypeMysql { - if err := db.Exec("SET FOREIGN_KEY_CHECKS = 0").Error; err != nil { - return err - } - defer func() { - err := db.Exec("SET FOREIGN_KEY_CHECKS = 1").Error - if err != nil { - log.Fatalf("failed to set foreign key checks: %s", err.Error()) - } - }() - } + // if conf.Conf.Database.Type == conf.DatabaseTypeMysql { + // if err := db.Exec("SET FOREIGN_KEY_CHECKS = 0").Error; err != nil { + // return err + // } + // defer func() { + // err := db.Exec("SET FOREIGN_KEY_CHECKS = 1").Error + // if err != nil { + // log.Fatalf("failed to set foreign key checks: %s", err.Error()) + // } + // }() + // } return db.Set("gorm:table_options", "ENGINE=InnoDB CHARSET=utf8mb4").AutoMigrate(dst...) case conf.DatabaseTypeSqlite3, conf.DatabaseTypePostgres: return db.AutoMigrate(dst...) diff --git a/internal/model/vendorBackend.go b/internal/model/vendorBackend.go index 4caf965..4772cfa 100644 --- a/internal/model/vendorBackend.go +++ b/internal/model/vendorBackend.go @@ -53,11 +53,11 @@ type VendorBackend struct { CreatedAt time.Time UpdatedAt time.Time Backend Backend `gorm:"embedded;embeddedPrefix:backend_" json:"backend"` - Enabled bool `gorm:"default:true" json:"enabled"` UsedBy BackendUsedBy `gorm:"embedded;embeddedPrefix:used_by_" json:"usedBy"` } type BackendUsedBy struct { + Enabled bool `gorm:"default:false" json:"enabled"` Bilibili bool `gorm:"default:false" json:"bilibili"` BilibiliBackendName string `gorm:"type:varchar(64)" json:"bilibiliBackendName"` Alist bool `gorm:"default:false" json:"alist"` diff --git a/internal/vendor/vendor.go b/internal/vendor/vendor.go index 6e418c8..02e1dbe 100644 --- a/internal/vendor/vendor.go +++ b/internal/vendor/vendor.go @@ -93,14 +93,14 @@ func EnableVendorBackend(ctx context.Context, endpoint string) (err error) { raw := LoadConns() if v, ok := raw[endpoint]; !ok { return fmt.Errorf("endpoint not found: %s", endpoint) - } else if v.Info.Enabled { + } else if v.Info.UsedBy.Enabled { return nil } - raw[endpoint].Info.Enabled = true + raw[endpoint].Info.UsedBy.Enabled = true defer func() { if err != nil { - raw[endpoint].Info.Enabled = false + raw[endpoint].Info.UsedBy.Enabled = false } }() @@ -130,19 +130,19 @@ func EnableVendorBackends(ctx context.Context, endpoints []string) (err error) { for _, endpoint := range endpoints { if v, ok := raw[endpoint]; !ok { return fmt.Errorf("endpoint not found: %s", endpoint) - } else if !v.Info.Enabled { + } else if !v.Info.UsedBy.Enabled { needChangeEndpoints = append(needChangeEndpoints, endpoint) } } for _, endpoint := range needChangeEndpoints { - raw[endpoint].Info.Enabled = true + raw[endpoint].Info.UsedBy.Enabled = true } defer func() { if err != nil { for _, endpoint := range needChangeEndpoints { - raw[endpoint].Info.Enabled = false + raw[endpoint].Info.UsedBy.Enabled = false } } }() @@ -171,14 +171,14 @@ func DisableVendorBackend(ctx context.Context, endpoint string) (err error) { raw := LoadConns() if v, ok := raw[endpoint]; !ok { return fmt.Errorf("endpoint not found: %s", endpoint) - } else if !v.Info.Enabled { + } else if !v.Info.UsedBy.Enabled { return nil } - raw[endpoint].Info.Enabled = false + raw[endpoint].Info.UsedBy.Enabled = false defer func() { if err != nil { - raw[endpoint].Info.Enabled = true + raw[endpoint].Info.UsedBy.Enabled = true } }() @@ -208,19 +208,19 @@ func DisableVendorBackends(ctx context.Context, endpoints []string) (err error) for _, endpoint := range endpoints { if v, ok := raw[endpoint]; !ok { return fmt.Errorf("endpoint not found: %s", endpoint) - } else if v.Info.Enabled { + } else if v.Info.UsedBy.Enabled { needChangeEndpoints = append(needChangeEndpoints, endpoint) } } for _, endpoint := range needChangeEndpoints { - raw[endpoint].Info.Enabled = false + raw[endpoint].Info.UsedBy.Enabled = false } defer func() { if err != nil { for _, endpoint := range needChangeEndpoints { - raw[endpoint].Info.Enabled = true + raw[endpoint].Info.UsedBy.Enabled = true } } }() @@ -405,7 +405,7 @@ func (b *VendorClients) EmbyClients() map[string]EmbyInterface { } func newBackendConn(ctx context.Context, conf *model.VendorBackend) (conns *BackendConn, err error) { - cc, err := NewGrpcClientConn(ctx, &conf.Backend) + cc, err := NewGrpcConn(ctx, &conf.Backend) if err != nil { return conns, err } @@ -446,7 +446,7 @@ func newVendorClients(conns map[string]*BackendConn) (*VendorClients, error) { emby: make(map[string]EmbyInterface), } for _, conn := range conns { - if !conn.Info.Enabled { + if !conn.Info.UsedBy.Enabled { continue } if conn.Info.UsedBy.Bilibili { @@ -484,7 +484,7 @@ func newVendorClients(conns map[string]*BackendConn) (*VendorClients, error) { return clients, nil } -func NewGrpcClientConn(ctx context.Context, conf *model.Backend) (*grpc.ClientConn, error) { +func NewGrpcConn(ctx context.Context, conf *model.Backend) (*grpc.ClientConn, error) { if conf.Endpoint == "" { return nil, errors.New("new grpc client failed, endpoint is empty") }