From b0a30dd136fd0cb71bb0010ce63cf46d5141c202 Mon Sep 17 00:00:00 2001 From: ze0s <43699394+zze0s@users.noreply.github.com> Date: Sun, 24 Nov 2024 14:07:45 +0100 Subject: [PATCH] feat(indexers): REDACTED update urls (#1830) * feat(indexers): REDACTED update urls * feat(databse): REDACTED update urls in db with migrations --- internal/database/postgres_migrate.go | 4 ++++ internal/database/sqlite_migrate.go | 4 ++++ internal/indexer/definitions/red.yaml | 12 ++++++------ internal/indexer/indexer_test.go | 10 +++++----- pkg/red/red.go | 2 +- 5 files changed, 20 insertions(+), 12 deletions(-) diff --git a/internal/database/postgres_migrate.go b/internal/database/postgres_migrate.go index aab499a..6a40aa5 100644 --- a/internal/database/postgres_migrate.go +++ b/internal/database/postgres_migrate.go @@ -986,5 +986,9 @@ UPDATE irc_network UPDATE irc_network SET server = 'irc.atw-inter.net', name = 'ATW-Inter' WHERE server = 'irc.ircnet.com'; +`, + `UPDATE indexer + SET base_url = 'https://redacted.sh/' + WHERE base_url = 'https://redacted.ch/'; `, } diff --git a/internal/database/sqlite_migrate.go b/internal/database/sqlite_migrate.go index 30b1db0..69a122d 100644 --- a/internal/database/sqlite_migrate.go +++ b/internal/database/sqlite_migrate.go @@ -1628,5 +1628,9 @@ UPDATE irc_network UPDATE irc_network SET server = 'irc.atw-inter.net', name = 'ATW-Inter' WHERE server = 'irc.ircnet.com'; +`, + `UPDATE indexer + SET base_url = 'https://redacted.sh/' + WHERE base_url = 'https://redacted.ch/'; `, } diff --git a/internal/indexer/definitions/red.yaml b/internal/indexer/definitions/red.yaml index 3c29c4f..a33413a 100644 --- a/internal/indexer/definitions/red.yaml +++ b/internal/indexer/definitions/red.yaml @@ -5,7 +5,7 @@ identifier: redacted description: Redacted (RED) is a private torrent tracker for MUSIC language: en-us urls: - - https://redacted.ch/ + - https://redacted.sh/ privacy: private protocol: torrent supports: @@ -33,7 +33,7 @@ settings: help: Settings -> Account Settings -> API Keys - Generate new api keys. Scope (User, Torrents) # api: -# url: https://redacted.ch/ajax.php +# url: https://redacted.sh/ajax.php # type: json # limits: # max: 10 @@ -83,7 +83,7 @@ irc: type: single lines: - tests: - - line: Artist - Albumname [2008] [Single] - FLAC / Lossless / Log / 100% / Cue / CD - https://redacted.ch/torrents.php?id=0000000 / https://redacted.ch/torrents.php?action=download&id=0000000 - hip.hop,rhythm.and.blues,2000s + - line: Artist - Albumname [2008] [Single] - FLAC / Lossless / Log / 100% / Cue / CD - https://redacted.sh/torrents.php?id=0000000 / https://redacted.sh/torrents.php?action=download&id=0000000 - hip.hop,rhythm.and.blues,2000s expect: torrentName: Artist - Albumname [2008] [Single] - FLAC / Lossless / Log / 100% / Cue / CD title: Artist - Albumname @@ -91,10 +91,10 @@ irc: category: Single releaseTags: FLAC / Lossless / Log / 100% / Cue / CD groupId: "0000000" - baseUrl: https://redacted.ch/ + baseUrl: https://redacted.sh/ torrentId: "0000000" tags: hip.hop,rhythm.and.blues,2000s - - line: A really long name here - Concertos 5 and 6, Suite No 2 [1991] [Album] - FLAC / Lossless / Log / 100% / Cue / CD - https://redacted.ch/torrents.php?id=0000000 / https://redacted.ch/torrents.php?action=download&id=0000000 - classical + - line: A really long name here - Concertos 5 and 6, Suite No 2 [1991] [Album] - FLAC / Lossless / Log / 100% / Cue / CD - https://redacted.sh/torrents.php?id=0000000 / https://redacted.sh/torrents.php?action=download&id=0000000 - classical expect: torrentName: A really long name here - Concertos 5 and 6, Suite No 2 [1991] [Album] - FLAC / Lossless / Log / 100% / Cue / CD title: A really long name here - Concertos 5 and 6, Suite No 2 @@ -102,7 +102,7 @@ irc: category: Album releaseTags: FLAC / Lossless / Log / 100% / Cue / CD groupId: "0000000" - baseUrl: https://redacted.ch/ + baseUrl: https://redacted.sh/ torrentId: "0000000" tags: classical pattern: '((.*) (?:\[(.*)\] \[(.*)\] - (.*))?) - .*id=(.*) \/ (https?://.+/).+id=(\d+)[ -]*(.*)' diff --git a/internal/indexer/indexer_test.go b/internal/indexer/indexer_test.go index 8c6012e..89a59cb 100644 --- a/internal/indexer/indexer_test.go +++ b/internal/indexer/indexer_test.go @@ -170,7 +170,7 @@ func TestIndexersParseAndFilter(t *testing.T) { { name: "announce_1", args: args{ - announceLines: []string{"Artist - Albumname [2008] [Single] - FLAC / Lossless / Log / 100% / Cue / CD - https://redacted.ch/torrents.php?id=0000000 / https://redacted.ch/torrents.php?action=download&id=0000000 - hip.hop,rhythm.and.blues,2000s"}, + announceLines: []string{"Artist - Albumname [2008] [Single] - FLAC / Lossless / Log / 100% / Cue / CD - https://redacted.sh/torrents.php?id=0000000 / https://redacted.sh/torrents.php?action=download&id=0000000 - hip.hop,rhythm.and.blues,2000s"}, filters: []filterTest{ { filter: &domain.Filter{ @@ -195,7 +195,7 @@ func TestIndexersParseAndFilter(t *testing.T) { { name: "announce_2", args: args{ - announceLines: []string{"A really long name here - Concertos 5 and 6, Suite No 2 [1991] [Album] - FLAC / Lossless / Log / 100% / Cue / CD - https://redacted.ch/torrents.php?id=0000000 / https://redacted.ch/torrents.php?action=download&id=0000000 - classical"}, + announceLines: []string{"A really long name here - Concertos 5 and 6, Suite No 2 [1991] [Album] - FLAC / Lossless / Log / 100% / Cue / CD - https://redacted.sh/torrents.php?id=0000000 / https://redacted.sh/torrents.php?action=download&id=0000000 - classical"}, filters: []filterTest{ { filter: &domain.Filter{ @@ -229,7 +229,7 @@ func TestIndexersParseAndFilter(t *testing.T) { { name: "announce_3", args: args{ - announceLines: []string{"The best artist - Album No 2 [2024] [EP] - FLAC / Lossless / Log / 100% / Cue / CD - https://redacted.ch/torrents.php?id=0000000 / https://redacted.ch/torrents.php?action=download&id=0000000 - classical"}, + announceLines: []string{"The best artist - Album No 2 [2024] [EP] - FLAC / Lossless / Log / 100% / Cue / CD - https://redacted.sh/torrents.php?id=0000000 / https://redacted.sh/torrents.php?action=download&id=0000000 - classical"}, filters: []filterTest{ { filter: &domain.Filter{ @@ -264,7 +264,7 @@ func TestIndexersParseAndFilter(t *testing.T) { { name: "announce_4", args: args{ - announceLines: []string{"The best artist - Album No 2 [2024] [EP] - FLAC / Lossless / Log / 100% / Cue / CD - https://redacted.ch/torrents.php?id=0000000 / https://redacted.ch/torrents.php?action=download&id=0000000 - classical"}, + announceLines: []string{"The best artist - Album No 2 [2024] [EP] - FLAC / Lossless / Log / 100% / Cue / CD - https://redacted.sh/torrents.php?id=0000000 / https://redacted.sh/torrents.php?action=download&id=0000000 - classical"}, filters: []filterTest{ { filter: &domain.Filter{ @@ -299,7 +299,7 @@ func TestIndexersParseAndFilter(t *testing.T) { { name: "announce_5", args: args{ - announceLines: []string{"The best artist - Album No 1 [2024] [EP] - FLAC / Lossless / Log / 87% / Cue / CD - https://redacted.ch/torrents.php?id=0000000 / https://redacted.ch/torrents.php?action=download&id=0000000 - classical"}, + announceLines: []string{"The best artist - Album No 1 [2024] [EP] - FLAC / Lossless / Log / 87% / Cue / CD - https://redacted.sh/torrents.php?id=0000000 / https://redacted.sh/torrents.php?action=download&id=0000000 - classical"}, filters: []filterTest{ { filter: &domain.Filter{ diff --git a/pkg/red/red.go b/pkg/red/red.go index 0bedcec..d97d163 100644 --- a/pkg/red/red.go +++ b/pkg/red/red.go @@ -20,7 +20,7 @@ import ( "golang.org/x/time/rate" ) -const DefaultURL = "https://redacted.ch/ajax.php" +const DefaultURL = "https://redacted.sh/ajax.php" type ApiClient interface { GetTorrentByID(ctx context.Context, torrentID string) (*domain.TorrentBasic, error)