Commits (4)
import { SortMeta } from 'primeng/api'
import { from, Observable } from 'rxjs'
import { catchError, concatMap, map, toArray } from 'rxjs/operators'
import { catchError, concatMap, toArray } from 'rxjs/operators'
import { HttpClient, HttpParams } from '@angular/common/http'
import { Injectable } from '@angular/core'
import { RestExtractor, RestPagination, RestService } from '@app/core'
......@@ -40,10 +40,7 @@ export class InstanceFollowService {
if (actorType) params = params.append('actorType', actorType)
return this.authHttp.get<ResultList<ActorFollow>>(InstanceFollowService.BASE_APPLICATION_URL + '/following', { params })
.pipe(
map(res => this.restExtractor.convertResultListDateToHuman(res)),
catchError(res => this.restExtractor.handleError(res))
)
.pipe(catchError(res => this.restExtractor.handleError(res)))
}
getFollowers (options: {
......@@ -66,10 +63,7 @@ export class InstanceFollowService {
if (actorType) params = params.append('actorType', actorType)
return this.authHttp.get<ResultList<ActorFollow>>(InstanceFollowService.BASE_APPLICATION_URL + '/followers', { params })
.pipe(
map(res => this.restExtractor.convertResultListDateToHuman(res)),
catchError(res => this.restExtractor.handleError(res))
)
.pipe(catchError(res => this.restExtractor.handleError(res)))
}
follow (hostsOrHandles: string[]) {
......
......@@ -40,7 +40,6 @@ export class UserNotificationService {
return this.authHttp.get<ResultList<UserNotification>>(UserNotificationService.BASE_NOTIFICATIONS_URL, { params, context })
.pipe(
map(res => this.restExtractor.convertResultListDateToHuman(res)),
map(res => this.restExtractor.applyToResultListData(res, this.formatNotification.bind(this))),
catchError(err => this.restExtractor.handleError(err))
)
......
......@@ -64,7 +64,6 @@ export class VideoImportService {
.get<ResultList<VideoImport>>(UserService.BASE_USERS_URL + '/me/videos/imports', { params })
.pipe(
switchMap(res => this.extractVideoImports(res)),
map(res => this.restExtractor.convertResultListDateToHuman(res)),
catchError(err => this.restExtractor.handleError(err))
)
}
......
import { SortMeta } from 'primeng/api'
import { Observable } from 'rxjs'
import { catchError, map } from 'rxjs/operators'
import { catchError } from 'rxjs/operators'
import { HttpClient, HttpParams } from '@angular/common/http'
import { Injectable } from '@angular/core'
import { RestExtractor, RestPagination, RestService } from '@app/core'
......@@ -35,10 +35,7 @@ export class VideoOwnershipService {
params = this.restService.addRestGetParams(params, pagination, sort)
return this.authHttp.get<ResultList<VideoChangeOwnership>>(url, { params })
.pipe(
map(res => this.restExtractor.convertResultListDateToHuman(res)),
catchError(res => this.restExtractor.handleError(res))
)
.pipe(catchError(res => this.restExtractor.handleError(res)))
}
acceptOwnership (id: number, input: VideoChangeOwnershipAccept) {
......
......@@ -53,7 +53,6 @@ export class BlocklistService {
return this.authHttp.get<ResultList<AccountBlock>>(BlocklistService.BASE_USER_BLOCKLIST_URL + '/accounts', { params })
.pipe(
map(res => this.restExtractor.convertResultListDateToHuman(res)),
map(res => this.restExtractor.applyToResultListData(res, this.formatAccountBlock.bind(this))),
catchError(err => this.restExtractor.handleError(err))
)
......@@ -84,10 +83,7 @@ export class BlocklistService {
if (search) params = params.append('search', search)
return this.authHttp.get<ResultList<ServerBlock>>(BlocklistService.BASE_USER_BLOCKLIST_URL + '/servers', { params })
.pipe(
map(res => this.restExtractor.convertResultListDateToHuman(res)),
catchError(err => this.restExtractor.handleError(err))
)
.pipe(catchError(err => this.restExtractor.handleError(err)))
}
blockServerByUser (host: string) {
......@@ -116,7 +112,6 @@ export class BlocklistService {
return this.authHttp.get<ResultList<AccountBlock>>(BlocklistService.BASE_SERVER_BLOCKLIST_URL + '/accounts', { params })
.pipe(
map(res => this.restExtractor.convertResultListDateToHuman(res)),
map(res => this.restExtractor.applyToResultListData(res, this.formatAccountBlock.bind(this))),
catchError(err => this.restExtractor.handleError(err))
)
......@@ -151,10 +146,7 @@ export class BlocklistService {
if (search) params = params.append('search', search)
return this.authHttp.get<ResultList<ServerBlock>>(BlocklistService.BASE_SERVER_BLOCKLIST_URL + '/servers', { params })
.pipe(
map(res => this.restExtractor.convertResultListDateToHuman(res)),
catchError(err => this.restExtractor.handleError(err))
)
.pipe(catchError(err => this.restExtractor.handleError(err)))
}
blockServerByInstance (host: string) {
......
import { SortMeta } from 'primeng/api'
import { from as observableFrom, Observable } from 'rxjs'
import { catchError, concatMap, map, toArray } from 'rxjs/operators'
import { catchError, concatMap, toArray } from 'rxjs/operators'
import { HttpClient, HttpParams } from '@angular/common/http'
import { Injectable } from '@angular/core'
import { RestExtractor, RestPagination, RestService } from '@app/core'
......@@ -47,10 +47,7 @@ export class VideoBlockService {
if (type) params = params.append('type', type.toString())
return this.authHttp.get<ResultList<VideoBlacklist>>(VideoBlockService.BASE_VIDEOS_URL + 'blacklist', { params })
.pipe(
map(res => this.restExtractor.convertResultListDateToHuman(res)),
catchError(res => this.restExtractor.handleError(res))
)
.pipe(catchError(res => this.restExtractor.handleError(res)))
}
unblockVideo (videoIdArgs: number | number[]) {
......
......@@ -260,12 +260,13 @@ class StatsCard extends Component {
const vw = Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0)
const vh = Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0)
const pr = (window.devicePixelRatio || 1).toFixed(2)
const frames = `${vw}x${vh}*${pr} / ${videoQuality.droppedVideoFrames} dropped of ${videoQuality.totalVideoFrames}`
const vp = `${vw}x${vh}*${pr}`
const { droppedVideoFrames, totalVideoFrames } = videoQuality
const frames = player.localize('{1} / {2} dropped of {3}', [ vp, droppedVideoFrames + '', totalVideoFrames + '' ])
const duration = player.duration()
let volume = `${Math.round(player.volume() * 100)}`
if (player.muted()) volume += ' (muted)'
if (player.muted()) volume += player.localize(' (muted)')
const networkActivity = playerNetworkInfo.downloadSpeed
? `${playerNetworkInfo.downloadSpeed} &dArr; / ${playerNetworkInfo.uploadSpeed} &uArr;`
......@@ -274,8 +275,9 @@ class StatsCard extends Component {
const totalTransferred = playerNetworkInfo.totalDownloaded
? `${playerNetworkInfo.totalDownloaded} &dArr; / ${playerNetworkInfo.totalUploaded} &uArr;`
: undefined
const { downloadedFromServer, downloadedFromPeers } = playerNetworkInfo
const downloadBreakdown = playerNetworkInfo.downloadedFromServer
? `${playerNetworkInfo.downloadedFromServer} from servers · ${playerNetworkInfo.downloadedFromPeers} from peers`
? player.localize('{1} from servers · {2} from peers', [ downloadedFromServer, downloadedFromPeers ])
: undefined
const bufferProgress = progress !== undefined
......
......@@ -914,7 +914,10 @@ If you want to write modern JavaScript, please use a transpiler like [Babel](htt
**Typescript**
If you want to use __Typescript__, you can add __PeerTube__ types as dev dependencies:
The easiest way to use __Typescript__ for both front-end and backend code is to clone [peertube-plugin-quickstart-typescript](https://github.com/JohnXLivingston/peertube-plugin-quickstart-typescript/) (also available on [framagit](https://framagit.org/Livingston/peertube-plugin-quickstart-typescript/)) instead of `peertube-plugin-quickstart`.
Please read carefully the [README file](https://github.com/JohnXLivingston/peertube-plugin-quickstart-typescript/blob/main/README.md), as there are some other differences with `peertube-plugin-quickstart` (using SCSS instead of CSS, linting rules, ...).
If you don't want to use `peertube-plugin-quickstart-typescript`, you can also manually add a dev dependency to __Peertube__ types:
```
npm install --save-dev @peertube/peertube-types
......
......@@ -140,7 +140,7 @@ these rules (ensure to customize them to your needs):
0 0 * * * /usr/bin/npm rebuild youtube-dl --prefix /PATH/TO/PEERTUBE/
# Synchronize the YT channel every sunday at 22:00 all the videos published since last monday included
0 22 * * 0 /usr/bin/node /PATH/TO/PEERTUBE/dist/server/tools/peertube-import-videos.js -u '__PEERTUBE_URL__' -U '__USER__' --password '__PASSWORD__' --target-url 'https://www.youtube.com/channel/___CHANNEL__' --since $(date --date="-6 days" +%Y-%m-%d)
0 22 * * 0 /usr/bin/node /PATH/TO/PEERTUBE/dist/server/tools/peertube-import-videos.js -u '__PEERTUBE_URL__' -U '__USER__' --password '__PASSWORD__' --target-url 'https://www.youtube.com/channel/___CHANNEL__' --since $(date --date="-6 days" +\%Y-\%m-\%d)
```
Also you may want to subscribe to the PeerTube channel in order to manually check the synchronization is successful.
......