X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fcore%2Fserver%2Fserver.service.ts;h=f33e6f20ce9648ce0d771ff08fbc5804c9e722cd;hb=d3e56c0c4b307c99e83fbafb7f2c5884cbc20055;hp=a1ce120698534a5af1db528869ea93c252f2fa35;hpb=bee0abffff73804d816b90c7fd599e0a51c09d61;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/core/server/server.service.ts b/client/src/app/core/server/server.service.ts index a1ce12069..f33e6f20c 100644 --- a/client/src/app/core/server/server.service.ts +++ b/client/src/app/core/server/server.service.ts @@ -6,13 +6,14 @@ import { Observable, of, ReplaySubject } from 'rxjs' import { getCompleteLocale, ServerConfig } from '../../../../../shared' import { About } from '../../../../../shared/models/server/about.model' import { environment } from '../../../environments/environment' -import { VideoConstant } from '../../../../../shared/models/videos' +import { VideoConstant, VideoPrivacy } 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' @Injectable() export class ServerService { + private static BASE_SERVER_URL = environment.apiUrl + '/api/v1/server/' private static BASE_CONFIG_URL = environment.apiUrl + '/api/v1/config/' private static BASE_VIDEO_URL = environment.apiUrl + '/api/v1/videos/' private static BASE_LOCALE_URL = environment.apiUrl + '/client/locales/' @@ -37,10 +38,17 @@ export class ServerService { css: '' } }, + email: { + enabled: false + }, + contactForm: { + enabled: false + }, serverVersion: 'Unknown', signup: { allowed: false, - allowedForCurrentIP: false + allowedForCurrentIP: false, + requiresEmailVerification: false }, transcoding: { enabledResolutions: [] @@ -81,10 +89,10 @@ export class ServerService { } } } - private videoCategories: Array> = [] - private videoLicences: Array> = [] + private videoCategories: Array> = [] + private videoLicences: Array> = [] private videoLanguages: Array> = [] - private videoPrivacies: Array> = [] + private videoPrivacies: Array> = [] constructor ( private http: HttpClient, @@ -140,20 +148,16 @@ export class ServerService { return this.videoPrivacies } - getAbout () { - return this.http.get(ServerService.BASE_CONFIG_URL + '/about') - } - private loadVideoAttributeEnum ( attributeName: 'categories' | 'licences' | 'languages' | 'privacies', - hashToPopulate: VideoConstant[], + hashToPopulate: VideoConstant[], notifier: ReplaySubject, sort = false ) { this.localeObservable .pipe( switchMap(translations => { - return this.http.get(ServerService.BASE_VIDEO_URL + attributeName) + return this.http.get<{ [id: string]: string }>(ServerService.BASE_VIDEO_URL + attributeName) .pipe(map(data => ({ data, translations }))) }) ) @@ -163,7 +167,7 @@ export class ServerService { const label = data[ dataKey ] hashToPopulate.push({ - id: dataKey, + id: attributeName === 'languages' ? dataKey : parseInt(dataKey, 10), label: peertubeTranslate(label, translations) }) })