Commit Graph

8463 Commits

Author SHA1 Message Date
Koushik Dutta
5dde5ae893 fix: add type annotations for network address functions
- Add parseInt with empty string fallback for undefined env vars
- getIpAddress returns string | undefined when no addresses available
- Add type guard filters for network interface arrays
2026-04-02 13:33:12 -07:00
Koushik Dutta
cfa9e2a200 fix: make LevelDocument._id and _documentType required
These properties are always present after document creation.
Update PluginDevice constructor to require id parameter.
2026-04-02 13:33:12 -07:00
Koushik Dutta
0d4a0d2c2c fix: initialize RpcResult before try block to match Python implementation
Previously, if this.serialize() threw an exception, result would be undefined
when passed to createErrorResult. This fix brings TypeScript in sync with the
Python rpc.py implementation which already initializes result before the try block.
2026-04-02 13:33:12 -07:00
Koushik Dutta
24ecc19e99 fix: add ts-ignore for delete operations on required properties
zipFile and unzippedPath are set at runtime by cluster worker host.
2026-04-02 13:33:12 -07:00
Koushik Dutta
675b967862 fix: add undefined to buffer state type annotations
Buffer state variables can be undefined before initialization.
2026-04-02 13:33:12 -07:00
Koushik Dutta
3882805cfc fix: add type guard filter for network interfaces
Filter undefined values after flat() to prevent runtime errors
when accessing ni.address.
2026-04-02 13:33:12 -07:00
Koushik Dutta
6ac91bc1a3 fix: add undefined to return type and filter
inferTypeFromInterfaces can return undefined for empty arrays.
Add type guard filter to remove undefined entries.
2026-04-02 13:33:12 -07:00
Koushik Dutta
b2301a3073 fix: add non-null assertions for process.argv and process.send
These values are guaranteed to exist in the plugin main process context.
2026-04-02 13:33:12 -07:00
Koushik Dutta
9cfa6ea58b fix: refactor serviceKey undefined handling
Check serviceKey directly after parsing instead of checking existing?.serviceKey.
This fixes a bug where key parsing failures would be silently ignored.
2026-04-02 13:33:12 -07:00
Koushik Dutta
65199ecdf7 refactor: rename mixins parameter to avoid mutation
Rename parameter to mixinsList to avoid mutating the input parameter.
Add non-null assertion for pop result.
2026-04-02 13:33:12 -07:00
Koushik Dutta
64ed95e9aa fix: add non-null assertions for parentPort access
parentPort is guaranteed to exist in worker thread context.
2026-04-02 13:33:12 -07:00
Koushik Dutta
8c5b2f48cc fix: add definite assignment assertion for cancel variable
Add `!` assertion to cancel variable that is assigned in callback.
2026-04-02 13:33:12 -07:00
Koushik Dutta
bc8f1ebc97 refactor: use Object.entries() in createHeadersArray
Use Object.entries() spread instead of manual loop for cleaner code.
2026-04-02 13:33:12 -07:00
Koushik Dutta
2977d0a90b server: update types 2026-04-02 13:33:12 -07:00
Koushik Dutta
dd59ac40b6 noImplicitReturns: enabled implicit return checking
Fixed all 32 errors by:
- Adding '| undefined' to return type signatures where functions could return undefined
- Changing 'return;' to 'return undefined;' (explicit instead of implicit)
- Adding 'return undefined;' at function ends where needed

