Skip to content

Enhancement: support qBittorrent apikey#6791

Merged
shamoon merged 5 commits into
gethomepage:devfrom
Clone003:feature/qbit-apikey
Jun 20, 2026
Merged

Enhancement: support qBittorrent apikey#6791
shamoon merged 5 commits into
gethomepage:devfrom
Clone003:feature/qbit-apikey

Conversation

@Clone003

@Clone003 Clone003 commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Proposed change

Description

Update qBittorrent service widget to support using an API key instead of a username and password.

qBittorent supports API Keys in version ≥ v5.2.0

I mostly referenced src\widgets\photoprism\proxy.js for the changes.

Closes #6706

Configuration Example

widget:
  type: qbittorrent
  url: http://qbittorrent.host.or.ip
  key: qbt_apikey

Testing

Since it's a simple change, I only tested in using by changing the services.yaml

  • Username and password still works
  • API Key works
  • Having both username/password and API key still works (should prioritize API Key)
  • Tested on both FireFox and Edge

AI Disclosure

I only used the Google AI Overview when googling REST API, javascript, and qBittorent api.

Type of change

  • New service widget
  • Bug fix (non-breaking change which fixes an issue)
  • New feature or enhancement (non-breaking change which adds functionality)
  • Documentation only
  • Other (please explain)

Checklist:

  • If applicable, I have added corresponding documentation changes.
  • If applicable, I have added or updated tests for new features and bug fixes (see testing).
  • If applicable, I have reviewed the feature / enhancement and / or service widget guidelines.
  • I have checked that all code style checks pass using pre-commit hooks and linting checks.
  • If applicable, I have tested my code for new features & regressions on both mobile & desktop devices, using the latest version of major browsers.
  • In the description above I have disclosed the use of AI tools in the coding of this PR.

@github-actions github-actions Bot added the enhancement New feature or request label Jun 20, 2026
@codecov

codecov Bot commented Jun 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.43%. Comparing base (7c5e345) to head (b823f36).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##              dev    #6791   +/-   ##
=======================================
  Coverage   81.42%   81.43%           
=======================================
  Files         532      532           
  Lines        9576     9581    +5     
  Branches     1797     1797           
=======================================
+ Hits         7797     7802    +5     
  Misses       1079     1079           
  Partials      700      700           
Flag Coverage Δ
vitest-shard-1 27.24% <0.00%> (-0.02%) ⬇️
vitest-shard-2 20.93% <0.00%> (-0.02%) ⬇️
vitest-shard-3 27.90% <0.00%> (-0.02%) ⬇️
vitest-shard-4 22.72% <100.00%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/widgets/qbittorrent/proxy.js 80.55% <100.00%> (+3.13%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Clone003

Copy link
Copy Markdown
Contributor Author

To make the coverage reach 100%, I could possible change the proxy.test.js Line 53 to use a key for the 5.2.0 test case.

Though, I'm not familiar with how the tests work.

From
getServiceWidget.mockResolvedValue({ url: "http://qb", username: "u", password: "p" });
To
getServiceWidget.mockResolvedValue({ url: "http://qb", key: "qbt_apikey" });

@shamoon shamoon enabled auto-merge (squash) June 20, 2026 22:48

@shamoon shamoon left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. The idea of tests is to mimic what happens in real life to ensure the code does what you expect. Lots of great resources on the web about it. See a3f352d

@shamoon shamoon merged commit 9b014e4 into gethomepage:dev Jun 20, 2026
12 checks passed
@Clone003

Clone003 commented Jun 20, 2026

Copy link
Copy Markdown
Contributor Author

Appreciate the peer review and merge!
The test would've taken me a whole day to figure it out since I haven't worked with JS.
After looking at your test, its clearer to me now what's happening. Thanks

Glad to contribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants