]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - shared/extra-utils/server/config.ts
modularize abstract video list header and implement video hotness recommendation...
[github/Chocobozzz/PeerTube.git] / shared / extra-utils / server / config.ts
index 35b08477f9a83976d7ad8812d3d001670386b18a..f7c488c0bbea34a49824391aa36e7fd847ff608c 100644 (file)
@@ -1,6 +1,6 @@
 import { makeDeleteRequest, makeGetRequest, makePutBodyRequest } from '../requests/requests'
 import { CustomConfig } from '../../models/server/custom-config.model'
-import { DeepPartial } from '@server/typings/utils'
+import { DeepPartial, HttpStatusCode } from '@shared/core-utils'
 import { merge } from 'lodash'
 
 function getConfig (url: string) {
@@ -9,7 +9,7 @@ function getConfig (url: string) {
   return makeGetRequest({
     url,
     path,
-    statusCodeExpected: 200
+    statusCodeExpected: HttpStatusCode.OK_200
   })
 }
 
@@ -19,11 +19,11 @@ function getAbout (url: string) {
   return makeGetRequest({
     url,
     path,
-    statusCodeExpected: 200
+    statusCodeExpected: HttpStatusCode.OK_200
   })
 }
 
-function getCustomConfig (url: string, token: string, statusCodeExpected = 200) {
+function getCustomConfig (url: string, token: string, statusCodeExpected = HttpStatusCode.OK_200) {
   const path = '/api/v1/config/custom'
 
   return makeGetRequest({
@@ -34,7 +34,7 @@ function getCustomConfig (url: string, token: string, statusCodeExpected = 200)
   })
 }
 
-function updateCustomConfig (url: string, token: string, newCustomConfig: CustomConfig, statusCodeExpected = 200) {
+function updateCustomConfig (url: string, token: string, newCustomConfig: CustomConfig, statusCodeExpected = HttpStatusCode.OK_200) {
   const path = '/api/v1/config/custom'
 
   return makePutBodyRequest({
@@ -117,6 +117,7 @@ function updateCustomSubConfig (url: string, token: string, newConfig: DeepParti
         '480p': true,
         '720p': false,
         '1080p': false,
+        '1440p': false,
         '2160p': false
       },
       webtorrent: {
@@ -126,6 +127,26 @@ function updateCustomSubConfig (url: string, token: string, newConfig: DeepParti
         enabled: false
       }
     },
+    live: {
+      enabled: true,
+      allowReplay: false,
+      maxDuration: -1,
+      maxInstanceLives: -1,
+      maxUserLives: 50,
+      transcoding: {
+        enabled: true,
+        threads: 4,
+        resolutions: {
+          '240p': true,
+          '360p': true,
+          '480p': true,
+          '720p': true,
+          '1080p': true,
+          '1440p': true,
+          '2160p': true
+        }
+      }
+    },
     import: {
       videos: {
         http: {
@@ -155,10 +176,28 @@ function updateCustomSubConfig (url: string, token: string, newConfig: DeepParti
           enabled: false
         },
         autoFollowIndex: {
-          indexUrl: 'https://instances.joinpeertube.org',
+          indexUrl: 'https://instances.joinpeertube.org/api/v1/instances/hosts',
           enabled: false
         }
       }
+    },
+    broadcastMessage: {
+      enabled: true,
+      level: 'warning',
+      message: 'hello',
+      dismissable: true
+    },
+    search: {
+      remoteUri: {
+        users: true,
+        anonymous: true
+      },
+      searchIndex: {
+        enabled: true,
+        url: 'https://search.joinpeertube.org',
+        disableLocalSearch: true,
+        isDefaultSearch: true
+      }
     }
   }
 
@@ -167,7 +206,7 @@ function updateCustomSubConfig (url: string, token: string, newConfig: DeepParti
   return updateCustomConfig(url, token, updateParams)
 }
 
-function deleteCustomConfig (url: string, token: string, statusCodeExpected = 200) {
+function deleteCustomConfig (url: string, token: string, statusCodeExpected = HttpStatusCode.OK_200) {
   const path = '/api/v1/config/custom'
 
   return makeDeleteRequest({