aboutsummaryrefslogtreecommitdiffhomepage
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html17
-rw-r--r--client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts6
-rw-r--r--client/src/app/header/header.component.html2
-rw-r--r--client/src/app/header/header.component.ts31
-rw-r--r--client/src/app/login/login.component.html21
-rw-r--r--client/src/app/login/login.component.ts8
-rw-r--r--client/src/app/shared/forms/markdown-textarea.component.html2
-rw-r--r--client/src/app/shared/forms/markdown-textarea.component.ts1
8 files changed, 23 insertions, 65 deletions
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html
index f61593677..e5340234b 100644
--- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html
+++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html
@@ -30,7 +30,7 @@
30 <div class="form-group"> 30 <div class="form-group">
31 <label i18n for="instanceDescription">Description</label><my-help helpType="markdownText"></my-help> 31 <label i18n for="instanceDescription">Description</label><my-help helpType="markdownText"></my-help>
32 <my-markdown-textarea 32 <my-markdown-textarea
33 id="instanceDescription" formControlName="description" textareaWidth="500px" [previewColumn]="true" 33 name="instanceDescription" formControlName="description" textareaWidth="500px" [previewColumn]="true"
34 [classes]="{ 'input-error': formErrors['instance.description'] }" 34 [classes]="{ 'input-error': formErrors['instance.description'] }"
35 ></my-markdown-textarea> 35 ></my-markdown-textarea>
36 <div *ngIf="formErrors.instance.description" class="form-error">{{ formErrors.instance.description }}</div> 36 <div *ngIf="formErrors.instance.description" class="form-error">{{ formErrors.instance.description }}</div>
@@ -101,7 +101,7 @@
101 <div class="form-group"> 101 <div class="form-group">
102 <label i18n for="instanceTerms">Terms</label><my-help helpType="markdownText"></my-help> 102 <label i18n for="instanceTerms">Terms</label><my-help helpType="markdownText"></my-help>
103 <my-markdown-textarea 103 <my-markdown-textarea
104 id="instanceTerms" formControlName="terms" textareaWidth="500px" [previewColumn]="true" 104 name="instanceTerms" formControlName="terms" textareaWidth="500px" [previewColumn]="true"
105 [ngClass]="{ 'input-error': formErrors['instance.terms'] }" 105 [ngClass]="{ 'input-error': formErrors['instance.terms'] }"
106 ></my-markdown-textarea> 106 ></my-markdown-textarea>
107 <div *ngIf="formErrors.instance.terms" class="form-error">{{ formErrors.instance.terms }}</div> 107 <div *ngIf="formErrors.instance.terms" class="form-error">{{ formErrors.instance.terms }}</div>
@@ -110,7 +110,7 @@
110 <div class="form-group"> 110 <div class="form-group">
111 <label i18n for="instanceCodeOfConduct">Code of conduct</label><my-help helpType="markdownText"></my-help> 111 <label i18n for="instanceCodeOfConduct">Code of conduct</label><my-help helpType="markdownText"></my-help>
112 <my-markdown-textarea 112 <my-markdown-textarea
113 id="instanceCodeOfConduct" formControlName="codeOfConduct" textareaWidth="500px" [previewColumn]="true" 113 name="instanceCodeOfConduct" formControlName="codeOfConduct" textareaWidth="500px" [previewColumn]="true"
114 [ngClass]="{ 'input-error': formErrors['instance.codeOfConduct'] }" 114 [ngClass]="{ 'input-error': formErrors['instance.codeOfConduct'] }"
115 ></my-markdown-textarea> 115 ></my-markdown-textarea>
116 <div *ngIf="formErrors.instance.codeOfConduct" class="form-error">{{ formErrors.instance.codeOfConduct }}</div> 116 <div *ngIf="formErrors.instance.codeOfConduct" class="form-error">{{ formErrors.instance.codeOfConduct }}</div>
@@ -121,7 +121,7 @@
121 <div class="label-small-info">Who moderates the instance? What is the policy regarding NSFW videos? Political videos? etc</div> 121 <div class="label-small-info">Who moderates the instance? What is the policy regarding NSFW videos? Political videos? etc</div>
122 122
123 <my-markdown-textarea 123 <my-markdown-textarea
124 id="instanceModerationInformation" formControlName="moderationInformation" textareaWidth="500px" [previewColumn]="true" 124 name="instanceModerationInformation" formControlName="moderationInformation" textareaWidth="500px" [previewColumn]="true"
125 [ngClass]="{ 'input-error': formErrors['instance.moderationInformation'] }" 125 [ngClass]="{ 'input-error': formErrors['instance.moderationInformation'] }"
126 ></my-markdown-textarea> 126 ></my-markdown-textarea>
127 <div *ngIf="formErrors.instance.moderationInformation" class="form-error">{{ formErrors.instance.moderationInformation }}</div> 127 <div *ngIf="formErrors.instance.moderationInformation" class="form-error">{{ formErrors.instance.moderationInformation }}</div>
@@ -134,7 +134,7 @@
134 <div class="label-small-info">A single person? A non-profit? A company?</div> 134 <div class="label-small-info">A single person? A non-profit? A company?</div>
135 135
136 <my-markdown-textarea 136 <my-markdown-textarea
137 id="instanceAdministrator" formControlName="administrator" textareaWidth="500px" textareaHeight="75px" [previewColumn]="true" 137 name="instanceAdministrator" formControlName="administrator" textareaWidth="500px" textareaHeight="75px" [previewColumn]="true"
138 [classes]="{ 'input-error': formErrors['instance.administrator'] }" 138 [classes]="{ 'input-error': formErrors['instance.administrator'] }"
139 ></my-markdown-textarea> 139 ></my-markdown-textarea>
140 140
@@ -181,7 +181,7 @@
181 <div class="label-small-info">2vCore 2GB RAM/or directly the link to the server you rent etc</div> 181 <div class="label-small-info">2vCore 2GB RAM/or directly the link to the server you rent etc</div>
182 182
183 <my-markdown-textarea 183 <my-markdown-textarea
184 id="instanceHardwareInformation" formControlName="hardwareInformation" textareaWidth="500px" textareaHeight="75px" [previewColumn]="true" 184 name="instanceHardwareInformation" formControlName="hardwareInformation" textareaWidth="500px" textareaHeight="75px" [previewColumn]="true"
185 [classes]="{ 'input-error': formErrors['instance.hardwareInformation'] }" 185 [classes]="{ 'input-error': formErrors['instance.hardwareInformation'] }"
186 ></my-markdown-textarea> 186 ></my-markdown-textarea>
187 187
@@ -239,7 +239,7 @@
239 inputName="signupRequiresEmailVerification" formControlName="requiresEmailVerification" 239 inputName="signupRequiresEmailVerification" formControlName="requiresEmailVerification"
240 i18n-labelText labelText="Signup requires email verification" 240 i18n-labelText labelText="Signup requires email verification"
241 ></my-peertube-checkbox> 241 ></my-peertube-checkbox>
242 242
243 <div [ngClass]="{ 'disabled-checkbox-extra': !isSignupEnabled() }" class="mt-3"> 243 <div [ngClass]="{ 'disabled-checkbox-extra': !isSignupEnabled() }" class="mt-3">
244 <label i18n for="signupLimit">Signup limit</label> 244 <label i18n for="signupLimit">Signup limit</label>
245 <input 245 <input
@@ -372,14 +372,13 @@
372 <my-peertube-checkbox 372 <my-peertube-checkbox
373 inputName="followingsInstanceAutoFollowIndexEnabled" formControlName="enabled" 373 inputName="followingsInstanceAutoFollowIndexEnabled" formControlName="enabled"
374 i18n-labelText labelText="Automatically follow instances of the public index" 374 i18n-labelText labelText="Automatically follow instances of the public index"
375 [(ngModel)]="isAutoFollowIndexEnabled"
376 > 375 >
377 <ng-container ngProjectAs="description"> 376 <ng-container ngProjectAs="description">
378 <span i18n>⚠️ This functionality requires a lot of attention and extra moderation.</span> 377 <span i18n>⚠️ This functionality requires a lot of attention and extra moderation.</span>
379 </ng-container> 378 </ng-container>
380 379
381 <ng-container ngProjectAs="extra"> 380 <ng-container ngProjectAs="extra">
382 <div [ngClass]="{ 'disabled-checkbox-extra': !isAutoFollowIndexEnabled }"> 381 <div [ngClass]="{ 'disabled-checkbox-extra': !isAutoFollowIndexEnabled() }">
383 <label i18n for="followingsInstanceAutoFollowIndexUrl">Index URL</label> 382 <label i18n for="followingsInstanceAutoFollowIndexUrl">Index URL</label>
384 <input 383 <input
385 type="text" id="followingsInstanceAutoFollowIndexUrl" 384 type="text" id="followingsInstanceAutoFollowIndexUrl"
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts
index 1bc907b73..c88e81c01 100644
--- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts
+++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts
@@ -24,8 +24,6 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
24 languageItems: SelectItem[] = [] 24 languageItems: SelectItem[] = []
25 categoryItems: SelectItem[] = [] 25 categoryItems: SelectItem[] = []
26 26
27 isAutoFollowIndexEnabled = false
28
29 private serverConfig: ServerConfig 27 private serverConfig: ServerConfig
30 28
31 constructor ( 29 constructor (
@@ -236,6 +234,10 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
236 return this.form.value['signup']['enabled'] === true 234 return this.form.value['signup']['enabled'] === true
237 } 235 }
238 236
237 isAutoFollowIndexEnabled () {
238 return this.form.value['followings']['instance']['autoFollowIndex']['enabled'] === true
239 }
240
239 async formValidated () { 241 async formValidated () {
240 this.configService.updateCustomConfig(this.form.getRawValue()) 242 this.configService.updateCustomConfig(this.form.getRawValue())
241 .subscribe( 243 .subscribe(
diff --git a/client/src/app/header/header.component.html b/client/src/app/header/header.component.html
index 1bdfe9858..4fd18f9bd 100644
--- a/client/src/app/header/header.component.html
+++ b/client/src/app/header/header.component.html
@@ -4,7 +4,7 @@
4> 4>
5<span (click)="doSearch()" class="icon icon-search"></span> 5<span (click)="doSearch()" class="icon icon-search"></span>
6 6
7<a class="upload-button" [routerLink]="routerLink"> 7<a class="upload-button" routerLink="/videos/upload">
8 <my-global-icon iconName="upload"></my-global-icon> 8 <my-global-icon iconName="upload"></my-global-icon>
9 <span i18n class="upload-button-label">Upload</span> 9 <span i18n class="upload-button-label">Upload</span>
10</a> 10</a>
diff --git a/client/src/app/header/header.component.ts b/client/src/app/header/header.component.ts
index 5fd122930..92a7eded6 100644
--- a/client/src/app/header/header.component.ts
+++ b/client/src/app/header/header.component.ts
@@ -2,9 +2,8 @@ import { filter, first, map, tap } from 'rxjs/operators'
2import { Component, OnInit } from '@angular/core' 2import { Component, OnInit } from '@angular/core'
3import { ActivatedRoute, NavigationEnd, Params, Router } from '@angular/router' 3import { ActivatedRoute, NavigationEnd, Params, Router } from '@angular/router'
4import { getParameterByName } from '../shared/misc/utils' 4import { getParameterByName } from '../shared/misc/utils'
5import { AuthService, ServerService, Notifier } from '@app/core' 5import { AuthService, Notifier, ServerService } from '@app/core'
6import { of } from 'rxjs' 6import { of } from 'rxjs'
7import { ServerConfig } from '@shared/models'
8import { I18n } from '@ngx-translate/i18n-polyfill' 7import { I18n } from '@ngx-translate/i18n-polyfill'
9 8
10@Component({ 9@Component({
@@ -17,8 +16,6 @@ export class HeaderComponent implements OnInit {
17 searchValue = '' 16 searchValue = ''
18 ariaLabelTextForSearch = '' 17 ariaLabelTextForSearch = ''
19 18
20 private serverConfig: ServerConfig
21
22 constructor ( 19 constructor (
23 private router: Router, 20 private router: Router,
24 private route: ActivatedRoute, 21 private route: ActivatedRoute,
@@ -38,23 +35,6 @@ export class HeaderComponent implements OnInit {
38 map(() => getParameterByName('search', window.location.href)) 35 map(() => getParameterByName('search', window.location.href))
39 ) 36 )
40 .subscribe(searchQuery => this.searchValue = searchQuery || '') 37 .subscribe(searchQuery => this.searchValue = searchQuery || '')
41
42 this.serverConfig = this.serverService.getTmpConfig()
43 this.serverService.getConfig().subscribe(
44 config => this.serverConfig = config,
45
46 err => this.notifier.error(err.message)
47 )
48 }
49
50 get routerLink () {
51 if (this.isUserLoggedIn()) {
52 return [ '/videos/upload' ]
53 } else if (this.isRegistrationAllowed()) {
54 return [ '/signup' ]
55 } else {
56 return [ '/login', { fromUpload: true } ]
57 }
58 } 38 }
59 39
60 doSearch () { 40 doSearch () {
@@ -73,15 +53,6 @@ export class HeaderComponent implements OnInit {
73 o.subscribe(() => this.router.navigate([ '/search' ], { queryParams })) 53 o.subscribe(() => this.router.navigate([ '/search' ], { queryParams }))
74 } 54 }
75 55
76 isUserLoggedIn () {
77 return this.authService.isLoggedIn()
78 }
79
80 isRegistrationAllowed () {
81 return this.serverConfig.signup.allowed &&
82 this.serverConfig.signup.allowedForCurrentIP
83 }
84
85 private loadUserLanguagesIfNeeded (queryParams: any) { 56 private loadUserLanguagesIfNeeded (queryParams: any) {
86 if (queryParams && queryParams.languageOneOf) return of(queryParams) 57 if (queryParams && queryParams.languageOneOf) return of(queryParams)
87 58
diff --git a/client/src/app/login/login.component.html b/client/src/app/login/login.component.html
index 6c6a41c4a..0b0bacff0 100644
--- a/client/src/app/login/login.component.html
+++ b/client/src/app/login/login.component.html
@@ -3,15 +3,18 @@
3 Login 3 Login
4 </div> 4 </div>
5 5
6 <div class="alert alert-warning" *ngIf="from.upload" role="alert"> 6 <div class="alert alert-info" *ngIf="signupAllowed === false" role="alert">
7 <h6 class="alert-heading" i18n> 7 <h6 class="alert-heading" i18n>
8 If you are looking for an account… 8 If you are looking for an account…
9 </h6> 9 </h6>
10
10 <div i18n> 11 <div i18n>
11 Currently this instance doesn't allow for user registration, but you can find an instance 12 Currently this instance doesn't allow for user registration, but you can find an instance
12 that gives you the possibility to sign up for an account and upload your videos there. 13 that gives you the possibility to sign up for an account and upload your videos there.
13 Find yours among multiple instances at <a class="alert-link" [href]="instancesIndexUrl" target="_blank" rel="noopener noreferrer">{{ instancesIndexUrl }}</a> 14
14 , a directory of instances recommended by this instance. 15 <br />
16
17 Find yours among multiple instances at <a class="alert-link" href="https://joinpeertube.org/instances" target="_blank" rel="noopener noreferrer">https://joinpeertube.org/instances</a>.
15 </div> 18 </div>
16 </div> 19 </div>
17 20
@@ -30,16 +33,6 @@
30 <a i18n *ngIf="signupAllowed === true" routerLink="/signup" class="create-an-account"> 33 <a i18n *ngIf="signupAllowed === true" routerLink="/signup" class="create-an-account">
31 or create an account 34 or create an account
32 </a> 35 </a>
33
34 <a i18n *ngIf="signupAllowed === false" href="https://joinpeertube.org/instances#instances-list" target="_blank" title="Click here to see a list of instances where to register" class="create-an-account">
35 or create an account on another instance
36 </a>
37
38 <my-help *ngIf="signupAllowed === false">
39 <ng-template ptTemplate="customHtml">
40 <ng-container i18n>User registration is not allowed on this instance, but you can register on many others!</ng-container>
41 </ng-template>
42 </my-help>
43 </div> 36 </div>
44 37
45 <div *ngIf="formErrors.username" class="form-error"> 38 <div *ngIf="formErrors.username" class="form-error">
diff --git a/client/src/app/login/login.component.ts b/client/src/app/login/login.component.ts
index 1394d6b58..580f28822 100644
--- a/client/src/app/login/login.component.ts
+++ b/client/src/app/login/login.component.ts
@@ -22,9 +22,6 @@ export class LoginComponent extends FormReactive implements OnInit {
22 22
23 error: string = null 23 error: string = null
24 forgotPasswordEmail = '' 24 forgotPasswordEmail = ''
25 from = {
26 upload: false
27 }
28 25
29 private openedForgotPasswordModal: NgbModalRef 26 private openedForgotPasswordModal: NgbModalRef
30 private serverConfig: ServerConfig 27 private serverConfig: ServerConfig
@@ -47,17 +44,12 @@ export class LoginComponent extends FormReactive implements OnInit {
47 return this.serverConfig.signup.allowed === true 44 return this.serverConfig.signup.allowed === true
48 } 45 }
49 46
50 get instancesIndexUrl () {
51 return this.serverConfig.followings.instance.autoFollowIndex.indexUrl || 'https://instances.joinpeertube.org'
52 }
53
54 isEmailDisabled () { 47 isEmailDisabled () {
55 return this.serverConfig.email.enabled === false 48 return this.serverConfig.email.enabled === false
56 } 49 }
57 50
58 ngOnInit () { 51 ngOnInit () {
59 this.serverConfig = this.route.snapshot.data.serverConfig 52 this.serverConfig = this.route.snapshot.data.serverConfig
60 this.from.upload = Boolean(this.route.snapshot.paramMap.get('fromUpload'))
61 53
62 this.buildForm({ 54 this.buildForm({
63 username: this.loginValidatorsService.LOGIN_USERNAME, 55 username: this.loginValidatorsService.LOGIN_USERNAME,
diff --git a/client/src/app/shared/forms/markdown-textarea.component.html b/client/src/app/shared/forms/markdown-textarea.component.html
index 3de3b6fcd..0925b9ad5 100644
--- a/client/src/app/shared/forms/markdown-textarea.component.html
+++ b/client/src/app/shared/forms/markdown-textarea.component.html
@@ -2,7 +2,7 @@
2 <textarea 2 <textarea
3 [(ngModel)]="content" (ngModelChange)="onModelChange()" 3 [(ngModel)]="content" (ngModelChange)="onModelChange()"
4 [ngClass]="classes" [ngStyle]="{ width: textareaWidth, height: textareaHeight, 'margin-right': textareaMarginRight }" 4 [ngClass]="classes" [ngStyle]="{ width: textareaWidth, height: textareaHeight, 'margin-right': textareaMarginRight }"
5 id="description" name="description"> 5 [id]="name" [name]="name">
6 </textarea> 6 </textarea>
7 7
8 <ngb-tabset *ngIf="arePreviewsDisplayed()" class="previews" type="pills"> 8 <ngb-tabset *ngIf="arePreviewsDisplayed()" class="previews" type="pills">
diff --git a/client/src/app/shared/forms/markdown-textarea.component.ts b/client/src/app/shared/forms/markdown-textarea.component.ts
index 0c5788899..19cd37573 100644
--- a/client/src/app/shared/forms/markdown-textarea.component.ts
+++ b/client/src/app/shared/forms/markdown-textarea.component.ts
@@ -28,6 +28,7 @@ export class MarkdownTextareaComponent implements ControlValueAccessor, OnInit {
28 @Input() truncate: number 28 @Input() truncate: number
29 @Input() markdownType: 'text' | 'enhanced' = 'text' 29 @Input() markdownType: 'text' | 'enhanced' = 'text'
30 @Input() markdownVideo = false 30 @Input() markdownVideo = false
31 @Input() name = 'description'
31 32
32 textareaMarginRight = '0' 33 textareaMarginRight = '0'
33 flexDirection = 'column' 34 flexDirection = 'column'