Merge branch 'develop' into unused-imports
This commit is contained in:
commit
0b4e5fe327
|
@ -44,7 +44,9 @@ before you start working on them :).
|
||||||
|
|
||||||
### Prerequisites
|
### Prerequisites
|
||||||
|
|
||||||
First, make sure that you have followed
|
First, you should use a server or PC with at least 4GB of RAM. Less RAM may lead to crashes.
|
||||||
|
|
||||||
|
Make sure that you have followed
|
||||||
[the steps](/support/doc/dependencies.md)
|
[the steps](/support/doc/dependencies.md)
|
||||||
to install the dependencies.
|
to install the dependencies.
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@ export class AuthService {
|
||||||
loginChangedSource: Observable<AuthStatus>
|
loginChangedSource: Observable<AuthStatus>
|
||||||
userInformationLoaded = new ReplaySubject<boolean>(1)
|
userInformationLoaded = new ReplaySubject<boolean>(1)
|
||||||
hotkeys: Hotkey[]
|
hotkeys: Hotkey[]
|
||||||
|
redirectUrl: string
|
||||||
|
|
||||||
private clientId: string = peertubeLocalStorage.getItem(AuthService.LOCAL_STORAGE_OAUTH_CLIENT_KEYS.CLIENT_ID)
|
private clientId: string = peertubeLocalStorage.getItem(AuthService.LOCAL_STORAGE_OAUTH_CLIENT_KEYS.CLIENT_ID)
|
||||||
private clientSecret: string = peertubeLocalStorage.getItem(AuthService.LOCAL_STORAGE_OAUTH_CLIENT_KEYS.CLIENT_SECRET)
|
private clientSecret: string = peertubeLocalStorage.getItem(AuthService.LOCAL_STORAGE_OAUTH_CLIENT_KEYS.CLIENT_SECRET)
|
||||||
|
@ -177,6 +178,8 @@ export class AuthService {
|
||||||
this.setStatus(AuthStatus.LoggedOut)
|
this.setStatus(AuthStatus.LoggedOut)
|
||||||
|
|
||||||
this.hotkeysService.remove(this.hotkeys)
|
this.hotkeysService.remove(this.hotkeys)
|
||||||
|
|
||||||
|
this.redirectUrl = null
|
||||||
}
|
}
|
||||||
|
|
||||||
refreshAccessToken () {
|
refreshAccessToken () {
|
||||||
|
|
|
@ -20,6 +20,8 @@ export class LoginGuard implements CanActivate, CanActivateChild {
|
||||||
canActivate (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
|
canActivate (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
|
||||||
if (this.auth.isLoggedIn() === true) return true
|
if (this.auth.isLoggedIn() === true) return true
|
||||||
|
|
||||||
|
this.auth.redirectUrl = state.url
|
||||||
|
|
||||||
this.router.navigate([ '/login' ])
|
this.router.navigate([ '/login' ])
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
or create an account
|
or create an account
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<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">
|
<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">
|
||||||
or create an account on another instance
|
or create an account on another instance
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ import { I18n } from '@ngx-translate/i18n-polyfill'
|
||||||
import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service'
|
import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service'
|
||||||
import { LoginValidatorsService } from '@app/shared/forms/form-validators/login-validators.service'
|
import { LoginValidatorsService } from '@app/shared/forms/form-validators/login-validators.service'
|
||||||
import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'
|
import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'
|
||||||
|
import { Router } from '@angular/router'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-login',
|
selector: 'my-login',
|
||||||
|
@ -26,6 +27,7 @@ export class LoginComponent extends FormReactive implements OnInit {
|
||||||
private openedForgotPasswordModal: NgbModalRef
|
private openedForgotPasswordModal: NgbModalRef
|
||||||
|
|
||||||
constructor (
|
constructor (
|
||||||
|
public router: Router,
|
||||||
protected formValidatorService: FormValidatorService,
|
protected formValidatorService: FormValidatorService,
|
||||||
private modalService: NgbModal,
|
private modalService: NgbModal,
|
||||||
private loginValidatorsService: LoginValidatorsService,
|
private loginValidatorsService: LoginValidatorsService,
|
||||||
|
@ -59,7 +61,7 @@ export class LoginComponent extends FormReactive implements OnInit {
|
||||||
|
|
||||||
this.authService.login(username, password)
|
this.authService.login(username, password)
|
||||||
.subscribe(
|
.subscribe(
|
||||||
() => this.redirectService.redirectToHomepage(),
|
() => this.redirect(),
|
||||||
|
|
||||||
err => {
|
err => {
|
||||||
if (err.message.indexOf('credentials are invalid') !== -1) this.error = this.i18n('Incorrect username or password.')
|
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 {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
redirect () {
|
||||||
|
const redirect = this.authService.redirectUrl
|
||||||
|
if (redirect) {
|
||||||
|
this.router.navigate([ redirect ])
|
||||||
|
} else {
|
||||||
|
this.redirectService.redirectToHomepage()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
askResetPassword () {
|
askResetPassword () {
|
||||||
this.userService.askResetPassword(this.forgotPasswordEmail)
|
this.userService.askResetPassword(this.forgotPasswordEmail)
|
||||||
.subscribe(
|
.subscribe(
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
<span
|
<span
|
||||||
role="button"
|
role="button"
|
||||||
class="help-tooltip-button"
|
class="help-tooltip-button"
|
||||||
|
container="body"
|
||||||
title="Get help"
|
title="Get help"
|
||||||
i18n-title
|
i18n-title
|
||||||
[attr.aria-pressed]="isPopoverOpened"
|
[attr.aria-pressed]="isPopoverOpened"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
[routerLink]="['/videos/watch', video.uuid]" [attr.title]="video.name"
|
[routerLink]="['/videos/watch', video.uuid]" [attr.title]="video.name"
|
||||||
class="video-thumbnail"
|
class="video-thumbnail"
|
||||||
>
|
>
|
||||||
<img [attr.alt]="video.name" [attr.aria-labelledby]="video.name" [attr.src]="getImageUrl()" [ngClass]="{ 'blur-filter': nsfw }" />
|
<img alt="" [attr.aria-labelledby]="video.name" [attr.src]="getImageUrl()" [ngClass]="{ 'blur-filter': nsfw }" />
|
||||||
|
|
||||||
<div class="video-thumbnail-overlay">
|
<div class="video-thumbnail-overlay">
|
||||||
{{ video.durationLabel }}
|
{{ video.durationLabel }}
|
||||||
|
|
|
@ -5,10 +5,20 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<div class="peertube-select-container">
|
<div class="form-group">
|
||||||
<select [(ngModel)]="resolutionId">
|
<div class="input-group input-group-sm">
|
||||||
<option *ngFor="let file of video.files" [value]="file.resolution.id">{{ file.resolution.label }}</option>
|
<div class="input-group-prepend peertube-select-container">
|
||||||
</select>
|
<select [(ngModel)]="resolutionId">
|
||||||
|
<option *ngFor="let file of video.files" [value]="file.resolution.id">{{ file.resolution.label }}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<input #urlInput (click)="urlInput.select()" type="text" class="form-control input-sm readonly" readonly [value]="getLink()" />
|
||||||
|
<div class="input-group-append">
|
||||||
|
<button [ngxClipboard]="urlInput" (click)="activateCopiedMessage()" type="button" class="btn btn-outline-secondary">
|
||||||
|
<span class="glyphicon glyphicon-copy"></span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="download-type">
|
<div class="download-type">
|
||||||
|
|
|
@ -2,7 +2,13 @@
|
||||||
@import 'mixins';
|
@import 'mixins';
|
||||||
|
|
||||||
.peertube-select-container {
|
.peertube-select-container {
|
||||||
@include peertube-select-container(130px);
|
@include peertube-select-container(100px);
|
||||||
|
border-top-right-radius: 0px;
|
||||||
|
border-bottom-right-radius: 0px;
|
||||||
|
|
||||||
|
select {
|
||||||
|
height: inherit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.download-type {
|
.download-type {
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
import { Component, ElementRef, Input, OnInit, ViewChild } from '@angular/core'
|
import { Component, ElementRef, Input, OnInit, ViewChild } from '@angular/core'
|
||||||
import { VideoDetails } from '../../../shared/video/video-details.model'
|
import { VideoDetails } from '../../../shared/video/video-details.model'
|
||||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
||||||
|
import { I18n } from '@ngx-translate/i18n-polyfill'
|
||||||
|
import { NotificationsService } from 'angular2-notifications'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-video-download',
|
selector: 'my-video-download',
|
||||||
|
@ -15,7 +17,11 @@ export class VideoDownloadComponent implements OnInit {
|
||||||
downloadType: 'direct' | 'torrent' | 'magnet' = 'torrent'
|
downloadType: 'direct' | 'torrent' | 'magnet' = 'torrent'
|
||||||
resolutionId: number | string = -1
|
resolutionId: number | string = -1
|
||||||
|
|
||||||
constructor (private modalService: NgbModal) { }
|
constructor (
|
||||||
|
private notificationsService: NotificationsService,
|
||||||
|
private modalService: NgbModal,
|
||||||
|
private i18n: I18n
|
||||||
|
) { }
|
||||||
|
|
||||||
ngOnInit () {
|
ngOnInit () {
|
||||||
this.resolutionId = this.video.files[0].resolution.id
|
this.resolutionId = this.video.files[0].resolution.id
|
||||||
|
@ -26,6 +32,10 @@ export class VideoDownloadComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
download () {
|
download () {
|
||||||
|
window.location.assign(this.getLink())
|
||||||
|
}
|
||||||
|
|
||||||
|
getLink () {
|
||||||
// HTML select send us a string, so convert it to a number
|
// HTML select send us a string, so convert it to a number
|
||||||
this.resolutionId = parseInt(this.resolutionId.toString(), 10)
|
this.resolutionId = parseInt(this.resolutionId.toString(), 10)
|
||||||
|
|
||||||
|
@ -48,6 +58,11 @@ export class VideoDownloadComponent implements OnInit {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})()
|
})()
|
||||||
window.location.assign(link)
|
|
||||||
|
return link
|
||||||
|
}
|
||||||
|
|
||||||
|
activateCopiedMessage () {
|
||||||
|
this.notificationsService.success(this.i18n('Success'), this.i18n('Copied'))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,27 @@ function getVideojsOptions (options: {
|
||||||
Object.assign(videojsOptions.plugins, {
|
Object.assign(videojsOptions.plugins, {
|
||||||
hotkeys: {
|
hotkeys: {
|
||||||
enableVolumeScroll: false,
|
enableVolumeScroll: false,
|
||||||
enableModifiersForNumbers: false
|
enableModifiersForNumbers: false,
|
||||||
|
customKeys: {
|
||||||
|
increasePlaybackRateKey: {
|
||||||
|
key: function (event) {
|
||||||
|
// use '>'
|
||||||
|
return event.which === 51
|
||||||
|
},
|
||||||
|
handler: function (player, options, event) {
|
||||||
|
player.playbackRate(player.playbackRate() + 0.1)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
decreasePlaybackRateKey: {
|
||||||
|
key: function (event) {
|
||||||
|
// use '<'
|
||||||
|
return event.which === 50
|
||||||
|
},
|
||||||
|
handler: function (player, options, event) {
|
||||||
|
player.playbackRate(player.playbackRate() - 0.1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,20 @@
|
||||||
# Dependencies
|
# Dependencies
|
||||||
|
|
||||||
|
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
||||||
|
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
||||||
|
|
||||||
|
|
||||||
|
- [Debian / Ubuntu and derivatives](#debian--ubuntu-and-derivatives)
|
||||||
|
- [Arch Linux](#arch-linux)
|
||||||
|
- [CentOS 7](#centos-7)
|
||||||
|
- [Fedora](#fedora)
|
||||||
|
- [FreeBSD](#freebsd)
|
||||||
|
- [macOS](#macos)
|
||||||
|
- [Gentoo](#gentoo)
|
||||||
|
- [Other distributions](#other-distributions)
|
||||||
|
|
||||||
|
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
||||||
|
|
||||||
## Debian / Ubuntu and derivatives
|
## Debian / Ubuntu and derivatives
|
||||||
1. On a fresh Debian/Ubuntu, as root user, install basic utility programs needed for the installation
|
1. On a fresh Debian/Ubuntu, as root user, install basic utility programs needed for the installation
|
||||||
|
|
||||||
|
@ -31,6 +46,11 @@ $ sudo apt-get update
|
||||||
$ sudo apt install ffmpeg
|
$ sudo apt install ffmpeg
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis:
|
||||||
|
```
|
||||||
|
$ sudo systemctl start redis postgresql
|
||||||
|
```
|
||||||
|
|
||||||
## Arch Linux
|
## Arch Linux
|
||||||
|
|
||||||
1. Run:
|
1. Run:
|
||||||
|
@ -39,6 +59,11 @@ $ sudo apt install ffmpeg
|
||||||
$ sudo pacman -S nodejs yarn ffmpeg postgresql openssl redis git wget unzip python2 base-devel npm nginx
|
$ sudo pacman -S nodejs yarn ffmpeg postgresql openssl redis git wget unzip python2 base-devel npm nginx
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis:
|
||||||
|
```
|
||||||
|
$ sudo systemctl start redis postgresql
|
||||||
|
```
|
||||||
|
|
||||||
## CentOS 7
|
## CentOS 7
|
||||||
|
|
||||||
1. Install NodeJS 8.x (current LTS):
|
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
|
||||||
$ 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
|
$ 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
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis:
|
||||||
|
```
|
||||||
|
$ sudo service redis start
|
||||||
|
$ sudo service postgresql start
|
||||||
|
```
|
||||||
|
|
||||||
|
## Fedora
|
||||||
|
|
||||||
|
0. Upgrade your packages:
|
||||||
|
```
|
||||||
|
dnf upgrade
|
||||||
|
```
|
||||||
|
1. Add a user with sudoers group access:
|
||||||
|
```
|
||||||
|
useradd my-peertube-user
|
||||||
|
passwd my-peertube-user
|
||||||
|
usermod my-peertube-user -a -G wheel # Add my-peertube-user to sudoers
|
||||||
|
su my-peertube-user
|
||||||
|
```
|
||||||
|
2. (Optional) Install certbot (choose instructions for nginx and your distribution) :
|
||||||
|
[https://certbot.eff.org/all-instructions](https://certbot.eff.org/all-instructions)
|
||||||
|
3. Install NodeJS 8.x (current LTS):
|
||||||
|
[https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora)
|
||||||
|
4. Install yarn:
|
||||||
|
[https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
|
||||||
|
5. Enable [RPM Fusion](https://rpmfusion.org) for Fedora (available for x86, x86_64, armhfp)
|
||||||
|
```
|
||||||
|
sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
|
||||||
|
```
|
||||||
|
This is necessary because `ffmpeg` is not in the Fedora repos.
|
||||||
|
|
||||||
|
6. Run:
|
||||||
|
```
|
||||||
|
sudo dnf install nginx ffmpeg postgresql-server postgresql-contrib openssl gcc-c++ make redis git
|
||||||
|
ffmpeg -version # Should be >= 3.x
|
||||||
|
g++ -v # Should be >= 5.x
|
||||||
|
```
|
||||||
|
7. Post-installation
|
||||||
|
|
||||||
|
_from [PostgreSQL documentation](https://www.postgresql.org/download/linux/redhat/):_
|
||||||
|
> Due to policies for Red Hat family distributions, the PostgreSQL installation will not be enabled for automatic start or have the database initialized automatically.
|
||||||
|
```
|
||||||
|
# PostgreSQL
|
||||||
|
sudo postgresql-setup initdb
|
||||||
|
sudo systemctl enable postgresql.service
|
||||||
|
sudo systemctl start postgresql.service
|
||||||
|
# Nginx
|
||||||
|
sudo systemctl enable nginx.service
|
||||||
|
sudo systemctl start nginx.service
|
||||||
|
# Redis
|
||||||
|
sudo systemctl enable redis.service
|
||||||
|
sudo systemctl start redis.service
|
||||||
|
```
|
||||||
|
8. Firewall
|
||||||
|
|
||||||
|
By default, you cannot acces your server via public IP. To do so, you must configure firewall:
|
||||||
|
```
|
||||||
|
# Ports used by peertube dev setup
|
||||||
|
sudo firewall-cmd --permanent --zone=public --add-port=3000/tcp
|
||||||
|
sudo firewall-cmd --permanent --zone=public --add-port=9000/tcp
|
||||||
|
# Optional
|
||||||
|
sudo firewall-cmd --permanent --zone=public --add-service=http
|
||||||
|
sudo firewall-cmd --permanent --zone=public --add-service=https
|
||||||
|
# Reload firewall
|
||||||
|
sudo firewall-cmd --reload
|
||||||
|
```
|
||||||
|
9. Configure max ports
|
||||||
|
|
||||||
|
This is necessary if you are running dev setup, otherwise you will have errors with `nodemon`
|
||||||
|
```
|
||||||
|
echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
|
||||||
|
```
|
||||||
|
[More info](https://stackoverflow.com/questions/34662574/node-js-getting-error-nodemon-internal-watch-failed-watch-enospc#34664097)
|
||||||
|
|
||||||
## FreeBSD
|
## FreeBSD
|
||||||
|
|
||||||
On a fresh install of [FreeBSD](https://www.freebsd.org), new system or new jail:
|
On a fresh install of [FreeBSD](https://www.freebsd.org), new system or new jail:
|
||||||
|
|
Loading…
Reference in New Issue