Commit graph

732 commits

Author SHA1 Message Date
Frederick Robinson
8d3921fd3b
feat(filters): validate filter size (#1263)
* update comments

* refactor, fail on malformed size constraints

* refactor validation, add failing test

* unify in ReleaseSizeOkay, refactor test

* validate filter limit parseability

* logging improvement

* refactor. more clear, explicit parsing step

* inline, add log

* comment tweak

* pass error with more info

* tweak parsedSizeLimits interface
2023-11-20 18:41:53 +01:00
Fabricio Silva
8a8069408a
fix(indexers): toggle state (#1214)
* fix(indexers): toggle state

* fix(indexers): toggle state

---------

Co-authored-by: ze0s <43699394+zze0s@users.noreply.github.com>
2023-11-19 23:11:12 +01:00
ze0s
8b5e08727b
fix(config): load from env vars (#995)
* fix(config): load from env and bind

* fix(config): remove unused imports

* feat: add new postgres config as vars
2023-11-19 22:16:46 +01:00
soup
d8c977b5ba
refactor(config): copylocks and staticcheck findings (#1261)
refactor: copylocks and staticcheck findings

Refactor mutex handling, optimize byte slice creation, and clean up code in accordance with go.staticcheck and copylocks guidelines.

- Changed AppConfig's mutex to *sync.Mutex, preventing mutex copying and enhancing thread safety.
- Simplified byte slice initialization in writeConfig for efficiency.
- Removed redundant return in DynamicReload for better code clarity.
2023-11-19 16:03:53 +01:00
Frederick Robinson
570af0940b
fix(indexers): AnimeBytes parsing (#1259)
* change test to expect correct output

* fix regex

* improve error message
2023-11-18 23:07:50 +01:00
soup
2bd1a68a94
feat(feeds): add force run (#1243)
* feat(feeds): add force run

* fix: simplify ForceRun

* add confirmation modal

* handle errors by using the test func

* require user input to run

* make sure to reschedule next job after forcerun

* refactor modal centering with grid

* refactor: Simplify startJob and forceRun logic

- Refactor `startJob` to accept a `runImmediately` flag. This flag controls whether the job should be run immediately or scheduled for later. This change simplifies the `ForceRun` function by allowing it to call `startJob` with `runImmediately` set to `true`.

- Remove redundant checks in `ForceRun` related to feed type. These checks are handled in `startJob`.

BREAKING CHANGE: The `startJob` function now requires a second argument, `runImmediately`. This change affects all calls to `startJob`.

* fix(web) Invalidate queries after forceRun

* refactor(feeds): init and test run

---------

Co-authored-by: ze0s <43699394+zze0s@users.noreply.github.com>
2023-11-18 21:54:53 +01:00
KaiserBh
666bdf68cd
feat(database): setup integration tests (#1118)
* refactor: this should be Debug() just like the rest.

* feat: catch error when updating client table.

Before if we provided the wrong ID it will just say it's successful when it shouldn't.

* chore: handle the errors.

* fix: defer tx.Rollback().

When I try handling the error we always hit the error no matter what even though there wasn't any error, This is due that defer block being executed unconditionally so even after we commit it successfully it will just give error. So add checking then commit it if all good.

* feat: added testing env.

This way we can use in memory sqlite.

* chore: Delete log should be debug as well.

* feat: enable foreign keys for testing for sqlite.

I recommend enabling all together. Not sure why it's commented but for now will keep it the same and only enable for testing.

* chore: catch error, if deleting a record fails.

* chore: catch error, if deleting a record fails.

* chore: catch error, when failed to enable toggle.

* chore: catch error, if updating failed.

* chore(filter): catch error, if deleting failed.

* chore(filter): catch error, if row is not modified for ToggleEnabled.

* chore(feed): Should be debug level to match with others.

* chore(feed): catch error when nothing is updated.

* chore: update docker-compose.yml add test_db for postgres.

* chore(ci): update include postgres db service before running tests.

* feat(database): Added database testing.

* feat(database): Added api integration testing.

* feat(database): Added action integration testing.

* feat(database): Added download_client integration testing.

* feat(database): Added filter integration testing.

* test(database): initial tests model (WIP)

* chore(feed): handle error when nothing is deleted.

* tests(feed): added delete testing.

* chore(feed): handle error when nothing is updated.

* chore(feed): handle error when nothing is updated.

* chore(feed): handle error when nothing is updated.

* feat(database): Added feed integration testing.

* fix(feed_cache): This should be time.Time not time.Duration.

* chore(feed_cache): handle error when deleting fails.

* feat(database): Added feed_cache integration testing.

* chore: add EOL

* feat: added indexer_test.go

* feat: added mock irc data

* fix: the column is not pass anymore it's password.

* chore: added assertion.

* fix: This is password column not pass test is failing because of it.

* feat: added tests cases for irc.

* feat: added test cases for release.

* feat: added test cases for notifications.

* feat: added Delete to the User DB that way it can be used for testing.

* feat: added user database tests.

* refactor: Make setupLogger and setupDatabase private also renamed them.

Changed the visibility of `setupLogger` to private based on feedback. Also renamed the function to `setupLoggerForTest` and `setupDatabaseForTest` to make its purpose more descriptive.

* fix(database): tests postgres ssl mode disable

* refactor(database): setup and teardown

---------

Co-authored-by: ze0s <43699394+zze0s@users.noreply.github.com>
2023-11-18 20:04:30 +01:00
Kuredant
14e12e7bc6
feat(indexers): add SugoiMusic (#1255)
* feat(indexers): add SugoiMusic

Regex tests: https://regex101.com/r/oRumE5/5

* fix(definitions): add tests to sugoimusic

---------

Co-authored-by: ze0s <ze0s@riseup.net>
2023-11-18 16:15:22 +01:00
Frederick Robinson
7cb2aaa8a5
feat(irc): log connection errors (#1239)
* add logline for failed connection

* modify logging, change debug -> error

* don't surface "client called Quit" errors

* irc: don't retry Connect() while stopped

* fix issue number

* don't unlock until state-change complete

* Revert "don't unlock until state-change complete"

This reverts commit bf107db99bc2758b729a5995c63067f8fdf16aec.

---------

Co-authored-by: Shivaram Lingamneni <slingamn@cs.stanford.edu>
2023-11-18 15:44:46 +01:00
Frederick Robinson
fef0da5711
feat(definitions): add expectations for test lines (#1257)
* factor out test helpers

* refactor, add tests for animebytes

* revert test refactor

* better name

* change format, migrate some examples

* migrated remaining test cases

* add comment about `Test` vs `Tests`

* refactor

* reorder expectations to match vars

* generate

* turn on strict unmarshalling, remove old `Test` from schema

* start modifying actual definitions

* done with the As

* Bs

* C, D

* E, F

* G, H, I, ... L

* M, N

* O, P

* R

* bonus error. without this, pattern/vars disagreement can panic.

* S

* T, U

* X.. Now we know our ABCs next time won't you sing with meeeee

* fix another test

* another driveby change

* be less strict parsing custom definitions

* fix(definitions): load custom definitions

---------

Co-authored-by: ze0s <ze0s@riseup.net>
2023-11-18 15:41:39 +01:00
stacksmash76
e842a7bd42
enhancement(web): ui overhaul (#1155)
* Various WebUI changes and fixes.

* feat(tooltip): make tooltip display upwards

* fix(tooltip): place tooltip to the right

* fix(web): add missing ml-px to SwitchGroup header

current: https://i.imgur.com/2WXstPV.png
new: https://i.imgur.com/QGQ49mP.png

* fix(web): collapse sections

* fix(web):  improve freeleech section

* fix(web): rename action to action_components

Renamed the 'action' folder to 'action_components' to resolve import issues due to case sensitivity.

* fix(web): align CollapsibleSection

Old Advanced tab: https://i.imgur.com/MXaJ5eJ.png
New Advanced tab: https://i.imgur.com/4nPJJRw.png
Music tab for comparison: https://i.imgur.com/I59X7ot.png

* fix(web): remove invalid CSS class

* revert: vertical padding on switchgroup

added py-0 on the freeleech part instead

* feat(settings): add back log files

* fix(settings): irc channels and font sizes

* fix(components): radio select roundness

* fix(styling): various minor changes

* fix(filters): remove jitter fields

---------

Co-authored-by: ze0s <43699394+zze0s@users.noreply.github.com>
Co-authored-by: soup <soup@r4tio.dev>
Co-authored-by: ze0s <ze0s@riseup.net>
2023-11-18 14:46:16 +01:00
ze0s
a274d9ddce fix(database): broken migrations 2023-11-17 23:23:55 +01:00
Steven Kreitzer
c5fb92ccf4
fix(filters): external webhook remove jitter (#1254)
* fix(filters): external webhook remove jitter

* fix: migrations

---------

Co-authored-by: ze0s <ze0s@riseup.net>
2023-11-17 17:05:29 +01:00
Bogdan
0b7d9b5976
feat(indexers): update base url for Milkie (#1256)
This is needed to prevent redirects www to non-www.
2023-11-14 20:31:06 +01:00
Antoine
73e76c4214
feat(database): postgres set ssl mode (#1245)
* feat(database): postgres set ssl mode

* feat(database): postgres set extra params
2023-11-06 19:04:32 +01:00
Kyle Sanderson
8c89481d88
feat(sqlite): implement query planner (#1174)
* feat(sqlite): implement query planner

* implement Close on SQLite
2023-11-01 18:07:16 +01:00
ze0s
d5d1cecc1b
feat(clients): Transmission support seedtime and ratiolimit (#1211)
* feat(clients): Transmission seedtime ratiolimit

* feat(clients): update client pkg

* feat(clients): update client pkg test

* feat(actions): update transmission
2023-10-31 00:38:23 +01:00
ze0s
568e41de24
feat(indexers): add ABNormal (#1232)
* feat(indexers): add Abnormal

* fix: casing

* fix: network name casing
2023-10-31 00:23:40 +01:00
soup
89d00d0986
fix(config): prevent overwriting default logPath (#1219)
* fix(config): prevent overwriting logPath default

* Fix duplication issue

* fix: Preserve non-empty logPath value in config
2023-10-30 23:04:53 +01:00
Kyle Sanderson
92659bca5f
fix(filters): external webhooks improve defaults (#1227)
* fix(external actions): retry

* mods

* wrap in bufio
2023-10-30 22:18:43 +01:00
ze0s
7c91d34cb4
fix(feeds): feed cache key (#1230)
* fix(feeds): feed cache sometimes missing key

* fix(feeds): feed cache use link as key if no guid
2023-10-30 22:10:03 +01:00
Daniel Williams
5225c1e956
feat(logs): sanitize basic auth in urls (#1188)
* Added regex pattern to capture credentials used to bypass auth

* Updated test case for log sanitisation

* Changed replacement pattern

* Update logs_sanitize_test.go

* fix: reorder regex patterns

---------

Co-authored-by: soup <soup@r4tio.dev>
2023-10-28 12:04:57 +02:00
Kyle Sanderson
19041de567
fix(indexers): capitalize TheOldSchool (#1222) 2023-10-28 12:01:25 +02:00
ze0s
0f943933a6
fix(database): migrations filter_external (#1221) 2023-10-27 19:10:19 +02:00
Steven Kreitzer
2080136669
feat(filters): external webhook retry on status codes (#1206)
* feat: external filter retry status codes

* chore: go mod tidy

* fix(database): migrations

---------

Co-authored-by: ze0s <ze0s@riseup.net>
2023-10-27 17:37:57 +02:00
martylukyy
d1fa1b7cdf
feat(indexers): BHD freeleech announces (#1216)
* feat(indexers): BHD freeleech announces

* feat: parse and map bhd freeleech

---------

Co-authored-by: ze0s <ze0s@riseup.net>
2023-10-26 22:30:28 +02:00
persuaded6414
367d8c8899
docs(definitions): MAM clarify cookie usage (#1199)
Update myanonamouse.yaml to have the right mam_id format

Autobrr's Discord had a user indicate that the format needs to be "mam_id=$id;"

The $id being the one created in the Preferences > Security in MAM website for the relevant IP.
2023-10-23 22:02:46 +02:00
ze0s
eb75714cf8
feat(indexers): add TheOldSchool (#1209)
* feat(indexers): add TheOldSchool

* change language code
remove unneeded lazy modifiers
account for empty parenthesis
account for miscellaneous character in usernames
make compatible with PCRE flavors

---------

Co-authored-by: martylukyy <35452459+martylukyy@users.noreply.github.com>
2023-10-23 20:48:42 +02:00
ze0s
522f22db46
feat(clients): Transmission set label (#1204)
* feat(clients): Transmission set label

* fix(clients): Transmission fmt

* fix(clients): Transmission set label before reannounce
2023-10-23 19:02:04 +02:00
ze0s
d602b1e868
fix(clients): qBittorrent rules ignore slow (#1200)
fix(clients): qBit rules ignore slow
2023-10-23 18:36:50 +02:00
martylukyy
ee0d055743
fix(indexers): TorrentSeeds remove nickserv fields (#1205)
fix(indexers): removal of torrentseeds nickserv fields
2023-10-22 18:06:07 +02:00
ze0s
3ed44aff26
fix(clients): qBittorrent reject stalled reannounce (#1201)
fix(clients): qBit reannounce stalled rejection
2023-10-21 17:18:31 +02:00
ze0s
9793764905
feat(feeds): improve caching (#1191)
* feat(feeds): improve caching

* fix(feeds): put cache if not empty

* fix(feeds): reassign loop var

* fix(feeds): enable busy_timeout again

* fix(feeds): enable busy_timeout again
2023-10-21 17:03:52 +02:00
ze0s
0f9a3e439b
feat(indexers): PTP support freeleech (#1195) 2023-10-19 18:50:14 +02:00
martylukyy
706f95116e
feat(indexers): add OnlyEncodes (#1190)
feat(indexers): add onlyencodes
2023-10-18 18:45:17 +02:00
ze0s
06b864da4d
fix(releases): search with postgres (#1181)
* fix(releases): search with postgres

* fix: validate release push status from filters

* fix: add missing import

* fix: validate push status if not empty
2023-10-16 20:27:15 +02:00
Gabe
faaec5625a
feat(indexers): remove closed indexer (PTN) (#1185)
PTN closed down for good.
2023-10-16 20:25:56 +02:00
Daniel Williams
f59e133398
feat(indexers): SubsPlease parse title (#1170)
* Update subsplease.yaml regex to parse title

This change aims to parse any multiple-word title to populate the title macro.

* Update subsplease.yaml also captures title for batch releases

I replaced the (.*?) part with ([^-()]+), which matches one or more characters that are not dashes or parentheses. This will stop at either a dash - or an opening parenthesis (

* Parsing title by matching a sequence instead of using a character class

Using whitespace - (dash) whitespace numerical or whitespace ( (open bracket) numerical to end the title pattern

* specify character amount of `\d` token

---------

Co-authored-by: martylukyy <35452459+martylukyy@users.noreply.github.com>
2023-10-14 12:11:23 +02:00
martylukyy
32c25e6cab
fix(indexers): pbay announce bot name (#1179) 2023-10-14 12:09:08 +02:00
MouldWarpMole
77948d7654
feat(notifications): Add Gotify (#1180)
feat(notifications): Add Gotify (resolves #513)
2023-10-14 12:08:12 +02:00
Bogdan
525861074b
feat(indexers): FileList update download link (#1172)
feat(indexers): remove unused filename argument from download link for FL
2023-10-10 18:00:06 +02:00
Bogdan
b70ad9f144
feat(indexers): update SSL port for AR (#1171) 2023-10-10 17:57:25 +02:00
Fabricio Silva
8600d3a2ab
fix(indexes): toggle on and off with switch (#1164)
* chore(indexers): replace array position with id

* fix(indexers): enable and disable without editing

* feat(indexer): add toggle endpoint and refactoring

---------

Co-authored-by: ze0s <ze0s@riseup.net>
2023-10-03 21:57:11 +02:00
martylukyy
603191b47d
fix(indexers): pbay regex pattern (#1165) 2023-10-03 16:38:24 +02:00
jolinarofmalkshur
dbb3ff3a3b
feat(feeds): improve file size parsing (#1162)
* In rss feeds, sometimes the only place the size is mentioned is in the
description field. If the size has not already been determined from
another source try to read it from there.

* Accept sizes with no space between value and unit of measure

* feat(feeds): get size from description add test

* fix(feeds): tests

---------

Co-authored-by: ze0s <ze0s@riseup.net>
2023-10-01 22:47:47 +02:00
ze0s
03ef86ac96
fix(indexers): NBL irc announce regex (#1153)
* fix(indexers): NLB regex pattern

* fix: improve regex

* fix: reintroduce category group
fix: exempt season numbering from title

---------

Co-authored-by: martylukyy <35452459+martylukyy@users.noreply.github.com>
2023-10-01 16:47:30 +02:00
Kyle Sanderson
98df0c9040
chore(build): enable CodeQL (#1026)
* Create codeql.yml

* setup pnpm

* sq.Eq{"ras.status": params.Filters.PushStatus}

* enable extended and quality

* fix: code scanning alert #58 #57

https://github.com/autobrr/autobrr/security/code-scanning/58
https://github.com/autobrr/autobrr/security/code-scanning/57

* fix: linting issues for code scanning 60, 59, 56

https://github.com/autobrr/autobrr/security/code-scanning/60
https://github.com/autobrr/autobrr/security/code-scanning/59
https://github.com/autobrr/autobrr/security/code-scanning/56

---------

Co-authored-by: Fabricio Silva <hi@fabricio.dev>
2023-09-26 21:24:59 +02:00
ze0s
a78a5d1bf8
fix(indexers): API get torrent check for nil body (#1146) 2023-09-26 20:33:36 +02:00
Adam Lau
657c966ecb
feat(notifications): Telegram display file size (#1148) 2023-09-26 20:32:51 +02:00
martylukyy
1900bf7742
fix(indexers): SubsPlease parse line pattern (#1152) 2023-09-26 20:27:21 +02:00