✨ qBittorrent: identifiants optionnels via bypass d'authentification (pas d'API key native)
This commit is contained in:
1 parent
95e5ead67a
commit
e8bbbc7d1e
5 files changed
+57
-18
No files matched your search
+9
-2
@@ -204,7 +204,7 @@ async def test_radarr() -> ConnectionResult:
|
||||
def qbittorrent_from_config() -> QbittorrentClient:
|
||||
qb = read_config().qbittorrent
|
||||
url = build_base_url(qb.url, qb.port)
|
||||
if not url or not qb.username or not qb.password:
|
||||
if not url:
|
||||
raise HTTPException(status_code=409, detail="La connexion qBittorrent n'est pas configurée")
|
||||
return QbittorrentClient(url, qb.username, qb.password)
|
||||
|
||||
@@ -228,8 +228,15 @@ def put_qbittorrent_settings(payload: QbittorrentSettingsWrite) -> QbittorrentSe
|
||||
cfg.qbittorrent.port = payload.port
|
||||
if payload.username:
|
||||
cfg.qbittorrent.username = payload.username
|
||||
if payload.password:
|
||||
if payload.password:
|
||||
cfg.qbittorrent.password = payload.password
|
||||
elif payload.password:
|
||||
# Mot de passe seul: on conserve l'utilisateur existant.
|
||||
cfg.qbittorrent.password = payload.password
|
||||
else:
|
||||
# Champs vides: mode bypass d'authentification qBittorrent, sans identifiants.
|
||||
cfg.qbittorrent.username = None
|
||||
cfg.qbittorrent.password = None
|
||||
write_config(cfg)
|
||||
return QbittorrentSettingsRead(
|
||||
url=cfg.qbittorrent.url,
|
||||
|
||||
Reference in new issue
Block a user