diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2019-12-11 22:13:20 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-12-13 09:13:43 +0100 |
commit | 88a7f93f8e5666f44121a2e3cf9d33d74c472aa7 (patch) | |
tree | 01a5d765f9ffed5cc4cbfc7b8c5fc14eb61548a7 | |
parent | 12f18b90ba6395464606052bb1bdfedb6b83df13 (diff) | |
download | PeerTube-88a7f93f8e5666f44121a2e3cf9d33d74c472aa7.tar.gz PeerTube-88a7f93f8e5666f44121a2e3cf9d33d74c472aa7.tar.zst PeerTube-88a7f93f8e5666f44121a2e3cf9d33d74c472aa7.zip |
add loop setting for playlists, and use sessionStorage
-rw-r--r-- | client/src/app/+admin/system/jobs/jobs.component.ts | 2 | ||||
-rw-r--r-- | client/src/app/core/auth/auth-user.model.ts | 2 | ||||
-rw-r--r-- | client/src/app/core/auth/auth.service.ts | 2 | ||||
-rw-r--r-- | client/src/app/core/server/server.service.ts | 2 | ||||
-rw-r--r-- | client/src/app/core/theme/theme.service.ts | 2 | ||||
-rw-r--r-- | client/src/app/shared/images/global-icon.component.ts | 1 | ||||
-rw-r--r-- | client/src/app/shared/misc/peertube-web-storage.ts (renamed from client/src/app/shared/misc/peertube-local-storage.ts) | 9 | ||||
-rw-r--r-- | client/src/app/shared/rest/rest-table.ts | 2 | ||||
-rw-r--r-- | client/src/app/videos/+video-watch/video-watch-playlist.component.html | 9 | ||||
-rw-r--r-- | client/src/app/videos/+video-watch/video-watch-playlist.component.scss | 4 | ||||
-rw-r--r-- | client/src/app/videos/+video-watch/video-watch-playlist.component.ts | 39 | ||||
-rw-r--r-- | client/src/app/videos/+video-watch/video-watch.component.ts | 9 | ||||
-rw-r--r-- | client/src/app/videos/recommendations/recommended-videos.component.ts | 8 | ||||
-rw-r--r-- | client/src/assets/images/global/repeat.svg | 1 |
14 files changed, 68 insertions, 24 deletions
diff --git a/client/src/app/+admin/system/jobs/jobs.component.ts b/client/src/app/+admin/system/jobs/jobs.component.ts index 95ee17023..c3211d71f 100644 --- a/client/src/app/+admin/system/jobs/jobs.component.ts +++ b/client/src/app/+admin/system/jobs/jobs.component.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, OnInit } from '@angular/core' |
2 | import { peertubeLocalStorage } from '@app/shared/misc/peertube-local-storage' | 2 | import { peertubeLocalStorage } from '@app/shared/misc/peertube-web-storage' |
3 | import { Notifier } from '@app/core' | 3 | import { Notifier } from '@app/core' |
4 | import { SortMeta } from 'primeng/api' | 4 | import { SortMeta } from 'primeng/api' |
5 | import { Job, JobType } from '../../../../../../shared/index' | 5 | import { Job, JobType } from '../../../../../../shared/index' |
diff --git a/client/src/app/core/auth/auth-user.model.ts b/client/src/app/core/auth/auth-user.model.ts index 334ede0cd..d371a923f 100644 --- a/client/src/app/core/auth/auth-user.model.ts +++ b/client/src/app/core/auth/auth-user.model.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { peertubeLocalStorage } from '@app/shared/misc/peertube-local-storage' | 1 | import { peertubeLocalStorage } from '@app/shared/misc/peertube-web-storage' |
2 | import { UserRight } from '../../../../../shared/models/users/user-right.enum' | 2 | import { UserRight } from '../../../../../shared/models/users/user-right.enum' |
3 | import { User as ServerUserModel } from '../../../../../shared/models/users/user.model' | 3 | import { User as ServerUserModel } from '../../../../../shared/models/users/user.model' |
4 | // Do not use the barrel (dependency loop) | 4 | // Do not use the barrel (dependency loop) |
diff --git a/client/src/app/core/auth/auth.service.ts b/client/src/app/core/auth/auth.service.ts index eaa822e0f..d601cadf5 100644 --- a/client/src/app/core/auth/auth.service.ts +++ b/client/src/app/core/auth/auth.service.ts | |||
@@ -12,7 +12,7 @@ import { RestExtractor } from '../../shared/rest/rest-extractor.service' | |||
12 | import { AuthStatus } from './auth-status.model' | 12 | import { AuthStatus } from './auth-status.model' |
13 | import { AuthUser } from './auth-user.model' | 13 | import { AuthUser } from './auth-user.model' |
14 | import { objectToUrlEncoded } from '@app/shared/misc/utils' | 14 | import { objectToUrlEncoded } from '@app/shared/misc/utils' |
15 | import { peertubeLocalStorage } from '@app/shared/misc/peertube-local-storage' | 15 | import { peertubeLocalStorage } from '@app/shared/misc/peertube-web-storage' |
16 | import { I18n } from '@ngx-translate/i18n-polyfill' | 16 | import { I18n } from '@ngx-translate/i18n-polyfill' |
17 | import { Hotkey, HotkeysService } from 'angular2-hotkeys' | 17 | import { Hotkey, HotkeysService } from 'angular2-hotkeys' |
18 | 18 | ||
diff --git a/client/src/app/core/server/server.service.ts b/client/src/app/core/server/server.service.ts index 8e76bebb1..cf9c411a4 100644 --- a/client/src/app/core/server/server.service.ts +++ b/client/src/app/core/server/server.service.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { map, shareReplay, switchMap, tap } from 'rxjs/operators' | 1 | import { map, shareReplay, switchMap, tap } from 'rxjs/operators' |
2 | import { HttpClient } from '@angular/common/http' | 2 | import { HttpClient } from '@angular/common/http' |
3 | import { Inject, Injectable, LOCALE_ID } from '@angular/core' | 3 | import { Inject, Injectable, LOCALE_ID } from '@angular/core' |
4 | import { peertubeLocalStorage } from '@app/shared/misc/peertube-local-storage' | 4 | import { peertubeLocalStorage } from '@app/shared/misc/peertube-web-storage' |
5 | import { Observable, of, ReplaySubject } from 'rxjs' | 5 | import { Observable, of, ReplaySubject } from 'rxjs' |
6 | import { getCompleteLocale, ServerConfig } from '../../../../../shared' | 6 | import { getCompleteLocale, ServerConfig } from '../../../../../shared' |
7 | import { environment } from '../../../environments/environment' | 7 | import { environment } from '../../../environments/environment' |
diff --git a/client/src/app/core/theme/theme.service.ts b/client/src/app/core/theme/theme.service.ts index b312e8f7a..9be8e7a2d 100644 --- a/client/src/app/core/theme/theme.service.ts +++ b/client/src/app/core/theme/theme.service.ts | |||
@@ -4,7 +4,7 @@ import { ServerService } from '@app/core/server' | |||
4 | import { environment } from '../../../environments/environment' | 4 | import { environment } from '../../../environments/environment' |
5 | import { PluginService } from '@app/core/plugins/plugin.service' | 5 | import { PluginService } from '@app/core/plugins/plugin.service' |
6 | import { ServerConfigTheme } from '@shared/models' | 6 | import { ServerConfigTheme } from '@shared/models' |
7 | import { peertubeLocalStorage } from '@app/shared/misc/peertube-local-storage' | 7 | import { peertubeLocalStorage } from '@app/shared/misc/peertube-web-storage' |
8 | 8 | ||
9 | @Injectable() | 9 | @Injectable() |
10 | export class ThemeService { | 10 | export class ThemeService { |
diff --git a/client/src/app/shared/images/global-icon.component.ts b/client/src/app/shared/images/global-icon.component.ts index eb723db94..31cfe2666 100644 --- a/client/src/app/shared/images/global-icon.component.ts +++ b/client/src/app/shared/images/global-icon.component.ts | |||
@@ -26,6 +26,7 @@ const icons = { | |||
26 | 'cross': require('!!raw-loader?!../../../assets/images/global/cross.svg'), | 26 | 'cross': require('!!raw-loader?!../../../assets/images/global/cross.svg'), |
27 | 'validate': require('!!raw-loader?!../../../assets/images/global/validate.svg'), | 27 | 'validate': require('!!raw-loader?!../../../assets/images/global/validate.svg'), |
28 | 'tick': require('!!raw-loader?!../../../assets/images/global/tick.svg'), | 28 | 'tick': require('!!raw-loader?!../../../assets/images/global/tick.svg'), |
29 | 'repeat': require('!!raw-loader?!../../../assets/images/global/repeat.svg'), | ||
29 | 'dislike': require('!!raw-loader?!../../../assets/images/video/dislike.svg'), | 30 | 'dislike': require('!!raw-loader?!../../../assets/images/video/dislike.svg'), |
30 | 'support': require('!!raw-loader?!../../../assets/images/video/support.svg'), | 31 | 'support': require('!!raw-loader?!../../../assets/images/video/support.svg'), |
31 | 'like': require('!!raw-loader?!../../../assets/images/video/like.svg'), | 32 | 'like': require('!!raw-loader?!../../../assets/images/video/like.svg'), |
diff --git a/client/src/app/shared/misc/peertube-local-storage.ts b/client/src/app/shared/misc/peertube-web-storage.ts index fb5c45acf..fff209678 100644 --- a/client/src/app/shared/misc/peertube-local-storage.ts +++ b/client/src/app/shared/misc/peertube-web-storage.ts | |||
@@ -42,12 +42,14 @@ class MemoryStorage { | |||
42 | } | 42 | } |
43 | 43 | ||
44 | let peertubeLocalStorage: Storage | 44 | let peertubeLocalStorage: Storage |
45 | let peertubeSessionStorage: Storage | ||
45 | try { | 46 | try { |
46 | peertubeLocalStorage = localStorage | 47 | peertubeLocalStorage = localStorage |
48 | peertubeSessionStorage = sessionStorage | ||
47 | } catch (err) { | 49 | } catch (err) { |
48 | const instance = new MemoryStorage() | 50 | const instance = new MemoryStorage() |
49 | 51 | ||
50 | peertubeLocalStorage = new Proxy(instance, { | 52 | peertubeLocalStorage = sessionStorage = new Proxy(instance, { |
51 | set: function (obj, prop: string | number, value) { | 53 | set: function (obj, prop: string | number, value) { |
52 | if (MemoryStorage.prototype.hasOwnProperty(prop)) { | 54 | if (MemoryStorage.prototype.hasOwnProperty(prop)) { |
53 | instance[prop] = value | 55 | instance[prop] = value |
@@ -67,4 +69,7 @@ try { | |||
67 | }) | 69 | }) |
68 | } | 70 | } |
69 | 71 | ||
70 | export { peertubeLocalStorage } | 72 | export { |
73 | peertubeLocalStorage, | ||
74 | peertubeSessionStorage | ||
75 | } | ||
diff --git a/client/src/app/shared/rest/rest-table.ts b/client/src/app/shared/rest/rest-table.ts index 884588207..c180346af 100644 --- a/client/src/app/shared/rest/rest-table.ts +++ b/client/src/app/shared/rest/rest-table.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { peertubeLocalStorage } from '@app/shared/misc/peertube-local-storage' | 1 | import { peertubeLocalStorage } from '@app/shared/misc/peertube-web-storage' |
2 | import { LazyLoadEvent } from 'primeng/components/common/lazyloadevent' | 2 | import { LazyLoadEvent } from 'primeng/components/common/lazyloadevent' |
3 | import { SortMeta } from 'primeng/components/common/sortmeta' | 3 | import { SortMeta } from 'primeng/components/common/sortmeta' |
4 | import { RestPagination } from './rest-pagination' | 4 | import { RestPagination } from './rest-pagination' |
diff --git a/client/src/app/videos/+video-watch/video-watch-playlist.component.html b/client/src/app/videos/+video-watch/video-watch-playlist.component.html index c07ba1ed6..a04081d35 100644 --- a/client/src/app/videos/+video-watch/video-watch-playlist.component.html +++ b/client/src/app/videos/+video-watch/video-watch-playlist.component.html | |||
@@ -24,6 +24,15 @@ | |||
24 | placement="bottom auto" | 24 | placement="bottom auto" |
25 | container="body" | 25 | container="body" |
26 | ></my-global-icon> | 26 | ></my-global-icon> |
27 | |||
28 | <my-global-icon | ||
29 | iconName="repeat" | ||
30 | [class.active]="loopPlaylist" | ||
31 | (click)="switchLoopPlaylist()" | ||
32 | [ngbTooltip]="'Loop playlist videos'" | ||
33 | placement="bottom auto" | ||
34 | container="body" | ||
35 | ></my-global-icon> | ||
27 | </div> | 36 | </div> |
28 | </div> | 37 | </div> |
29 | 38 | ||
diff --git a/client/src/app/videos/+video-watch/video-watch-playlist.component.scss b/client/src/app/videos/+video-watch/video-watch-playlist.component.scss index ba8d1c3e1..0dd318cb0 100644 --- a/client/src/app/videos/+video-watch/video-watch-playlist.component.scss +++ b/client/src/app/videos/+video-watch/video-watch-playlist.component.scss | |||
@@ -39,6 +39,10 @@ | |||
39 | display: flex; | 39 | display: flex; |
40 | margin: 10px 0; | 40 | margin: 10px 0; |
41 | 41 | ||
42 | my-global-icon:not(:last-child) { | ||
43 | margin-right: .5rem; | ||
44 | } | ||
45 | |||
42 | my-global-icon { | 46 | my-global-icon { |
43 | &:not(.active) { | 47 | &:not(.active) { |
44 | opacity: .5 | 48 | opacity: .5 |
diff --git a/client/src/app/videos/+video-watch/video-watch-playlist.component.ts b/client/src/app/videos/+video-watch/video-watch-playlist.component.ts index ed2aeda6e..c6b04fd4b 100644 --- a/client/src/app/videos/+video-watch/video-watch-playlist.component.ts +++ b/client/src/app/videos/+video-watch/video-watch-playlist.component.ts | |||
@@ -3,11 +3,11 @@ import { VideoPlaylist } from '@app/shared/video-playlist/video-playlist.model' | |||
3 | import { ComponentPagination } from '@app/shared/rest/component-pagination.model' | 3 | import { ComponentPagination } from '@app/shared/rest/component-pagination.model' |
4 | import { VideoDetails, VideoPlaylistPrivacy } from '@shared/models' | 4 | import { VideoDetails, VideoPlaylistPrivacy } from '@shared/models' |
5 | import { Router } from '@angular/router' | 5 | import { Router } from '@angular/router' |
6 | import { User, UserService } from '@app/shared' | 6 | import { UserService } from '@app/shared' |
7 | import { AuthService, Notifier } from '@app/core' | 7 | import { AuthService, Notifier } from '@app/core' |
8 | import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service' | 8 | import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service' |
9 | import { VideoPlaylistElement } from '@app/shared/video-playlist/video-playlist-element.model' | 9 | import { VideoPlaylistElement } from '@app/shared/video-playlist/video-playlist-element.model' |
10 | import { peertubeLocalStorage } from '@app/shared/misc/peertube-local-storage' | 10 | import { peertubeLocalStorage, peertubeSessionStorage } from '@app/shared/misc/peertube-web-storage' |
11 | import { I18n } from '@ngx-translate/i18n-polyfill' | 11 | import { I18n } from '@ngx-translate/i18n-polyfill' |
12 | 12 | ||
13 | @Component({ | 13 | @Component({ |
@@ -17,6 +17,7 @@ import { I18n } from '@ngx-translate/i18n-polyfill' | |||
17 | }) | 17 | }) |
18 | export class VideoWatchPlaylistComponent { | 18 | export class VideoWatchPlaylistComponent { |
19 | static LOCAL_STORAGE_AUTO_PLAY_NEXT_VIDEO_PLAYLIST = 'auto_play_video_playlist' | 19 | static LOCAL_STORAGE_AUTO_PLAY_NEXT_VIDEO_PLAYLIST = 'auto_play_video_playlist' |
20 | static SESSION_STORAGE_AUTO_PLAY_NEXT_VIDEO_PLAYLIST = 'loop_playlist' | ||
20 | 21 | ||
21 | @Input() video: VideoDetails | 22 | @Input() video: VideoDetails |
22 | @Input() playlist: VideoPlaylist | 23 | @Input() playlist: VideoPlaylist |
@@ -30,6 +31,8 @@ export class VideoWatchPlaylistComponent { | |||
30 | 31 | ||
31 | autoPlayNextVideoPlaylist: boolean | 32 | autoPlayNextVideoPlaylist: boolean |
32 | autoPlayNextVideoPlaylistSwitchText = '' | 33 | autoPlayNextVideoPlaylistSwitchText = '' |
34 | loopPlaylist: boolean | ||
35 | loopPlaylistSwitchText = '' | ||
33 | noPlaylistVideos = false | 36 | noPlaylistVideos = false |
34 | currentPlaylistPosition = 1 | 37 | currentPlaylistPosition = 1 |
35 | 38 | ||
@@ -45,6 +48,9 @@ export class VideoWatchPlaylistComponent { | |||
45 | ? this.auth.getUser().autoPlayNextVideoPlaylist | 48 | ? this.auth.getUser().autoPlayNextVideoPlaylist |
46 | : peertubeLocalStorage.getItem(VideoWatchPlaylistComponent.LOCAL_STORAGE_AUTO_PLAY_NEXT_VIDEO_PLAYLIST) !== 'false' | 49 | : peertubeLocalStorage.getItem(VideoWatchPlaylistComponent.LOCAL_STORAGE_AUTO_PLAY_NEXT_VIDEO_PLAYLIST) !== 'false' |
47 | this.setAutoPlayNextVideoPlaylistSwitchText() | 50 | this.setAutoPlayNextVideoPlaylistSwitchText() |
51 | |||
52 | this.loopPlaylist = peertubeSessionStorage.getItem(VideoWatchPlaylistComponent.SESSION_STORAGE_AUTO_PLAY_NEXT_VIDEO_PLAYLIST) === 'true' | ||
53 | this.setLoopPlaylistSwitchText() | ||
48 | } | 54 | } |
49 | 55 | ||
50 | onPlaylistVideosNearOfBottom () { | 56 | onPlaylistVideosNearOfBottom () { |
@@ -121,9 +127,9 @@ export class VideoWatchPlaylistComponent { | |||
121 | this.onPlaylistVideosNearOfBottom() | 127 | this.onPlaylistVideosNearOfBottom() |
122 | } | 128 | } |
123 | 129 | ||
124 | navigateToNextPlaylistVideo () { | 130 | navigateToNextPlaylistVideo (_next: VideoPlaylistElement = null) { |
125 | if (this.currentPlaylistPosition < this.playlistPagination.totalItems) { | 131 | if (this.currentPlaylistPosition < this.playlistPagination.totalItems) { |
126 | const next = this.playlistElements.find(e => e.position === this.currentPlaylistPosition + 1) | 132 | const next = _next || this.playlistElements.find(e => e.position === this.currentPlaylistPosition + 1) |
127 | 133 | ||
128 | if (!next || !next.video) { | 134 | if (!next || !next.video) { |
129 | this.currentPlaylistPosition++ | 135 | this.currentPlaylistPosition++ |
@@ -134,6 +140,9 @@ export class VideoWatchPlaylistComponent { | |||
134 | const start = next.startTimestamp | 140 | const start = next.startTimestamp |
135 | const stop = next.stopTimestamp | 141 | const stop = next.stopTimestamp |
136 | this.router.navigate([],{ queryParams: { videoId: next.video.uuid, start, stop } }) | 142 | this.router.navigate([],{ queryParams: { videoId: next.video.uuid, start, stop } }) |
143 | } else if (this.loopPlaylist) { | ||
144 | this.currentPlaylistPosition = 0 | ||
145 | this.navigateToNextPlaylistVideo(this.playlistElements.find(e => e.position === this.currentPlaylistPosition)) | ||
137 | } | 146 | } |
138 | } | 147 | } |
139 | 148 | ||
@@ -160,9 +169,25 @@ export class VideoWatchPlaylistComponent { | |||
160 | } | 169 | } |
161 | } | 170 | } |
162 | 171 | ||
172 | switchLoopPlaylist () { | ||
173 | this.loopPlaylist = !this.loopPlaylist | ||
174 | this.setLoopPlaylistSwitchText() | ||
175 | |||
176 | peertubeSessionStorage.setItem( | ||
177 | VideoWatchPlaylistComponent.SESSION_STORAGE_AUTO_PLAY_NEXT_VIDEO_PLAYLIST, | ||
178 | this.loopPlaylist.toString() | ||
179 | ) | ||
180 | } | ||
181 | |||
163 | private setAutoPlayNextVideoPlaylistSwitchText () { | 182 | private setAutoPlayNextVideoPlaylistSwitchText () { |
164 | this.autoPlayNextVideoPlaylistSwitchText = this.i18n('{{verb}} autoplay for playlists', { | 183 | this.autoPlayNextVideoPlaylistSwitchText = this.autoPlayNextVideoPlaylist |
165 | verb: this.autoPlayNextVideoPlaylist ? this.i18n('Disable') : this.i18n('Enable') | 184 | ? this.i18n('Stop autoplaying next video') |
166 | }) | 185 | : this.i18n('Autoplay next video') |
186 | } | ||
187 | |||
188 | private setLoopPlaylistSwitchText () { | ||
189 | this.loopPlaylistSwitchText = this.loopPlaylist | ||
190 | ? this.i18n('Stop looping playlist videos') | ||
191 | : this.i18n('Loop playlist videos') | ||
167 | } | 192 | } |
168 | } | 193 | } |
diff --git a/client/src/app/videos/+video-watch/video-watch.component.ts b/client/src/app/videos/+video-watch/video-watch.component.ts index 92c1c50c0..aaaa63d4d 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.ts +++ b/client/src/app/videos/+video-watch/video-watch.component.ts | |||
@@ -2,7 +2,7 @@ import { catchError } from 'rxjs/operators' | |||
2 | import { ChangeDetectorRef, Component, ElementRef, Inject, LOCALE_ID, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core' | 2 | import { ChangeDetectorRef, Component, ElementRef, Inject, LOCALE_ID, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core' |
3 | import { ActivatedRoute, Router } from '@angular/router' | 3 | import { ActivatedRoute, Router } from '@angular/router' |
4 | import { RedirectService } from '@app/core/routing/redirect.service' | 4 | import { RedirectService } from '@app/core/routing/redirect.service' |
5 | import { peertubeLocalStorage } from '@app/shared/misc/peertube-local-storage' | 5 | import { peertubeLocalStorage, peertubeSessionStorage } from '@app/shared/misc/peertube-web-storage' |
6 | import { VideoSupportComponent } from '@app/videos/+video-watch/modal/video-support.component' | 6 | import { VideoSupportComponent } from '@app/videos/+video-watch/modal/video-support.component' |
7 | import { MetaService } from '@ngx-meta/core' | 7 | import { MetaService } from '@ngx-meta/core' |
8 | import { AuthUser, Notifier, ServerService } from '@app/core' | 8 | import { AuthUser, Notifier, ServerService } from '@app/core' |
@@ -46,7 +46,6 @@ import { RecommendedVideosComponent } from '../recommendations/recommended-video | |||
46 | }) | 46 | }) |
47 | export class VideoWatchComponent implements OnInit, OnDestroy { | 47 | export class VideoWatchComponent implements OnInit, OnDestroy { |
48 | private static LOCAL_STORAGE_PRIVACY_CONCERN_KEY = 'video-watch-privacy-concern' | 48 | private static LOCAL_STORAGE_PRIVACY_CONCERN_KEY = 'video-watch-privacy-concern' |
49 | private static LOCAL_STORAGE_AUTO_PLAY_NEXT_VIDEO = 'auto_play_next_video' | ||
50 | 49 | ||
51 | @ViewChild('videoWatchPlaylist', { static: true }) videoWatchPlaylist: VideoWatchPlaylistComponent | 50 | @ViewChild('videoWatchPlaylist', { static: true }) videoWatchPlaylist: VideoWatchPlaylistComponent |
52 | @ViewChild('videoShareModal', { static: false }) videoShareModal: VideoShareComponent | 51 | @ViewChild('videoShareModal', { static: false }) videoShareModal: VideoShareComponent |
@@ -439,11 +438,11 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
439 | if (this.playlist) { | 438 | if (this.playlist) { |
440 | if ( | 439 | if ( |
441 | this.user && this.user.autoPlayNextVideoPlaylist || | 440 | this.user && this.user.autoPlayNextVideoPlaylist || |
442 | peertubeLocalStorage.getItem(VideoWatchPlaylistComponent.LOCAL_STORAGE_AUTO_PLAY_NEXT_VIDEO_PLAYLIST) === 'true' | 441 | peertubeSessionStorage.getItem(VideoWatchPlaylistComponent.SESSION_STORAGE_AUTO_PLAY_NEXT_VIDEO_PLAYLIST) === 'true' |
443 | ) this.zone.run(() => this.videoWatchPlaylist.navigateToNextPlaylistVideo()) | 442 | ) this.zone.run(() => this.videoWatchPlaylist.navigateToNextPlaylistVideo()) |
444 | } else if ( | 443 | } else if ( |
445 | this.user && this.user.autoPlayNextVideo || | 444 | this.user && this.user.autoPlayNextVideo || |
446 | peertubeLocalStorage.getItem(RecommendedVideosComponent.LOCAL_STORAGE_AUTO_PLAY_NEXT_VIDEO) === 'true' | 445 | peertubeSessionStorage.getItem(RecommendedVideosComponent.SESSION_STORAGE_AUTO_PLAY_NEXT_VIDEO) === 'true' |
447 | ) { | 446 | ) { |
448 | this.zone.run(() => this.autoplayNext()) | 447 | this.zone.run(() => this.autoplayNext()) |
449 | } | 448 | } |
@@ -453,7 +452,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
453 | if (this.playlist) { | 452 | if (this.playlist) { |
454 | if ( | 453 | if ( |
455 | this.user && this.user.autoPlayNextVideoPlaylist || | 454 | this.user && this.user.autoPlayNextVideoPlaylist || |
456 | peertubeLocalStorage.getItem(VideoWatchPlaylistComponent.LOCAL_STORAGE_AUTO_PLAY_NEXT_VIDEO_PLAYLIST) === 'true' | 455 | peertubeSessionStorage.getItem(VideoWatchPlaylistComponent.SESSION_STORAGE_AUTO_PLAY_NEXT_VIDEO_PLAYLIST) === 'true' |
457 | ) this.zone.run(() => this.videoWatchPlaylist.navigateToNextPlaylistVideo()) | 456 | ) this.zone.run(() => this.videoWatchPlaylist.navigateToNextPlaylistVideo()) |
458 | } | 457 | } |
459 | }) | 458 | }) |
diff --git a/client/src/app/videos/recommendations/recommended-videos.component.ts b/client/src/app/videos/recommendations/recommended-videos.component.ts index 771ae54a2..fdcfb28e3 100644 --- a/client/src/app/videos/recommendations/recommended-videos.component.ts +++ b/client/src/app/videos/recommendations/recommended-videos.component.ts | |||
@@ -7,7 +7,7 @@ import { RecommendedVideosStore } from '@app/videos/recommendations/recommended- | |||
7 | import { User } from '@app/shared' | 7 | import { User } from '@app/shared' |
8 | import { AuthService, Notifier } from '@app/core' | 8 | import { AuthService, Notifier } from '@app/core' |
9 | import { UserService } from '@app/shared/users/user.service' | 9 | import { UserService } from '@app/shared/users/user.service' |
10 | import { peertubeLocalStorage } from '@app/shared/misc/peertube-local-storage' | 10 | import { peertubeSessionStorage } from '@app/shared/misc/peertube-web-storage' |
11 | 11 | ||
12 | @Component({ | 12 | @Component({ |
13 | selector: 'my-recommended-videos', | 13 | selector: 'my-recommended-videos', |
@@ -15,7 +15,7 @@ import { peertubeLocalStorage } from '@app/shared/misc/peertube-local-storage' | |||
15 | styleUrls: [ './recommended-videos.component.scss' ] | 15 | styleUrls: [ './recommended-videos.component.scss' ] |
16 | }) | 16 | }) |
17 | export class RecommendedVideosComponent implements OnChanges { | 17 | export class RecommendedVideosComponent implements OnChanges { |
18 | static LOCAL_STORAGE_AUTO_PLAY_NEXT_VIDEO = 'auto_play_next_video' | 18 | static SESSION_STORAGE_AUTO_PLAY_NEXT_VIDEO = 'auto_play_next_video' |
19 | 19 | ||
20 | @Input() inputRecommendation: RecommendationInfo | 20 | @Input() inputRecommendation: RecommendationInfo |
21 | @Input() user: User | 21 | @Input() user: User |
@@ -39,7 +39,7 @@ export class RecommendedVideosComponent implements OnChanges { | |||
39 | 39 | ||
40 | this.autoPlayNextVideo = this.authService.isLoggedIn() | 40 | this.autoPlayNextVideo = this.authService.isLoggedIn() |
41 | ? this.authService.getUser().autoPlayNextVideo | 41 | ? this.authService.getUser().autoPlayNextVideo |
42 | : peertubeLocalStorage.getItem(RecommendedVideosComponent.LOCAL_STORAGE_AUTO_PLAY_NEXT_VIDEO) === 'true' || false | 42 | : peertubeSessionStorage.getItem(RecommendedVideosComponent.SESSION_STORAGE_AUTO_PLAY_NEXT_VIDEO) === 'true' || false |
43 | } | 43 | } |
44 | 44 | ||
45 | public ngOnChanges (): void { | 45 | public ngOnChanges (): void { |
@@ -53,7 +53,7 @@ export class RecommendedVideosComponent implements OnChanges { | |||
53 | } | 53 | } |
54 | 54 | ||
55 | switchAutoPlayNextVideo () { | 55 | switchAutoPlayNextVideo () { |
56 | peertubeLocalStorage.setItem(RecommendedVideosComponent.LOCAL_STORAGE_AUTO_PLAY_NEXT_VIDEO, this.autoPlayNextVideo.toString()) | 56 | peertubeSessionStorage.setItem(RecommendedVideosComponent.SESSION_STORAGE_AUTO_PLAY_NEXT_VIDEO, this.autoPlayNextVideo.toString()) |
57 | 57 | ||
58 | if (this.authService.isLoggedIn()) { | 58 | if (this.authService.isLoggedIn()) { |
59 | const details = { | 59 | const details = { |
diff --git a/client/src/assets/images/global/repeat.svg b/client/src/assets/images/global/repeat.svg new file mode 100644 index 000000000..c7657b08e --- /dev/null +++ b/client/src/assets/images/global/repeat.svg | |||
@@ -0,0 +1 @@ | |||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-repeat"><polyline points="17 1 21 5 17 9"></polyline><path d="M3 11V9a4 4 0 0 1 4-4h14"></path><polyline points="7 23 3 19 7 15"></polyline><path d="M21 13v2a4 4 0 0 1-4 4H3"></path></svg> \ No newline at end of file | |||