feat: add support for proxies to use with IRC and Indexers (#1421)

* feat: add support for proxies

* fix(http): release handler

* fix(migrations): define proxy early

* fix(migrations): pg proxy

* fix(proxy): list update delete

* fix(proxy): remove log and imports

* feat(irc): use proxy

* feat(irc): tests

* fix(web): update imports for ProxyForms.tsx

* fix(database): migration

* feat(proxy): test

* feat(proxy): validate proxy type

* feat(proxy): validate and test

* feat(proxy): improve validate and test

* feat(proxy): fix db schema

* feat(proxy): add db tests

* feat(proxy): handle http errors

* fix(http): imports

* feat(proxy): use proxy for indexer downloads

* feat(proxy): indexerforms select proxy

* feat(proxy): handle torrent download

* feat(proxy): skip if disabled

* feat(proxy): imports

* feat(proxy): implement in Feeds

* feat(proxy): update helper text indexer proxy

* feat(proxy): add internal cache
This commit is contained in:
ze0s 2024-09-02 11:10:45 +02:00 committed by GitHub
parent 472d327308
commit bc0f4cc055
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
59 changed files with 2533 additions and 371 deletions

View file

@ -24,7 +24,9 @@ import (
"github.com/autobrr/autobrr/internal/irc"
"github.com/autobrr/autobrr/internal/logger"
"github.com/autobrr/autobrr/internal/notification"
"github.com/autobrr/autobrr/internal/proxy"
"github.com/autobrr/autobrr/internal/release"
"github.com/autobrr/autobrr/internal/releasedownload"
"github.com/autobrr/autobrr/internal/scheduler"
"github.com/autobrr/autobrr/internal/server"
"github.com/autobrr/autobrr/internal/update"
@ -103,24 +105,27 @@ func main() {
notificationRepo = database.NewNotificationRepo(log, db)
releaseRepo = database.NewReleaseRepo(log, db)
userRepo = database.NewUserRepo(log, db)
proxyRepo = database.NewProxyRepo(log, db)
)
// setup services
var (
apiService = api.NewService(log, apikeyRepo)
notificationService = notification.NewService(log, notificationRepo)
updateService = update.NewUpdate(log, cfg.Config)
notificationService = notification.NewService(log, notificationRepo)
schedulingService = scheduler.NewService(log, cfg.Config, notificationService, updateService)
indexerAPIService = indexer.NewAPIService(log)
userService = user.NewService(userRepo)
authService = auth.NewService(log, userService)
proxyService = proxy.NewService(log, proxyRepo)
downloadService = releasedownload.NewDownloadService(log, releaseRepo, indexerRepo, proxyService)
downloadClientService = download_client.NewService(log, downloadClientRepo)
actionService = action.NewService(log, actionRepo, downloadClientService, bus)
actionService = action.NewService(log, actionRepo, downloadClientService, downloadService, bus)
indexerService = indexer.NewService(log, cfg.Config, indexerRepo, releaseRepo, indexerAPIService, schedulingService)
filterService = filter.NewService(log, filterRepo, actionService, releaseRepo, indexerAPIService, indexerService)
filterService = filter.NewService(log, filterRepo, actionService, releaseRepo, indexerAPIService, indexerService, downloadService)
releaseService = release.NewService(log, releaseRepo, actionService, filterService, indexerService)
ircService = irc.NewService(log, serverEvents, ircRepo, releaseService, indexerService, notificationService)
feedService = feed.NewService(log, feedRepo, feedCacheRepo, releaseService, schedulingService)
ircService = irc.NewService(log, serverEvents, ircRepo, releaseService, indexerService, notificationService, proxyService)
feedService = feed.NewService(log, feedRepo, feedCacheRepo, releaseService, proxyService, schedulingService)
)
// register event subscribers
@ -146,6 +151,7 @@ func main() {
indexerService,
ircService,
notificationService,
proxyService,
releaseService,
updateService,
)