diff --git a/.gitignore b/.gitignore index a806eca..07196f0 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,5 @@ server/config.db server/web/pages/template/route.go server/server.pem server/server.key +settings.json +viewed.json \ No newline at end of file diff --git a/README.md b/README.md index cb9f942..dfd0807 100644 --- a/README.md +++ b/README.md @@ -167,6 +167,27 @@ https://github.com/vladlenas Synology NAS packages repo source: https://grigi.lt +### Development + +#### Go server + +To run the Go server locally, just run + +```bash +cd server +go run ./cmd +``` + +#### Web development + +To run the web server locally, just run + +```bash +yarn start +``` + +More info at https://github.com/YouROK/TorrServer/tree/master/web#readme + ### Build #### Server @@ -262,7 +283,7 @@ local:127.0.0.1 - [FaintGhost](https://github.com/FaintGhost) Zhang Yaowei for Simplified Chinese web translation - [Anton111111](https://github.com/Anton111111) Anton Potekhin for sleep on Windows fixes - [lieranderl](https://github.com/lieranderl) Evgeni for adding SSL support code -- [cocool97](https://github.com/cocool97) for openapi API documentation +- [cocool97](https://github.com/cocool97) for openapi API documentation and torrent categories - [shadeov](https://github.com/shadeov) for README improvements - [butaford](https://github.com/butaford) Pavel for make docker file and scripts - [filimonic](https://github.com/filimonic) Alexey D. Filimonov diff --git a/server/cmd/main.go b/server/cmd/main.go index ad9e1f9..22b9525 100644 --- a/server/cmd/main.go +++ b/server/cmd/main.go @@ -155,7 +155,7 @@ func watchTDir(dir string) { if strings.ToLower(filepath.Ext(file.Name())) == ".torrent" { sp, err := openFile(filename) if err == nil { - tor, err := torr.AddTorrent(sp, "", "", "") + tor, err := torr.AddTorrent(sp, "", "", "", "") if err == nil { if tor.GotInfo() { if tor.Title == "" { diff --git a/server/go.mod b/server/go.mod index 4f719e8..620b4d2 100644 --- a/server/go.mod +++ b/server/go.mod @@ -8,12 +8,12 @@ require ( github.com/agnivade/levenshtein v1.1.1 github.com/alexflint/go-arg v1.4.3 github.com/anacrolix/dms v1.6.0 - github.com/anacrolix/log v0.15.0 + github.com/anacrolix/log v0.15.2 github.com/anacrolix/missinggo/v2 v2.7.3 - github.com/anacrolix/publicip v0.3.0 + github.com/anacrolix/publicip v0.3.1 github.com/anacrolix/torrent v1.54.1 - github.com/gin-contrib/cors v1.5.0 - github.com/gin-contrib/location v0.0.2 + github.com/gin-contrib/cors v1.7.1 + github.com/gin-contrib/location v1.0.0 github.com/gin-gonic/gin v1.9.1 github.com/kljensen/snowball v0.9.0 github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c @@ -22,7 +22,7 @@ require ( github.com/swaggo/gin-swagger v1.6.0 github.com/swaggo/swag v1.16.3 go.etcd.io/bbolt v1.3.9 - golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 + golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 golang.org/x/image v0.15.0 golang.org/x/time v0.5.0 gopkg.in/vansante/go-ffprobe.v2 v2.1.1 @@ -30,7 +30,7 @@ require ( require ( github.com/KyleBanks/depth v1.2.1 // indirect - github.com/RoaringBitmap/roaring v1.9.0 // indirect + github.com/RoaringBitmap/roaring v1.9.1 // indirect github.com/alecthomas/atomic v0.1.0-alpha2 // indirect github.com/alexflint/go-scalar v1.2.0 // indirect github.com/anacrolix/chansync v0.4.0 // indirect @@ -47,7 +47,7 @@ require ( github.com/benbjohnson/immutable v0.4.3 // indirect github.com/bits-and-blooms/bitset v1.13.0 // indirect github.com/bradfitz/iter v0.0.0-20191230175014-e8f45d346db8 // indirect - github.com/bytedance/sonic v1.11.1 // indirect + github.com/bytedance/sonic v1.11.3 // indirect github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect github.com/chenzhuoyu/iasm v0.9.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect @@ -56,13 +56,13 @@ require ( github.com/frankban/quicktest v1.14.6 // indirect github.com/gabriel-vasile/mimetype v1.4.3 // indirect github.com/gin-contrib/sse v0.1.0 // indirect - github.com/go-openapi/jsonpointer v0.20.2 // indirect - github.com/go-openapi/jsonreference v0.20.4 // indirect - github.com/go-openapi/spec v0.20.14 // indirect - github.com/go-openapi/swag v0.22.9 // indirect + github.com/go-openapi/jsonpointer v0.21.0 // indirect + github.com/go-openapi/jsonreference v0.21.0 // indirect + github.com/go-openapi/spec v0.21.0 // indirect + github.com/go-openapi/swag v0.23.0 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect - github.com/go-playground/validator/v10 v10.18.0 // indirect + github.com/go-playground/validator/v10 v10.19.0 // indirect github.com/goccy/go-json v0.10.2 // indirect github.com/google/btree v1.1.2 // indirect github.com/google/go-cmp v0.6.0 // indirect @@ -76,18 +76,18 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/mschoch/smat v0.2.0 // indirect - github.com/pelletier/go-toml/v2 v2.1.1 // indirect + github.com/pelletier/go-toml/v2 v2.2.0 // indirect github.com/rs/dnscache v0.0.0-20230804202142-fc85eb664529 // indirect github.com/ryszard/goskiplist v0.0.0-20150312221310-2dfbae5fcf46 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/ugorji/go/codec v1.2.12 // indirect golang.org/x/arch v0.7.0 // indirect - golang.org/x/crypto v0.19.0 // indirect - golang.org/x/net v0.21.0 // indirect - golang.org/x/sync v0.6.0 // indirect - golang.org/x/sys v0.17.0 // indirect + golang.org/x/crypto v0.22.0 // indirect + golang.org/x/net v0.24.0 // indirect + golang.org/x/sync v0.7.0 // indirect + golang.org/x/sys v0.19.0 // indirect golang.org/x/text v0.14.0 // indirect - golang.org/x/tools v0.18.0 // indirect + golang.org/x/tools v0.20.0 // indirect google.golang.org/protobuf v1.33.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/server/go.sum b/server/go.sum index 1332f96..aa8187d 100644 --- a/server/go.sum +++ b/server/go.sum @@ -9,8 +9,8 @@ github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6Xge github.com/RoaringBitmap/roaring v0.4.7/go.mod h1:8khRDP4HmeXns4xIj9oGrKSz7XTQiJx2zgh7AcNke4w= github.com/RoaringBitmap/roaring v0.4.17/go.mod h1:D3qVegWTmfCaX4Bl5CrBE9hfrSrrXIr8KVNvRsDi1NI= github.com/RoaringBitmap/roaring v0.4.23/go.mod h1:D0gp8kJQgE1A4LQ5wFLggQEyvDi06Mq5mKs52e1TwOo= -github.com/RoaringBitmap/roaring v1.9.0 h1:lwKhr90/j0jVXJyh5X+vQN1VVn77rQFfYnh6RDRGCcE= -github.com/RoaringBitmap/roaring v1.9.0/go.mod h1:6AXUsoIEzDTFFQCe1RbGA6uFONMhvejWj5rqITANK90= +github.com/RoaringBitmap/roaring v1.9.1 h1:LXcSqGGGMKm+KAzUyWn7ZeREqoOkoMX+KwLOK1thc4I= +github.com/RoaringBitmap/roaring v1.9.1/go.mod h1:6AXUsoIEzDTFFQCe1RbGA6uFONMhvejWj5rqITANK90= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= github.com/agnivade/levenshtein v1.1.1 h1:QY8M92nrzkmr798gCo3kmMyqXFzdQVpxLlGPRBij0P8= @@ -48,8 +48,8 @@ github.com/anacrolix/log v0.3.0/go.mod h1:lWvLTqzAnCWPJA08T2HCstZi0L1y2Wyvm3FJgw github.com/anacrolix/log v0.6.0/go.mod h1:lWvLTqzAnCWPJA08T2HCstZi0L1y2Wyvm3FJgwU9jwU= github.com/anacrolix/log v0.13.1/go.mod h1:D4+CvN8SnruK6zIFS/xPoRJmtvtnxs+CSfDQ+BFxZ68= github.com/anacrolix/log v0.14.2/go.mod h1:1OmJESOtxQGNMlUO5rcv96Vpp9mfMqXXbe2RdinFLdY= -github.com/anacrolix/log v0.15.0 h1:QIhbW5NDUL6P1Aml+ZfdaXJ+QFAnrO0K1EpFYs/nh9M= -github.com/anacrolix/log v0.15.0/go.mod h1:m0poRtlr41mriZlXBQ9SOVZ8yZBkLjOkDhd5Li5pITA= +github.com/anacrolix/log v0.15.2 h1:LTSf5Wm6Q4GNWPFMBP7NPYV6UBVZzZLKckL+/Lj72Oo= +github.com/anacrolix/log v0.15.2/go.mod h1:m0poRtlr41mriZlXBQ9SOVZ8yZBkLjOkDhd5Li5pITA= github.com/anacrolix/missinggo v1.1.0/go.mod h1:MBJu3Sk/k3ZfGYcS7z18gwfu72Ey/xopPFJJbTi5yIo= github.com/anacrolix/missinggo v1.1.2-0.20190815015349-b888af804467/go.mod h1:MBJu3Sk/k3ZfGYcS7z18gwfu72Ey/xopPFJJbTi5yIo= github.com/anacrolix/missinggo v1.2.1/go.mod h1:J5cMhif8jPmFoC3+Uvob3OXXNIhOUikzMt+uUjeM21Y= @@ -63,8 +63,8 @@ github.com/anacrolix/missinggo/v2 v2.7.3 h1:Ee//CmZBMadeNiYB/hHo9ly2PFOEZ4Fhsbnu github.com/anacrolix/missinggo/v2 v2.7.3/go.mod h1:mIEtp9pgaXqt8VQ3NQxFOod/eQ1H0D1XsZzKUQfwtac= github.com/anacrolix/multiless v0.3.1-0.20221221005021-2d12701f83f7 h1:lOtCD+LzoD1g7bowhYJNR++uV+FyY5bTZXKwnPex9S8= github.com/anacrolix/multiless v0.3.1-0.20221221005021-2d12701f83f7/go.mod h1:zJv1JF9AqdZiHwxqPgjuOZDGWER6nyE48WBCi/OOrMM= -github.com/anacrolix/publicip v0.3.0 h1:QK+lvqNzZDznqWMe5lbnjdXsKb7Mvhqy6osV3J+HwPY= -github.com/anacrolix/publicip v0.3.0/go.mod h1:tF1kAG96Ao3t9Q8zyfA7Lso1wOEfHHEcZQTRI+PMm4k= +github.com/anacrolix/publicip v0.3.1 h1:a8tXUS4L6dG3mBFp4ZhvzmEztEEPThJDLTaF2KOAz0g= +github.com/anacrolix/publicip v0.3.1/go.mod h1:tF1kAG96Ao3t9Q8zyfA7Lso1wOEfHHEcZQTRI+PMm4k= github.com/anacrolix/stm v0.2.0/go.mod h1:zoVQRvSiGjGoTmbM0vSLIiaKjWtNPeTvXUSdJQA4hsg= github.com/anacrolix/stm v0.5.0 h1:9df1KBpttF0TzLgDq51Z+TEabZKMythqgx89f1FQJt8= github.com/anacrolix/stm v0.5.0/go.mod h1:MOwrSy+jCm8Y7HYfMAwPj7qWVu7XoVvjOiYwJmpeB/M= @@ -96,8 +96,8 @@ github.com/bradfitz/iter v0.0.0-20191230175014-e8f45d346db8 h1:GKTyiRCL6zVf5wWaq github.com/bradfitz/iter v0.0.0-20191230175014-e8f45d346db8/go.mod h1:spo1JLcs67NmW1aVLEgtA8Yy1elc+X8y5SRW1sFW4Og= github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM= github.com/bytedance/sonic v1.10.0-rc/go.mod h1:ElCzW+ufi8qKqNW0FY314xriJhyJhuoJ3gFZdAHF7NM= -github.com/bytedance/sonic v1.11.1 h1:JC0+6c9FoWYYxakaoa+c5QTtJeiSZNeByOBhXtAFSn4= -github.com/bytedance/sonic v1.11.1/go.mod h1:iZcSUejdk5aukTND/Eu/ivjQuEL0Cu9/rf50Hi0u/g4= +github.com/bytedance/sonic v1.11.3 h1:jRN+yEjakWh8aK5FzrciUHG8OFXK+4/KrAX/ysEtHAA= +github.com/bytedance/sonic v1.11.3/go.mod h1:iZcSUejdk5aukTND/Eu/ivjQuEL0Cu9/rf50Hi0u/g4= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY= github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk= @@ -129,14 +129,13 @@ github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7z github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk= -github.com/gin-contrib/cors v1.5.0 h1:DgGKV7DDoOn36DFkNtbHrjoRiT5ExCe+PC9/xp7aKvk= -github.com/gin-contrib/cors v1.5.0/go.mod h1:TvU7MAZ3EwrPLI2ztzTt3tqgvBCq+wn8WpZmfADjupI= +github.com/gin-contrib/cors v1.7.1 h1:s9SIppU/rk8enVvkzwiC2VK3UZ/0NNGsWfUKvV55rqs= +github.com/gin-contrib/cors v1.7.1/go.mod h1:n/Zj7B4xyrgk/cX1WCX2dkzFfaNm/xJb6oIUk7WTtps= github.com/gin-contrib/gzip v0.0.6 h1:NjcunTcGAj5CO1gn4N8jHOSIeRFHIbn51z6K+xaN4d4= -github.com/gin-contrib/location v0.0.2 h1:QZKh1+K/LLR4KG/61eIO3b7MLuKi8tytQhV6texLgP4= -github.com/gin-contrib/location v0.0.2/go.mod h1:NGoidiRlf0BlA/VKSVp+g3cuSMeTmip/63PhEjRhUAc= +github.com/gin-contrib/location v1.0.0 h1:j/7yjXfMl3Q9wGFhaCeqgss9ozz1euOSVc4T27PfT4E= +github.com/gin-contrib/location v1.0.0/go.mod h1:J5T7bQQOj/uhs37QL+zER84+U3+xj2ofrjt1VZ3FGR0= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= -github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= 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/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE= @@ -149,25 +148,21 @@ github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2 github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-openapi/jsonpointer v0.20.2 h1:mQc3nmndL8ZBzStEo3JYF8wzmeWffDH4VbXz58sAx6Q= -github.com/go-openapi/jsonpointer v0.20.2/go.mod h1:bHen+N0u1KEO3YlmqOjTT9Adn1RfD91Ar825/PuiRVs= -github.com/go-openapi/jsonreference v0.20.4 h1:bKlDxQxQJgwpUSgOENiMPzCTBVuc7vTdXSSgNeAhojU= -github.com/go-openapi/jsonreference v0.20.4/go.mod h1:5pZJyJP2MnYCpoeoMAql78cCHauHj0V9Lhc506VOpw4= -github.com/go-openapi/spec v0.20.14 h1:7CBlRnw+mtjFGlPDRZmAMnq35cRzI91xj03HVyUi/Do= -github.com/go-openapi/spec v0.20.14/go.mod h1:8EOhTpBoFiask8rrgwbLC3zmJfz4zsCUueRuPM6GNkw= -github.com/go-openapi/swag v0.22.9 h1:XX2DssF+mQKM2DHsbgZK74y/zj4mo9I99+89xUmuZCE= -github.com/go-openapi/swag v0.22.9/go.mod h1:3/OXnFfnMAwBD099SwYRk7GD3xOrr1iL7d/XNLXVVwE= -github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= +github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ= +github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY= +github.com/go-openapi/jsonreference v0.21.0 h1:Rs+Y7hSXT83Jacb7kFyjn4ijOuVGSvOdF2+tg1TRrwQ= +github.com/go-openapi/jsonreference v0.21.0/go.mod h1:LmZmgsrTkVg9LG4EaHeY8cBDslNPMo06cago5JNLkm4= +github.com/go-openapi/spec v0.21.0 h1:LTVzPc3p/RzRnkQqLRndbAzjY0d0BCL72A6j3CdL9ZY= +github.com/go-openapi/spec v0.21.0/go.mod h1:78u6VdPw81XU44qEWGhtr982gJ5BWg2c0I5XwVMotYk= +github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE= +github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ= github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= -github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= -github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= -github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= -github.com/go-playground/validator/v10 v10.18.0 h1:BvolUXjp4zuvkZ5YN5t7ebzbhlUtPsPm2S9NAZ5nl9U= -github.com/go-playground/validator/v10 v10.18.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= +github.com/go-playground/validator/v10 v10.19.0 h1:ol+5Fu+cSq9JD7SoSqe04GMI92cbn0+wvQ3bZ8b/AU4= +github.com/go-playground/validator/v10 v10.19.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= @@ -180,7 +175,6 @@ github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfb github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= @@ -240,12 +234,10 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= @@ -265,8 +257,8 @@ github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= -github.com/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI= -github.com/pelletier/go-toml/v2 v2.1.1/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= +github.com/pelletier/go-toml/v2 v2.2.0 h1:QLgLl2yMN7N+ruc31VynXs1vhMZa7CeHHejIeBAsoHo= +github.com/pelletier/go-toml/v2 v2.2.0/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= @@ -313,6 +305,7 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.2.1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= @@ -321,8 +314,9 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/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/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/swaggo/files v1.0.1 h1:J1bVJ4XHZNq0I46UU90611i9/YzdrF7x92oX1ig5IdE= github.com/swaggo/files v1.0.1/go.mod h1:0qXmMNH6sXNf+73t65aKeB+ApmgxdnkQzVTAj2uaMUg= github.com/swaggo/gin-swagger v1.6.0 h1:y8sxvQ3E20/RCyrXeFfg60r6H0Z+SwpTjMYsMm+zy8M= @@ -336,8 +330,6 @@ github.com/tsynik/torrent v1.2.16 h1:jEXIkdPKIOerO+8b/12wTvEoLnjGFcHX7dMitTmrWH0 github.com/tsynik/torrent v1.2.16/go.mod h1:c/K0Twt8E0qXJj02tl5FmjhGXSl0XzbFYrzkXTGqU+w= 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= -github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= -github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE= github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= github.com/willf/bitset v1.1.9/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= @@ -356,12 +348,12 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo= -golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= +golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= +golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20220428152302-39d4317da171/go.mod h1:lgLbSvA5ygNOMpwM/9anMpWVlVJ7Z+cHWq/eFuinpGE= -golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 h1:LfspQV/FYTatPTr/3HzIcmiUFH7PGP+OQ6mgDYo3yuQ= -golang.org/x/exp v0.0.0-20240222234643-814bf88cf225/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc= +golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 h1:985EYyeCOxTpcgOTJpflJUwOeEz0CQOdPt73OzpE9F8= +golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI= golang.org/x/image v0.15.0 h1:kOELfmgrmJlw4Cdb7g/QGuB3CvDrXbqEIww/pNtNBm8= golang.org/x/image v0.15.0/go.mod h1:HUYqC05R2ZcZ3ejNQsIHQDQiwWM4JBqmm6MKANTp4LE= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -371,7 +363,7 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/mod v0.6.0-dev.0.20211013180041-c96bc1413d57/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8= +golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -388,8 +380,8 @@ golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20220524220425-1d687d428aca/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= +golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -400,8 +392,8 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -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/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/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-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -412,7 +404,6 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200413165638-669c56c373c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -425,8 +416,8 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= +golang.org/x/sys v0.19.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= @@ -449,8 +440,8 @@ golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3 golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.8-0.20211029000441-d6a9af8af023/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.18.0 h1:k8NLag8AGHnn+PHbl7g43CtqZAwG60vZkLqgyZgIHgQ= -golang.org/x/tools v0.18.0/go.mod h1:GL7B4CwcLLeo59yx/9UWWuNOW1n3VZ4f5axWfML7Lcg= +golang.org/x/tools v0.20.0 h1:hz/CVckiOxybQvFw6h7b/q80NTr9IUQb4s1IIzW7KNY= +golang.org/x/tools v0.20.0/go.mod h1:WvitBU7JJf6A4jOdg4S1tviW9bhUxkgeCui/0JHctQg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -485,7 +476,6 @@ gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/server/settings/torrent.go b/server/settings/torrent.go index 40361cb..d539c40 100644 --- a/server/settings/torrent.go +++ b/server/settings/torrent.go @@ -12,9 +12,10 @@ import ( type TorrentDB struct { *torrent.TorrentSpec - Title string `json:"title,omitempty"` - Poster string `json:"poster,omitempty"` - Data string `json:"data,omitempty"` + Title string `json:"title,omitempty"` + Category string `json:"category,omitempty"` + Poster string `json:"poster,omitempty"` + Data string `json:"data,omitempty"` Timestamp int64 `json:"timestamp,omitempty"` Size int64 `json:"size,omitempty"` diff --git a/server/torr/apihelper.go b/server/torr/apihelper.go index ed169c5..76e4ca6 100644 --- a/server/torr/apihelper.go +++ b/server/torr/apihelper.go @@ -37,7 +37,7 @@ func LoadTorrent(tor *Torrent) *Torrent { return tr } -func AddTorrent(spec *torrent.TorrentSpec, title, poster string, data string) (*Torrent, error) { +func AddTorrent(spec *torrent.TorrentSpec, title, poster string, data string, category string) (*Torrent, error) { torr, err := NewTorrent(spec, bts) if err != nil { log.TLogln("error add torrent:", err) @@ -55,12 +55,24 @@ func AddTorrent(spec *torrent.TorrentSpec, title, poster string, data string) (* torr.Title = torr.Info().Name } } + + // Category can be override + torr.Category = category + if torr.Category == "" { + if torDB != nil { + torr.Category = torDB.Category + // } else { + // torr.Category = "None" + } + } + if torr.Poster == "" { torr.Poster = poster if torr.Poster == "" && torDB != nil { torr.Poster = torDB.Poster } } + if torr.Data == "" { torr.Data = data if torr.Data == "" && torDB != nil { @@ -96,6 +108,7 @@ func GetTorrent(hashHex string) *Torrent { tr.Data = tor.Data tr.Size = tor.Size tr.Timestamp = tor.Timestamp + tr.Category = tor.Category tr.GotInfo() } }() @@ -103,7 +116,7 @@ func GetTorrent(hashHex string) *Torrent { return tor } -func SetTorrent(hashHex, title, poster, data string) *Torrent { +func SetTorrent(hashHex, title, poster, category string, data string) *Torrent { hash := metainfo.NewHashFromHex(hashHex) torr := bts.GetTorrent(hash) torrDb := GetTorrentDB(hash) @@ -122,12 +135,14 @@ func SetTorrent(hashHex, title, poster, data string) *Torrent { } torr.Title = title torr.Poster = poster + torr.Category = category torr.Data = data } if torrDb != nil { torrDb.Title = title torrDb.Poster = poster + torrDb.Category = category torrDb.Data = data AddTorrentDB(torrDb) } diff --git a/server/torr/dbwrapper.go b/server/torr/dbwrapper.go index 4aca82f..60e525f 100644 --- a/server/torr/dbwrapper.go +++ b/server/torr/dbwrapper.go @@ -22,6 +22,7 @@ func AddTorrentDB(torr *Torrent) { t := new(settings.TorrentDB) t.TorrentSpec = torr.TorrentSpec t.Title = torr.Title + t.Category = torr.Category if torr.Data == "" { files := new(tsFiles) files.TorrServer.Files = torr.Status().FileStats @@ -54,6 +55,7 @@ func GetTorrentDB(hash metainfo.Hash) *Torrent { torr.Size = db.Size torr.Data = db.Data torr.Stat = state.TorrentInDB + torr.Category = db.Category return torr } } @@ -74,6 +76,7 @@ func ListTorrentsDB() map[metainfo.Hash]*Torrent { torr.Poster = db.Poster torr.Timestamp = db.Timestamp torr.Size = db.Size + torr.Category = db.Category torr.Data = db.Data torr.Stat = state.TorrentInDB ret[torr.TorrentSpec.InfoHash] = torr diff --git a/server/torr/state/state.go b/server/torr/state/state.go index 39a96e2..e46ee6c 100644 --- a/server/torr/state/state.go +++ b/server/torr/state/state.go @@ -32,6 +32,7 @@ const ( type TorrentStatus struct { Title string `json:"title"` + Category string `json:"category"` Poster string `json:"poster"` Data string `json:"data,omitempty"` Timestamp int64 `json:"timestamp"` diff --git a/server/torr/torrent.go b/server/torr/torrent.go index b113a24..278db2f 100644 --- a/server/torr/torrent.go +++ b/server/torr/torrent.go @@ -20,9 +20,10 @@ import ( ) type Torrent struct { - Title string - Poster string - Data string + Title string + Category string + Poster string + Data string *torrent.TorrentSpec Stat state.TorrentStat @@ -290,6 +291,7 @@ func (t *Torrent) Status() *state.TorrentStatus { st.Stat = t.Stat st.StatString = t.Stat.String() st.Title = t.Title + st.Category = t.Category st.Poster = t.Poster st.Data = t.Data st.Timestamp = t.Timestamp diff --git a/server/web/api/play.go b/server/web/api/play.go index 48d4180..a17dbc7 100644 --- a/server/web/api/play.go +++ b/server/web/api/play.go @@ -54,7 +54,7 @@ func play(c *gin.Context) { } if tor.Stat == state.TorrentInDB { - tor, err = torr.AddTorrent(spec, tor.Title, tor.Poster, tor.Data) + tor, err = torr.AddTorrent(spec, tor.Title, tor.Poster, tor.Data, tor.Category) if err != nil { c.AbortWithError(http.StatusInternalServerError, err) return diff --git a/server/web/api/stream.go b/server/web/api/stream.go index 6f9ab57..7c9cc9c 100644 --- a/server/web/api/stream.go +++ b/server/web/api/stream.go @@ -95,7 +95,7 @@ func stream(c *gin.Context) { data = tor.Data } if tor == nil || tor.Stat == state.TorrentInDB { - tor, err = torr.AddTorrent(spec, title, poster, data) + tor, err = torr.AddTorrent(spec, title, poster, data, tor.Category) if err != nil { c.AbortWithError(http.StatusInternalServerError, err) return @@ -169,6 +169,7 @@ func streamNoAuth(c *gin.Context) { title := c.Query("title") poster := c.Query("poster") data := "" + category := c.Query("category") if link == "" { c.AbortWithError(http.StatusBadRequest, errors.New("link should not be empty")) @@ -193,9 +194,10 @@ func streamNoAuth(c *gin.Context) { title = tor.Title poster = tor.Poster data = tor.Data + category = tor.Category if tor.Stat == state.TorrentInDB { - tor, err = torr.AddTorrent(spec, title, poster, data) + tor, err = torr.AddTorrent(spec, title, poster, data, category) if err != nil { c.AbortWithError(http.StatusInternalServerError, err) return diff --git a/server/web/api/torrents.go b/server/web/api/torrents.go index 34cef2a..c5b18b8 100644 --- a/server/web/api/torrents.go +++ b/server/web/api/torrents.go @@ -21,6 +21,7 @@ type torrReqJS struct { Link string `json:"link,omitempty"` Hash string `json:"hash,omitempty"` Title string `json:"title,omitempty"` + Category string `json:"category,omitempty"` Poster string `json:"poster,omitempty"` Data string `json:"data,omitempty"` SaveToDB bool `json:"save_to_db,omitempty"` @@ -94,7 +95,10 @@ func addTorrent(req torrReqJS, c *gin.Context) { return } - tor, err := torr.AddTorrent(torrSpec, req.Title, req.Poster, req.Data) + tor, err := torr.AddTorrent(torrSpec, req.Title, req.Poster, req.Data, req.Category) + + log.TLogln("Final torrent category: ", tor.Category) + if err != nil { log.TLogln("error add torrent:", err) c.AbortWithError(http.StatusInternalServerError, err) @@ -149,7 +153,7 @@ func setTorrent(req torrReqJS, c *gin.Context) { c.AbortWithError(http.StatusBadRequest, errors.New("hash is empty")) return } - torr.SetTorrent(req.Hash, req.Title, req.Poster, req.Data) + torr.SetTorrent(req.Hash, req.Title, req.Poster, req.Category, req.Data) c.Status(200) } diff --git a/server/web/api/upload.go b/server/web/api/upload.go index e0352ca..1a1efa3 100644 --- a/server/web/api/upload.go +++ b/server/web/api/upload.go @@ -20,6 +20,7 @@ import ( // @Param file formData file true "Torrent file to insert" // @Param save formData string false "Save to DB" // @Param title formData string false "Torrent title" +// @Param category formData string false "Torrent category" // @Param poster formData string false "Torrent poster" // @Param data formData string false "Torrent data" // @@ -41,6 +42,10 @@ func torrentUpload(c *gin.Context) { if len(form.Value["title"]) > 0 { title = form.Value["title"][0] } + category := "" + if len(form.Value["category"]) > 0 { + category = form.Value["category"][0] + } poster := "" if len(form.Value["poster"]) > 0 { poster = form.Value["poster"][0] @@ -66,7 +71,7 @@ func torrentUpload(c *gin.Context) { continue } - tor, err = torr.AddTorrent(spec, title, poster, data) + tor, err = torr.AddTorrent(spec, title, poster, data, category) if err != nil { log.TLogln("error upload torrent:", err) continue diff --git a/server/web/pages/template/html.go b/server/web/pages/template/html.go index 13672a6..e4da0f1 100644 --- a/server/web/pages/template/html.go +++ b/server/web/pages/template/html.go @@ -118,20 +118,20 @@ var Mstile150x150png []byte //go:embed pages/site.webmanifest var Sitewebmanifest []byte -//go:embed pages/static/js/2.916c2545.chunk.js -var Staticjs2916c2545chunkjs []byte +//go:embed pages/static/js/2.00261e25.chunk.js +var Staticjs200261e25chunkjs []byte -//go:embed pages/static/js/2.916c2545.chunk.js.LICENSE.txt -var Staticjs2916c2545chunkjsLICENSEtxt []byte +//go:embed pages/static/js/2.00261e25.chunk.js.LICENSE.txt +var Staticjs200261e25chunkjsLICENSEtxt []byte -//go:embed pages/static/js/2.916c2545.chunk.js.map -var Staticjs2916c2545chunkjsmap []byte +//go:embed pages/static/js/2.00261e25.chunk.js.map +var Staticjs200261e25chunkjsmap []byte -//go:embed pages/static/js/main.55f380e1.chunk.js -var Staticjsmain55f380e1chunkjs []byte +//go:embed pages/static/js/main.4f4f0915.chunk.js +var Staticjsmain4f4f0915chunkjs []byte -//go:embed pages/static/js/main.55f380e1.chunk.js.map -var Staticjsmain55f380e1chunkjsmap []byte +//go:embed pages/static/js/main.4f4f0915.chunk.js.map +var Staticjsmain4f4f0915chunkjsmap []byte //go:embed pages/static/js/runtime-main.f542387e.js var Staticjsruntimemainf542387ejs []byte diff --git a/server/web/pages/template/pages/asset-manifest.json b/server/web/pages/template/pages/asset-manifest.json index c6b5e05..55f3c9e 100644 --- a/server/web/pages/template/pages/asset-manifest.json +++ b/server/web/pages/template/pages/asset-manifest.json @@ -1,17 +1,17 @@ { "files": { - "main.js": "/static/js/main.55f380e1.chunk.js", - "main.js.map": "/static/js/main.55f380e1.chunk.js.map", + "main.js": "/static/js/main.4f4f0915.chunk.js", + "main.js.map": "/static/js/main.4f4f0915.chunk.js.map", "runtime-main.js": "/static/js/runtime-main.f542387e.js", "runtime-main.js.map": "/static/js/runtime-main.f542387e.js.map", - "static/js/2.916c2545.chunk.js": "/static/js/2.916c2545.chunk.js", - "static/js/2.916c2545.chunk.js.map": "/static/js/2.916c2545.chunk.js.map", + "static/js/2.00261e25.chunk.js": "/static/js/2.00261e25.chunk.js", + "static/js/2.00261e25.chunk.js.map": "/static/js/2.00261e25.chunk.js.map", "index.html": "/index.html", - "static/js/2.916c2545.chunk.js.LICENSE.txt": "/static/js/2.916c2545.chunk.js.LICENSE.txt" + "static/js/2.00261e25.chunk.js.LICENSE.txt": "/static/js/2.00261e25.chunk.js.LICENSE.txt" }, "entrypoints": [ "static/js/runtime-main.f542387e.js", - "static/js/2.916c2545.chunk.js", - "static/js/main.55f380e1.chunk.js" + "static/js/2.00261e25.chunk.js", + "static/js/main.4f4f0915.chunk.js" ] } \ No newline at end of file diff --git a/server/web/pages/template/pages/index.html b/server/web/pages/template/pages/index.html index b489fb1..a3db807 100644 --- a/server/web/pages/template/pages/index.html +++ b/server/web/pages/template/pages/index.html @@ -1 +1 @@ -TorrServer MatriX
\ No newline at end of file +TorrServer MatriX
\ No newline at end of file diff --git a/server/web/pages/template/route.go b/server/web/pages/template/route.go index 3800b6f..22be5f4 100644 --- a/server/web/pages/template/route.go +++ b/server/web/pages/template/route.go @@ -207,7 +207,7 @@ func RouteWebPages(route gin.IRouter) { etag := fmt.Sprintf("%x", md5.Sum(Browserconfigxml)) c.Header("Cache-Control", "public, max-age=31536000") c.Header("ETag", etag) - c.Data(200, "application/xml; charset=utf-8", Browserconfigxml) + c.Data(200, "text/xml; charset=utf-8", Browserconfigxml) }) route.GET("/dlnaicon-120.png", func(c *gin.Context) { @@ -280,46 +280,46 @@ func RouteWebPages(route gin.IRouter) { c.Data(200, "application/manifest+json", Sitewebmanifest) }) - route.GET("/static/js/2.916c2545.chunk.js", func(c *gin.Context) { - etag := fmt.Sprintf("%x", md5.Sum(Staticjs2916c2545chunkjs)) + route.GET("/static/js/2.00261e25.chunk.js", func(c *gin.Context) { + etag := fmt.Sprintf("%x", md5.Sum(Staticjs200261e25chunkjs)) c.Header("Cache-Control", "public, max-age=31536000") c.Header("ETag", etag) - c.Data(200, "application/javascript; charset=utf-8", Staticjs2916c2545chunkjs) + c.Data(200, "text/javascript; charset=utf-8", Staticjs200261e25chunkjs) }) - route.GET("/static/js/2.916c2545.chunk.js.LICENSE.txt", func(c *gin.Context) { - etag := fmt.Sprintf("%x", md5.Sum(Staticjs2916c2545chunkjsLICENSEtxt)) + route.GET("/static/js/2.00261e25.chunk.js.LICENSE.txt", func(c *gin.Context) { + etag := fmt.Sprintf("%x", md5.Sum(Staticjs200261e25chunkjsLICENSEtxt)) c.Header("Cache-Control", "public, max-age=31536000") c.Header("ETag", etag) - c.Data(200, "text/plain; charset=utf-8", Staticjs2916c2545chunkjsLICENSEtxt) + c.Data(200, "text/plain; charset=utf-8", Staticjs200261e25chunkjsLICENSEtxt) }) - route.GET("/static/js/2.916c2545.chunk.js.map", func(c *gin.Context) { - etag := fmt.Sprintf("%x", md5.Sum(Staticjs2916c2545chunkjsmap)) + route.GET("/static/js/2.00261e25.chunk.js.map", func(c *gin.Context) { + etag := fmt.Sprintf("%x", md5.Sum(Staticjs200261e25chunkjsmap)) c.Header("Cache-Control", "public, max-age=31536000") c.Header("ETag", etag) - c.Data(200, "application/json", Staticjs2916c2545chunkjsmap) + c.Data(200, "application/json", Staticjs200261e25chunkjsmap) }) - route.GET("/static/js/main.55f380e1.chunk.js", func(c *gin.Context) { - etag := fmt.Sprintf("%x", md5.Sum(Staticjsmain55f380e1chunkjs)) + route.GET("/static/js/main.4f4f0915.chunk.js", func(c *gin.Context) { + etag := fmt.Sprintf("%x", md5.Sum(Staticjsmain4f4f0915chunkjs)) c.Header("Cache-Control", "public, max-age=31536000") c.Header("ETag", etag) - c.Data(200, "application/javascript; charset=utf-8", Staticjsmain55f380e1chunkjs) + c.Data(200, "text/javascript; charset=utf-8", Staticjsmain4f4f0915chunkjs) }) - route.GET("/static/js/main.55f380e1.chunk.js.map", func(c *gin.Context) { - etag := fmt.Sprintf("%x", md5.Sum(Staticjsmain55f380e1chunkjsmap)) + route.GET("/static/js/main.4f4f0915.chunk.js.map", func(c *gin.Context) { + etag := fmt.Sprintf("%x", md5.Sum(Staticjsmain4f4f0915chunkjsmap)) c.Header("Cache-Control", "public, max-age=31536000") c.Header("ETag", etag) - c.Data(200, "application/json", Staticjsmain55f380e1chunkjsmap) + c.Data(200, "application/json", Staticjsmain4f4f0915chunkjsmap) }) route.GET("/static/js/runtime-main.f542387e.js", func(c *gin.Context) { etag := fmt.Sprintf("%x", md5.Sum(Staticjsruntimemainf542387ejs)) c.Header("Cache-Control", "public, max-age=31536000") c.Header("ETag", etag) - c.Data(200, "application/javascript; charset=utf-8", Staticjsruntimemainf542387ejs) + c.Data(200, "text/javascript; charset=utf-8", Staticjsruntimemainf542387ejs) }) route.GET("/static/js/runtime-main.f542387e.js.map", func(c *gin.Context) { diff --git a/web/README.md b/web/README.md index 6ffd9c3..8c89a2d 100644 --- a/web/README.md +++ b/web/README.md @@ -9,7 +9,7 @@ > > `http://192.168.78.4:8090/` - wrong 3. in `.env` file add TMDB api key -4. `yarn start` +4. `NODE_OPTIONS=--openssl-legacy-provider yarn start` ### Eslint > Prettier will fix the code every time the code is saved diff --git a/web/src/components/Add/AddDialog.jsx b/web/src/components/Add/AddDialog.jsx index 2469e2b..ffa3123 100644 --- a/web/src/components/Add/AddDialog.jsx +++ b/web/src/components/Add/AddDialog.jsx @@ -26,11 +26,13 @@ export default function AddDialog({ title: originalTitle, name: originalName, poster: originalPoster, + category: originalCategory, }) { const { t } = useTranslation() const isEditMode = !!originalHash const [torrentSource, setTorrentSource] = useState(originalHash || '') const [title, setTitle] = useState(originalTitle || '') + const [category, setCategory] = useState(originalCategory || '') const [originalTorrentTitle, setOriginalTorrentTitle] = useState('') const [parsedTitle, setParsedTitle] = useState('') const [posterUrl, setPosterUrl] = useState(originalPoster || '') @@ -207,6 +209,7 @@ export default function AddDialog({ hash: originalHash, title: title || originalName, poster: posterUrl, + category, }) .finally(handleClose) } else if (selectedFile) { @@ -220,7 +223,14 @@ export default function AddDialog({ } else { // link save axios - .post(torrentsHost(), { action: 'add', link: torrentSource, title, poster: posterUrl, save_to_db: true }) + .post(torrentsHost(), { + action: 'add', + link: torrentSource, + title, + category, + poster: posterUrl, + save_to_db: true, + }) .catch(handleClose) } } @@ -239,10 +249,10 @@ export default function AddDialog({ setTorrentSource={setTorrentSource} /> )} - setTitle(value) + const handleCategoryChange = ({ target: { value } }) => setCategory(value) const handlePosterUrlChange = ({ target: { value } }) => { setPosterUrl(value) checkImageURL(value).then(setIsPosterUrlCorrect) @@ -56,6 +69,9 @@ export default function RightSideComponent({ checkImageURL(url).then(setIsPosterUrlCorrect) setIsUserInteractedWithPoster(true) } + // main categories + const catIndex = TORRENT_CATEGORIES.findIndex(e => e.key === category) + // const catArray = TORRENT_CATEGORIES.find(e => e.key === category) return ( @@ -66,6 +82,7 @@ export default function RightSideComponent({ value={originalTorrentTitle} margin='dense' label={t('AddDialog.OriginalTorrentTitle')} + style={{ marginTop: '1em' }} type='text' variant='outlined' fullWidth @@ -87,7 +104,8 @@ export default function RightSideComponent({ endAdornment: ( { setTitle('') setIsCustomTitleEnabled(!isCustomTitleEnabled) @@ -95,7 +113,7 @@ export default function RightSideComponent({ setIsUserInteractedWithPoster(false) }} > - + ), @@ -108,6 +126,7 @@ export default function RightSideComponent({ value={title} margin='dense' label={t('AddDialog.TitleBlank')} + style={{ marginTop: '1em' }} type='text' variant='outlined' fullWidth @@ -123,6 +142,50 @@ export default function RightSideComponent({ variant='outlined' fullWidth /> + + + {t('AddDialog.CategoryHelperText')} + + + diff --git a/web/src/components/App/Sidebar.jsx b/web/src/components/App/Sidebar.jsx index 9158381..4654c70 100644 --- a/web/src/components/App/Sidebar.jsx +++ b/web/src/components/App/Sidebar.jsx @@ -11,10 +11,14 @@ import RemoveAll from 'components/RemoveAll' import AboutDialog from 'components/About' import CloseServer from 'components/CloseServer' import { memo } from 'react' +import CheckIcon from '@material-ui/icons/Check' +import ClearIcon from '@material-ui/icons/Clear' +import { TORRENT_CATEGORIES } from 'components/categories' +import FilterByCategory from 'components/FilterByCategory' import { AppSidebarStyle } from './style' -const Sidebar = ({ isDrawerOpen, setIsDonationDialogOpen, isOffline, isLoading }) => { +const Sidebar = ({ isDrawerOpen, setIsDonationDialogOpen, isOffline, isLoading, setGlobalFilterCategory }) => { const { t } = useTranslation() return ( @@ -27,6 +31,34 @@ const Sidebar = ({ isDrawerOpen, setIsDonationDialogOpen, isOffline, isLoading } + + } + setGlobalFilterCategory={setGlobalFilterCategory} + /> + {TORRENT_CATEGORIES.map(category => ( + + ))} + } + setGlobalFilterCategory={setGlobalFilterCategory} + /> + + + + diff --git a/web/src/components/App/index.jsx b/web/src/components/App/index.jsx index 75ec1ca..4593203 100644 --- a/web/src/components/App/index.jsx +++ b/web/src/components/App/index.jsx @@ -43,6 +43,7 @@ export default function App() { const [isDarkMode, currentThemeMode, updateThemeMode, muiTheme] = useMaterialUITheme() const [currentLang, changeLang] = useChangeLanguage() const [isOffline, setIsOffline] = useState(false) + const [globalCategoryFilter, setGlobalFilterCategory] = useState('all') const { data: torrents, isLoading } = useQuery('torrents', getTorrents, { retry: 1, refetchInterval: 1000, @@ -126,9 +127,16 @@ export default function App() { isLoading={isLoading} isDrawerOpen={isDrawerOpen} setIsDonationDialogOpen={setIsDonationDialogOpen} + setGlobalFilterCategory={setGlobalFilterCategory} /> - + + diff --git a/web/src/components/DialogTorrentDetailsContent/widgets/index.jsx b/web/src/components/DialogTorrentDetailsContent/widgets/index.jsx index a8592f1..76d554e 100644 --- a/web/src/components/DialogTorrentDetailsContent/widgets/index.jsx +++ b/web/src/components/DialogTorrentDetailsContent/widgets/index.jsx @@ -6,10 +6,12 @@ import { Widgets as WidgetsIcon, PhotoSizeSelectSmall as PhotoSizeSelectSmallIcon, Build as BuildIcon, + Category as CategoryIcon, } from '@material-ui/icons' import { getPeerString, humanizeSize, humanizeSpeed } from 'utils/Utils' import { useTranslation } from 'react-i18next' import { GETTING_INFO, IN_DB, CLOSED, PRELOAD, WORKING } from 'torrentStates' +import { TORRENT_CATEGORIES } from 'components/categories' import StatisticsField from '../StatisticsField' import useGetWidgetColors from './useGetWidgetColors' @@ -126,3 +128,25 @@ export const SizeWidget = ({ data }) => { /> ) } + +export const CategoryWidget = ({ data }) => { + const { t } = useTranslation() + const { iconBGColor, valueBGColor } = useGetWidgetColors('category') + // main categories + const catIndex = TORRENT_CATEGORIES.findIndex(e => e.key === data) + const catArray = TORRENT_CATEGORIES.find(e => e.key === data) + + if (data) { + return ( + = 0 ? t(catArray.name) : data.length > 1 ? data.charAt(0).toUpperCase() + data.slice(1) : data} + iconBg={iconBGColor} + valueBg={valueBGColor} + icon={CategoryIcon} + /> + ) + } + + return null +} diff --git a/web/src/components/DialogTorrentDetailsContent/widgets/useGetWidgetColors.jsx b/web/src/components/DialogTorrentDetailsContent/widgets/useGetWidgetColors.jsx index f9305f9..8ddb850 100644 --- a/web/src/components/DialogTorrentDetailsContent/widgets/useGetWidgetColors.jsx +++ b/web/src/components/DialogTorrentDetailsContent/widgets/useGetWidgetColors.jsx @@ -13,6 +13,7 @@ const colors = { piecesLength: { iconBGColor: '#0982c8', valueBGColor: '#098cd7' }, status: { iconBGColor: '#aea25b', valueBGColor: '#b4aa6e' }, size: { iconBGColor: '#9b01ad', valueBGColor: '#ac03bf' }, + category: { iconBGColor: '#914820', valueBGColor: '#c9632c' }, }, dark: { downloadSpeed: { iconBGColor: '#0c6600', valueBGColor: '#0d7000' }, @@ -22,6 +23,7 @@ const colors = { piecesLength: { iconBGColor: '#07659c', valueBGColor: '#0872af' }, status: { iconBGColor: '#938948', valueBGColor: '#9f9450' }, size: { iconBGColor: '#81008f', valueBGColor: '#9102a1' }, + category: { iconBGColor: '#914820', valueBGColor: '#c9632c' }, }, } diff --git a/web/src/components/FilterByCategory.jsx b/web/src/components/FilterByCategory.jsx new file mode 100644 index 0000000..d18905b --- /dev/null +++ b/web/src/components/FilterByCategory.jsx @@ -0,0 +1,20 @@ +import ListItem from '@material-ui/core/ListItem' +import ListItemIcon from '@material-ui/core/ListItemIcon' +import ListItemText from '@material-ui/core/ListItemText' +import { useTranslation } from 'react-i18next' + +export default function FilterByCategory({ categoryKey, categoryName, setGlobalFilterCategory, icon }) { + const onClick = () => { + setGlobalFilterCategory(categoryKey) + } + const { t } = useTranslation() + + return ( + <> + + {icon} + + + + ) +} diff --git a/web/src/components/TorrentCard/index.jsx b/web/src/components/TorrentCard/index.jsx index 44a00e7..0697ed3 100644 --- a/web/src/components/TorrentCard/index.jsx +++ b/web/src/components/TorrentCard/index.jsx @@ -19,6 +19,7 @@ import AddDialog from 'components/Add/AddDialog' import { StyledDialog } from 'style/CustomMaterialUiStyles' import useOnStandaloneAppOutsideClick from 'utils/useOnStandaloneAppOutsideClick' import { GETTING_INFO, IN_DB, CLOSED, PRELOAD, WORKING } from 'torrentStates' +import { TORRENT_CATEGORIES } from 'components/categories' import { StatusIndicators, @@ -44,7 +45,16 @@ const Torrent = ({ torrent }) => { const openDeleteTorrentAlert = () => setIsDeleteTorrentOpened(true) const closeDeleteTorrentAlert = () => setIsDeleteTorrentOpened(false) - const { title, name, poster, torrent_size: torrentSize, download_speed: downloadSpeed, hash, stat } = torrent + const { + title, + name, + category, + poster, + torrent_size: torrentSize, + download_speed: downloadSpeed, + hash, + stat, + } = torrent const dropTorrent = () => axios.post(torrentsHost(), { action: 'drop', hash }) const deleteTorrent = () => axios.post(torrentsHost(), { action: 'rem', hash }) @@ -72,6 +82,9 @@ const Torrent = ({ torrent }) => { const fullPlaylistLink = `${playlistTorrHost()}/${encodeURIComponent(parsedTitle || 'file')}.m3u?link=${hash}&m3u` const detailedInfoDialogRef = useOnStandaloneAppOutsideClick(closeDetailedInfo) + // main categories + const catIndex = TORRENT_CATEGORIES.findIndex(e => e.key === category) + const catArray = TORRENT_CATEGORIES.find(e => e.key === category) return ( <> @@ -108,7 +121,9 @@ const Torrent = ({ torrent }) => {
-
{t('Name')}
+
+ {category ? (catIndex >= 0 ? t(catArray.name) : category) : t('Name')} +
{parsedTitle}
@@ -170,7 +185,14 @@ const Torrent = ({ torrent }) => { {isEditDialogOpen && ( - + )} ) diff --git a/web/src/components/TorrentCard/style.js b/web/src/components/TorrentCard/style.js index 1348bbf..c6ff613 100644 --- a/web/src/components/TorrentCard/style.js +++ b/web/src/components/TorrentCard/style.js @@ -115,6 +115,18 @@ export const TorrentCardDescription = styled.div` flex-direction: column; } + // .description-title-wrapper > .description-section-name { + // display: flex; + // flex-wrap: nowrap; + // justify-content: space-between; + // self-align: end; + // } + + // .description-category-wrapper { + // display: inline-flex; + // color: #1a1a1a; + // } + .description-section-name { text-transform: uppercase; font-size: 10px; diff --git a/web/src/components/TorrentList/index.jsx b/web/src/components/TorrentList/index.jsx index 47fb714..4ccd090 100644 --- a/web/src/components/TorrentList/index.jsx +++ b/web/src/components/TorrentList/index.jsx @@ -1,11 +1,13 @@ import TorrentCard from 'components/TorrentCard' import CircularProgress from '@material-ui/core/CircularProgress' import { TorrentListWrapper, CenteredGrid } from 'components/App/style' +// import { useTranslation } from 'react-i18next' import NoServerConnection from './NoServerConnection' import AddFirstTorrent from './AddFirstTorrent' -export default function TorrentList({ isOffline, isLoading, sortABC, torrents }) { +export default function TorrentList({ isOffline, isLoading, sortABC, torrents, sortCategory }) { + // const { t } = useTranslation() if (isLoading || isOffline || !torrents.length) { return ( @@ -20,9 +22,11 @@ export default function TorrentList({ isOffline, isLoading, sortABC, torrents }) ) } + const filteredTorrents = torrents.filter(torrent => sortCategory === 'all' || torrent.category === sortCategory) + return sortABC ? ( - {torrents + {filteredTorrents .sort((a, b) => a.title > b.title) .map(torrent => ( @@ -30,7 +34,7 @@ export default function TorrentList({ isOffline, isLoading, sortABC, torrents }) ) : ( - {torrents.map(torrent => ( + {filteredTorrents.map(torrent => ( ))} diff --git a/web/src/components/categories.jsx b/web/src/components/categories.jsx new file mode 100644 index 0000000..a0df4c4 --- /dev/null +++ b/web/src/components/categories.jsx @@ -0,0 +1,11 @@ +import MovieCreationIcon from '@material-ui/icons/MovieCreation' +import LiveTvIcon from '@material-ui/icons/LiveTv' +import MusicNoteIcon from '@material-ui/icons/MusicNote' +import MoreHorizIcon from '@material-ui/icons/MoreHoriz' + +export const TORRENT_CATEGORIES = [ + { key: 'movie', name: 'Movies', icon: }, + { key: 'tv', name: 'Series', icon: }, + { key: 'music', name: 'Music', icon: }, + { key: 'other', name: 'Other', icon: }, +] diff --git a/web/src/locales/bg/translation.json b/web/src/locales/bg/translation.json index ad276c8..7ae1415 100644 --- a/web/src/locales/bg/translation.json +++ b/web/src/locales/bg/translation.json @@ -9,6 +9,7 @@ "Or": "или", "ClickOrDrag": "Щракнете / Влачи§Пусни (.torrent)" }, + "CategoryHelperText": "Торент категория", "CustomTorrentTitle": "Персонализирано заглавие (по избор)", "CustomTorrentTitleHelperText": "Напишете персонализирано заглавие, за да намерите плакат", "HashExists": "Този торент вече е в базата данни", @@ -21,6 +22,7 @@ }, "AddFromLink": "Добавете торент", "AddNewTorrent": "Добавете нов торент", + "All": "Всичко", "ApiDocs": "Документация на API", "B": "B", "bps": "bps", @@ -28,6 +30,7 @@ "BufferNote": "Задайте предварително зареден кеш преди възпроизвеждане > 32 MB в настройките, за да промените предварителния буфер", "Cache": "Кеш", "Cancel": "Отказ", + "Category": "Категория", "Clear": "Изчисти", "Close": "Затвори", "CloseServer?": "Искате ли да изключите сървъра?", @@ -43,7 +46,7 @@ "button": "Подробности за кеша", "header": "Подробности за кеша" }, - "Details": "Подробности", + "Details": "Детайли", "Donate?": "Искате ли да дарите?", "Donate": "Дарение", "DownloadPlaylist": "Изтегляне на плейлист", @@ -66,13 +69,17 @@ "Links": "Връзки", "MB": "MB", "Mbps": "Mbps", + "Movies": "Филми", + "Music": "Музика", "Name": "Име", "NasReleases": "NAS Releases", + "None": "Нито един", "NoTorrentsAdded": "Няма добавени торенти", "Offline": "Извън линия", "OK": "OK", "OpenLink": "Отвори линк", - "Peers": "Пиъри·Сийдъри", + "Other": "Други", + "Peers": "Пиъри·Сийди", "PiecesCount": "Брой парчета", "PiecesLength": "Дължина на парчетата", "Playlist": "Плейлист", @@ -98,6 +105,7 @@ "Sec": "сек", "Seconds": "Секунди", "SelectSeason": "Избери сезон", + "Series": "Серия", "SettingsDialog": { "AddRetrackers": "Добавяне на ретракери", "AdditionalSettings": "Допълнителни настройки", @@ -180,6 +188,7 @@ "TorrentStatus": "Статус на торента", "TorrentWorking": "Активен", "TurnOff": "Изключване", + "Uncategorized": "Некатегоризиран", "UploadFile": "Качи файл", "UploadSpeed": "Скорост на качване", "Viewed": "Гледан" diff --git a/web/src/locales/en/translation.json b/web/src/locales/en/translation.json index f2826e5..82af228 100644 --- a/web/src/locales/en/translation.json +++ b/web/src/locales/en/translation.json @@ -9,6 +9,7 @@ "Or": "OR", "ClickOrDrag": "CLICK / DRAG & DROP (.torrent)" }, + "CategoryHelperText": "Torrent category", "CustomTorrentTitle": "Custom title (optional)", "CustomTorrentTitleHelperText": "Write custom title to find poster", "HashExists": "This torrent is already in database", @@ -21,6 +22,7 @@ }, "AddFromLink": "Add Torrent", "AddNewTorrent": "Add new torrent", + "All": "All", "ApiDocs": "API Docs", "B": "B", "bps": "bps", @@ -28,6 +30,7 @@ "BufferNote": "Set Preload Cache Before Play > 32 MB in settings to change preload size", "Cache": "Cache", "Cancel": "Cancel", + "Category": "Category", "Clear": "Clear", "Close": "Close", "CloseServer?": "Do you want to turn off server?", @@ -66,12 +69,16 @@ "Links": "Links", "MB": "MB", "Mbps": "Mbps", + "Movies": "Movies", + "Music": "Music", "Name": "Name", "NasReleases": "NAS Releases", + "None": "None", "NoTorrentsAdded": "No torrents added", "Offline": "Offline", "OK": "OK", "OpenLink": "Open link", + "Other": "Other", "Peers": "Peers·Seeds", "PiecesCount": "Pieces count", "PiecesLength": "Pieces length", @@ -98,6 +105,7 @@ "Sec": "s", "Seconds": "Seconds", "SelectSeason": "Select Season", + "Series": "Series", "SettingsDialog": { "AddRetrackers": "Add retrackers", "AdditionalSettings": "Additional Settings", @@ -180,6 +188,7 @@ "TorrentStatus": "Torrent Status", "TorrentWorking": "Active", "TurnOff": "Turn Off", + "Uncategorized": "Uncategorized", "UploadFile": "Upload File", "UploadSpeed": "Upload speed", "Viewed": "Viewed" diff --git a/web/src/locales/ru/translation.json b/web/src/locales/ru/translation.json index 456cd65..83e016e 100644 --- a/web/src/locales/ru/translation.json +++ b/web/src/locales/ru/translation.json @@ -9,6 +9,7 @@ "Or": "ИЛИ", "ClickOrDrag": "НАЖМИТЕ / ПЕРЕТАЩИТЕ ФАЙЛ (.torrent)" }, + "CategoryHelperText": "Категория для торрента", "CustomTorrentTitle": "Cвое название (не обязательно)", "CustomTorrentTitleHelperText": "Напишите свое название, чтобы найти постер", "HashExists": "Этот торрент уже есть в базе данных", @@ -21,6 +22,7 @@ }, "AddFromLink": "Добавить", "AddNewTorrent": "Добавить новый торрент", + "All": "Все", "ApiDocs": "Документация API", "B": "Б", "bps": "бит/c", @@ -28,6 +30,7 @@ "BufferNote": "Установите Буфер предзагрузки > 32 МБ в настройках для измененения размера предзагрузки", "Cache": "Кеш", "Cancel": "Отмена", + "Category": "Категория", "Clear": "Очистить", "Close": "Закрыть", "CloseServer?": "Хотите выключить сервер?", @@ -66,12 +69,16 @@ "Links": "Ссылки", "MB": "МБ", "Mbps": "Мбит/c", + "Movies": "Фильмы", + "Music": "Музыка", "Name": "Название", "NasReleases": "Релизы для NAS", + "None": "Нет", "NoTorrentsAdded": "Нет торрентов", "Offline": "Сервер недоступен", "OK": "OK", "OpenLink": "Открыть", + "Other": "Другое", "Peers": "Пиры·Сиды", "PiecesCount": "Кол-во блоков", "PiecesLength": "Размер блока", @@ -98,6 +105,7 @@ "Sec": "c", "Seconds": "Секунды", "SelectSeason": "Выбор сезона", + "Series": "Сериалы", "SettingsDialog": { "AddRetrackers": "Добавлять", "AdditionalSettings": "Расширенные настройки", @@ -180,6 +188,7 @@ "TorrentStatus": "Состояние торрента", "TorrentWorking": "Активен", "TurnOff": "Выключить", + "Uncategorized": "Без категории", "UploadFile": "Загрузить файл", "UploadSpeed": "Скорость отдачи", "Viewed": "Просм." diff --git a/web/src/locales/ua/translation.json b/web/src/locales/ua/translation.json index 85d63b6..ce5c0f2 100644 --- a/web/src/locales/ua/translation.json +++ b/web/src/locales/ua/translation.json @@ -9,6 +9,7 @@ "Or": "ЧИ", "ClickOrDrag": "НАТИСНІТЬ / ПЕРЕТЯГНІТЬ ФАЙЛ (.torrent)" }, + "CategoryHelperText": "Торрент-категорія", "CustomTorrentTitle": "Власна назва (опційно)", "CustomTorrentTitleHelperText": "Напишіть власну назву, щоб знайти плакат", "HashExists": "Даний торент вже є у базі даних", @@ -21,6 +22,7 @@ }, "AddFromLink": "Додати торент", "AddNewTorrent": "Додати новий торент", + "All": "Усе", "ApiDocs": "Документація API", "B": "Б", "bps": "біт/c", @@ -28,6 +30,7 @@ "BufferNote": "Встановіть буфер попереднього завантаження > 32 МБ в налаштуваннях, щоб його змінити.", "Cache": "Кеш", "Cancel": "Скасувати", + "Category": "Категорія", "Clear": "Очистити", "Close": "Закрити", "CloseServer?": "Хочете вимкнути сервер?", @@ -66,12 +69,16 @@ "Links": "Посилання", "MB": "МБ", "Mbps": "Мбіт/c", + "Movies": "Фільми", + "Music": "Музика", "Name": "Назва", "NasReleases": "Релізи для NAS", + "None": "Жодного", "NoTorrentsAdded": "Немає торентів", "Offline": "Сервер не доступний", "OK": "OK", "OpenLink": "Відкрити", + "Other": "Інший", "Peers": "Піри·Сіди", "PiecesCount": "К-сть блоків", "PiecesLength": "Розмір блоку", @@ -98,6 +105,7 @@ "Sec": "c", "Seconds": "Секунди", "SelectSeason": "Вибір сезону", + "Series": "Серія", "SettingsDialog": { "AddRetrackers": "Додавати", "AdditionalSettings": "Додаткові налаштування", @@ -180,6 +188,7 @@ "TorrentStatus": "Статус торенту", "TorrentWorking": "Активний", "TurnOff": "Виключити", + "Uncategorized": "Без категорії", "UploadFile": "Завантажити файл", "UploadSpeed": "Швидкість відвантаження", "Viewed": "Перегл." diff --git a/web/src/locales/zh/translation.json b/web/src/locales/zh/translation.json index 5d86d04..86221f5 100644 --- a/web/src/locales/zh/translation.json +++ b/web/src/locales/zh/translation.json @@ -9,6 +9,7 @@ "Or": "或", "ClickOrDrag": "点击/拖放上传 (.torrent)" }, + "CategoryHelperText": "Torrent 类别", "CustomTorrentTitle": "自定义标题(可选)", "CustomTorrentTitleHelperText": "编写自定义标题以查找海报", "HashExists": "这个种子已经在数据库中", @@ -21,6 +22,7 @@ }, "AddFromLink": "添加种子", "AddNewTorrent": "添加新种子", + "All": "全部", "ApiDocs": "API 文档", "B": "B", "bps": "bps", @@ -28,6 +30,7 @@ "BufferNote": "在设置中将播放前预加载缓存设置为大于 32 MB 以更改预加载大小", "Cache": "缓存", "Cancel": "取消", + "Category": "类别", "Clear": "清除", "Close": "关闭", "CloseServer?": "你想关闭服务器吗?", @@ -66,12 +69,16 @@ "Links": "链接", "MB": "MB", "Mbps": "Mbps", + "Movies": "电影", + "Music": "音乐", "Name": "名称", "NasReleases": "NAS 版本", + "None": "没有任何", "NoTorrentsAdded": "没有添加种子", "Offline": "离线", "OK": "确定", "OpenLink": "打开链接", + "Other": "其他", "Peers": "Peers·Seeds", "PiecesCount": "块数量", "PiecesLength": "块长度", @@ -98,6 +105,7 @@ "Sec": "秒", "Seconds": "秒", "SelectSeason": "选择季", + "Series": "系列", "SettingsDialog": { "AddRetrackers": "添加retrackers", "AdditionalSettings": "附加设置", @@ -180,6 +188,7 @@ "TorrentStatus": "种子状态", "TorrentWorking": "活跃", "TurnOff": "关闭", + "Uncategorized": "未分类", "UploadFile": "上传文件", "UploadSpeed": "上传速度", "Viewed": "查看"