Add ability to customize views/playback interval

This commit is contained in:
Chocobozzz
2023-12-13 10:06:25 +01:00
parent 49a4b8cb7d
commit fe37e5232b
15 changed files with 143 additions and 14 deletions

View File

@@ -300,6 +300,27 @@ export interface ServerConfig {
homepage: {
enabled: boolean
}
openTelemetry: {
metrics: {
enabled: boolean
// milliseconds
playbackStatsInterval: number
}
}
views: {
videos: {
watchingInterval: {
// milliseconds
anonymous: number
// milliseconds
users: number
}
}
}
}
export type HTMLServerConfig = Omit<ServerConfig, 'signup'>

View File

@@ -498,6 +498,16 @@ describe('Test config', function () {
await setAccessTokensToServers([ server ])
})
it('Should have the correct default config', async function () {
const data = await server.config.getConfig()
expect(data.openTelemetry.metrics.enabled).to.be.false
expect(data.openTelemetry.metrics.playbackStatsInterval).to.equal(15000)
expect(data.views.videos.watchingInterval.anonymous).to.equal(5000)
expect(data.views.videos.watchingInterval.users).to.equal(5000)
})
it('Should have a correct config on a server with registration enabled', async function () {
const data = await server.config.getConfig()