andreknieriem / photobooth

A photobooth Web-Application for raspberry pi with gphoto2
https://photobooth.andrerinas.de/
MIT License
301 stars 163 forks source link

Implemented continous check for new pictures in gallery.php #260

Closed EccoB closed 4 years ago

EccoB commented 4 years ago

Problem: When the gallery is used standalone, new pictures won't be visible till the user manually refreshes the page.

Solution: Added jQuery script that asks the server weather the database changed, if so the page will be reloaded automatically.

Implementation details:

andi34 commented 4 years ago

Hey and thanks for your contribution! I've rebased and adjusted your changes to work on my Photobooth fork too.

But there's one problem: If I am on the standalone gallery watching pictures in full size and someone else is taking a picture on the Photobooth my page get refreshed which shouldn't happen while I am active on the gallery.

We need to detect touch and mouse events and only refresh the page if there's no activity.

andreknieriem commented 4 years ago

Hey @andi34 and @EccoB. Take a look at core.js for the timetolive variable. That is what you are looking for, to stop refresh on user action.

andi34 commented 4 years ago

Thanks @andreknieriem ! Will take a look at in the evening 👍

EccoB commented 4 years ago

Hey @andi34 and @andreknieriem Thanks for all your comments. I took a look at the user interaction problem and found it best to introduce a function in core.js that tells weather there is a user interaction pending based on the TimeOut function there. If so, we just skip any further checks and updates as the page nevertheless will be refreshed after the timetolive in core.js

andi34 commented 4 years ago

Thanks @EccoB ! I've fixed the lint issues and made the DB check optional available, also adjustable interval via admin panel: https://github.com/andi34/photobooth/pull/121/files