onvif icon indicating copy to clipboard operation
onvif copied to clipboard

[WIP] Rewrite cam.js in typescript in separate branch

Open agsh opened this issue 3 years ago • 3 comments

agsh avatar Jan 13 '22 11:01 agsh

Deploying onvif with  Cloudflare Pages  Cloudflare Pages

Latest commit: f74afb7
Status:🚫  Build failed.

View logs

Hey! Just wanted to say thanks for all the amazing work you've put into rewriting the ONVIF library in TypeScript. It's been super helpful as a starting point.

Since this PR has been hanging around for a while and folks are really wanting a TypeScript version, I went ahead and made a stable fork based on your work. You can find it as @2bad/onvif on github and npm. I kept all the original code from here and added some stability fixes and tests while providing a stable build.

If anyone needs a working TypeScript ONVIF package right now, just run:

npm install @2bad/onvif

Hope this helps out the community! And hey, I'm totally down to work together on bringing these efforts together in the future.

mrhyde avatar Oct 23 '24 01:10 mrhyde

@mrhyde Hello! Great work! Glad that someone combine all the things that I wrote to a working version!

The main goal of the v1.x is to keep the best of 0.x, add types (I generate it from the ONVIF WSDL schemas) and make it a bit more modular.

We've got a lot of patches in 0.x to support as much cameras as we can. Not all of them, because the problem is in manufacturers, not specification. So I need to gracefully move all the methods.

BTW, here is my roadmap: https://github.com/agsh/onvif/blob/v1/CHECKED.md

Have you added any new onvif methods to the code? And your PRs are welcome any time! :+1:

agsh avatar Oct 25 '24 09:10 agsh

here just to say that I'm looking forward to this! Keep up the good work!

rodrigograca31 avatar Mar 08 '25 22:03 rodrigograca31

@agsh I'd like to point a critical issue that prevents authentication with cameras

When authenticating, the current implementation checks for the presence of date/time components but doesn't properly handle zero values. If hour, minute, or second is 0, the code treats these as falsy values and throws an "Invalid date or time structure" error, preventing successful authentication.

I've implemented a fix in my branch and have tested it extensively in a production environment for the past couple of months. Due to the significant number of changes in my fork, I can't simply submit this as a standard PR. You can check out the specific commit that addresses this issue here: https://github.com/2BAD/onvif/commit/c1b5c2ba8719d5125c3ae1d2a1ae2e220b48944d

mrhyde avatar Mar 22 '25 04:03 mrhyde

@agsh I'd like to point a critical issue that prevents authentication with cameras

When authenticating, the current implementation checks for the presence of date/time components but doesn't properly handle zero values. If hour, minute, or second is 0, the code treats these as falsy values and throws an "Invalid date or time structure" error, preventing successful authentication.

I've implemented a fix in my branch and have tested it extensively in a production environment for the past couple of months. Due to the significant number of changes in my fork, I can't simply submit this as a standard PR. You can check out the specific commit that addresses this issue here: 2BAD/onvif@c1b5c2b

@mrhyde Hi! Thanks for your interest in this project! Yes, you are right, the code you point to is buggy, but there is one problem... It is not my code. It is not in this library. It is your changes... :laughing:

https://github.com/2BAD/onvif/commit/c35c03214a4fded235f280672f1dd64e8bfd6721#diff-be0ad991d767e285d4a7362e8c021924de8bc914d42742fec462a4fa0a7769e6L279-R318

agsh avatar Mar 22 '25 17:03 agsh

@mrhyde Hi! Thanks for your interest in this project! Yes, you are right, the code you point to is buggy, but there is one problem... It is not my code. It is not in this library. It is your changes... 😆

Oh man this is awkward 😆 I was pretty sure that code was coming from the upstream but apparently it was my oversight during type fixes. Sorry for wasting your time on this one!

mrhyde avatar Mar 23 '25 02:03 mrhyde