Commit graph

772 commits

Author SHA1 Message Date
ze0s
b68ae334ca
fix(http): init oidc handler if enabled (#1888) 2024-12-22 21:59:58 +01:00
soup
43c28fc0c6
feat(auth): implement auth proxy support with OpenID Connect (#1853)
* feat(auth): implement oidc

* refactor(auth): centralize OIDC state cookie handling

* fix(web): resolve unused error variables in route handlers

* docs(readme): add OIDC authentication feature to list

* fix(auth): improve OIDC cookie handling for reverse proxy setups

The OIDC state cookie's Secure flag is now properly set when running behind a reverse proxy by checking both direct TLS and X-Forwarded-Proto header. This fixes authentication issues in common setups where:

- autobrr runs behind a reverse proxy that terminates HTTPS
- local development environments without TLS
- mixed protocol environments (internal HTTP, external HTTPS)

* fix: use crypt/random if argon2id fails

* feat(auth): show both login options when user exists in db

if user doesn't exist, e.g. canOnboard=true then we only show the OIDC button, since regular login makes no sense in that case

If user does not exist in db and the user wants to create a local user, OIDC needs to be disabled first

* feat(auth): improve OIDC provider initialization with discovery logging

* revert(issuer): do not remove trailing slash

* feat(auth): improve OIDC username resolution with additional claims

* fix(auth): handle OIDC issuer URLs with and without trailing slashes

When initializing the OIDC provider, automatically retry with/without trailing
slash if the first attempt fails.

- First attempts with original issuer URL
- If fails with trailing slash, retries without
- If fails without trailing slash, retries with

* feat(oidc): add gorilla sessions store for secure state management

Add gorilla sessions store to handle encrypted state cookies in OIDC flow,
while removing redundant session validation checks

Co-authored-by: Kyle Sanderson <kyle.leet@gmail.com>

* fix(auth): prevent duplicate OIDC state cookies for authenticated sessions

Modify OIDC config handler to check for existing authenticated sessions
before setting state cookie. Still returns OIDC enabled status to maintain
UI state, but prevents unnecessary cookie creation for authenticated users.

* feat(oidc): use random secret for temporary state cookies

Co-authored-by: Kyle Sanderson <kyle.leet@gmail.com>

* feat(auth): add rate limiting to OIDC endpoints

Co-authored-by: Kyle Sanderson <kyle.leet@gmail.com>

* fix(auth): validate OIDC authorization code presence in callback

Co-authored-by: Kyle Sanderson <kyle.leet@gmail.com>

* fix(auth): properly handle OIDC session errors

Improve error handling in OIDC login flow by properly handling cookie store
session errors. Return HTTP 500 if session cannot be retrieved instead of
silently continuing with potentially invalid state.

Co-authored-by: Kyle Sanderson <kyle.leet@gmail.com>

* feat(auth): track and display authentication method for oidc and password logins

* fix: tests

* docs(readme): add environment variable section

* go mod tidy

* chore: log style and errors

---------

Co-authored-by: Kyle Sanderson <kyle.leet@gmail.com>
Co-authored-by: ze0s <ze0s@riseup.net>
2024-12-19 14:41:31 +01:00
KaiserBh
4432dfb099
feat(http): implement proper BaseUrl support to coexist with legacy mode (#1298)
* refactor: remove baseUrl from api calls and sseBaseUrl

* refactor: set cookie session to '/'.

Since that's where the api endpoint is that way we set it to the root domain, we can't set it to the subfolder since the api is called directly now and not using the baseUrl.

* feat: add the baseUrl route.

When user for example is in `/autobrr` and hit reload it should just return the index.html.

* refactor: now it have to be `/autobrr`

Remove the trailing `/`, now base url is set to /autobrr aligned with other arrs.

* refactor: remove baseUrl stuff.

* refactor: use separate router for the api endpoint and the baseUrl.

I don't think we need separate router, but I didn't test it, so feel free to test it and see if it works without the separate router, the whole point was to make sure that it's not prefixed with baseUrl and I noticed that it was being called in the frontend `APIClients.ts`. So yea just check if it works without it then keep the old one.

Also removed the index since it was zombie code not being used anywhere.

* feat: Dynamic base url.

* fix: auth handler deps

* feat(http): mount web and api on baseurl

* feat(http): web api client routes

* feat(http): baseurl legacy mode

* feat(http): baseurl legacy mode test

* feat(http): add assetBaseUrl

* feat(http): try separate web handlers

* feat(http): improve file serving

* feat(http): ignore .gitkeep

* fix(assets): windows paths

* fix(assets): windows paths trimprefix

* fix(assets): windows paths join

* fix(assets): cleanup

* fix(assets): additional web route check

* feat(http): add comments

---------

Co-authored-by: ze0s <ze0s@riseup.net>
2024-12-19 12:56:04 +01:00
Alexander Chernov
acef4ac624
feat(filters): RED and OPS fetch uploader from API (#1348)
* feat: added uploader when fetching torrent details on RED indexer

* revert

* tests

* refactor(filters): size and uploader api checks

* refactor(filters): fix test

* refactor(filters): add mutex to rejections

---------

Co-authored-by: Kyle Sanderson <kyle.leet@gmail.com>
Co-authored-by: ze0s <ze0s@riseup.net>
2024-12-17 20:39:09 +01:00
ze0s
04c4bd482f
feat(releases): improve freeleech parsing (#1880)
* capture fl as freeleech from vars
2024-12-17 16:05:18 +01:00
ze0s
f6891bf9a3
fix(indexers): PrivateSilverScreen freeleech parsing (#1879) 2024-12-16 19:08:00 +01:00
ze0s
96f61a90e5
fix(database): SQLite try reindexing on integrity check error (#1877)
* fix(database): SQLite try reindexing on consistency error

* fix(database): SQLite return err if no bad indexes found
2024-12-14 15:58:18 +01:00
Kyle Sanderson
81ce8acb2b
fix(releases): search by group (#1876)
fix(search): regression on group
2024-12-12 13:56:04 +01:00
soup
21b768aed8
feat(indexers): add PrivateSilverScreen (#1871)
* feat(indexers): add PrivateSilverScreen

* fix: update irc auth pass not required
2024-12-12 13:52:00 +01:00
ze0s
e808edab50
fix(releases): set freeleech from downloadVolumeFactor (#1873)
* fix(releases): set freeleech from downloadVolumeFactor

* fix(releases): set freeleechpercent from downloadVolumeFactor
2024-12-11 16:44:09 +01:00
ze0s
24f31574e5
feat(indexers): update PTP announce to new format (#1738)
* feat(indexers): update PTP to new format

* fix: update expect line

* feat: use unique key for dl link

* feat: update pattern

* fix: definition tests

* feat: rename var

* feat: add custom vars map

* feat: start mapCustomVars

* Update internal/indexer/definitions/ptp.yaml

Co-authored-by: nuxen <felix.schubert1998@gmail.com>

* feat(indexers): map custom indexer vars

* feat: support upload unix epoch time

* feat(releases): update mapvars

* feat(indexers): remove ptp api init

* feat(indexers): update ptp category mapping

* feat(releases): show announce type in details

* feat(releases): mapvars announcetype

---------

Co-authored-by: nuxen <felix.schubert1998@gmail.com>
2024-12-08 23:35:32 +01:00
ze0s
f644b3a4d6
feat(filters): implement AnnounceType (#1837)
* feat(filters): implement AnnounceType

* fix: rss tests
2024-12-08 21:08:24 +01:00
Nuno Sénica
ab718b8232
feat(macros): add Description (#1863)
Add release.Description to macros
2024-12-07 17:44:53 +01:00
soup
99a9e6bc0f
fix(http): downgrade canOnboard check to warning log level (#1859) 2024-12-06 13:01:45 +01:00
establish33
4c39198c37
feat(indexers): add UploadCX (#1852)
* Create uploadcx.yaml

* fix: trim whitespace and remove percent sign

---------

Co-authored-by: ze0s <43699394+zze0s@users.noreply.github.com>
2024-11-30 19:15:10 +01:00
ze0s
ee04c61a54
fix(indexers): iPlay RMT update download url (#1849) 2024-11-27 17:14:24 +01:00
Kyle Sanderson
f292d2709b
fix(database): backup on windows bad filename (#1841)
* fix(migrations): use safe characters during backup

* remove _ because of splits

* Update sqlite.go

* flip
2024-11-25 10:59:40 +01:00
ze0s
2dcd876068
fix(database): SeedPool migrations (#1838) 2024-11-24 21:51:47 +01:00
ze0s
be9a956598
feat(indexers): update SeedPool IRC announce parsing (#1835)
* feat(indexers): update SeedPool IRC port

* feat(indexers): SeedPool add db migration

* fix(indexers): adapt regex, tests and vars

* fix(indexers): set internal var to origin to fix parsing

---------

Co-authored-by: martylukyy <35452459+martylukyy@users.noreply.github.com>
2024-11-24 18:34:40 +01:00
ze0s
b0a30dd136
feat(indexers): REDACTED update urls (#1830)
* feat(indexers): REDACTED update urls

* feat(databse): REDACTED update urls in db with migrations
2024-11-24 14:07:45 +01:00
ze0s
f54c51fa06
fix(downloadclient): qBittorrent url parse err handling (#1832)
* fix(downloadclient): qBittorrent url parse err handling

* fix(downloadclient): qBittorrent url parse err handling test
2024-11-24 00:53:59 +01:00
Kyle Sanderson
4cc0f9cc83
feat(tests): add Parallelization where possible (#1823)
* feat(tests): add Parallelization where possible
2024-11-23 15:16:09 +01:00
ze0s
c0882aff84
fix(releases): parse missing source and misinterpreted group name (#1820)
fix(releases): parse missing source and groups
2024-11-23 15:08:58 +01:00
soup
fc137f2077
feat(http): add error logging for API responses (#1819)
* feat(api): add error logging for API responses

* fix: revert import order

* feat(http): log msg

* feat(http): remove extra server logger

---------

Co-authored-by: ze0s <ze0s@riseup.net>
2024-11-16 22:31:48 +01:00
martylukyy
74eea79215
feat(database): SQLite database backups (#1756)
* feat(database): SQLite database backups

* feat(database): do not produce SQL injections

* feat(database): retain all backups if 0 or less
refactor(database): specify database driver in func names

* refactor(database): return early on cleanup

* refactor(database): do not call cleanup func if max backups set to 0

* refactor(database): backup retention behavior

* feat(database): improve logging

---------

Co-authored-by: ze0s <43699394+zze0s@users.noreply.github.com>
2024-11-12 19:14:45 +01:00
ze0s
1227657ae8
feat(indexers): FearNoPeer update IRC server (#1816)
* feat(indexers): update FearNoPeer IRC server

* Update FNP irc server and add migrations for SceneHD and BitHUmen changes all in one.

The update for FNP from LibraIRC to P2P-Network will set the nick to nick_0 to not cause any UNIQUE constraint issues. Users will have to update or merge with existing P2P-Network config.
2024-11-09 16:06:35 +01:00
ze0s
099905f5ec
feat(indexers): update BitHUmen IRC server (#1815)
* feat(indexers): update BitHUmen IRC server

* feat(indexers): update BitHUmen IRC server network name
2024-11-09 14:48:06 +01:00
ze0s
7d7ac3e01a
feat(indexers): update SceneHD IRC server (#1813) 2024-11-09 14:29:49 +01:00
soup
b4f0d60b9b
chore: add missing license headers (#1811)
* chore: add missing license headers

* missing license in test files
2024-11-06 21:37:42 +01:00
ze0s
40fe3e9f54
fix(indexers): delete feed with indexer (#1810)
* fix(indexers): delete feed in one go

* fix(indexers): sort imports

* refactor(feeds): db methods for find
2024-11-06 20:48:46 +01:00
ze0s
41216babe6
fix(proxy): add shared transport for proxies (#1808)
fix(proxy): use separate transport for proxies
2024-11-06 18:55:23 +01:00
ze0s
59c5858bf0
fix(releases): update size after actions run (#1809) 2024-11-06 18:55:00 +01:00
Kyle Sanderson
f4c2aef38c
fix(indexers): BTFiles size parsing (#1805)
* fix(indexers): btfiles size

* fix: revert btfiles definition tests

* fix(release): strip comma of torrentSize string before parse

---------

Co-authored-by: ze0s <43699394+zze0s@users.noreply.github.com>
2024-11-06 14:13:27 +01:00
soup
13113907b2
feat(indexers): DigitalCore parse Tags and Genre (#1790)
* fix(indexer): update digitalcore with new pattern

* refactor: switch releaseTags and tags fields

- Tags now represents genres (e.g. Drama, Comedy)
- ReleaseTags represents release attributes (e.g. p2p, unrar)
2024-10-28 14:29:25 +01:00
soup
70dc2cb6c0
fix(indexer): update suggested nick format for FearNoPeer IRC (#1788)
fix(indexer): Update suggested nick format for FearNoPeer
2024-10-25 08:19:59 +02:00
ze0s
63b8519bd9
fix(filters): trim user input (#1784) 2024-10-23 17:42:48 +02:00
ze0s
8f2398a627
fix(filters): lint warning variable naming (#1783)
* fix(filters): variable naming

* fix(filters): variable naming
2024-10-23 17:31:49 +02:00
ze0s
d23e7ffca6
fix(downloads): handle panic in error check (#1782) 2024-10-23 17:05:48 +02:00
Kyle Sanderson
f89ea9e2ff
feat(filters): sanitize description (#1781)
feat(filters): sanitize description
2024-10-23 16:44:00 +02:00
ze0s
f029de233f
feat(filters): improve rejection handling (#1776)
* feat(filters): improve rejection handling

* fix(filters): rejection tests

* fix(filters): size check error rejection
2024-10-20 22:58:55 +02:00
KyokoMiki
ae779e5461
feat(download-client): add label to Deluge if it does not exist (#1761)
* feat(download-client): Add label to deluge if it does not exist

* refactor(downloadclient): deluge set label

---------

Co-authored-by: ze0s <ze0s@riseup.net>
2024-10-20 14:04:00 +02:00
soup
2386a9db31
fix(config): log reload message once (#1773)
fix(config): prevent double logging of config reload message
2024-10-20 12:56:42 +02:00
martylukyy
509e4ddaed
fix(indexers): update Fuzer IRC addr (#1764) 2024-10-09 15:44:46 +02:00
Carmelo Scandaliato
d15b61870e
fix(filters): release download counts (#1739)
* fix(database): count multiple actions per filter as one download

* fix(database): change queries and add tests

* fix(releases): add additional testdata

---------

Co-authored-by: ze0s <ze0s@riseup.net>
2024-10-06 14:52:20 +02:00
ze0s
737184a985
feat(downloads): handle http status 429 rate-limit retry (#1749)
* feat(downloads): handle rate-limit retry

* feat: abort if greater than max time 7200 seconds
2024-10-06 14:24:18 +02:00
ze0s
ca2d956e02
fix(notifications): disable notification and events have no effect (#1754)
fix(notifications): disable notificatio nand events
2024-10-06 14:12:01 +02:00
martylukyy
009647fcd1
feat(filters): sort by created and updated (#1751)
* feat(web): sort by date

* feat(filters): sort by created_at and updated_at

---------

Co-authored-by: ze0s <43699394+zze0s@users.noreply.github.com>
2024-10-04 15:02:27 +02:00
ze0s
bf7e1381ac
fix(downloadclients): arrs change size type to uint64 (#1744)
* fix(downloadclients): arrs change size type to uint64

* fix(downloadclients): check resp.Body
2024-09-29 14:04:16 +02:00
ze0s
e9726363b4
fix(downloadclients): do not load Deluge from cache (#1743)
Co-authored-by: ze0s <>
2024-09-29 12:48:53 +02:00
Nagy László Zoltán
91db3cfd0f
chore(indexers): remove LilleSky (#1735) 2024-09-21 13:04:54 +02:00