tapo: fix 2 way

This commit is contained in:
Koushik Dutta
2024-07-22 17:40:33 -07:00
parent 112633a776
commit 34dbc7930e
3 changed files with 11 additions and 14 deletions

View File

@@ -1,12 +1,12 @@
{
"name": "@scrypted/tapo",
"version": "0.0.17",
"version": "0.0.18",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@scrypted/tapo",
"version": "0.0.17",
"version": "0.0.18",
"dependencies": {
"@scrypted/common": "file:../../common",
"@scrypted/sdk": "file:../../sdk",
@@ -23,19 +23,18 @@
"license": "ISC",
"dependencies": {
"@scrypted/sdk": "file:../sdk",
"@scrypted/server": "file:../server",
"http-auth-utils": "^3.0.2",
"node-fetch-commonjs": "^3.1.1",
"typescript": "^5.3.3"
"http-auth-utils": "^5.0.1",
"typescript": "^5.5.3"
},
"devDependencies": {
"@types/node": "^20.10.8",
"@types/node": "^20.11.0",
"monaco-editor": "^0.50.0",
"ts-node": "^10.9.2"
}
},
"../../sdk": {
"name": "@scrypted/sdk",
"version": "0.3.4",
"version": "0.3.45",
"license": "ISC",
"dependencies": {
"@babel/preset-typescript": "^7.18.6",

View File

@@ -1,6 +1,6 @@
{
"name": "@scrypted/tapo",
"version": "0.0.17",
"version": "0.0.18",
"description": "Tapo Camera Plugin for Scrypted",
"scripts": {
"scrypted-setup-project": "scrypted-setup-project",

View File

@@ -1,9 +1,9 @@
import { Deferred } from '@scrypted/common/src/deferred';
import { authHttpFetch } from '@scrypted/common/src/http-auth-fetch';
import { readLine } from '@scrypted/common/src/read-stream';
import { parseHeaders, readBody, readMessage, writeMessage } from '@scrypted/common/src/rtsp-server';
import crypto from 'crypto';
import { Duplex, PassThrough, Writable } from 'stream';
import { httpFetch } from '../../../server/src/fetch/http-fetch';
import { digestAuthHeader } from './digest-auth';
export function getTapoAdminPassword(cloudPassword: string, useSHA256: boolean) {
@@ -27,8 +27,7 @@ export class TapoAPI {
const url = `http://${options.address}/stream`;
// will fail with auth required.
const response = await authHttpFetch({
credential: undefined,
const response = await httpFetch({
url: url,
checkStatusCode: false,
method: 'POST',
@@ -48,8 +47,7 @@ export class TapoAPI {
const auth = digestAuthHeader('POST', '/stream', wwwAuthenticate, 'admin', password, 0) + ', algorithm=MD5';
const response2 = await authHttpFetch({
credential: undefined,
const response2 = await httpFetch({
url: url,
method: 'POST',
headers: {