diff options
author | Chocobozzz <me@florianbigard.com> | 2022-03-24 13:36:47 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2022-04-15 09:49:35 +0200 |
commit | b211106695bb82f6c32e53306081b5262c3d109d (patch) | |
tree | fa187de1c33b0956665f5362e29af6b0f6d8bb57 /server.ts | |
parent | 69d48ee30c9d47cddf0c3c047dc99a99dcb6e894 (diff) | |
download | PeerTube-b211106695bb82f6c32e53306081b5262c3d109d.tar.gz PeerTube-b211106695bb82f6c32e53306081b5262c3d109d.tar.zst PeerTube-b211106695bb82f6c32e53306081b5262c3d109d.zip |
Support video views/viewers stats in server
* Add "currentTime" and "event" body params to view endpoint
* Merge watching and view endpoints
* Introduce WatchAction AP activity
* Add tables to store viewer information of local videos
* Add endpoints to fetch video views/viewers stats of local videos
* Refactor views/viewers handlers
* Support "views" and "viewers" counters for both VOD and live videos
Diffstat (limited to 'server.ts')
-rw-r--r-- | server.ts | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -112,6 +112,7 @@ import { RemoveOldHistoryScheduler } from './server/lib/schedulers/remove-old-hi | |||
112 | import { AutoFollowIndexInstances } from './server/lib/schedulers/auto-follow-index-instances' | 112 | import { AutoFollowIndexInstances } from './server/lib/schedulers/auto-follow-index-instances' |
113 | import { RemoveDanglingResumableUploadsScheduler } from './server/lib/schedulers/remove-dangling-resumable-uploads-scheduler' | 113 | import { RemoveDanglingResumableUploadsScheduler } from './server/lib/schedulers/remove-dangling-resumable-uploads-scheduler' |
114 | import { VideoViewsBufferScheduler } from './server/lib/schedulers/video-views-buffer-scheduler' | 114 | import { VideoViewsBufferScheduler } from './server/lib/schedulers/video-views-buffer-scheduler' |
115 | import { GeoIPUpdateScheduler } from './server/lib/schedulers/geo-ip-update-scheduler' | ||
115 | import { isHTTPSignatureDigestValid } from './server/helpers/peertube-crypto' | 116 | import { isHTTPSignatureDigestValid } from './server/helpers/peertube-crypto' |
116 | import { PeerTubeSocket } from './server/lib/peertube-socket' | 117 | import { PeerTubeSocket } from './server/lib/peertube-socket' |
117 | import { updateStreamingPlaylistsInfohashesIfNeeded } from './server/lib/hls' | 118 | import { updateStreamingPlaylistsInfohashesIfNeeded } from './server/lib/hls' |
@@ -123,7 +124,7 @@ import { LiveManager } from './server/lib/live' | |||
123 | import { HttpStatusCode } from './shared/models/http/http-error-codes' | 124 | import { HttpStatusCode } from './shared/models/http/http-error-codes' |
124 | import { VideosTorrentCache } from '@server/lib/files-cache/videos-torrent-cache' | 125 | import { VideosTorrentCache } from '@server/lib/files-cache/videos-torrent-cache' |
125 | import { ServerConfigManager } from '@server/lib/server-config-manager' | 126 | import { ServerConfigManager } from '@server/lib/server-config-manager' |
126 | import { VideoViews } from '@server/lib/video-views' | 127 | import { VideoViewsManager } from '@server/lib/views/video-views-manager' |
127 | import { isTestInstance } from './server/helpers/core-utils' | 128 | import { isTestInstance } from './server/helpers/core-utils' |
128 | 129 | ||
129 | // ----------- Command line ----------- | 130 | // ----------- Command line ----------- |
@@ -295,10 +296,11 @@ async function startApplication () { | |||
295 | AutoFollowIndexInstances.Instance.enable() | 296 | AutoFollowIndexInstances.Instance.enable() |
296 | RemoveDanglingResumableUploadsScheduler.Instance.enable() | 297 | RemoveDanglingResumableUploadsScheduler.Instance.enable() |
297 | VideoViewsBufferScheduler.Instance.enable() | 298 | VideoViewsBufferScheduler.Instance.enable() |
299 | GeoIPUpdateScheduler.Instance.enable() | ||
298 | 300 | ||
299 | Redis.Instance.init() | 301 | Redis.Instance.init() |
300 | PeerTubeSocket.Instance.init(server) | 302 | PeerTubeSocket.Instance.init(server) |
301 | VideoViews.Instance.init() | 303 | VideoViewsManager.Instance.init() |
302 | 304 | ||
303 | updateStreamingPlaylistsInfohashesIfNeeded() | 305 | updateStreamingPlaylistsInfohashesIfNeeded() |
304 | .catch(err => logger.error('Cannot update streaming playlist infohashes.', { err })) | 306 | .catch(err => logger.error('Cannot update streaming playlist infohashes.', { err })) |