>
<span (click)="doSearch()" class="icon icon-search"></span>
-<a class="upload-button" [routerLink]="routerLink">
+<a class="upload-button" routerLink="/videos/upload">
<my-global-icon iconName="upload"></my-global-icon>
<span i18n class="upload-button-label">Upload</span>
</a>
import { Component, OnInit } from '@angular/core'
import { ActivatedRoute, NavigationEnd, Params, Router } from '@angular/router'
import { getParameterByName } from '../shared/misc/utils'
-import { AuthService, ServerService, Notifier } from '@app/core'
+import { AuthService, Notifier, ServerService } from '@app/core'
import { of } from 'rxjs'
-import { ServerConfig } from '@shared/models'
import { I18n } from '@ngx-translate/i18n-polyfill'
@Component({
searchValue = ''
ariaLabelTextForSearch = ''
- private serverConfig: ServerConfig
-
constructor (
private router: Router,
private route: ActivatedRoute,
map(() => getParameterByName('search', window.location.href))
)
.subscribe(searchQuery => this.searchValue = searchQuery || '')
-
- this.serverConfig = this.serverService.getTmpConfig()
- this.serverService.getConfig().subscribe(
- config => this.serverConfig = config,
-
- err => this.notifier.error(err.message)
- )
- }
-
- get routerLink () {
- if (this.isUserLoggedIn()) {
- return [ '/videos/upload' ]
- } else if (this.isRegistrationAllowed()) {
- return [ '/signup' ]
- } else {
- return [ '/login', { fromUpload: true } ]
- }
}
doSearch () {
o.subscribe(() => this.router.navigate([ '/search' ], { queryParams }))
}
- isUserLoggedIn () {
- return this.authService.isLoggedIn()
- }
-
- isRegistrationAllowed () {
- return this.serverConfig.signup.allowed &&
- this.serverConfig.signup.allowedForCurrentIP
- }
-
private loadUserLanguagesIfNeeded (queryParams: any) {
if (queryParams && queryParams.languageOneOf) return of(queryParams)
Login
</div>
- <div class="alert alert-warning" *ngIf="from.upload" role="alert">
+ <div class="alert alert-info" *ngIf="signupAllowed === false" role="alert">
<h6 class="alert-heading" i18n>
If you are looking for an account…
</h6>
+
<div i18n>
- Currently this instance doesn't allow for user registration, but you can find an instance
+ Currently this instance doesn't allow for user registration, but you can find an instance
that gives you the possibility to sign up for an account and upload your videos there.
- Find yours among multiple instances at <a class="alert-link" [href]="instancesIndexUrl" target="_blank" rel="noopener noreferrer">{{ instancesIndexUrl }}</a>
- , a directory of instances recommended by this instance.
+
+ <br />
+
+ 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>.
</div>
</div>
<a i18n *ngIf="signupAllowed === true" routerLink="/signup" class="create-an-account">
or create an account
</a>
-
- <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">
- or create an account on another instance
- </a>
-
- <my-help *ngIf="signupAllowed === false">
- <ng-template ptTemplate="customHtml">
- <ng-container i18n>User registration is not allowed on this instance, but you can register on many others!</ng-container>
- </ng-template>
- </my-help>
</div>
<div *ngIf="formErrors.username" class="form-error">
error: string = null
forgotPasswordEmail = ''
- from = {
- upload: false
- }
private openedForgotPasswordModal: NgbModalRef
private serverConfig: ServerConfig
return this.serverConfig.signup.allowed === true
}
- get instancesIndexUrl () {
- return this.serverConfig.followings.instance.autoFollowIndex.indexUrl || 'https://instances.joinpeertube.org'
- }
-
isEmailDisabled () {
return this.serverConfig.email.enabled === false
}
ngOnInit () {
this.serverConfig = this.route.snapshot.data.serverConfig
- this.from.upload = Boolean(this.route.snapshot.paramMap.get('fromUpload'))
this.buildForm({
username: this.loginValidatorsService.LOGIN_USERNAME,