bp2008 / cameraproxy

A Windows Service which acts as a "smart" proxy for IP network cameras. Uses the .NET framework and parts of the VLC media player libraries.
GNU General Public License v3.0
69 stars 21 forks source link

Session Length? #10

Closed jiriteach closed 4 years ago

jiriteach commented 6 years ago

Hi - I have this installed and running well. I had a query around Session Length - I have set this for a user to 0 which means that it shouldn't persist beyond the current request. For a simple .html page which shows the camera feed - permission is set to 100. I can authenticate and view this, closing the browser off or accessing it again, loads the page without login. Any reason why or do you have a pointer on how to handle this? Thanks

bp2008 commented 6 years ago

Yeah, this app is coded to store your login info in a cookie for a period of 1 year. So more than likely it is just logging in with every request.

jiriteach commented 6 years ago

Ah - Thanks and good to know. Do you know where in the code this 1 year period is being set? So Session Length does nothing? Thanks

bp2008 commented 6 years ago

Yeah, for the most part it does nothing. I mean, the comment right below it says as much.

This does not really affect functionality. It is simply an optimization. A value of 0 causes the session to never be persisted beyond the current request.

Setting it to 0 means slightly higher CPU cost to process each web request, but it also means you aren't keeping sessions around in memory for very long. It is effectively a worthless optimization. Trading an insignificant amount of CPU time for an insignificant amount of memory.

jiriteach commented 6 years ago

Thanks for clarifying this! Do you know where in the code the cookie for a period of 1 year is being set?

Im happy to share back all of the changes I’ve made. Have completely re-hauled the UI and created a dynamic overview and streaming pages using Bootstrap 4 and it’s theming franework for a responsive UI. Works really well on every device. Will eventually wrap it into a native app.

bp2008 commented 6 years ago

Hmm, I said it was 1 year but it is in fact 1000 days. LOL

https://github.com/bp2008/cameraproxy/blob/b5216882ae8406880b49bda54cd4eb65f01a3de1/MJpegCameraProxy/MJpegCameraProxy/Pages/Login.cs

bp2008 commented 6 years ago

Gosh this app has a lot of bad design in it. Oh well. I started the thing when I was still in college.

jiriteach commented 6 years ago

LOL have noticed - am slowly working my way through updating parts. It does the fundementals very well. I have Dahua cameras and they’re good but the web experience is rubbish/requires plugins which don’t work and so are most of the tools out there. Sighthound comes close to what I was wanting to achieve but it’s too expensive. Also removes the need for browser plugins. Given the lack of non plugin based support for RTSP from most of the camera providers - I can see a future for this 👍