Functions updated:
- src/cluster/cluster-setup.ts: getClusterObject, getScryptedClusterMode
- src/fetch/index.ts: getHttpFetchAccept
- src/infer-defaults.ts: inferRoomFromName, getProvidedRoomOrDefault, getDisplayRoom
- src/level.ts: tryGet
- src/plugin/plugin-api.ts: getDeviceById
- src/plugin/plugin-device.ts: findMethod, findMixin
- src/plugin/plugin-host-api.ts: setDeviceProperty
- src/plugin/system.ts: getOwnPropertyDescriptor
- src/rpc.ts: getIteratorNext
- src/runtime.ts: getAccessControlAllowOrigin, getDeviceLogger, getEndpointPluginData, getAccessControls, invalidatePluginDevice, rebuildPluginDeviceMixinTable, installNpm, getPluginHostForDevice, getDevice
- src/scrypted-server-main.ts: getDefaultAuthentication, checkValidUserToken
- src/services/addresses.ts: getLocalAddresses
- src/state.ts: setState
2026-04-02 13:33:09 -07:00
Koushik Dutta
fd0b3a0b8f noImplicitOverride: enabled override modifier checking
Added 'override' keyword to methods that override base class members:
- src/level.ts: override open() methods
- src/plugin/plugin-remote-worker.ts: override setStorage() methods
- src/plugin/runtime/node-fork-worker.ts: override pid getter
- src/plugin/runtime/python-worker.ts: override stdout/stderr getters
- src/rpc.ts: override cause parameter in RPCResultError
- src/runtime.ts: override wss property
- src/state.ts: override listenDevice() method
2026-04-02 13:32:51 -07:00
Koushik Dutta
196ff8378c noUncheckedIndexedAccess: enabled unchecked indexed access checking 2026-04-02 13:32:51 -07:00
Koushik Dutta
78311762a7 strictFunctionTypes: enabled stricter function type checking 2026-04-02 13:32:51 -07:00
Koushik Dutta
4e0ab38986 noImplicitThis: enabled implicit this checking 2026-04-02 13:32:51 -07:00
Koushik Dutta
bd8b152bfd noFallthroughCasesInSwitch: enabled switch fallthrough checking 2026-04-02 13:32:51 -07:00
Koushik Dutta
7cf11d040c strictBindCallApply: enabled stricter bind/call/apply checking 2026-04-02 13:32:51 -07:00
Koushik Dutta
125db2e8dd sdk: remove axios, fix http-fetch usage
Some checks failed
Build SDK / Build (push) Has been cancelled
2026-03-31 09:08:24 -07:00
Koushik Dutta
a64dd8e878 http-fetch: missing file 2026-03-31 09:07:24 -07:00
Koushik Dutta
25bf83832a http-fetch: fix buffer post 2026-03-31 09:06:21 -07:00
Koushik Dutta
181d0fdc92 packages: expose http fetch 2026-03-31 08:38:02 -07:00
Koushik Dutta
148bd27fd3 sdk: switch off axios to @scrypted/auth-fetch 2026-03-31 08:19:48 -07:00
Koushik Dutta
b634330ab0 sdk: make bin files typescript 2026-03-31 08:17:42 -07:00
Koushik Dutta
21ce1af766 packages: publish auth-fetch 2026-03-31 08:09:25 -07:00
Koushik Dutta
89b780590a packages: publish auth-fetch 2026-03-31 08:04:45 -07:00
Koushik Dutta
f1fac2ab99 Merge branch 'main' of github.com:koush/scrypted
Some checks failed
Build SDK / Build (push) Has been cancelled
2026-03-28 20:31:35 -07:00
Koushik Dutta
41e17a8dc4 core: remove scripts templates, direct to scripts site 2026-03-28 20:31:31 -07:00
Koushik Dutta
936a81ecbb sdk: filter invalid devices from storage settings 2026-03-28 12:08:04 -07:00
JoshADC
eefab888a7 reolink: logout expired token sessions before renewing (#1979)
The ReolinkCameraClient never called the Logout API before requesting a
new token, causing stale sessions to accumulate on the camera. When the
camera's session limit was reached (~68 min cycle), it would close the
RTMP/RTSP connection, dropping the stream.

Add a logout() method that releases the old token session before login()
requests a new one, matching the pattern already used by ReolinkNvrClient.
This prevents session buildup and eliminates periodic stream drops.

Fixes #1873

Co-authored-by: Josh Casada <joshcasada@Joshs-Mac-mini.ts.net lan>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-23 08:23:11 -07:00
Koushik Dutta
6a8260d09d ncnn: readd cluster label 2026-03-08 10:42:04 -07:00
Koushik Dutta
4a8d5dbe6d detect: fix segmentation labels 2026-03-08 10:39:00 -07:00
Koushik Dutta
c77bbec748 detect: publish fixed ncnn segmentation and cluster fork 2026-03-08 10:36:10 -07:00
Koushik Dutta
0e31a780ac detect: finish segmentation support 2026-03-07 17:30:09 -08:00
Koushik Dutta
f2f8fb265f detect: finish segmentation support 2026-03-07 17:26:08 -08:00
Koushik Dutta
baa9368199 ncnn: fix face recognition model name 2026-03-07 17:15:31 -08:00
Koushik Dutta
feed98d7e7 ncnn: new models 2026-03-07 09:26:00 -08:00
Koushik Dutta
f62976b979 diagnostics: more domain checks 2026-03-05 08:41:22 -08:00
Koushik Dutta
0aa4118828 detect: bump deps 2026-03-02 11:05:48 -08:00
Koushik Dutta
80b1ba2fa3 detect: publish new models as default 2026-03-01 12:40:05 -08:00
Koushik Dutta
46dd4006c7 detect: move clip to huggingface 2026-02-27 20:49:33 -08:00
Koushik Dutta
e66ea8e794 rebroadcast: publish 2026-02-26 08:42:31 -08:00
Alexis Rouillard
6fd84af50f rebroadcast: Use optional chaining for allowBatteryPrebuffer (#1986) 2026-02-18 10:19:15 -08:00
JoshADC
7112e049cb rebroadcast: fix RTMP acknowledgement uint32 overflow (#1980)
The RTMP client's totalBytesReceived counter grows unbounded as a
JavaScript number. When it exceeds 2^31 (~2.15 GB received), the
writeUInt32BE call in sendAcknowledgementIfNeeded throws a RangeError
because JavaScript bitwise operations produce signed 32-bit integers.
This crashes the RTMP session and drops the video stream.

For a high-bitrate camera like the Reolink D340P (~4 Mbps main stream),
this overflow occurs after approximately 90 minutes of continuous
streaming, causing periodic stream drops at a consistent interval.

Fix by using the unsigned right shift operator (>>> 0) to keep
totalBytesReceived and bytesToAck in the unsigned uint32 range [0,
4294967295], matching the RTMP spec's sequence number wrapping behavior.

Co-authored-by: Josh Casada <joshcasada@Joshs-Mac-mini.ts.net lan>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 18:53:46 -08:00
George Talusan
440926ef73 onvif: clear binaryTimeout on destroy (#1974) 2026-02-03 14:14:57 -08:00
Roman Sokolov
3d1d3727dc hikvision-doorbell: fixes (#1970)
* Let's try to fix the plugin freezing

* hikvision-doorbell version up after merging from main
2026-01-24 08:18:59 -08:00
Koushik Dutta
079878b663 core: allow PATH in terminal service 2026-01-21 16:21:15 -08:00