aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-09-24 10:40:27 +0200
committerGitHub <noreply@github.com>2018-09-24 10:40:27 +0200
commit0b4e5fe32708afce54212810738aa4d0c3dc178d (patch)
tree5d9b160e257a2bd116e67c9363b798f422ead44c /client/src
parent23db998f07d674c621972a769df73203b14e093a (diff)
parent01448622992b12318a2fff508e501732b59dd6be (diff)
downloadPeerTube-0b4e5fe32708afce54212810738aa4d0c3dc178d.tar.gz
PeerTube-0b4e5fe32708afce54212810738aa4d0c3dc178d.tar.zst
PeerTube-0b4e5fe32708afce54212810738aa4d0c3dc178d.zip
Merge branch 'develop' into unused-imports
Diffstat (limited to 'client/src')
-rw-r--r--client/src/app/core/auth/auth.service.ts3
-rw-r--r--client/src/app/core/routing/login-guard.service.ts2
-rw-r--r--client/src/app/login/login.component.html2
-rw-r--r--client/src/app/login/login.component.ts13
-rw-r--r--client/src/app/shared/misc/help.component.html1
-rw-r--r--client/src/app/shared/video/video-thumbnail.component.html2
-rw-r--r--client/src/app/videos/+video-watch/modal/video-download.component.html18
-rw-r--r--client/src/app/videos/+video-watch/modal/video-download.component.scss8
-rw-r--r--client/src/app/videos/+video-watch/modal/video-download.component.ts19
-rw-r--r--client/src/assets/player/peertube-player.ts22
10 files changed, 79 insertions, 11 deletions
diff --git a/client/src/app/core/auth/auth.service.ts b/client/src/app/core/auth/auth.service.ts
index 88ea89639..8ff5713a1 100644
--- a/client/src/app/core/auth/auth.service.ts
+++ b/client/src/app/core/auth/auth.service.ts
@@ -38,6 +38,7 @@ export class AuthService {
38 loginChangedSource: Observable<AuthStatus> 38 loginChangedSource: Observable<AuthStatus>
39 userInformationLoaded = new ReplaySubject<boolean>(1) 39 userInformationLoaded = new ReplaySubject<boolean>(1)
40 hotkeys: Hotkey[] 40 hotkeys: Hotkey[]
41 redirectUrl: string
41 42
42 private clientId: string = peertubeLocalStorage.getItem(AuthService.LOCAL_STORAGE_OAUTH_CLIENT_KEYS.CLIENT_ID) 43 private clientId: string = peertubeLocalStorage.getItem(AuthService.LOCAL_STORAGE_OAUTH_CLIENT_KEYS.CLIENT_ID)
43 private clientSecret: string = peertubeLocalStorage.getItem(AuthService.LOCAL_STORAGE_OAUTH_CLIENT_KEYS.CLIENT_SECRET) 44 private clientSecret: string = peertubeLocalStorage.getItem(AuthService.LOCAL_STORAGE_OAUTH_CLIENT_KEYS.CLIENT_SECRET)
@@ -177,6 +178,8 @@ export class AuthService {
177 this.setStatus(AuthStatus.LoggedOut) 178 this.setStatus(AuthStatus.LoggedOut)
178 179
179 this.hotkeysService.remove(this.hotkeys) 180 this.hotkeysService.remove(this.hotkeys)
181
182 this.redirectUrl = null
180 } 183 }
181 184
182 refreshAccessToken () { 185 refreshAccessToken () {
diff --git a/client/src/app/core/routing/login-guard.service.ts b/client/src/app/core/routing/login-guard.service.ts
index 18bc41ca6..40ff8f505 100644
--- a/client/src/app/core/routing/login-guard.service.ts
+++ b/client/src/app/core/routing/login-guard.service.ts
@@ -20,6 +20,8 @@ export class LoginGuard implements CanActivate, CanActivateChild {
20 canActivate (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) { 20 canActivate (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
21 if (this.auth.isLoggedIn() === true) return true 21 if (this.auth.isLoggedIn() === true) return true
22 22
23 this.auth.redirectUrl = state.url
24
23 this.router.navigate([ '/login' ]) 25 this.router.navigate([ '/login' ])
24 return false 26 return false
25 } 27 }
diff --git a/client/src/app/login/login.component.html b/client/src/app/login/login.component.html
index 267a2d857..fa585c883 100644
--- a/client/src/app/login/login.component.html
+++ b/client/src/app/login/login.component.html
@@ -19,7 +19,7 @@
19 or create an account 19 or create an account
20 </a> 20 </a>
21 21
22 <a i18n *ngIf="signupAllowed === false" href="https://joinpeertube.org/en/#getting-started" target="_blank" title="Click here to see how to get started!" class="create-an-account"> 22 <a i18n *ngIf="signupAllowed === false" href="https://joinpeertube.org/en/#register" target="_blank" title="Click here to see a list of instances where to register" class="create-an-account">
23 or create an account on another instance 23 or create an account on another instance
24 </a> 24 </a>
25 25
diff --git a/client/src/app/login/login.component.ts b/client/src/app/login/login.component.ts
index 4bae3ae5c..7553e6456 100644
--- a/client/src/app/login/login.component.ts
+++ b/client/src/app/login/login.component.ts
@@ -8,6 +8,7 @@ import { I18n } from '@ngx-translate/i18n-polyfill'
8import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' 8import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service'
9import { LoginValidatorsService } from '@app/shared/forms/form-validators/login-validators.service' 9import { LoginValidatorsService } from '@app/shared/forms/form-validators/login-validators.service'
10import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap' 10import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'
11import { Router } from '@angular/router'
11 12
12@Component({ 13@Component({
13 selector: 'my-login', 14 selector: 'my-login',
@@ -26,6 +27,7 @@ export class LoginComponent extends FormReactive implements OnInit {
26 private openedForgotPasswordModal: NgbModalRef 27 private openedForgotPasswordModal: NgbModalRef
27 28
28 constructor ( 29 constructor (
30 public router: Router,
29 protected formValidatorService: FormValidatorService, 31 protected formValidatorService: FormValidatorService,
30 private modalService: NgbModal, 32 private modalService: NgbModal,
31 private loginValidatorsService: LoginValidatorsService, 33 private loginValidatorsService: LoginValidatorsService,
@@ -59,7 +61,7 @@ export class LoginComponent extends FormReactive implements OnInit {
59 61
60 this.authService.login(username, password) 62 this.authService.login(username, password)
61 .subscribe( 63 .subscribe(
62 () => this.redirectService.redirectToHomepage(), 64 () => this.redirect(),
63 65
64 err => { 66 err => {
65 if (err.message.indexOf('credentials are invalid') !== -1) this.error = this.i18n('Incorrect username or password.') 67 if (err.message.indexOf('credentials are invalid') !== -1) this.error = this.i18n('Incorrect username or password.')
@@ -69,6 +71,15 @@ export class LoginComponent extends FormReactive implements OnInit {
69 ) 71 )
70 } 72 }
71 73
74 redirect () {
75 const redirect = this.authService.redirectUrl
76 if (redirect) {
77 this.router.navigate([ redirect ])
78 } else {
79 this.redirectService.redirectToHomepage()
80 }
81 }
82
72 askResetPassword () { 83 askResetPassword () {
73 this.userService.askResetPassword(this.forgotPasswordEmail) 84 this.userService.askResetPassword(this.forgotPasswordEmail)
74 .subscribe( 85 .subscribe(
diff --git a/client/src/app/shared/misc/help.component.html b/client/src/app/shared/misc/help.component.html
index 5b3ddde1d..28ccb1e26 100644
--- a/client/src/app/shared/misc/help.component.html
+++ b/client/src/app/shared/misc/help.component.html
@@ -15,6 +15,7 @@
15<span 15<span
16 role="button" 16 role="button"
17 class="help-tooltip-button" 17 class="help-tooltip-button"
18 container="body"
18 title="Get help" 19 title="Get help"
19 i18n-title 20 i18n-title
20 [attr.aria-pressed]="isPopoverOpened" 21 [attr.aria-pressed]="isPopoverOpened"
diff --git a/client/src/app/shared/video/video-thumbnail.component.html b/client/src/app/shared/video/video-thumbnail.component.html
index 6935ed948..c1d45ea18 100644
--- a/client/src/app/shared/video/video-thumbnail.component.html
+++ b/client/src/app/shared/video/video-thumbnail.component.html
@@ -2,7 +2,7 @@
2 [routerLink]="['/videos/watch', video.uuid]" [attr.title]="video.name" 2 [routerLink]="['/videos/watch', video.uuid]" [attr.title]="video.name"
3 class="video-thumbnail" 3 class="video-thumbnail"
4> 4>
5<img [attr.alt]="video.name" [attr.aria-labelledby]="video.name" [attr.src]="getImageUrl()" [ngClass]="{ 'blur-filter': nsfw }" /> 5<img alt="" [attr.aria-labelledby]="video.name" [attr.src]="getImageUrl()" [ngClass]="{ 'blur-filter': nsfw }" />
6 6
7<div class="video-thumbnail-overlay"> 7<div class="video-thumbnail-overlay">
8 {{ video.durationLabel }} 8 {{ video.durationLabel }}
diff --git a/client/src/app/videos/+video-watch/modal/video-download.component.html b/client/src/app/videos/+video-watch/modal/video-download.component.html
index edd054123..f46f92a17 100644
--- a/client/src/app/videos/+video-watch/modal/video-download.component.html
+++ b/client/src/app/videos/+video-watch/modal/video-download.component.html
@@ -5,10 +5,20 @@
5 </div> 5 </div>
6 6
7 <div class="modal-body"> 7 <div class="modal-body">
8 <div class="peertube-select-container"> 8 <div class="form-group">
9 <select [(ngModel)]="resolutionId"> 9 <div class="input-group input-group-sm">
10 <option *ngFor="let file of video.files" [value]="file.resolution.id">{{ file.resolution.label }}</option> 10 <div class="input-group-prepend peertube-select-container">
11 </select> 11 <select [(ngModel)]="resolutionId">
12 <option *ngFor="let file of video.files" [value]="file.resolution.id">{{ file.resolution.label }}</option>
13 </select>
14 </div>
15 <input #urlInput (click)="urlInput.select()" type="text" class="form-control input-sm readonly" readonly [value]="getLink()" />
16 <div class="input-group-append">
17 <button [ngxClipboard]="urlInput" (click)="activateCopiedMessage()" type="button" class="btn btn-outline-secondary">
18 <span class="glyphicon glyphicon-copy"></span>
19 </button>
20 </div>
21 </div>
12 </div> 22 </div>
13 23
14 <div class="download-type"> 24 <div class="download-type">
diff --git a/client/src/app/videos/+video-watch/modal/video-download.component.scss b/client/src/app/videos/+video-watch/modal/video-download.component.scss
index 6325f67a3..439cbb3e3 100644
--- a/client/src/app/videos/+video-watch/modal/video-download.component.scss
+++ b/client/src/app/videos/+video-watch/modal/video-download.component.scss
@@ -2,7 +2,13 @@
2@import 'mixins'; 2@import 'mixins';
3 3
4.peertube-select-container { 4.peertube-select-container {
5 @include peertube-select-container(130px); 5 @include peertube-select-container(100px);
6 border-top-right-radius: 0px;
7 border-bottom-right-radius: 0px;
8
9 select {
10 height: inherit;
11 }
6} 12}
7 13
8.download-type { 14.download-type {
diff --git a/client/src/app/videos/+video-watch/modal/video-download.component.ts b/client/src/app/videos/+video-watch/modal/video-download.component.ts
index f4d9003ee..b1b2c0623 100644
--- a/client/src/app/videos/+video-watch/modal/video-download.component.ts
+++ b/client/src/app/videos/+video-watch/modal/video-download.component.ts
@@ -1,6 +1,8 @@
1import { Component, ElementRef, Input, OnInit, ViewChild } from '@angular/core' 1import { Component, ElementRef, Input, OnInit, ViewChild } from '@angular/core'
2import { VideoDetails } from '../../../shared/video/video-details.model' 2import { VideoDetails } from '../../../shared/video/video-details.model'
3import { NgbModal } from '@ng-bootstrap/ng-bootstrap' 3import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
4import { I18n } from '@ngx-translate/i18n-polyfill'
5import { NotificationsService } from 'angular2-notifications'
4 6
5@Component({ 7@Component({
6 selector: 'my-video-download', 8 selector: 'my-video-download',
@@ -15,7 +17,11 @@ export class VideoDownloadComponent implements OnInit {
15 downloadType: 'direct' | 'torrent' | 'magnet' = 'torrent' 17 downloadType: 'direct' | 'torrent' | 'magnet' = 'torrent'
16 resolutionId: number | string = -1 18 resolutionId: number | string = -1
17 19
18 constructor (private modalService: NgbModal) { } 20 constructor (
21 private notificationsService: NotificationsService,
22 private modalService: NgbModal,
23 private i18n: I18n
24 ) { }
19 25
20 ngOnInit () { 26 ngOnInit () {
21 this.resolutionId = this.video.files[0].resolution.id 27 this.resolutionId = this.video.files[0].resolution.id
@@ -26,6 +32,10 @@ export class VideoDownloadComponent implements OnInit {
26 } 32 }
27 33
28 download () { 34 download () {
35 window.location.assign(this.getLink())
36 }
37
38 getLink () {
29 // HTML select send us a string, so convert it to a number 39 // HTML select send us a string, so convert it to a number
30 this.resolutionId = parseInt(this.resolutionId.toString(), 10) 40 this.resolutionId = parseInt(this.resolutionId.toString(), 10)
31 41
@@ -48,6 +58,11 @@ export class VideoDownloadComponent implements OnInit {
48 } 58 }
49 } 59 }
50 })() 60 })()
51 window.location.assign(link) 61
62 return link
63 }
64
65 activateCopiedMessage () {
66 this.notificationsService.success(this.i18n('Success'), this.i18n('Copied'))
52 } 67 }
53} 68}
diff --git a/client/src/assets/player/peertube-player.ts b/client/src/assets/player/peertube-player.ts
index eca2ce6c3..5cea69eb8 100644
--- a/client/src/assets/player/peertube-player.ts
+++ b/client/src/assets/player/peertube-player.ts
@@ -69,7 +69,27 @@ function getVideojsOptions (options: {
69 Object.assign(videojsOptions.plugins, { 69 Object.assign(videojsOptions.plugins, {
70 hotkeys: { 70 hotkeys: {
71 enableVolumeScroll: false, 71 enableVolumeScroll: false,
72 enableModifiersForNumbers: false 72 enableModifiersForNumbers: false,
73 customKeys: {
74 increasePlaybackRateKey: {
75 key: function (event) {
76 // use '>'
77 return event.which === 51
78 },
79 handler: function (player, options, event) {
80 player.playbackRate(player.playbackRate() + 0.1)
81 }
82 },
83 decreasePlaybackRateKey: {
84 key: function (event) {
85 // use '<'
86 return event.which === 50
87 },
88 handler: function (player, options, event) {
89 player.playbackRate(player.playbackRate() - 0.1)
90 }
91 }
92 }
73 } 93 }
74 }) 94 })
75 } 95 }