Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
71e9d29
qbittorrent and transmission as clients of bitmagnet. Includes graph…
rraymondgh Jul 27, 2024
5c5a6a8
qbittorrent and transmission as clients of bitmagnet. Includes graph…
rraymondgh Jul 27, 2024
c294d20
Merge branch 'download' of https://github.com/rraymondgh/bitmagnet in…
rraymondgh Oct 28, 2024
191d136
Merge remote-tracking branch 'upstream/main' into download
rraymondgh Oct 28, 2024
181b416
revert correct versions of libraries
rraymondgh Oct 29, 2024
8f8e379
UI work excluding i18n
rraymondgh Oct 30, 2024
3076f19
templated code
rraymondgh Oct 30, 2024
f9bc7d8
Merge branch 'i18n_torrent_bulk_actions' into download
rraymondgh Oct 30, 2024
65fea85
i18n
rraymondgh Oct 30, 2024
6bac22c
login once - webui prettier and build
rraymondgh Nov 4, 2024
73a22ea
Merge remote-tracking branch 'upstream/main' into download
rraymondgh Mar 3, 2025
595ef93
complete Merge remote-tracking branch 'upstream/main' into download
rraymondgh Mar 3, 2025
8a345a3
Merge remote-tracking branch 'upstream/main' into download
rraymondgh Mar 27, 2025
44b9ea9
fix merge breaks and linting
rraymondgh Mar 27, 2025
3d27e55
Merge remote-tracking branch 'upstream/main' into download
rraymondgh May 13, 2025
43ec8d4
fix linting and merge breaks
rraymondgh May 13, 2025
54d0dd8
core qbit module (go 1.23)
rraymondgh May 25, 2025
6d54412
sendTo target concept
rraymondgh Jun 5, 2025
5e9e12d
1. sub-package structure 2. complete enum with generators 3. ntfy client
rraymondgh Jun 16, 2025
4d43e43
enums defined once
rraymondgh Jun 18, 2025
6107217
Merge remote-tracking branch 'upstream/main' into download
rraymondgh Jun 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ tasks:

gen-classifier-schema:
cmds:
- go run . classifier schema --format json > ./bitmagnet.io/schemas/classifier-0.1.json
- go run . classifier schema --format json > ./bitmagnet.io/schemas/classifier-0.1

gen-webui-graphql:
dir: ./webui
Expand Down
18 changes: 12 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ require (
github.com/anacrolix/dht/v2 v2.22.0
github.com/anacrolix/missinggo/v2 v2.8.0
github.com/anacrolix/torrent v1.58.0
github.com/autobrr/go-qbittorrent v1.11.0
github.com/bits-and-blooms/bloom/v3 v3.7.0
github.com/facette/natsort v0.0.0-20181210072756-2cd4dd1e2dcb
github.com/frankban/quicktest v1.14.6
Expand All @@ -22,6 +23,7 @@ require (
github.com/grafana/pyroscope-go/godeltaprof v0.1.8
github.com/hashicorp/golang-lru/v2 v2.0.7
github.com/hedhyw/rex v1.0.0
github.com/hekmon/transmissionrpc/v3 v3.0.0
github.com/iancoleman/strcase v0.3.0
github.com/jackc/pgx/v5 v5.7.2
github.com/jedib0t/go-pretty/v6 v6.6.5
Expand All @@ -42,9 +44,9 @@ require (
github.com/xeipuuv/gojsonschema v1.2.0
go.uber.org/fx v1.23.0
go.uber.org/zap v1.27.0
golang.org/x/sync v0.11.0
golang.org/x/sys v0.30.0
golang.org/x/text v0.22.0
golang.org/x/sync v0.14.0
golang.org/x/sys v0.33.0
golang.org/x/text v0.25.0
golang.org/x/time v0.10.0
google.golang.org/protobuf v1.36.5
gopkg.in/yaml.v3 v3.0.1
Expand All @@ -56,6 +58,7 @@ require (
)

require (
github.com/Masterminds/semver v1.5.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad // indirect
Expand All @@ -78,6 +81,7 @@ require (
github.com/anacrolix/stm v0.5.0 // indirect
github.com/anacrolix/sync v0.5.3 // indirect; indirect m
github.com/antlr4-go/antlr/v4 v4.13.1 // indirect
github.com/avast/retry-go v3.0.0+incompatible // indirect
github.com/benbjohnson/immutable v0.4.3 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.20.0 // indirect
Expand All @@ -103,7 +107,9 @@ require (
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/websocket v1.5.3 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hekmon/cunits/v2 v2.1.0 // indirect
github.com/huandu/xstrings v1.5.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
Expand Down Expand Up @@ -170,11 +176,11 @@ require (
go.uber.org/dig v1.18.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/arch v0.13.0 // indirect
golang.org/x/crypto v0.33.0 // indirect
golang.org/x/crypto v0.38.0 // indirect
golang.org/x/exp v0.0.0-20250106191152-7588d65b2ba8 // indirect
golang.org/x/mod v0.23.0 // indirect
golang.org/x/net v0.35.0 // indirect
golang.org/x/term v0.29.0 // indirect
golang.org/x/net v0.40.0 // indirect
golang.org/x/term v0.32.0 // indirect
golang.org/x/tools v0.30.0 // indirect
golang.org/x/tools/cmd/cover v0.1.0-deprecated // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250106144421-5f5ef82da422 // indirect
Expand Down
36 changes: 24 additions & 12 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ github.com/DATA-DOG/go-sqlmock v1.5.2 h1:OcvFkGmslmlZibjAjaHm3L//6LiuBgolP7Oputl
github.com/DATA-DOG/go-sqlmock v1.5.2/go.mod h1:88MAG/4G7SMwSE3CeA0ZKzrT5CiOU3OJ+JlNzwDqpNU=
github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI=
github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww=
github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
github.com/Masterminds/semver/v3 v3.3.1 h1:QtNSWtVZ3nBfk8mAOu/B6v7FMJ+NHTIgUPi7rj+4nv4=
github.com/Masterminds/semver/v3 v3.3.1/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
github.com/Masterminds/sprig/v3 v3.3.0 h1:mQh0Yrg1XPo6vjYXgtf5OtijNAKJRNcTdOOGZe3tPhs=
Expand Down Expand Up @@ -92,6 +94,10 @@ github.com/antlr4-go/antlr/v4 v4.13.1/go.mod h1:GKmUxMtwp6ZgGwZSva4eWPC5mS6vUAmO
github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0 h1:jfIu9sQUG6Ig+0+Ap1h4unLjW6YQJpKZVmUzxsD4E/Q=
github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE=
github.com/autobrr/go-qbittorrent v1.11.0 h1:Xmt28ECvZYDiamabEUtDZvJxiO/NaoGjJF4mHESDXq4=
github.com/autobrr/go-qbittorrent v1.11.0/go.mod h1:sIwIdqDcFbN67tSC5p5Lp27M8/BQFoSoW5XqXyVdHF0=
github.com/avast/retry-go v3.0.0+incompatible h1:4SOWQ7Qs+oroOTQOYnAHqelpCO0biHSxpiH9JdtuBj0=
github.com/avast/retry-go v3.0.0+incompatible/go.mod h1:XtSnn+n/sHqQIpZ10K1qAevBhOOCWBLXXy3hyiqqBrY=
github.com/benbjohnson/immutable v0.2.0/go.mod h1:uc6OHo6PN2++n98KHLxW8ef4W42ylHiQSENghE1ezxI=
github.com/benbjohnson/immutable v0.4.3 h1:GYHcksoJ9K6HyAUpGxwZURrbTkXA0Dh4otXGqbhdrjA=
github.com/benbjohnson/immutable v0.4.3/go.mod h1:qJIKKSmdqz1tVzNtst1DZzvaqOU1onk1rc03IeM3Owk=
Expand Down Expand Up @@ -254,13 +260,19 @@ github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aN
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/grafana/pyroscope-go/godeltaprof v0.1.8 h1:iwOtYXeeVSAeYefJNaxDytgjKtUuKQbJqgAIjlnicKg=
github.com/grafana/pyroscope-go/godeltaprof v0.1.8/go.mod h1:2+l7K7twW49Ct4wFluZD3tZ6e0SjanjcUUBPVD/UuGU=
github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k=
github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM=
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/hedhyw/rex v1.0.0 h1:f7QNmVMBsmuEop/wg85byq6YbOHQr0q3Y78Q3IwKp+I=
github.com/hedhyw/rex v1.0.0/go.mod h1:n9CYz3ztkAp56mrMXw65Q3LeXCO2AZSUvO7VMHsVMF8=
github.com/hekmon/cunits/v2 v2.1.0 h1:k6wIjc4PlacNOHwKEMBgWV2/c8jyD4eRMs5mR1BBhI0=
github.com/hekmon/cunits/v2 v2.1.0/go.mod h1:9r1TycXYXaTmEWlAIfFV8JT+Xo59U96yUJAYHxzii2M=
github.com/hekmon/transmissionrpc/v3 v3.0.0 h1:0Fb11qE0IBh4V4GlOwHNYpqpjcYDp5GouolwrpmcUDQ=
github.com/hekmon/transmissionrpc/v3 v3.0.0/go.mod h1:38SlNhFzinVUuY87wGj3acOmRxeYZAZfrj6Re7UgCDg=
github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM=
github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
Expand Down Expand Up @@ -563,8 +575,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.33.0 h1:IOBPskki6Lysi0lo9qQvbxiQ+FvsCC/YWOecCHAixus=
golang.org/x/crypto v0.33.0/go.mod h1:bVdXmD7IV/4GdElGPozy6U7lWdRXA4qyRVGJV57uQ5M=
golang.org/x/crypto v0.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8=
golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20250106191152-7588d65b2ba8 h1:yqrTHse8TCMW1M1ZCP+VAR/l0kKxwaAIqN/il7x4voA=
golang.org/x/exp v0.0.0-20250106191152-7588d65b2ba8/go.mod h1:tujkw807nyEEAamNbDrEGzRav+ilXA7PCRAd6xsmwiU=
Expand Down Expand Up @@ -597,8 +609,8 @@ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96b
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8=
golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk=
golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY=
golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds=
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=
Expand All @@ -612,8 +624,8 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ
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.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w=
golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ=
golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
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=
Expand Down Expand Up @@ -644,23 +656,23 @@ 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.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
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=
golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY=
golang.org/x/term v0.29.0 h1:L6pJp37ocefwRRtYPKSWOWzOtWSxVajvz2ldH/xi3iU=
golang.org/x/term v0.29.0/go.mod h1:6bl4lRlvVuDgSf3179VpIxBF0o10JUpXWOnI7nErv7s=
golang.org/x/term v0.32.0 h1:DR4lr0TjUs3epypdhTOkMmuF5CDFJ/8pOnbzMZPQ7bg=
golang.org/x/term v0.32.0/go.mod h1:uZG1FhGx848Sqfsq4/DlJr3xGGsYMu/L5GW4abiaEPQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM=
golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=
golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4=
golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA=
golang.org/x/time v0.10.0 h1:3usCWA8tQn0L8+hFJQNgzpWbd89begxN66o1Ojdn5L4=
golang.org/x/time v0.10.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
Expand Down
5 changes: 5 additions & 0 deletions graphql/mutations/ClientSendTo.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
mutation ClientSendTo($clientID: ClientID, $infoHashes: [Hash20!]!) {
client {
sendTo(clientID: $clientID, infoHashes: $infoHashes)
}
}
6 changes: 6 additions & 0 deletions graphql/queries/ClientSendToConfig.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
query SendToConfig {
sendToConfig {
enabled
sendTo
}
}
6 changes: 6 additions & 0 deletions graphql/schema/enums.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,9 @@ enum QueueJobsOrderByField {
ran_at
priority
}

enum ClientID {
QBittorrent
Transmission
Ntfy
}
5 changes: 5 additions & 0 deletions graphql/schema/mutation.graphqls
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
type Mutation {
torrent: TorrentMutation!
queue: QueueMutation!
client: ClientMutation!
}

type TorrentMutation {
Expand All @@ -18,3 +19,7 @@ input TorrentReprocessInput {
apisDisabled: Boolean
localSearchDisabled: Boolean
}

type ClientMutation {
sendTo(clientID: ClientID, infoHashes: [Hash20!]): Void
}
6 changes: 6 additions & 0 deletions graphql/schema/query.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ type Query {
queue: QueueQuery!
torrent: TorrentQuery!
torrentContent: TorrentContentQuery!
sendToConfig: ClientSendToConfigQuery!
}

type TorrentQuery {
Expand Down Expand Up @@ -67,3 +68,8 @@ type HealthQuery {
status: HealthStatus!
checks: [HealthCheck!]!
}

type ClientSendToConfigQuery {
enabled: Boolean!
sendTo: [ClientID!]!
}
2 changes: 2 additions & 0 deletions internal/app/appfx/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/bitmagnet-io/bitmagnet/internal/app/cmd/workercmd"
"github.com/bitmagnet-io/bitmagnet/internal/blocking/blockingfx"
"github.com/bitmagnet-io/bitmagnet/internal/classifier/classifierfx"
"github.com/bitmagnet-io/bitmagnet/internal/client/clientfx"
"github.com/bitmagnet-io/bitmagnet/internal/config/configfx"
"github.com/bitmagnet-io/bitmagnet/internal/database/databasefx"
"github.com/bitmagnet-io/bitmagnet/internal/database/migrations"
Expand Down Expand Up @@ -59,6 +60,7 @@ func New() fx.Option {
validationfx.New(),
versionfx.New(),
workerfx.New(),
clientfx.New(),
fx.Provide(
args.New,
cli.New,
Expand Down
72 changes: 72 additions & 0 deletions internal/client/adapter/common.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package adapter

import (
"context"

"github.com/bitmagnet-io/bitmagnet/internal/client"
clientmodel "github.com/bitmagnet-io/bitmagnet/internal/client/model"
q "github.com/bitmagnet-io/bitmagnet/internal/database/query"
"github.com/bitmagnet-io/bitmagnet/internal/database/search"
"github.com/bitmagnet-io/bitmagnet/internal/model"
)

type content = []search.TorrentContentResultItem

type clientWorker interface {
AddInfoHashes(ctx context.Context, req client.AddInfoHashesRequest) error
sendTo(ctx context.Context, content *content) error
}

type CommonClient struct {
config *client.Config
search search.Search
client clientWorker
}

func New(cfg *client.Config, search search.Search) CommonClient {
cc := CommonClient{
config: cfg,
search: search,
}

return cc
}

func (c CommonClient) downloadCategory(contentType model.ContentType) string {
category := c.config.Categories[contentType]
if category == "" {
category = c.config.DefaultCategory
}

return category
}

func (c CommonClient) AddInfoHashes(ctx context.Context, req client.AddInfoHashesRequest) error {
switch req.ClientID {
case clientmodel.IDTransmission:
c.client = transmissionClient{CommonClient: c}
case clientmodel.IDQBittorrent:
c.client = qBitClient{CommonClient: c}
case clientmodel.IDNtfy:
c.client = ntfy{CommonClient: c}
default:
return clientmodel.ErrInvalidID
}

options := []q.Option{
q.Where(
search.TorrentContentInfoHashCriteria(req.InfoHashes...),
),
search.TorrentContentCoreJoins(),
search.HydrateTorrentContentContent(),
search.HydrateTorrentContentTorrent(),
q.Limit(uint(len(req.InfoHashes))),
}

sr, err := c.search.TorrentContent(ctx, options...)
if err != nil {
return err
}

return c.client.sendTo(ctx, &sr.Items)
}
39 changes: 39 additions & 0 deletions internal/client/adapter/ntfy.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package adapter

import (
"context"
"fmt"

"github.com/bitmagnet-io/bitmagnet/internal/client/model"
"github.com/go-resty/resty/v2"
)

type ntfy struct {
CommonClient
}

func (n ntfy) sendTo(ctx context.Context, content *content) error {
sendTo, ok := n.config.GetSendTo(model.IDNtfy)
if !ok {
return model.ErrInvalidID
}

topic, exists := n.config.Categories["ntfy"]
if !exists {
topic = "magnet"
}

r := resty.New().R().SetContext(ctx)

for _, item := range *content {
resp, err := r.SetBody(item.Torrent.MagnetURI()).
Post(fmt.Sprintf("http://%v:%v/%v", sendTo.Host, sendTo.Port, topic))
if err != nil {
return err
} else if resp.IsError() {
return fmt.Errorf("[%v] %v", resp.StatusCode(), resp.Request.URL)
}
}

return nil
}
Loading