aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-03-08 12:01:55 +0100
committerChocobozzz <me@florianbigard.com>2018-03-08 12:01:55 +0100
commit73e09f270660c78e50e86921a5ca6b356f760c7c (patch)
treefc12bdd72840715f2a5e0ffba480b60c4bc2b7fb /client/src
parent6a6d92b1ecca1dfcf4b13f291553f2485814f730 (diff)
downloadPeerTube-73e09f270660c78e50e86921a5ca6b356f760c7c.tar.gz
PeerTube-73e09f270660c78e50e86921a5ca6b356f760c7c.tar.zst
PeerTube-73e09f270660c78e50e86921a5ca6b356f760c7c.zip
Try to detect incompatible web browsers
Diffstat (limited to 'client/src')
-rw-r--r--client/src/app/app.component.ts2
-rw-r--r--client/src/app/videos/+video-watch/video-watch.component.ts12
-rw-r--r--client/src/index.html15
-rw-r--r--client/src/main.ts13
-rw-r--r--client/src/sass/application.scss8
5 files changed, 39 insertions, 11 deletions
diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts
index f95103365..5d8e8badf 100644
--- a/client/src/app/app.component.ts
+++ b/client/src/app/app.component.ts
@@ -44,6 +44,8 @@ export class AppComponent implements OnInit {
44 } 44 }
45 45
46 ngOnInit () { 46 ngOnInit () {
47 document.getElementById('incompatible-browser').className += 'browser-ok'
48
47 const pathname = window.location.pathname 49 const pathname = window.location.pathname
48 if (!pathname || pathname === '/') { 50 if (!pathname || pathname === '/') {
49 this.redirectService.redirectToHomepage() 51 this.redirectService.redirectToHomepage()
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 5750c5fca..7951e3927 100644
--- a/client/src/app/videos/+video-watch/video-watch.component.ts
+++ b/client/src/app/videos/+video-watch/video-watch.component.ts
@@ -49,8 +49,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
49 shortVideoDescription: string 49 shortVideoDescription: string
50 videoHTMLDescription = '' 50 videoHTMLDescription = ''
51 likesBarTooltipText = '' 51 likesBarTooltipText = ''
52 hasAlreadyAcceptedPrivacyConcern = false
52 53
53 private hasAlreadyAcceptedPrivacyConcern = false
54 private otherVideos: Video[] = [] 54 private otherVideos: Video[] = []
55 private paramsSub: Subscription 55 private paramsSub: Subscription
56 56
@@ -260,6 +260,11 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
260 ) 260 )
261 } 261 }
262 262
263 acceptedPrivacyConcern () {
264 localStorage.setItem(VideoWatchComponent.LOCAL_STORAGE_PRIVACY_CONCERN_KEY, 'true')
265 this.hasAlreadyAcceptedPrivacyConcern = true
266 }
267
263 private updateVideoDescription (description: string) { 268 private updateVideoDescription (description: string) {
264 this.video.description = description 269 this.video.description = description
265 this.setVideoDescriptionHTML() 270 this.setVideoDescriptionHTML()
@@ -470,9 +475,4 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
470 // Be sure the autoPlay is set to false 475 // Be sure the autoPlay is set to false
471 return this.user.autoPlayVideo !== false 476 return this.user.autoPlayVideo !== false
472 } 477 }
473
474 private acceptedPrivacyConcern () {
475 localStorage.setItem(VideoWatchComponent.LOCAL_STORAGE_PRIVACY_CONCERN_KEY, 'true')
476 this.hasAlreadyAcceptedPrivacyConcern = true
477 }
478} 478}
diff --git a/client/src/index.html b/client/src/index.html
index a824a39e2..cd9f76cf9 100644
--- a/client/src/index.html
+++ b/client/src/index.html
@@ -34,6 +34,21 @@
34 </p> 34 </p>
35 </noscript> 35 </noscript>
36 36
37 <div id="incompatible-browser" class="alert alert-danger" style="display: none">
38 <p>We are sorry but it seems that PeerTube is not compatible with your web browser.</p>
39 <p>Please try with the latest version of <a href="https://www.mozilla.org" target="_blank">Mozilla Firefox</a>.</p>
40 <p>If you think this is a mistake, do not hesitate <a href="https://github.com/Chocobozzz/PeerTube/issues/new" target="_blank">to report it</a>.</p>
41 </div>
42
43 <script type="text/javascript">
44 window.onerror = function () {
45 var elem = document.getElementById('incompatible-browser')
46 if (elem.className.indexOf('browser-ok') === -1) {
47 elem.style.display = 'block'
48 }
49 }
50 </script>
51
37 <my-app> 52 <my-app>
38 </my-app> 53 </my-app>
39 54
diff --git a/client/src/main.ts b/client/src/main.ts
index 4b18d163c..e1a69e4a4 100644
--- a/client/src/main.ts
+++ b/client/src/main.ts
@@ -20,11 +20,14 @@ const bootstrap = () => platformBrowserDynamic()
20 // .catch(err => console.error('Cannot register service worker.', err)) 20 // .catch(err => console.error('Cannot register service worker.', err))
21 // } 21 // }
22 22
23 navigator.serviceWorker.getRegistrations().then(registrations => { 23 if (navigator.serviceWorker) {
24 for (const registration of registrations) { 24 navigator.serviceWorker.getRegistrations()
25 registration.unregister() 25 .then(registrations => {
26 } 26 for (const registration of registrations) {
27 }) 27 registration.unregister()
28 }
29 })
30 }
28 31
29 return bootstrapModule 32 return bootstrapModule
30 }) 33 })
diff --git a/client/src/sass/application.scss b/client/src/sass/application.scss
index 438990a40..f2d9f7201 100644
--- a/client/src/sass/application.scss
+++ b/client/src/sass/application.scss
@@ -24,6 +24,14 @@ body {
24 color: #000; 24 color: #000;
25} 25}
26 26
27#incompatible-browser {
28 display: none;
29 text-align: center;
30 position: absolute;
31 width: 100%;
32 top: 45%;
33}
34
27strong { 35strong {
28 font-weight: $font-semibold; 36 font-weight: $font-semibold;
29} 37}