aboutsummaryrefslogtreecommitdiffhomepage
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/package.json2
-rw-r--r--client/src/app/+videos/+video-edit/video-add.component.html2
-rw-r--r--client/src/app/+videos/+video-edit/video-add.component.ts2
-rw-r--r--client/src/app/core/routing/custom-reuse-strategy.ts12
-rw-r--r--client/src/app/core/users/user.model.ts5
-rw-r--r--client/src/app/shared/shared-main/angular/infinite-scroller.directive.ts3
-rw-r--r--client/src/app/shared/shared-video-miniature/videos-list.component.html3
-rw-r--r--client/src/app/shared/shared-video-miniature/videos-selection.component.html3
-rw-r--r--client/src/root-helpers/peertube-web-storage.ts13
-rw-r--r--client/src/standalone/videos/test-embed.ts2
10 files changed, 29 insertions, 18 deletions
diff --git a/client/package.json b/client/package.json
index 7d3edd0a7..afa0efe13 100644
--- a/client/package.json
+++ b/client/package.json
@@ -1,6 +1,6 @@
1{ 1{
2 "name": "peertube-client", 2 "name": "peertube-client",
3 "version": "3.4.0", 3 "version": "3.4.1",
4 "private": true, 4 "private": true,
5 "license": "AGPL-3.0", 5 "license": "AGPL-3.0",
6 "author": { 6 "author": {
diff --git a/client/src/app/+videos/+video-edit/video-add.component.html b/client/src/app/+videos/+video-edit/video-add.component.html
index 7dd9ba357..29cf08e75 100644
--- a/client/src/app/+videos/+video-edit/video-add.component.html
+++ b/client/src/app/+videos/+video-edit/video-add.component.html
@@ -15,7 +15,7 @@
15</ng-container> 15</ng-container>
16 16
17<ng-container *ngIf="!user.isUploadDisabled()"> 17<ng-container *ngIf="!user.isUploadDisabled()">
18 <div *ngIf="user.isAutoBlocked()" class="upload-message auto-blocked alert alert-warning"> 18 <div *ngIf="user.isAutoBlocked(serverConfig)" class="upload-message auto-blocked alert alert-warning">
19 <div>{{ uploadMessages.autoBlock }}</div> 19 <div>{{ uploadMessages.autoBlock }}</div>
20 <ng-template [ngTemplateOutlet]="AlertButtons" *ngIf="!hasNoQuotaLeft && !hasNoQuotaLeftDaily"></ng-template> 20 <ng-template [ngTemplateOutlet]="AlertButtons" *ngIf="!hasNoQuotaLeft && !hasNoQuotaLeftDaily"></ng-template>
21 </div> 21 </div>
diff --git a/client/src/app/+videos/+video-edit/video-add.component.ts b/client/src/app/+videos/+video-edit/video-add.component.ts
index 46881be4e..bcb2fc4fa 100644
--- a/client/src/app/+videos/+video-edit/video-add.component.ts
+++ b/client/src/app/+videos/+video-edit/video-add.component.ts
@@ -43,7 +43,7 @@ export class VideoAddComponent implements OnInit, CanComponentDeactivate {
43 hasNoQuotaLeft = false 43 hasNoQuotaLeft = false
44 hasNoQuotaLeftDaily = false 44 hasNoQuotaLeftDaily = false
45 45
46 private serverConfig: HTMLServerConfig 46 serverConfig: HTMLServerConfig
47 47
48 constructor ( 48 constructor (
49 private auth: AuthService, 49 private auth: AuthService,
diff --git a/client/src/app/core/routing/custom-reuse-strategy.ts b/client/src/app/core/routing/custom-reuse-strategy.ts
index 3000093a8..1498e221f 100644
--- a/client/src/app/core/routing/custom-reuse-strategy.ts
+++ b/client/src/app/core/routing/custom-reuse-strategy.ts
@@ -1,7 +1,7 @@
1import { Injectable } from '@angular/core' 1import { ComponentRef, Injectable } from '@angular/core'
2import { ActivatedRouteSnapshot, DetachedRouteHandle, RouteReuseStrategy } from '@angular/router' 2import { ActivatedRouteSnapshot, DetachedRouteHandle, RouteReuseStrategy } from '@angular/router'
3import { RouterSetting } from './' 3import { DisableForReuseHook } from './disable-for-reuse-hook'
4import { PeerTubeRouterService } from './peertube-router.service' 4import { PeerTubeRouterService, RouterSetting } from './peertube-router.service'
5 5
6@Injectable() 6@Injectable()
7export class CustomReuseStrategy implements RouteReuseStrategy { 7export class CustomReuseStrategy implements RouteReuseStrategy {
@@ -22,9 +22,11 @@ export class CustomReuseStrategy implements RouteReuseStrategy {
22 const key = this.generateKey(route) 22 const key = this.generateKey(route)
23 this.recentlyUsed = key 23 this.recentlyUsed = key
24 24
25 console.log('Storing component %s to reuse later.', key); 25 console.log('Storing component %s to reuse later.', key)
26 26
27 (handle as any).componentRef.instance.disableForReuse() 27 const componentRef = (handle as any).componentRef as ComponentRef<DisableForReuseHook>
28 componentRef.instance.disableForReuse()
29 componentRef.changeDetectorRef.detectChanges()
28 30
29 this.storedRouteHandles.set(key, handle) 31 this.storedRouteHandles.set(key, handle)
30 32
diff --git a/client/src/app/core/users/user.model.ts b/client/src/app/core/users/user.model.ts
index 00078af5d..c0e5d3169 100644
--- a/client/src/app/core/users/user.model.ts
+++ b/client/src/app/core/users/user.model.ts
@@ -2,6 +2,7 @@ import { Account } from '@app/shared/shared-main/account/account.model'
2import { hasUserRight } from '@shared/core-utils/users' 2import { hasUserRight } from '@shared/core-utils/users'
3import { 3import {
4 ActorImage, 4 ActorImage,
5 HTMLServerConfig,
5 NSFWPolicyType, 6 NSFWPolicyType,
6 User as UserServerModel, 7 User as UserServerModel,
7 UserAdminFlag, 8 UserAdminFlag,
@@ -136,7 +137,9 @@ export class User implements UserServerModel {
136 return this.videoQuota === 0 || this.videoQuotaDaily === 0 137 return this.videoQuota === 0 || this.videoQuotaDaily === 0
137 } 138 }
138 139
139 isAutoBlocked () { 140 isAutoBlocked (serverConfig: HTMLServerConfig) {
141 if (serverConfig.autoBlacklist.videos.ofUsers.enabled !== true) return false
142
140 return this.role === UserRole.USER && this.adminFlags !== UserAdminFlag.BYPASS_VIDEO_AUTO_BLACKLIST 143 return this.role === UserRole.USER && this.adminFlags !== UserAdminFlag.BYPASS_VIDEO_AUTO_BLACKLIST
141 } 144 }
142} 145}
diff --git a/client/src/app/shared/shared-main/angular/infinite-scroller.directive.ts b/client/src/app/shared/shared-main/angular/infinite-scroller.directive.ts
index bebc6efa7..c247cfde2 100644
--- a/client/src/app/shared/shared-main/angular/infinite-scroller.directive.ts
+++ b/client/src/app/shared/shared-main/angular/infinite-scroller.directive.ts
@@ -13,6 +13,7 @@ export class InfiniteScrollerDirective implements OnInit, OnDestroy, AfterViewCh
13 13
14 // Add angular state in query params to reuse the routed component 14 // Add angular state in query params to reuse the routed component
15 @Input() setAngularState: boolean 15 @Input() setAngularState: boolean
16 @Input() parentDisabled = false
16 17
17 @Output() nearOfBottom = new EventEmitter<void>() 18 @Output() nearOfBottom = new EventEmitter<void>()
18 19
@@ -74,7 +75,7 @@ export class InfiniteScrollerDirective implements OnInit, OnDestroy, AfterViewCh
74 filter(({ current, maximumScroll }) => (current / maximumScroll) > this.decimalLimit) 75 filter(({ current, maximumScroll }) => (current / maximumScroll) > this.decimalLimit)
75 ) 76 )
76 .subscribe(() => { 77 .subscribe(() => {
77 if (this.setAngularState) this.setScrollRouteParams() 78 if (this.setAngularState && !this.parentDisabled) this.setScrollRouteParams()
78 79
79 this.nearOfBottom.emit() 80 this.nearOfBottom.emit()
80 }) 81 })
diff --git a/client/src/app/shared/shared-video-miniature/videos-list.component.html b/client/src/app/shared/shared-video-miniature/videos-list.component.html
index 67933f177..2b554517f 100644
--- a/client/src/app/shared/shared-video-miniature/videos-list.component.html
+++ b/client/src/app/shared/shared-video-miniature/videos-list.component.html
@@ -40,7 +40,8 @@
40 40
41 <div class="no-results" i18n *ngIf="hasDoneFirstQuery && videos.length === 0">No results.</div> 41 <div class="no-results" i18n *ngIf="hasDoneFirstQuery && videos.length === 0">No results.</div>
42 <div 42 <div
43 myInfiniteScroller (nearOfBottom)="onNearOfBottom()" [dataObservable]="onDataSubject.asObservable()" [setAngularState]="true" 43 myInfiniteScroller (nearOfBottom)="onNearOfBottom()" [dataObservable]="onDataSubject.asObservable()"
44 [setAngularState]="true" [parentDisabled]="disabled"
44 class="videos" [ngClass]="{ 'display-as-row': displayAsRow }" 45 class="videos" [ngClass]="{ 'display-as-row': displayAsRow }"
45 > 46 >
46 <ng-container *ngFor="let video of videos; trackBy: videoById;"> 47 <ng-container *ngFor="let video of videos; trackBy: videoById;">
diff --git a/client/src/app/shared/shared-video-miniature/videos-selection.component.html b/client/src/app/shared/shared-video-miniature/videos-selection.component.html
index f2af874dd..6ea2661e4 100644
--- a/client/src/app/shared/shared-video-miniature/videos-selection.component.html
+++ b/client/src/app/shared/shared-video-miniature/videos-selection.component.html
@@ -2,7 +2,8 @@
2 2
3<div 3<div
4 class="videos" 4 class="videos"
5 myInfiniteScroller (nearOfBottom)="onNearOfBottom()" [dataObservable]="onDataSubject.asObservable()" [setAngularState]="true" 5 myInfiniteScroller (nearOfBottom)="onNearOfBottom()" [dataObservable]="onDataSubject.asObservable()"
6 [parentDisabled]="disabled" [setAngularState]="true"
6> 7>
7 <div class="video" *ngFor="let video of videos; let i = index; trackBy: videoById"> 8 <div class="video" *ngFor="let video of videos; let i = index; trackBy: videoById">
8 9
diff --git a/client/src/root-helpers/peertube-web-storage.ts b/client/src/root-helpers/peertube-web-storage.ts
index 68a2462de..3622cdc44 100644
--- a/client/src/root-helpers/peertube-web-storage.ts
+++ b/client/src/root-helpers/peertube-web-storage.ts
@@ -6,19 +6,20 @@ function proxify (instance: MemoryStorage) {
6 return new Proxy(instance, { 6 return new Proxy(instance, {
7 set: function (obj, prop: string | symbol, value) { 7 set: function (obj, prop: string | symbol, value) {
8 if (Object.prototype.hasOwnProperty.call(MemoryStorage, prop)) { 8 if (Object.prototype.hasOwnProperty.call(MemoryStorage, prop)) {
9 // FIXME: symbol typing issue https://github.com/microsoft/TypeScript/issues/1863 9 // FIXME: remove cast on typescript upgrade
10 instance[prop as any] = value 10 instance[prop as any] = value
11 } else { 11 } else {
12 instance.setItem(prop, value) 12 instance.setItem(prop, value)
13 } 13 }
14
14 return true 15 return true
15 }, 16 },
16 get: function (target, name: string | symbol | number) { 17 get: function (target, name: string | symbol | number) {
17 if (Object.prototype.hasOwnProperty.call(MemoryStorage, name)) { 18 // FIXME: remove cast on typescript upgrade
18 // FIXME: symbol typing issue https://github.com/microsoft/TypeScript/issues/1863 19 if (typeof instance[name as any] === 'function') {
20 // FIXME: remove cast on typescript upgrade
19 return instance[name as any] 21 return instance[name as any]
20 } 22 } else if (valuesMap.has(name)) {
21 if (valuesMap.has(name)) {
22 return instance.getItem(name) 23 return instance.getItem(name)
23 } 24 }
24 } 25 }
@@ -83,7 +84,7 @@ try {
83} 84}
84 85
85// support Brave and other browsers using null rather than an exception 86// support Brave and other browsers using null rather than an exception
86if (peertubeLocalStorage === null || peertubeSessionStorage === null) { 87if (!peertubeLocalStorage || !peertubeSessionStorage) {
87 reinitStorage() 88 reinitStorage()
88} 89}
89 90
diff --git a/client/src/standalone/videos/test-embed.ts b/client/src/standalone/videos/test-embed.ts
index 7213cbf8b..18c338a2d 100644
--- a/client/src/standalone/videos/test-embed.ts
+++ b/client/src/standalone/videos/test-embed.ts
@@ -15,6 +15,8 @@ window.addEventListener('load', async () => {
15 ? `/video-playlists/embed/${elementId}?api=1` 15 ? `/video-playlists/embed/${elementId}?api=1`
16 : `/videos/embed/${elementId}?api=1` 16 : `/videos/embed/${elementId}?api=1`
17 17
18 iframe.sandbox.add('allow-same-origin', 'allow-scripts', 'allow-popups')
19
18 const mainElement = document.querySelector('#host') 20 const mainElement = document.querySelector('#host')
19 mainElement.appendChild(iframe) 21 mainElement.appendChild(iframe)
20 22