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 {
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>()
css: ''
}
},
+ search: {
+ remoteUri: {
+ users: true,
+ anonymous: false
+ }
+ },
plugin: {
registered: []
},
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()
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',