From 7193ad1044d2dfad8f929f0951f9a3601c056f67 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 8 Feb 2018 17:31:05 +0100 Subject: Add service worker --- client/src/app/app.module.ts | 9 +++++-- .../src/app/shared/video/abstract-video-list.scss | 24 +++++++++++++++++ client/src/index.html | 2 +- client/src/manifest.json | 2 +- client/src/ngsw-config.json | 30 ++++++++++++++++++++++ 5 files changed, 63 insertions(+), 4 deletions(-) create mode 100644 client/src/ngsw-config.json (limited to 'client/src') diff --git a/client/src/app/app.module.ts b/client/src/app/app.module.ts index 1134d061b..34114b60b 100644 --- a/client/src/app/app.module.ts +++ b/client/src/app/app.module.ts @@ -1,9 +1,11 @@ import { NgModule } from '@angular/core' import { BrowserModule } from '@angular/platform-browser' +import { ServiceWorkerModule } from '@angular/service-worker' import { AboutModule } from '@app/about' import { ResetPasswordModule } from '@app/reset-password' import { MetaLoader, MetaModule, MetaStaticLoader, PageTitlePositioning } from '@ngx-meta/core' +import { environment } from '../environments/environment' import { AccountModule } from './account' @@ -24,7 +26,8 @@ export function metaFactory (): MetaLoader { applicationName: 'PeerTube', defaults: { title: 'PeerTube', - description: 'PeerTube, a decentralized video streaming platform using P2P (BitTorrent) directly in the web browser' + description: 'PeerTube, a federated (ActivityPub) video streaming platform ' + + 'using P2P (BitTorrent) directly in the web browser with WebTorrent and Angular. ' } }) } @@ -57,7 +60,9 @@ export function metaFactory (): MetaLoader { MetaModule.forRoot({ provide: MetaLoader, useFactory: (metaFactory) - }) + }), + + ServiceWorkerModule.register('/ngsw-worker.js', { enabled: environment.production }) ], providers: [ ] }) diff --git a/client/src/app/shared/video/abstract-video-list.scss b/client/src/app/shared/video/abstract-video-list.scss index 52797bc6c..0f0ff20f0 100644 --- a/client/src/app/shared/video/abstract-video-list.scss +++ b/client/src/app/shared/video/abstract-video-list.scss @@ -5,3 +5,27 @@ text-align: left; } } + +@media screen and (max-width: 400px) and (min-resolution: 1.5dppx) { + .videos { + text-align: center; + + /deep/ .video-miniature { + padding-right: 0; + height: 215px; + width: 100%; + + .video-miniature-information { + width: 100%; + } + + /deep/ .video-thumbnail { + width: 100%; + + img { + width: 100%; + } + } + } + } +} diff --git a/client/src/index.html b/client/src/index.html index 61a8d2ed1..8ff89f6a4 100644 --- a/client/src/index.html +++ b/client/src/index.html @@ -8,7 +8,7 @@ - + diff --git a/client/src/manifest.json b/client/src/manifest.json index ac5eac647..a9e885739 100644 --- a/client/src/manifest.json +++ b/client/src/manifest.json @@ -42,5 +42,5 @@ ], "name": "PeerTube", "short_name": "PeerTube", - "start_url": "/videos/recently-added" + "start_url": "." } diff --git a/client/src/ngsw-config.json b/client/src/ngsw-config.json new file mode 100644 index 000000000..47a116bb7 --- /dev/null +++ b/client/src/ngsw-config.json @@ -0,0 +1,30 @@ +{ + "index": "/index.html", + "assetGroups": [ + { + "name": "app", + "installMode": "prefetch", + "resources": { + "files": [ + "/index.html", + "/client/assets/images/favicon.png" + ], + "versionedFiles": [ + "/client/*.bundle.css", + "/client/*.bundle.js", + "/client/*.chunk.js" + ] + } + }, + { + "name": "assets", + "installMode": "lazy", + "updateMode": "prefetch", + "resources": { + "files": [ + "/client/assets/**" + ] + } + } + ] +} -- cgit v1.2.3