reolink: add HTTPS option for the NVR/Hub api.cgi connection#1
Open
SnoElement wants to merge 1 commit into
Open
reolink: add HTTPS option for the NVR/Hub api.cgi connection#1SnoElement wants to merge 1 commit into
SnoElement wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds an opt-in HTTPS control-path for the Reolink NVR/Home Hub api.cgi client so HTTPS-only hubs (Home Hub / Home Hub Pro) can be managed successfully while preserving HTTP defaults for existing devices.
Changes:
- Adds an Advanced per-device “Use HTTPS” toggle and threads it into
ReolinkNvrClientto select the URL scheme forapi.cgirequests. - Makes the API port scheme-aware when unset (80 for HTTP, 443 for HTTPS), while honoring explicit overrides.
- Updates NVR add-device flow to persist the new HTTPS setting and to default the port based on the chosen scheme.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| plugins/reolink/src/nvr/nvr.ts | Adds “Use HTTPS” device setting and makes API port default depend on scheme when unset. |
| plugins/reolink/src/nvr/api.ts | Introduces protocol selection and switches api.cgi URL construction to use it. |
| plugins/reolink/src/main.ts | Adds HTTPS toggle to the add-device flow and applies scheme-aware default port for NVR creation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
f6f6363 to
00b7436
Compare
The NVR/Hub client hardcodes http:// for every api.cgi request. The Reolink Home Hub and Home Hub Pro only serve their API over HTTPS, so the plugin cannot connect to them (login, GetEvents polling, snapshots, PTZ, etc. all fail against http://host:443). Add a per-device "Use HTTPS" toggle (Advanced), surfaced both on the NVR add-device form and on the NVR device settings, and thread it through ReolinkNvrClient as a constructor flag that selects the URL scheme. Defaults to HTTP, so existing cameras and NVRs are unaffected; the add-device port default switches to 443 when HTTPS is selected. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
00b7436 to
7d19232
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The NVR/Hub API client (
nvr/api.ts) hardcodeshttp://for everyapi.cgirequest. The Reolink Home Hub and Home Hub Pro only serve their API over HTTPS, so the plugin cannot talk to them at all — login,GetEventspolling, snapshots, PTZ, etc. all fail againsthttp://host:443.Change
main.ts) and the NVR device settings (nvr/nvr.ts).ReolinkNvrClientas a constructor flag that selects the URL scheme (this.protocol); allapi.cgiURLs use it.Defaults to HTTP, so existing cameras and NVRs are unaffected (backward compatible).
Validation
Tested on a real Reolink Home Hub Pro (firmware v3.3.0.466): with "Use HTTPS" on, the hub connects,
GetHubInfo/GetDevicesInfosucceed, and there are zeroEPROTO/wrong-version SSL errors (which is whathttp://host:443produced before this change).Note
The standalone-camera path (
reolink-api.ts,probe.ts) hardcodeshttp://the same way; this PR only covers the NVR/Hub path. The standalone path could get the same treatment as a follow-up.