aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.github/CONTRIBUTING.md6
-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
-rw-r--r--support/doc/dependencies.md99
12 files changed, 182 insertions, 13 deletions
diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
index 6d095cc47..4b352922e 100644
--- a/.github/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
@@ -44,7 +44,9 @@ before you start working on them :).
44 44
45### Prerequisites 45### Prerequisites
46 46
47First, make sure that you have followed 47First, you should use a server or PC with at least 4GB of RAM. Less RAM may lead to crashes.
48
49Make sure that you have followed
48[the steps](/support/doc/dependencies.md) 50[the steps](/support/doc/dependencies.md)
49to install the dependencies. 51to install the dependencies.
50 52
@@ -173,4 +175,4 @@ $ npm run mocha -- --exit --require ts-node/register/type-check --bail server/te
173``` 175```
174 176
175Instance configurations are in `config/test-{1,2,3,4,5,6}.yaml`. 177Instance configurations are in `config/test-{1,2,3,4,5,6}.yaml`.
176Note that only instance 2 has transcoding enabled. \ No newline at end of file 178Note that only instance 2 has transcoding enabled.
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 }
diff --git a/support/doc/dependencies.md b/support/doc/dependencies.md
index 35812aa8b..d98d71020 100644
--- a/support/doc/dependencies.md
+++ b/support/doc/dependencies.md
@@ -1,5 +1,20 @@
1# Dependencies 1# Dependencies
2 2
3<!-- START doctoc generated TOC please keep comment here to allow auto update -->
4<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
5
6
7- [Debian / Ubuntu and derivatives](#debian--ubuntu-and-derivatives)
8- [Arch Linux](#arch-linux)
9- [CentOS 7](#centos-7)
10- [Fedora](#fedora)
11- [FreeBSD](#freebsd)
12- [macOS](#macos)
13- [Gentoo](#gentoo)
14- [Other distributions](#other-distributions)
15
16<!-- END doctoc generated TOC please keep comment here to allow auto update -->
17
3## Debian / Ubuntu and derivatives 18## Debian / Ubuntu and derivatives
4 1. On a fresh Debian/Ubuntu, as root user, install basic utility programs needed for the installation 19 1. On a fresh Debian/Ubuntu, as root user, install basic utility programs needed for the installation
5 20
@@ -31,6 +46,11 @@ $ sudo apt-get update
31$ sudo apt install ffmpeg 46$ sudo apt install ffmpeg
32``` 47```
33 48
49Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis:
50```
51$ sudo systemctl start redis postgresql
52```
53
34## Arch Linux 54## Arch Linux
35 55
36 1. Run: 56 1. Run:
@@ -39,6 +59,11 @@ $ sudo apt install ffmpeg
39$ sudo pacman -S nodejs yarn ffmpeg postgresql openssl redis git wget unzip python2 base-devel npm nginx 59$ sudo pacman -S nodejs yarn ffmpeg postgresql openssl redis git wget unzip python2 base-devel npm nginx
40``` 60```
41 61
62Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis:
63```
64$ sudo systemctl start redis postgresql
65```
66
42## CentOS 7 67## CentOS 7
43 68
44 1. Install NodeJS 8.x (current LTS): 69 1. Install NodeJS 8.x (current LTS):
@@ -68,6 +93,80 @@ Later when you invoke any node command, please prefix them with `CC=/opt/rh/devt
68$ sudo -H -u peertube CC=/opt/rh/devtoolset-7/root/usr/bin/gcc CXX=/opt/rh/devtoolset-7/root/usr/bin/g++ yarn install --production --pure-lockfile 93$ sudo -H -u peertube CC=/opt/rh/devtoolset-7/root/usr/bin/gcc CXX=/opt/rh/devtoolset-7/root/usr/bin/g++ yarn install --production --pure-lockfile
69``` 94```
70 95
96Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis:
97```
98$ sudo service redis start
99$ sudo service postgresql start
100```
101
102## Fedora
103
1040. Upgrade your packages:
105```
106dnf upgrade
107```
1081. Add a user with sudoers group access:
109```
110useradd my-peertube-user
111passwd my-peertube-user
112usermod my-peertube-user -a -G wheel # Add my-peertube-user to sudoers
113su my-peertube-user
114```
1152. (Optional) Install certbot (choose instructions for nginx and your distribution) :
116[https://certbot.eff.org/all-instructions](https://certbot.eff.org/all-instructions)
1173. Install NodeJS 8.x (current LTS):
118[https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora)
1194. Install yarn:
120[https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
1215. Enable [RPM Fusion](https://rpmfusion.org) for Fedora (available for x86, x86_64, armhfp)
122```
123sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
124```
125This is necessary because `ffmpeg` is not in the Fedora repos.
126
1276. Run:
128```
129sudo dnf install nginx ffmpeg postgresql-server postgresql-contrib openssl gcc-c++ make redis git
130ffmpeg -version # Should be >= 3.x
131g++ -v # Should be >= 5.x
132```
1337. Post-installation
134
135_from [PostgreSQL documentation](https://www.postgresql.org/download/linux/redhat/):_
136> Due to policies for Red Hat family distributions, the PostgreSQL installation will not be enabled for automatic start or have the database initialized automatically.
137```
138# PostgreSQL
139sudo postgresql-setup initdb
140sudo systemctl enable postgresql.service
141sudo systemctl start postgresql.service
142# Nginx
143sudo systemctl enable nginx.service
144sudo systemctl start nginx.service
145# Redis
146sudo systemctl enable redis.service
147sudo systemctl start redis.service
148```
1498. Firewall
150
151By default, you cannot acces your server via public IP. To do so, you must configure firewall:
152```
153# Ports used by peertube dev setup
154sudo firewall-cmd --permanent --zone=public --add-port=3000/tcp
155sudo firewall-cmd --permanent --zone=public --add-port=9000/tcp
156# Optional
157sudo firewall-cmd --permanent --zone=public --add-service=http
158sudo firewall-cmd --permanent --zone=public --add-service=https
159# Reload firewall
160sudo firewall-cmd --reload
161```
1629. Configure max ports
163
164This is necessary if you are running dev setup, otherwise you will have errors with `nodemon`
165```
166echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
167```
168[More info](https://stackoverflow.com/questions/34662574/node-js-getting-error-nodemon-internal-watch-failed-watch-enospc#34664097)
169
71## FreeBSD 170## FreeBSD
72 171
73On a fresh install of [FreeBSD](https://www.freebsd.org), new system or new jail: 172On a fresh install of [FreeBSD](https://www.freebsd.org), new system or new jail: