]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/core/server/server.service.ts
Normalize modal close buttons, and cancel/submit button styles
[github/Chocobozzz/PeerTube.git] / client / src / app / core / server / server.service.ts
index cdcbcb528ec8931ffb677e3e6f9b2525b28aadd8..e015d0e1430d9e7f9727dd5c70f595804602e1f9 100644 (file)
@@ -9,6 +9,7 @@ import { VideoConstant } from '../../../../../shared/models/videos'
 import { isDefaultLocale, peertubeTranslate } from '../../../../../shared/models/i18n'
 import { getDevLocale, isOnDevLocale } from '@app/shared/i18n/i18n-utils'
 import { sortBy } from '@app/shared/misc/utils'
+import { ServerStats } from '@shared/models/server'
 
 @Injectable()
 export class ServerService {
@@ -16,6 +17,8 @@ export class ServerService {
   private static BASE_VIDEO_URL = environment.apiUrl + '/api/v1/videos/'
   private static BASE_VIDEO_PLAYLIST_URL = environment.apiUrl + '/api/v1/video-playlists/'
   private static BASE_LOCALE_URL = environment.apiUrl + '/client/locales/'
+  private static BASE_STATS_URL = environment.apiUrl + '/api/v1/server/stats'
+
   private static CONFIG_LOCAL_STORAGE_KEY = 'server-config'
 
   configReloaded = new Subject<void>()
@@ -44,6 +47,12 @@ export class ServerService {
         css: ''
       }
     },
+    search: {
+      remoteUri: {
+        users: true,
+        anonymous: false
+      }
+    },
     plugin: {
       registered: []
     },
@@ -159,8 +168,11 @@ export class ServerService {
     if (!this.configObservable) {
       this.configObservable = this.http.get<ServerConfig>(ServerService.BASE_CONFIG_URL)
                                   .pipe(
-                                    tap(this.saveConfigLocally),
-                                    tap(() => this.configLoaded = true),
+                                    tap(config => this.saveConfigLocally(config)),
+                                    tap(config => {
+                                      this.config = config
+                                      this.configLoaded = true
+                                    }),
                                     tap(() => {
                                       if (this.configReset) {
                                         this.configReloaded.next()
@@ -235,6 +247,10 @@ export class ServerService {
     return this.localeObservable.pipe(first())
   }
 
+  getServerStats () {
+    return this.http.get<ServerStats>(ServerService.BASE_STATS_URL)
+  }
+
   private loadAttributeEnum <T extends string | number> (
     baseUrl: string,
     attributeName: 'categories' | 'licences' | 'languages' | 'privacies',