aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src
diff options
context:
space:
mode:
Diffstat (limited to 'client/src')
-rw-r--r--client/src/app/app.component.ts2
-rw-r--r--client/src/app/core/plugins/plugin.service.ts3
-rw-r--r--client/src/app/shared/misc/utils.ts36
-rw-r--r--client/src/app/videos/videos-routing.module.ts2
-rw-r--r--client/src/sass/application.scss1
-rw-r--r--client/src/sass/player/_player-variables.scss6
-rw-r--r--client/src/sass/player/peertube-skin.scss6
7 files changed, 46 insertions, 10 deletions
diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts
index db1f91f8c..50c5f5b9b 100644
--- a/client/src/app/app.component.ts
+++ b/client/src/app/app.component.ts
@@ -226,7 +226,7 @@ export class AppComponent implements OnInit {
226 new Hotkey('g o', (event: KeyboardEvent): boolean => { 226 new Hotkey('g o', (event: KeyboardEvent): boolean => {
227 this.router.navigate([ '/videos/overview' ]) 227 this.router.navigate([ '/videos/overview' ])
228 return false 228 return false
229 }, undefined, this.i18n('Go to the videos overview page')), 229 }, undefined, this.i18n('Go to the discover videos page')),
230 new Hotkey('g t', (event: KeyboardEvent): boolean => { 230 new Hotkey('g t', (event: KeyboardEvent): boolean => {
231 this.router.navigate([ '/videos/trending' ]) 231 this.router.navigate([ '/videos/trending' ])
232 return false 232 return false
diff --git a/client/src/app/core/plugins/plugin.service.ts b/client/src/app/core/plugins/plugin.service.ts
index 3bb82e8a9..3af36765a 100644
--- a/client/src/app/core/plugins/plugin.service.ts
+++ b/client/src/app/core/plugins/plugin.service.ts
@@ -18,6 +18,7 @@ import { PublicServerSetting } from '@shared/models/plugins/public-server.settin
18import { getDevLocale, isOnDevLocale } from '@app/shared/i18n/i18n-utils' 18import { getDevLocale, isOnDevLocale } from '@app/shared/i18n/i18n-utils'
19import { RegisterClientHelpers } from '../../../types/register-client-option.model' 19import { RegisterClientHelpers } from '../../../types/register-client-option.model'
20import { PluginTranslation } from '@shared/models/plugins/plugin-translation.model' 20import { PluginTranslation } from '@shared/models/plugins/plugin-translation.model'
21import { importModule } from '@app/shared/misc/utils'
21 22
22interface HookStructValue extends RegisterClientHookOptions { 23interface HookStructValue extends RegisterClientHookOptions {
23 plugin: ServerConfigPlugin 24 plugin: ServerConfigPlugin
@@ -222,7 +223,7 @@ export class PluginService implements ClientHook {
222 console.log('Loading script %s of plugin %s.', clientScript.script, plugin.name) 223 console.log('Loading script %s of plugin %s.', clientScript.script, plugin.name)
223 224
224 return this.zone.runOutsideAngular(() => { 225 return this.zone.runOutsideAngular(() => {
225 return import(/* webpackIgnore: true */ clientScript.script) 226 return importModule(clientScript.script)
226 .then((script: ClientScriptModule) => script.register({ registerHook, peertubeHelpers })) 227 .then((script: ClientScriptModule) => script.register({ registerHook, peertubeHelpers }))
227 .then(() => this.sortHooksByPriority()) 228 .then(() => this.sortHooksByPriority())
228 .catch(err => console.error('Cannot import or register plugin %s.', pluginInfo.plugin.name, err)) 229 .catch(err => console.error('Cannot import or register plugin %s.', pluginInfo.plugin.name, err))
diff --git a/client/src/app/shared/misc/utils.ts b/client/src/app/shared/misc/utils.ts
index 85fc1c3a0..f26240d21 100644
--- a/client/src/app/shared/misc/utils.ts
+++ b/client/src/app/shared/misc/utils.ts
@@ -134,6 +134,41 @@ function scrollToTop () {
134 window.scroll(0, 0) 134 window.scroll(0, 0)
135} 135}
136 136
137// Thanks: https://github.com/uupaa/dynamic-import-polyfill
138function importModule (path: string) {
139 return new Promise((resolve, reject) => {
140 const vector = '$importModule$' + Math.random().toString(32).slice(2)
141 const script = document.createElement('script')
142
143 const destructor = () => {
144 delete window[ vector ]
145 script.onerror = null
146 script.onload = null
147 script.remove()
148 URL.revokeObjectURL(script.src)
149 script.src = ''
150 }
151
152 script.defer = true
153 script.type = 'module'
154
155 script.onerror = () => {
156 reject(new Error(`Failed to import: ${path}`))
157 destructor()
158 }
159 script.onload = () => {
160 resolve(window[ vector ])
161 destructor()
162 }
163 const absURL = (environment.apiUrl || window.location.origin) + path
164 const loader = `import * as m from "${absURL}"; window.${vector} = m;` // export Module
165 const blob = new Blob([ loader ], { type: 'text/javascript' })
166 script.src = URL.createObjectURL(blob)
167
168 document.head.appendChild(script)
169 })
170}
171
137export { 172export {
138 sortBy, 173 sortBy,
139 durationToString, 174 durationToString,
@@ -147,5 +182,6 @@ export {
147 objectToFormData, 182 objectToFormData,
148 objectLineFeedToHtml, 183 objectLineFeedToHtml,
149 removeElementFromArray, 184 removeElementFromArray,
185 importModule,
150 scrollToTop 186 scrollToTop
151} 187}
diff --git a/client/src/app/videos/videos-routing.module.ts b/client/src/app/videos/videos-routing.module.ts
index 4eaae93cb..f0049d8c4 100644
--- a/client/src/app/videos/videos-routing.module.ts
+++ b/client/src/app/videos/videos-routing.module.ts
@@ -19,7 +19,7 @@ const videosRoutes: Routes = [
19 component: VideoOverviewComponent, 19 component: VideoOverviewComponent,
20 data: { 20 data: {
21 meta: { 21 meta: {
22 title: 'Videos overview' 22 title: 'Discover videos'
23 } 23 }
24 } 24 }
25 }, 25 },
diff --git a/client/src/sass/application.scss b/client/src/sass/application.scss
index c64a8ebf8..4fa722327 100644
--- a/client/src/sass/application.scss
+++ b/client/src/sass/application.scss
@@ -1,5 +1,4 @@
1$icon-font-path: '~@neos21/bootstrap3-glyphicons/assets/fonts/'; 1$icon-font-path: '~@neos21/bootstrap3-glyphicons/assets/fonts/';
2@import '_bootstrap';
3 2
4@import '_variables'; 3@import '_variables';
5@import '_mixins'; 4@import '_mixins';
diff --git a/client/src/sass/player/_player-variables.scss b/client/src/sass/player/_player-variables.scss
index 4e9e8736c..0c2359ac7 100644
--- a/client/src/sass/player/_player-variables.scss
+++ b/client/src/sass/player/_player-variables.scss
@@ -11,9 +11,3 @@ $slider-bg-color: lighten($primary-background-color, 33%);
11$progress-margin: 10px; 11$progress-margin: 10px;
12 12
13$assets-path: '../../assets/' !default; 13$assets-path: '../../assets/' !default;
14
15body {
16 --embedForegroundColor: #{$primary-foreground-color};
17
18 --embedBigPlayBackgroundColor: #{$primary-background-color};
19}
diff --git a/client/src/sass/player/peertube-skin.scss b/client/src/sass/player/peertube-skin.scss
index 039cf7e00..4bf48a570 100644
--- a/client/src/sass/player/peertube-skin.scss
+++ b/client/src/sass/player/peertube-skin.scss
@@ -2,6 +2,12 @@
2@import '_mixins'; 2@import '_mixins';
3@import './_player-variables'; 3@import './_player-variables';
4 4
5body {
6 --embedForegroundColor: #{$primary-foreground-color};
7
8 --embedBigPlayBackgroundColor: #{$primary-background-color};
9}
10
5@mixin big-play-button-triangle-size($triangle-size) { 11@mixin big-play-button-triangle-size($triangle-size) {
6 width: $triangle-size; 12 width: $triangle-size;
7 height: $triangle-size; 13 height: $triangle-size;