diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2020-08-03 18:06:49 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-08-06 15:08:58 +0200 |
commit | 4504f09f6e85f09b0489debb547a17209d7176ea (patch) | |
tree | 1e2fdcdd3a0982f6e873205f69bdf90de7f4a883 /client/src/app | |
parent | 71ab65d02f359000f9ca6a00f163d66d56a33955 (diff) | |
download | PeerTube-4504f09f6e85f09b0489debb547a17209d7176ea.tar.gz PeerTube-4504f09f6e85f09b0489debb547a17209d7176ea.tar.zst PeerTube-4504f09f6e85f09b0489debb547a17209d7176ea.zip |
deal with refresh token in embed
Diffstat (limited to 'client/src/app')
18 files changed, 103 insertions, 268 deletions
diff --git a/client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.ts b/client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.ts index 0048882bc..c29f69475 100644 --- a/client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.ts +++ b/client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.ts | |||
@@ -2,7 +2,7 @@ import { BytesPipe } from 'ngx-pipes' | |||
2 | import { SortMeta } from 'primeng/api' | 2 | import { SortMeta } from 'primeng/api' |
3 | import { Component, OnInit } from '@angular/core' | 3 | import { Component, OnInit } from '@angular/core' |
4 | import { ConfirmService, Notifier, RestPagination, RestTable, ServerService } from '@app/core' | 4 | import { ConfirmService, Notifier, RestPagination, RestTable, ServerService } from '@app/core' |
5 | import { peertubeLocalStorage } from '@app/helpers/peertube-web-storage' | 5 | import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' |
6 | import { RedundancyService } from '@app/shared/shared-main' | 6 | import { RedundancyService } from '@app/shared/shared-main' |
7 | import { I18n } from '@ngx-translate/i18n-polyfill' | 7 | import { I18n } from '@ngx-translate/i18n-polyfill' |
8 | import { VideoRedundanciesTarget, VideoRedundancy } from '@shared/models' | 8 | import { VideoRedundanciesTarget, VideoRedundancy } from '@shared/models' |
diff --git a/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts b/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts index e94c293ca..3242bcf46 100644 --- a/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts +++ b/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts | |||
@@ -14,7 +14,7 @@ import { DomSanitizer } from '@angular/platform-browser' | |||
14 | @Component({ | 14 | @Component({ |
15 | selector: 'my-video-block-list', | 15 | selector: 'my-video-block-list', |
16 | templateUrl: './video-block-list.component.html', | 16 | templateUrl: './video-block-list.component.html', |
17 | styleUrls: [ '../../../shared/shared-moderation/moderation.scss', '../../../shared/shared-abuse-list/abuse-list-table.component.scss', './video-block-list.component.scss' ] | 17 | styleUrls: [ '../../../shared/shared-moderation/moderation.scss', './video-block-list.component.scss' ] |
18 | }) | 18 | }) |
19 | export class VideoBlockListComponent extends RestTable implements OnInit, AfterViewInit { | 19 | export class VideoBlockListComponent extends RestTable implements OnInit, AfterViewInit { |
20 | blocklist: (VideoBlacklist & { reasonHtml?: string, embedHtml?: string })[] = [] | 20 | blocklist: (VideoBlacklist & { reasonHtml?: string, embedHtml?: string })[] = [] |
diff --git a/client/src/app/+admin/system/jobs/jobs.component.ts b/client/src/app/+admin/system/jobs/jobs.component.ts index 38a78de33..ceb848976 100644 --- a/client/src/app/+admin/system/jobs/jobs.component.ts +++ b/client/src/app/+admin/system/jobs/jobs.component.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { SortMeta } from 'primeng/api' | 1 | import { SortMeta } from 'primeng/api' |
2 | import { Component, OnInit } from '@angular/core' | 2 | import { Component, OnInit } from '@angular/core' |
3 | import { Notifier, RestPagination, RestTable } from '@app/core' | 3 | import { Notifier, RestPagination, RestTable } from '@app/core' |
4 | import { peertubeLocalStorage } from '@app/helpers/peertube-web-storage' | 4 | import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' |
5 | import { I18n } from '@ngx-translate/i18n-polyfill' | 5 | import { I18n } from '@ngx-translate/i18n-polyfill' |
6 | import { Job, JobState, JobType } from '@shared/models' | 6 | import { Job, JobState, JobType } from '@shared/models' |
7 | import { JobStateClient } from '../../../../types/job-state-client.type' | 7 | import { JobStateClient } from '../../../../types/job-state-client.type' |
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 2c21be643..519ce2974 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 | |||
@@ -1,7 +1,7 @@ | |||
1 | import { Component, Input } from '@angular/core' | 1 | import { Component, Input } from '@angular/core' |
2 | import { Router } from '@angular/router' | 2 | import { Router } from '@angular/router' |
3 | import { AuthService, ComponentPagination, LocalStorageService, Notifier, SessionStorageService, UserService } from '@app/core' | 3 | import { AuthService, ComponentPagination, LocalStorageService, Notifier, SessionStorageService, UserService } from '@app/core' |
4 | import { peertubeLocalStorage, peertubeSessionStorage } from '@app/helpers/peertube-web-storage' | 4 | import { peertubeLocalStorage, peertubeSessionStorage } from '@root-helpers/peertube-web-storage' |
5 | import { VideoPlaylist, VideoPlaylistElement, VideoPlaylistService } from '@app/shared/shared-video-playlist' | 5 | import { VideoPlaylist, VideoPlaylistElement, VideoPlaylistService } from '@app/shared/shared-video-playlist' |
6 | import { I18n } from '@ngx-translate/i18n-polyfill' | 6 | import { I18n } from '@ngx-translate/i18n-polyfill' |
7 | import { VideoDetails, VideoPlaylistPrivacy } from '@shared/models' | 7 | import { VideoDetails, VideoPlaylistPrivacy } from '@shared/models' |
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 e355faf25..bb0830d99 100644 --- a/client/src/app/+videos/+video-watch/video-watch.component.ts +++ b/client/src/app/+videos/+video-watch/video-watch.component.ts | |||
@@ -7,7 +7,8 @@ import { ActivatedRoute, Router } from '@angular/router' | |||
7 | import { AuthService, AuthUser, ConfirmService, MarkdownService, Notifier, RestExtractor, ServerService, UserService } from '@app/core' | 7 | import { AuthService, AuthUser, ConfirmService, MarkdownService, Notifier, RestExtractor, ServerService, UserService } from '@app/core' |
8 | import { HooksService } from '@app/core/plugins/hooks.service' | 8 | import { HooksService } from '@app/core/plugins/hooks.service' |
9 | import { RedirectService } from '@app/core/routing/redirect.service' | 9 | import { RedirectService } from '@app/core/routing/redirect.service' |
10 | import { isXPercentInViewport, peertubeLocalStorage, scrollToTop } from '@app/helpers' | 10 | import { isXPercentInViewport, scrollToTop } from '@app/helpers' |
11 | import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' | ||
11 | import { Video, VideoCaptionService, VideoDetails, VideoService } from '@app/shared/shared-main' | 12 | import { Video, VideoCaptionService, VideoDetails, VideoService } from '@app/shared/shared-main' |
12 | import { SubscribeButtonComponent } from '@app/shared/shared-user-subscription' | 13 | import { SubscribeButtonComponent } from '@app/shared/shared-user-subscription' |
13 | import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist' | 14 | import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist' |
diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts index a62aa4870..dee7fd056 100644 --- a/client/src/app/app.component.ts +++ b/client/src/app/app.component.ts | |||
@@ -15,7 +15,8 @@ import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | |||
15 | import { I18n } from '@ngx-translate/i18n-polyfill' | 15 | import { I18n } from '@ngx-translate/i18n-polyfill' |
16 | import { BroadcastMessageLevel, getShortLocale, is18nPath, ServerConfig, UserRole } from '@shared/models' | 16 | import { BroadcastMessageLevel, getShortLocale, is18nPath, ServerConfig, UserRole } from '@shared/models' |
17 | import { MenuService } from './core/menu/menu.service' | 17 | import { MenuService } from './core/menu/menu.service' |
18 | import { peertubeLocalStorage, POP_STATE_MODAL_DISMISS } from './helpers' | 18 | import { POP_STATE_MODAL_DISMISS } from './helpers' |
19 | import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' | ||
19 | import { InstanceService } from './shared/shared-instance' | 20 | import { InstanceService } from './shared/shared-instance' |
20 | 21 | ||
21 | @Component({ | 22 | @Component({ |
diff --git a/client/src/app/core/auth/auth-user.model.ts b/client/src/app/core/auth/auth-user.model.ts index 88b730938..ee61ff881 100644 --- a/client/src/app/core/auth/auth-user.model.ts +++ b/client/src/app/core/auth/auth-user.model.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { Observable, of } from 'rxjs' | 1 | import { Observable, of } from 'rxjs' |
2 | import { map } from 'rxjs/operators' | 2 | import { map } from 'rxjs/operators' |
3 | import { User } from '@app/core/users/user.model' | 3 | import { User } from '@app/core/users/user.model' |
4 | import { peertubeLocalStorage } from '@app/helpers/peertube-web-storage' | 4 | import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' |
5 | import { | 5 | import { |
6 | hasUserRight, | 6 | hasUserRight, |
7 | MyUser as ServerMyUserModel, | 7 | MyUser as ServerMyUserModel, |
@@ -12,66 +12,7 @@ import { | |||
12 | UserRole, | 12 | UserRole, |
13 | UserVideoQuota | 13 | UserVideoQuota |
14 | } from '@shared/models' | 14 | } from '@shared/models' |
15 | 15 | import { TokenOptions, Tokens } from '../../../root-helpers/pure-auth-user.model' | |
16 | export type TokenOptions = { | ||
17 | accessToken: string | ||
18 | refreshToken: string | ||
19 | tokenType: string | ||
20 | } | ||
21 | |||
22 | // Private class only used by User | ||
23 | class Tokens { | ||
24 | private static KEYS = { | ||
25 | ACCESS_TOKEN: 'access_token', | ||
26 | REFRESH_TOKEN: 'refresh_token', | ||
27 | TOKEN_TYPE: 'token_type' | ||
28 | } | ||
29 | |||
30 | accessToken: string | ||
31 | refreshToken: string | ||
32 | tokenType: string | ||
33 | |||
34 | static load () { | ||
35 | const accessTokenLocalStorage = peertubeLocalStorage.getItem(this.KEYS.ACCESS_TOKEN) | ||
36 | const refreshTokenLocalStorage = peertubeLocalStorage.getItem(this.KEYS.REFRESH_TOKEN) | ||
37 | const tokenTypeLocalStorage = peertubeLocalStorage.getItem(this.KEYS.TOKEN_TYPE) | ||
38 | |||
39 | if (accessTokenLocalStorage && refreshTokenLocalStorage && tokenTypeLocalStorage) { | ||
40 | return new Tokens({ | ||
41 | accessToken: accessTokenLocalStorage, | ||
42 | refreshToken: refreshTokenLocalStorage, | ||
43 | tokenType: tokenTypeLocalStorage | ||
44 | }) | ||
45 | } | ||
46 | |||
47 | return null | ||
48 | } | ||
49 | |||
50 | static flush () { | ||
51 | peertubeLocalStorage.removeItem(this.KEYS.ACCESS_TOKEN) | ||
52 | peertubeLocalStorage.removeItem(this.KEYS.REFRESH_TOKEN) | ||
53 | peertubeLocalStorage.removeItem(this.KEYS.TOKEN_TYPE) | ||
54 | } | ||
55 | |||
56 | constructor (hash?: TokenOptions) { | ||
57 | if (hash) { | ||
58 | this.accessToken = hash.accessToken | ||
59 | this.refreshToken = hash.refreshToken | ||
60 | |||
61 | if (hash.tokenType === 'bearer') { | ||
62 | this.tokenType = 'Bearer' | ||
63 | } else { | ||
64 | this.tokenType = hash.tokenType | ||
65 | } | ||
66 | } | ||
67 | } | ||
68 | |||
69 | save () { | ||
70 | peertubeLocalStorage.setItem(Tokens.KEYS.ACCESS_TOKEN, this.accessToken) | ||
71 | peertubeLocalStorage.setItem(Tokens.KEYS.REFRESH_TOKEN, this.refreshToken) | ||
72 | peertubeLocalStorage.setItem(Tokens.KEYS.TOKEN_TYPE, this.tokenType) | ||
73 | } | ||
74 | } | ||
75 | 16 | ||
76 | export class AuthUser extends User implements ServerMyUserModel { | 17 | export class AuthUser extends User implements ServerMyUserModel { |
77 | tokens: Tokens | 18 | tokens: Tokens |
diff --git a/client/src/app/core/auth/auth.service.ts b/client/src/app/core/auth/auth.service.ts index 94262b9aa..d3dc48267 100644 --- a/client/src/app/core/auth/auth.service.ts +++ b/client/src/app/core/auth/auth.service.ts | |||
@@ -5,7 +5,7 @@ import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http' | |||
5 | import { Injectable } from '@angular/core' | 5 | import { Injectable } from '@angular/core' |
6 | import { Router } from '@angular/router' | 6 | import { Router } from '@angular/router' |
7 | import { Notifier } from '@app/core/notification/notifier.service' | 7 | import { Notifier } from '@app/core/notification/notifier.service' |
8 | import { objectToUrlEncoded, peertubeLocalStorage } from '@app/helpers' | 8 | import { objectToUrlEncoded, peertubeLocalStorage } from '@root-helpers/index' |
9 | import { I18n } from '@ngx-translate/i18n-polyfill' | 9 | import { I18n } from '@ngx-translate/i18n-polyfill' |
10 | import { MyUser as UserServerModel, OAuthClientLocal, User, UserLogin, UserRefreshToken } from '@shared/models' | 10 | import { MyUser as UserServerModel, OAuthClientLocal, User, UserLogin, UserRefreshToken } from '@shared/models' |
11 | import { environment } from '../../../environments/environment' | 11 | import { environment } from '../../../environments/environment' |
diff --git a/client/src/app/core/rest/rest-table.ts b/client/src/app/core/rest/rest-table.ts index e6328eddc..7e7e6f4f7 100644 --- a/client/src/app/core/rest/rest-table.ts +++ b/client/src/app/core/rest/rest-table.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { peertubeLocalStorage } from '@app/helpers/peertube-web-storage' | 1 | import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' |
2 | import { LazyLoadEvent, SortMeta } from 'primeng/api' | 2 | import { LazyLoadEvent, SortMeta } from 'primeng/api' |
3 | import { RestPagination } from './rest-pagination' | 3 | import { RestPagination } from './rest-pagination' |
4 | import { Subject } from 'rxjs' | 4 | import { Subject } from 'rxjs' |
diff --git a/client/src/app/core/server/server.service.ts b/client/src/app/core/server/server.service.ts index 32a135203..c69e0919a 100644 --- a/client/src/app/core/server/server.service.ts +++ b/client/src/app/core/server/server.service.ts | |||
@@ -2,7 +2,8 @@ import { Observable, of, Subject } from 'rxjs' | |||
2 | import { first, map, share, shareReplay, switchMap, tap } from 'rxjs/operators' | 2 | import { first, map, share, shareReplay, switchMap, tap } from 'rxjs/operators' |
3 | import { HttpClient } from '@angular/common/http' | 3 | import { HttpClient } from '@angular/common/http' |
4 | import { Inject, Injectable, LOCALE_ID } from '@angular/core' | 4 | import { Inject, Injectable, LOCALE_ID } from '@angular/core' |
5 | import { getDevLocale, isOnDevLocale, peertubeLocalStorage, sortBy } from '@app/helpers' | 5 | import { getDevLocale, isOnDevLocale, sortBy } from '@app/helpers' |
6 | import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' | ||
6 | import { | 7 | import { |
7 | getCompleteLocale, | 8 | getCompleteLocale, |
8 | isDefaultLocale, | 9 | isDefaultLocale, |
diff --git a/client/src/app/core/users/user.model.ts b/client/src/app/core/users/user.model.ts index 4256f370b..a94b35c46 100644 --- a/client/src/app/core/users/user.model.ts +++ b/client/src/app/core/users/user.model.ts | |||
@@ -10,23 +10,10 @@ import { | |||
10 | UserRole, | 10 | UserRole, |
11 | VideoChannel | 11 | VideoChannel |
12 | } from '@shared/models' | 12 | } from '@shared/models' |
13 | import { UserKeys } from '@root-helpers/user-keys' | ||
13 | 14 | ||
14 | export class User implements UserServerModel { | 15 | export class User implements UserServerModel { |
15 | static KEYS = { | 16 | static KEYS = UserKeys |
16 | ID: 'id', | ||
17 | ROLE: 'role', | ||
18 | EMAIL: 'email', | ||
19 | VIDEOS_HISTORY_ENABLED: 'videos-history-enabled', | ||
20 | USERNAME: 'username', | ||
21 | NSFW_POLICY: 'nsfw_policy', | ||
22 | WEBTORRENT_ENABLED: 'peertube-videojs-' + 'webtorrent_enabled', | ||
23 | AUTO_PLAY_VIDEO: 'auto_play_video', | ||
24 | SESSION_STORAGE_AUTO_PLAY_NEXT_VIDEO: 'auto_play_next_video', | ||
25 | AUTO_PLAY_VIDEO_PLAYLIST: 'auto_play_video_playlist', | ||
26 | THEME: 'theme', | ||
27 | LAST_ACTIVE_THEME: 'last_active_theme', | ||
28 | VIDEO_LANGUAGES: 'video_languages' | ||
29 | } | ||
30 | 17 | ||
31 | id: number | 18 | id: number |
32 | username: string | 19 | username: string |
diff --git a/client/src/app/core/wrappers/storage.service.ts b/client/src/app/core/wrappers/storage.service.ts index 9a60b9785..ad3aca6b8 100644 --- a/client/src/app/core/wrappers/storage.service.ts +++ b/client/src/app/core/wrappers/storage.service.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { Observable, Subject } from 'rxjs' | 1 | import { Observable, Subject } from 'rxjs' |
2 | import { filter } from 'rxjs/operators' | 2 | import { filter } from 'rxjs/operators' |
3 | import { Injectable } from '@angular/core' | 3 | import { Injectable } from '@angular/core' |
4 | import { peertubeLocalStorage, peertubeSessionStorage } from '@app/helpers' | 4 | import { peertubeLocalStorage, peertubeSessionStorage } from '@root-helpers/peertube-web-storage' |
5 | 5 | ||
6 | abstract class StorageService { | 6 | abstract class StorageService { |
7 | protected instance: Storage | 7 | protected instance: Storage |
diff --git a/client/src/app/helpers/index.ts b/client/src/app/helpers/index.ts index 06806402e..cc61255ba 100644 --- a/client/src/app/helpers/index.ts +++ b/client/src/app/helpers/index.ts | |||
@@ -1,6 +1,5 @@ | |||
1 | export * from './locales' | 1 | export * from './locales' |
2 | export * from './constants' | 2 | export * from './constants' |
3 | export * from './i18n-utils' | 3 | export * from './i18n-utils' |
4 | export * from './peertube-web-storage' | ||
5 | export * from './utils' | 4 | export * from './utils' |
6 | export * from './zone' | 5 | export * from './zone' |
diff --git a/client/src/app/helpers/peertube-web-storage.ts b/client/src/app/helpers/peertube-web-storage.ts deleted file mode 100644 index 0db1301bd..000000000 --- a/client/src/app/helpers/peertube-web-storage.ts +++ /dev/null | |||
@@ -1,81 +0,0 @@ | |||
1 | // Thanks: https://github.com/capaj/localstorage-polyfill | ||
2 | |||
3 | const valuesMap = new Map() | ||
4 | |||
5 | function proxify (instance: MemoryStorage) { | ||
6 | return new Proxy(instance, { | ||
7 | set: function (obj, prop: string | number, value) { | ||
8 | if (MemoryStorage.prototype.hasOwnProperty(prop)) { | ||
9 | instance[prop] = value | ||
10 | } else { | ||
11 | instance.setItem(prop, value) | ||
12 | } | ||
13 | return true | ||
14 | }, | ||
15 | get: function (target, name: string | number) { | ||
16 | if (MemoryStorage.prototype.hasOwnProperty(name)) { | ||
17 | return instance[name] | ||
18 | } | ||
19 | if (valuesMap.has(name)) { | ||
20 | return instance.getItem(name) | ||
21 | } | ||
22 | } | ||
23 | }) | ||
24 | } | ||
25 | |||
26 | class MemoryStorage { | ||
27 | [key: string]: any | ||
28 | [index: number]: string | ||
29 | |||
30 | getItem (key: any) { | ||
31 | const stringKey = String(key) | ||
32 | if (valuesMap.has(key)) { | ||
33 | return String(valuesMap.get(stringKey)) | ||
34 | } | ||
35 | |||
36 | return null | ||
37 | } | ||
38 | |||
39 | setItem (key: any, val: any) { | ||
40 | valuesMap.set(String(key), String(val)) | ||
41 | } | ||
42 | |||
43 | removeItem (key: any) { | ||
44 | valuesMap.delete(key) | ||
45 | } | ||
46 | |||
47 | clear () { | ||
48 | valuesMap.clear() | ||
49 | } | ||
50 | |||
51 | key (i: any) { | ||
52 | if (arguments.length === 0) { | ||
53 | throw new TypeError('Failed to execute "key" on "Storage": 1 argument required, but only 0 present.') | ||
54 | } | ||
55 | |||
56 | const arr = Array.from(valuesMap.keys()) | ||
57 | return arr[i] | ||
58 | } | ||
59 | |||
60 | get length () { | ||
61 | return valuesMap.size | ||
62 | } | ||
63 | } | ||
64 | |||
65 | let peertubeLocalStorage: Storage | ||
66 | let peertubeSessionStorage: Storage | ||
67 | try { | ||
68 | peertubeLocalStorage = localStorage | ||
69 | peertubeSessionStorage = sessionStorage | ||
70 | } catch (err) { | ||
71 | const instanceLocalStorage = new MemoryStorage() | ||
72 | const instanceSessionStorage = new MemoryStorage() | ||
73 | |||
74 | peertubeLocalStorage = proxify(instanceLocalStorage) | ||
75 | peertubeSessionStorage = proxify(instanceSessionStorage) | ||
76 | } | ||
77 | |||
78 | export { | ||
79 | peertubeLocalStorage, | ||
80 | peertubeSessionStorage | ||
81 | } | ||
diff --git a/client/src/app/helpers/utils.ts b/client/src/app/helpers/utils.ts index 8e9f72adb..825b6ca96 100644 --- a/client/src/app/helpers/utils.ts +++ b/client/src/app/helpers/utils.ts | |||
@@ -81,15 +81,6 @@ function immutableAssign <A, B> (target: A, source: B) { | |||
81 | return Object.assign({}, target, source) | 81 | return Object.assign({}, target, source) |
82 | } | 82 | } |
83 | 83 | ||
84 | function objectToUrlEncoded (obj: any) { | ||
85 | const str: string[] = [] | ||
86 | for (const key of Object.keys(obj)) { | ||
87 | str.push(encodeURIComponent(key) + '=' + encodeURIComponent(obj[key])) | ||
88 | } | ||
89 | |||
90 | return str.join('&') | ||
91 | } | ||
92 | |||
93 | // Thanks: https://gist.github.com/ghinda/8442a57f22099bdb2e34 | 84 | // Thanks: https://gist.github.com/ghinda/8442a57f22099bdb2e34 |
94 | function objectToFormData (obj: any, form?: FormData, namespace?: string) { | 85 | function objectToFormData (obj: any, form?: FormData, namespace?: string) { |
95 | const fd = form || new FormData() | 86 | const fd = form || new FormData() |
@@ -207,7 +198,6 @@ export { | |||
207 | sortBy, | 198 | sortBy, |
208 | durationToString, | 199 | durationToString, |
209 | lineFeedToHtml, | 200 | lineFeedToHtml, |
210 | objectToUrlEncoded, | ||
211 | getParameterByName, | 201 | getParameterByName, |
212 | populateAsyncUserVideoChannels, | 202 | populateAsyncUserVideoChannels, |
213 | getAbsoluteAPIUrl, | 203 | getAbsoluteAPIUrl, |
diff --git a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.scss b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.scss index 7ed7c9e87..5da624963 100644 --- a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.scss +++ b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.scss | |||
@@ -1,98 +1,9 @@ | |||
1 | @import 'variables'; | ||
2 | @import 'mixins'; | ||
3 | @import 'miniature'; | ||
4 | |||
5 | .table-video-link { | ||
6 | @include disable-outline; | ||
7 | |||
8 | position: relative; | ||
9 | top: 3px; | ||
10 | } | ||
11 | |||
12 | .table-comment-link, | ||
13 | .table-account-link { | ||
14 | @include disable-outline; | ||
15 | |||
16 | color: var(--mainForegroundColor); | ||
17 | |||
18 | ::ng-deep p:last-child { | ||
19 | margin: 0; | ||
20 | } | ||
21 | } | ||
22 | |||
23 | .table-account-link { | ||
24 | display: flex; | ||
25 | flex-direction: column; | ||
26 | } | ||
27 | |||
28 | .comment-flagged-account, | 1 | .comment-flagged-account, |
29 | .account-flagged-handle { | 2 | .account-flagged-handle { |
30 | font-size: 11px; | 3 | font-size: 11px; |
31 | color: var(--greyForegroundColor); | 4 | color: var(--greyForegroundColor); |
32 | } | 5 | } |
33 | 6 | ||
34 | .table-video { | ||
35 | display: inline-flex; | ||
36 | |||
37 | .table-video-image { | ||
38 | @include miniature-thumbnail; | ||
39 | |||
40 | $image-height: 45px; | ||
41 | |||
42 | height: $image-height; | ||
43 | width: #{(16/9) * $image-height}; | ||
44 | margin-right: 0.5rem; | ||
45 | border-radius: 2px; | ||
46 | border: none; | ||
47 | background: transparent; | ||
48 | display: inline-flex; | ||
49 | justify-content: center; | ||
50 | align-items: center; | ||
51 | position: relative; | ||
52 | |||
53 | img { | ||
54 | height: 100%; | ||
55 | width: 100%; | ||
56 | border-radius: 2px; | ||
57 | } | ||
58 | |||
59 | span { | ||
60 | color: pvar(--inputPlaceholderColor); | ||
61 | } | ||
62 | |||
63 | .table-video-image-label { | ||
64 | @include static-thumbnail-overlay; | ||
65 | position: absolute; | ||
66 | border-radius: 3px; | ||
67 | font-size: 10px; | ||
68 | padding: 0 3px; | ||
69 | line-height: 1.3; | ||
70 | bottom: 2px; | ||
71 | right: 2px; | ||
72 | } | ||
73 | } | ||
74 | |||
75 | .table-video-text { | ||
76 | display: inline-flex; | ||
77 | flex-direction: column; | ||
78 | justify-content: center; | ||
79 | font-size: 90%; | ||
80 | color: pvar(--mainForegroundColor); | ||
81 | line-height: 1rem; | ||
82 | |||
83 | div .glyphicon { | ||
84 | font-size: 80%; | ||
85 | color: gray; | ||
86 | margin-left: 0.1rem; | ||
87 | } | ||
88 | |||
89 | div + div { | ||
90 | color: var(--greyForegroundColor); | ||
91 | font-size: 11px; | ||
92 | } | ||
93 | } | ||
94 | } | ||
95 | |||
96 | .abuse-states .glyphicon-comment { | 7 | .abuse-states .glyphicon-comment { |
97 | margin-left: 0.5rem; | 8 | margin-left: 0.5rem; |
98 | } | 9 | } |
diff --git a/client/src/app/shared/shared-moderation/moderation.scss b/client/src/app/shared/shared-moderation/moderation.scss index c9f0d0c42..c57872bae 100644 --- a/client/src/app/shared/shared-moderation/moderation.scss +++ b/client/src/app/shared/shared-moderation/moderation.scss | |||
@@ -65,3 +65,88 @@ my-action-dropdown.show { | |||
65 | display: block !important; | 65 | display: block !important; |
66 | } | 66 | } |
67 | } | 67 | } |
68 | |||
69 | .table-video-link { | ||
70 | @include disable-outline; | ||
71 | |||
72 | position: relative; | ||
73 | top: 3px; | ||
74 | } | ||
75 | |||
76 | .table-comment-link, | ||
77 | .table-account-link { | ||
78 | @include disable-outline; | ||
79 | |||
80 | color: var(--mainForegroundColor); | ||
81 | |||
82 | ::ng-deep p:last-child { | ||
83 | margin: 0; | ||
84 | } | ||
85 | } | ||
86 | |||
87 | .table-account-link { | ||
88 | display: flex; | ||
89 | flex-direction: column; | ||
90 | } | ||
91 | |||
92 | .table-video { | ||
93 | display: inline-flex; | ||
94 | |||
95 | .table-video-image { | ||
96 | @include miniature-thumbnail; | ||
97 | |||
98 | $image-height: 45px; | ||
99 | |||
100 | height: $image-height; | ||
101 | width: #{(16/9) * $image-height}; | ||
102 | margin-right: 0.5rem; | ||
103 | border-radius: 2px; | ||
104 | border: none; | ||
105 | background: transparent; | ||
106 | display: inline-flex; | ||
107 | justify-content: center; | ||
108 | align-items: center; | ||
109 | position: relative; | ||
110 | |||
111 | img { | ||
112 | height: 100%; | ||
113 | width: 100%; | ||
114 | border-radius: 2px; | ||
115 | } | ||
116 | |||
117 | span { | ||
118 | color: pvar(--inputPlaceholderColor); | ||
119 | } | ||
120 | |||
121 | .table-video-image-label { | ||
122 | @include static-thumbnail-overlay; | ||
123 | position: absolute; | ||
124 | border-radius: 3px; | ||
125 | font-size: 10px; | ||
126 | padding: 0 3px; | ||
127 | line-height: 1.3; | ||
128 | bottom: 2px; | ||
129 | right: 2px; | ||
130 | } | ||
131 | } | ||
132 | |||
133 | .table-video-text { | ||
134 | display: inline-flex; | ||
135 | flex-direction: column; | ||
136 | justify-content: center; | ||
137 | font-size: 90%; | ||
138 | color: pvar(--mainForegroundColor); | ||
139 | line-height: 1rem; | ||
140 | |||
141 | div .glyphicon { | ||
142 | font-size: 80%; | ||
143 | color: gray; | ||
144 | margin-left: 0.1rem; | ||
145 | } | ||
146 | |||
147 | div + div { | ||
148 | color: var(--greyForegroundColor); | ||
149 | font-size: 11px; | ||
150 | } | ||
151 | } | ||
152 | } | ||
diff --git a/client/src/app/shared/shared-search/search.service.ts b/client/src/app/shared/shared-search/search.service.ts index 96b954c99..15c4a7012 100644 --- a/client/src/app/shared/shared-search/search.service.ts +++ b/client/src/app/shared/shared-search/search.service.ts | |||
@@ -3,7 +3,7 @@ import { catchError, map, switchMap } from 'rxjs/operators' | |||
3 | import { HttpClient, HttpParams } from '@angular/common/http' | 3 | import { HttpClient, HttpParams } from '@angular/common/http' |
4 | import { Injectable } from '@angular/core' | 4 | import { Injectable } from '@angular/core' |
5 | import { ComponentPaginationLight, RestExtractor, RestPagination, RestService } from '@app/core' | 5 | import { ComponentPaginationLight, RestExtractor, RestPagination, RestService } from '@app/core' |
6 | import { peertubeLocalStorage } from '@app/helpers' | 6 | import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' |
7 | import { Video, VideoChannel, VideoChannelService, VideoService } from '@app/shared/shared-main' | 7 | import { Video, VideoChannel, VideoChannelService, VideoService } from '@app/shared/shared-main' |
8 | import { ResultList, SearchTargetType, Video as VideoServerModel, VideoChannel as VideoChannelServerModel } from '@shared/models' | 8 | import { ResultList, SearchTargetType, Video as VideoServerModel, VideoChannel as VideoChannelServerModel } from '@shared/models' |
9 | import { environment } from '../../../environments/environment' | 9 | import { environment } from '../../../environments/environment' |