ActivityPub-federated video streaming platform using P2P directly in your web browser
Try to detect incompatible web browsers
Chocobozzz73e09f270660
diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.tsindex f95103365e..5d8e8badf7 100644--- a/client/src/app/app.component.ts+++ b/client/src/app/app.component.ts@@ -44,6 +44,8 @@ export class AppComponent implements OnInit {}ngOnInit () {+ document.getElementById('incompatible-browser').className += 'browser-ok'+const pathname = window.location.pathnameif (!pathname || pathname === '/') {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.tsindex 5750c5fca2..7951e39270 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 {shortVideoDescription: stringvideoHTMLDescription = ''likesBarTooltipText = ''+ hasAlreadyAcceptedPrivacyConcern = false- private hasAlreadyAcceptedPrivacyConcern = falseprivate otherVideos: Video[] = []private paramsSub: Subscription@@ -260,6 +260,11 @@ export class VideoWatchComponent implements OnInit, OnDestroy {)}+ acceptedPrivacyConcern () {+ localStorage.setItem(VideoWatchComponent.LOCAL_STORAGE_PRIVACY_CONCERN_KEY, 'true')+ this.hasAlreadyAcceptedPrivacyConcern = true+ }+private updateVideoDescription (description: string) {this.video.description = descriptionthis.setVideoDescriptionHTML()@@ -470,9 +475,4 @@ export class VideoWatchComponent implements OnInit, OnDestroy {// Be sure the autoPlay is set to falsereturn this.user.autoPlayVideo !== false}-- private acceptedPrivacyConcern () {- localStorage.setItem(VideoWatchComponent.LOCAL_STORAGE_PRIVACY_CONCERN_KEY, 'true')- this.hasAlreadyAcceptedPrivacyConcern = true- }}diff --git a/client/src/index.html b/client/src/index.htmlindex a824a39e2b..cd9f76cf9d 100644--- a/client/src/index.html+++ b/client/src/index.html@@ -34,6 +34,21 @@</p></noscript>+ <div id="incompatible-browser" class="alert alert-danger" style="display: none">+ <p>We are sorry but it seems that PeerTube is not compatible with your web browser.</p>+ <p>Please try with the latest version of <a href="https://www.mozilla.org" target="_blank">Mozilla Firefox</a>.</p>+ <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>+ </div>++ <script type="text/javascript">+ window.onerror = function () {+ var elem = document.getElementById('incompatible-browser')+ if (elem.className.indexOf('browser-ok') === -1) {+ elem.style.display = 'block'+ }+ }+ </script>+<my-app></my-app>diff --git a/client/src/main.ts b/client/src/main.tsindex 4b18d163c4..e1a69e4a4b 100644--- a/client/src/main.ts+++ b/client/src/main.ts@@ -20,11 +20,14 @@ const bootstrap = () => platformBrowserDynamic()// .catch(err => console.error('Cannot register service worker.', err))// }- navigator.serviceWorker.getRegistrations().then(registrations => {- for (const registration of registrations) {- registration.unregister()- }- })+ if (navigator.serviceWorker) {+ navigator.serviceWorker.getRegistrations()+ .then(registrations => {+ for (const registration of registrations) {+ registration.unregister()+ }+ })+ }return bootstrapModule})diff --git a/client/src/sass/application.scss b/client/src/sass/application.scssindex 438990a405..f2d9f72012 100644--- a/client/src/sass/application.scss+++ b/client/src/sass/application.scss@@ -24,6 +24,14 @@ body {color: #000;}+#incompatible-browser {+ display: none;+ text-align: center;+ position: absolute;+ width: 100%;+ top: 45%;+}+strong {font-weight: $font-semibold;}