Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reolink add nvr flag #1620

Merged
merged 4 commits into from
Oct 21, 2024
Merged

Reolink add nvr flag #1620

merged 4 commits into from
Oct 21, 2024

Conversation

apocaliss92
Copy link
Contributor

No description provided.

const deviceInfo: DevInfo = await response.body?.[0]?.value?.DevInfo;

// Will need to check if it's valid for NVR and NVR_WIFI
if (['HOMEHUB'].includes(deviceInfo.exactType)) {
Copy link
Owner

Choose a reason for hiding this comment

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

invert this logic so if it doesn't include, it immediately returns deviceInfo. Remaining code will be only for reolink home hub logic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done!

@@ -201,16 +201,53 @@ export class ReolinkCameraClient {
const url = new URL(`http://${this.host}/api.cgi`);
const params = url.searchParams;
params.set('cmd', 'GetDevInfo');
const response = await this.requestWithLogin({
let response = await this.requestWithLogin({
Copy link
Owner

Choose a reason for hiding this comment

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

why are these "let" and reused?

Use different variables for different request types. mutability on the response makes understanding this code later difficult.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

@koush koush merged commit 446e8ed into koush:main Oct 21, 2024
@apocaliss92 apocaliss92 deleted the reolink-add-nvr-flag branch November 15, 2024 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants