aboutsummaryrefslogtreecommitdiffhomepage
path: root/server.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-03-24 13:36:47 +0100
committerChocobozzz <chocobozzz@cpy.re>2022-04-15 09:49:35 +0200
commitb211106695bb82f6c32e53306081b5262c3d109d (patch)
treefa187de1c33b0956665f5362e29af6b0f6d8bb57 /server.ts
parent69d48ee30c9d47cddf0c3c047dc99a99dcb6e894 (diff)
downloadPeerTube-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.ts6
1 files changed, 4 insertions, 2 deletions
diff --git a/server.ts b/server.ts
index bb7a0c210..ad162832b 100644
--- a/server.ts
+++ b/server.ts
@@ -112,6 +112,7 @@ import { RemoveOldHistoryScheduler } from './server/lib/schedulers/remove-old-hi
112import { AutoFollowIndexInstances } from './server/lib/schedulers/auto-follow-index-instances' 112import { AutoFollowIndexInstances } from './server/lib/schedulers/auto-follow-index-instances'
113import { RemoveDanglingResumableUploadsScheduler } from './server/lib/schedulers/remove-dangling-resumable-uploads-scheduler' 113import { RemoveDanglingResumableUploadsScheduler } from './server/lib/schedulers/remove-dangling-resumable-uploads-scheduler'
114import { VideoViewsBufferScheduler } from './server/lib/schedulers/video-views-buffer-scheduler' 114import { VideoViewsBufferScheduler } from './server/lib/schedulers/video-views-buffer-scheduler'
115import { GeoIPUpdateScheduler } from './server/lib/schedulers/geo-ip-update-scheduler'
115import { isHTTPSignatureDigestValid } from './server/helpers/peertube-crypto' 116import { isHTTPSignatureDigestValid } from './server/helpers/peertube-crypto'
116import { PeerTubeSocket } from './server/lib/peertube-socket' 117import { PeerTubeSocket } from './server/lib/peertube-socket'
117import { updateStreamingPlaylistsInfohashesIfNeeded } from './server/lib/hls' 118import { updateStreamingPlaylistsInfohashesIfNeeded } from './server/lib/hls'
@@ -123,7 +124,7 @@ import { LiveManager } from './server/lib/live'
123import { HttpStatusCode } from './shared/models/http/http-error-codes' 124import { HttpStatusCode } from './shared/models/http/http-error-codes'
124import { VideosTorrentCache } from '@server/lib/files-cache/videos-torrent-cache' 125import { VideosTorrentCache } from '@server/lib/files-cache/videos-torrent-cache'
125import { ServerConfigManager } from '@server/lib/server-config-manager' 126import { ServerConfigManager } from '@server/lib/server-config-manager'
126import { VideoViews } from '@server/lib/video-views' 127import { VideoViewsManager } from '@server/lib/views/video-views-manager'
127import { isTestInstance } from './server/helpers/core-utils' 128import { 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 }))