✨ qBittorrent: cle API native (>= 5.2, Bearer) + compatibilite login 204 + suppression torrent en bypass/port separe
This commit is contained in:
1 parent
c7344f8988
commit
8e76fb7112
8 files changed
+143
-15
No files matched your search
+15
-2
@@ -30,6 +30,7 @@ type QbittorrentSettings = {
|
||||
port: number | null;
|
||||
username: string | null;
|
||||
password_configured: boolean;
|
||||
api_key_configured: boolean;
|
||||
};
|
||||
|
||||
const jsonHeaders = { "Content-Type": "application/json" };
|
||||
@@ -119,6 +120,7 @@ export default function App() {
|
||||
const [qbitPort, setQbitPort] = useState("");
|
||||
const [qbitUsername, setQbitUsername] = useState("");
|
||||
const [qbitPassword, setQbitPassword] = useState("");
|
||||
const [qbitApiKey, setQbitApiKey] = useState("");
|
||||
const [qbitConfigured, setQbitConfigured] = useState(false);
|
||||
const [selected, setSelected] = useState<Movie | null>(null);
|
||||
const [posterUrl, setPosterUrl] = useState<string | null>(null);
|
||||
@@ -211,7 +213,7 @@ export default function App() {
|
||||
setQbitUrl(qbittorrent.url ?? "");
|
||||
setQbitPort(qbittorrent.port?.toString() ?? "");
|
||||
setQbitUsername(qbittorrent.username ?? "");
|
||||
setQbitConfigured(qbittorrent.password_configured);
|
||||
setQbitConfigured(qbittorrent.password_configured || qbittorrent.api_key_configured);
|
||||
if (!radarr.api_key_configured || !qbittorrent.password_configured) {
|
||||
notify(
|
||||
"Configuration incomplète — renseignez les connexions Radarr et qBittorrent dans la page Configuration.",
|
||||
@@ -332,10 +334,12 @@ export default function App() {
|
||||
port: qbitPort ? Number(qbitPort) : null,
|
||||
username: qbitUsername,
|
||||
password: qbitPassword || null,
|
||||
api_key: qbitApiKey || null,
|
||||
}),
|
||||
});
|
||||
setQbitConfigured(settings.password_configured);
|
||||
setQbitConfigured(settings.password_configured || settings.api_key_configured);
|
||||
setQbitPassword("");
|
||||
setQbitApiKey("");
|
||||
const result = await api<{ message: string }>("/api/settings/qbittorrent/test", {
|
||||
method: "POST",
|
||||
});
|
||||
@@ -1008,6 +1012,15 @@ export default function App() {
|
||||
onChange={(event) => setQbitPassword(event.target.value)}
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
Clé API (optionnel — qBittorrent ≥ 5.2)
|
||||
<input
|
||||
type="password"
|
||||
placeholder="qbt_... — prioritaire sur les identifiants"
|
||||
value={qbitApiKey}
|
||||
onChange={(event) => setQbitApiKey(event.target.value)}
|
||||
/>
|
||||
</label>
|
||||
<button disabled={busy}>Enregistrer et tester</button>
|
||||
</form>
|
||||
{qbitConfigured && (
|
||||
|
||||
@@ -30,6 +30,8 @@ export default function Settings() {
|
||||
const [qbitUsername, setQbitUsername] = useState("");
|
||||
const [qbitPassword, setQbitPassword] = useState("");
|
||||
const [qbitPasswordConfigured, setQbitPasswordConfigured] = useState(false);
|
||||
const [qbitApiKey, setQbitApiKey] = useState("");
|
||||
const [qbitApiKeyConfigured, setQbitApiKeyConfigured] = useState(false);
|
||||
|
||||
const [message, setMessage] = useState("");
|
||||
const [busy, setBusy] = useState(false);
|
||||
@@ -56,6 +58,7 @@ export default function Settings() {
|
||||
setQbitUrl(settings.qbittorrent.url ?? "");
|
||||
setQbitUsername(settings.qbittorrent.username ?? "");
|
||||
setQbitPasswordConfigured(settings.qbittorrent.password_configured);
|
||||
setQbitApiKeyConfigured(settings.qbittorrent.api_key_configured);
|
||||
}, []);
|
||||
|
||||
const refreshSettings = useCallback(async (): Promise<SettingsRead> => {
|
||||
@@ -157,11 +160,13 @@ export default function Settings() {
|
||||
url: qbitUrl || null,
|
||||
username: qbitUsername || null,
|
||||
password: qbitPassword || null,
|
||||
api_key: qbitApiKey || null,
|
||||
},
|
||||
}),
|
||||
});
|
||||
|
||||
setQbitPassword("");
|
||||
setQbitApiKey("");
|
||||
const fresh = await refreshSettings();
|
||||
if (fresh.qbittorrent.status === "unconfigured") {
|
||||
setMessage("Configuration enregistrée");
|
||||
@@ -353,7 +358,7 @@ export default function Settings() {
|
||||
</div>
|
||||
<p className="muted">Optionnel: nécessaire pour supprimer torrent + données après import validé.</p>
|
||||
</div>
|
||||
<form onSubmit={saveQbittorrent} className="form-3">
|
||||
<form onSubmit={saveQbittorrent} className="form-4">
|
||||
<label>
|
||||
URL WebUI
|
||||
<input
|
||||
@@ -381,6 +386,17 @@ export default function Settings() {
|
||||
onChange={(event) => setQbitPassword(event.target.value)}
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
Clé API {qbitApiKeyConfigured && <span>· configurée</span>}
|
||||
<input
|
||||
type="password"
|
||||
placeholder={
|
||||
qbitApiKeyConfigured ? "Laisser vide pour conserver" : "qbt_... (qBittorrent ≥ 5.2)"
|
||||
}
|
||||
value={qbitApiKey}
|
||||
onChange={(event) => setQbitApiKey(event.target.value)}
|
||||
/>
|
||||
</label>
|
||||
<button disabled={busy}>Enregistrer et tester</button>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
@@ -22,6 +22,7 @@ export type QbittorrentSettingsRead = ServiceStatus & {
|
||||
url: string | null;
|
||||
username: string | null;
|
||||
password_configured: boolean;
|
||||
api_key_configured: boolean;
|
||||
};
|
||||
|
||||
export type SettingsRead = {
|
||||
|
||||
Reference in new issue
Block a user