</ng-container>
</div>
+ <ng-container formGroupName="client">
+
+ <ng-container formGroupName="videos">
+ <ng-container formGroupName="miniature">
+ <div class="form-group">
+ <my-peertube-checkbox
+ inputName="clientVideosMiniaturePreferAuthorDisplayName" formControlName="preferAuthorDisplayName"
+ i18n-labelText labelText="Prefer author display name in video miniature"
+ ></my-peertube-checkbox>
+ </div>
+ </ng-container>
+ </ng-container>
+
+ <ng-container formGroupName="menu">
+ <ng-container formGroupName="login">
+ <div class="form-group">
+ <my-peertube-checkbox
+ inputName="clientMenuLoginRedirectOnSingleExternalAuth" formControlName="redirectOnSingleExternalAuth"
+ i18n-labelText labelText="Redirect users on single external auth when users click on the login button in menu"
+ >
+ <ng-container ngProjectAs="description">
+ <span *ngIf="countExternalAuth() === 0" i18n>⚠️ You don't have any external auth plugin enabled.</span>
+ <span *ngIf="countExternalAuth() > 1" i18n>⚠️ You have multiple external auth plugins enabled.</span>
+ </ng-container>
+ </my-peertube-checkbox>
+ </div>
+ </ng-container>
+ </ng-container>
+ </ng-container>
+
</div>
</div>
<div class="form-group col-12 col-lg-4 col-xl-3">
<div i18n class="inner-form-title">VIDEO CHANNELS</div>
</div>
-
+
<div class="form-group form-group-right col-12 col-lg-8 col-xl-9">
<div class="form-group" formGroupName="videoChannels">
<label i18n for="videoChannelsMaxPerUser">Max video channels per user</label>
}
}
+ countExternalAuth () {
+ return this.serverConfig.plugin.registeredExternalAuths.length
+ }
+
getVideoQuotaOptions () {
return this.configService.videoQuotaOptions
}
whitelisted: null
}
},
+ client: {
+ videos: {
+ miniature: {
+ preferAuthorDisplayName: null
+ }
+ },
+ menu: {
+ login: {
+ redirectOnSingleExternalAuth: null
+ }
+ }
+ },
cache: {
previews: {
size: CACHE_PREVIEWS_SIZE_VALIDATOR
-import { environment } from 'src/environments/environment'
+
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core'
import { ActivatedRoute } from '@angular/router'
import { AuthService, Notifier, RedirectService, UserService } from '@app/core'
import { FormReactive, FormValidatorService } from '@app/shared/shared-forms'
import { InstanceAboutAccordionComponent } from '@app/shared/shared-instance'
import { NgbAccordion, NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'
+import { PluginsManager } from '@root-helpers/plugins-manager'
import { RegisteredExternalAuthConfig, ServerConfig } from '@shared/models'
@Component({
}
getAuthHref (auth: RegisteredExternalAuthConfig) {
- return environment.apiUrl + `/plugins/${auth.name}/${auth.version}/auth/${auth.authName}`
+ return PluginsManager.getExternalAuthHref(auth)
}
login () {
</div>
<div *ngIf="!isLoggedIn" class="login-buttons-block">
- <a i18n routerLink="/login" class="peertube-button-link orange-button">Login</a>
+ <a i18n *ngIf="!getExternalLoginHref()" routerLink="/login" class="peertube-button-link orange-button">Login</a>
+ <a i18n *ngIf="getExternalLoginHref()" [href]="getExternalLoginHref()" class="peertube-button-link orange-button">Login</a>
+
<a i18n *ngIf="isRegistrationAllowed()" routerLink="/signup" class="peertube-button-link create-account-button">Create an account</a>
</div>
import { QuickSettingsModalComponent } from '@app/modal/quick-settings-modal.component'
import { PeertubeModalService } from '@app/shared/shared-main/peertube-modal/peertube-modal.service'
import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap'
+import { PluginsManager } from '@root-helpers/plugins-manager'
import { HTMLServerConfig, ServerConfig, UserRight, VideoConstant } from '@shared/models'
const logger = debug('peertube:menu:MenuComponent')
.subscribe(() => this.openQuickSettings())
}
+ getExternalLoginHref () {
+ if (this.serverConfig.client.menu.login.redirectOnSingleExternalAuth !== true) return undefined
+
+ const externalAuths = this.serverConfig.plugin.registeredExternalAuths
+ if (externalAuths.length !== 1) return undefined
+
+ return PluginsManager.getExternalAuthHref(externalAuths[0])
+ }
+
isRegistrationAllowed () {
if (!this.serverConfig) return false
RegisterClientHookOptions,
RegisterClientSettingsScript,
RegisterClientVideoFieldOptions,
+ RegisteredExternalAuthConfig,
ServerConfigPlugin
} from '../../../shared/models'
import { environment } from '../environments/environment'
return isTheme ? '/themes' : '/plugins'
}
+ static getExternalAuthHref (auth: RegisteredExternalAuthConfig) {
+ return environment.apiUrl + `/plugins/${auth.name}/${auth.version}/auth/${auth.authName}`
+
+ }
+
loadPluginsList (config: HTMLServerConfig) {
for (const plugin of config.plugin.registered) {
this.addPlugin(plugin)
# By default PeerTube client displays author username
prefer_author_display_name: false
+ menu:
+ login:
+ # If you enable only one external auth plugin
+ # You can automatically redirect your users on this external platform when they click on the login button
+ redirect_on_single_external_auth: false
+
# From the project root directory
storage:
tmp: 'storage/tmp/' # Use to download data (imports etc), store uploaded files before and during processing...
# By default PeerTube client displays author username
prefer_author_display_name: false
+ menu:
+ login:
+ # If you enable only one external auth plugin
+ # You can automatically redirect your users on this external platform when they click on the login button
+ redirect_on_single_external_auth: false
+
# From the project root directory
storage:
tmp: '/var/www/peertube/storage/tmp/' # Use to download data (imports etc), store uploaded files before and during processing...
whitelisted: CONFIG.SERVICES.TWITTER.WHITELISTED
}
},
+ client: {
+ videos: {
+ miniature: {
+ preferAuthorDisplayName: CONFIG.CLIENT.VIDEOS.MINIATURE.PREFER_AUTHOR_DISPLAY_NAME
+ }
+ },
+ menu: {
+ login: {
+ redirectOnSingleExternalAuth: CONFIG.CLIENT.MENU.LOGIN.REDIRECT_ON_SINGLE_EXTERNAL_AUTH
+ }
+ }
+ },
cache: {
previews: {
size: CONFIG.CACHE.PREVIEWS.SIZE
'transcoding.resolutions.2160p',
'import.videos.http.enabled', 'import.videos.torrent.enabled', 'import.videos.concurrency', 'auto_blacklist.videos.of_users.enabled',
'trending.videos.interval_days',
+ 'client.videos.miniature.prefer_author_display_name', 'client.menu.login.redirect_on_single_external_auth',
'instance.name', 'instance.short_description', 'instance.description', 'instance.terms', 'instance.default_client_route',
'instance.is_nsfw', 'instance.default_nsfw_policy', 'instance.robots', 'instance.securitytxt',
'services.twitter.username', 'services.twitter.whitelisted',
MINIATURE: {
get PREFER_AUTHOR_DISPLAY_NAME () { return config.get<boolean>('client.videos.miniature.prefer_author_display_name') }
}
+ },
+ MENU: {
+ LOGIN: {
+ get REDIRECT_ON_SINGLE_EXTERNAL_AUTH () { return config.get<boolean>('client.menu.login.redirect_on_single_external_auth') }
+ }
}
},
miniature: {
preferAuthorDisplayName: CONFIG.CLIENT.VIDEOS.MINIATURE.PREFER_AUTHOR_DISPLAY_NAME
}
+ },
+ menu: {
+ login: {
+ redirectOnSingleExternalAuth: CONFIG.CLIENT.MENU.LOGIN.REDIRECT_ON_SINGLE_EXTERNAL_AUTH
+ }
}
},
whitelisted: true
}
},
+ client: {
+ videos: {
+ miniature: {
+ preferAuthorDisplayName: false
+ }
+ },
+ menu: {
+ login: {
+ redirectOnSingleExternalAuth: false
+ }
+ }
+ },
cache: {
previews: {
size: 2
expect(data.services.twitter.username).to.equal('@Chocobozzz')
expect(data.services.twitter.whitelisted).to.be.false
+ expect(data.client.videos.miniature.preferAuthorDisplayName).to.be.false
+ expect(data.client.menu.login.redirectOnSingleExternalAuth).to.be.false
+
expect(data.cache.previews.size).to.equal(1)
expect(data.cache.captions.size).to.equal(1)
expect(data.cache.torrents.size).to.equal(1)
expect(data.services.twitter.username).to.equal('@Kuja')
expect(data.services.twitter.whitelisted).to.be.true
+ expect(data.client.videos.miniature.preferAuthorDisplayName).to.be.true
+ expect(data.client.menu.login.redirectOnSingleExternalAuth).to.be.true
+
expect(data.cache.previews.size).to.equal(2)
expect(data.cache.captions.size).to.equal(3)
expect(data.cache.torrents.size).to.equal(4)
whitelisted: true
}
},
+ client: {
+ videos: {
+ miniature: {
+ preferAuthorDisplayName: true
+ }
+ },
+ menu: {
+ login: {
+ redirectOnSingleExternalAuth: true
+ }
+ }
+ },
cache: {
previews: {
size: 2
whitelisted: true
}
},
+ client: {
+ videos: {
+ miniature: {
+ preferAuthorDisplayName: false
+ }
+ },
+ menu: {
+ login: {
+ redirectOnSingleExternalAuth: false
+ }
+ }
+ },
cache: {
previews: {
size: 2
}
}
+ client: {
+ videos: {
+ miniature: {
+ preferAuthorDisplayName: boolean
+ }
+ }
+
+ menu: {
+ login: {
+ redirectOnSingleExternalAuth: boolean
+ }
+ }
+ }
+
cache: {
previews: {
size: number
preferAuthorDisplayName: boolean
}
}
+
+ menu: {
+ login: {
+ redirectOnSingleExternalAuth: boolean
+ }
+ }
}
webadmin: {