Zibbp / ganymede

Twitch VOD and Live Stream archiving platform. Includes a rendered and real-time chat for each archive.
https://github.com/Zibbp/ganymede
GNU General Public License v3.0
494 stars 25 forks source link

Count the Views from Ganymede, not from Twitch #287

Closed TheFrodo closed 1 year ago

TheFrodo commented 1 year ago

Good evening,

Would it be possible to count the views depending on how many have viewed the VOD on Ganymede? Currently there are the views of Twitch, but it would make sense if there would be the views of Ganymede, or do I see it wrong?

Zibbp commented 1 year ago

Here's what I've come up with.

On every initial page load of a video (https://ganymede.domain.net/vods/4aa5aab3-49ee-11ee-b96c-0242ac130004) a request is sent to a new endpoint. The new endpoint currently only houses the logic to increment the local_view column on the vod table by 1. So every page load, authenticated or unauthenticated, will increment the view. I'll probably show the local view count along side the source view count.

Work in progress here https://github.com/Zibbp/ganymede/pull/288

Let me know what you think.

TheFrodo commented 1 year ago

That sounds good. Only I'm worried that you can manipulate the views in this way. Simply with a F5.

It probably doesn't matter, but wouldn't it make sense to somehow build in a security mechanism?

Zibbp commented 1 year ago

With counting un-authenticated view, the security mechanisms are limited. I'd have to store the user's IP temporarily to ensure the IP is only tied to one view in X hours. I don't really want to mess around with that, especially as a lot of users are using a reverse proxy, the IP may not be the real user's IP.

I don't see real harm in someone abusing this, it's only a view count.

TheFrodo commented 1 year ago

That's right, I hadn't thought of that at all. Yes, you're right, that's not really a big security risk.

I should think first, then write :D

Zibbp commented 1 year ago

This feature has been released in v1.4.3.