added service workers

This commit is contained in:
Nicolas Constant 2020-02-25 22:52:50 -05:00
parent 73f0628519
commit 24821d9e94
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
15 changed files with 386 additions and 399 deletions

View File

@ -1,145 +1,149 @@
{ {
"$schema": "./node_modules/@angular/cli/lib/config/schema.json", "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1, "version": 1,
"newProjectRoot": "projects", "newProjectRoot": "projects",
"projects": { "projects": {
"sengi": { "sengi": {
"root": "", "root": "",
"sourceRoot": "src", "sourceRoot": "src",
"projectType": "application", "projectType": "application",
"architect": { "architect": {
"build": { "build": {
"builder": "@angular-devkit/build-angular:browser", "builder": "@angular-devkit/build-angular:browser",
"options": { "options": {
"outputPath": "dist", "outputPath": "dist",
"index": "src/index.html", "index": "src/index.html",
"main": "src/main.ts", "main": "src/main.ts",
"tsConfig": "src/tsconfig.app.json", "tsConfig": "src/tsconfig.app.json",
"polyfills": "src/polyfills.ts", "polyfills": "src/polyfills.ts",
"assets": [ "assets": [
"src/assets", "src/assets",
"src/favicon.ico" "src/favicon.ico",
], "src/manifest.json"
"styles": [ ],
"src/sass/styles.scss", "styles": [
"node_modules/@ctrl/ngx-emoji-mart/picker.css" "src/sass/styles.scss",
], "node_modules/@ctrl/ngx-emoji-mart/picker.css"
"stylePreprocessorOptions": { ],
"includePaths": [ "stylePreprocessorOptions": {
"./src/sass", "includePaths": [
"./node_modules/bootstrap/scss" "./src/sass",
] "./node_modules/bootstrap/scss"
}, ]
"scripts": [] },
}, "scripts": []
"configurations": { },
"production": { "configurations": {
"optimization": true, "production": {
"outputHashing": "all", "optimization": true,
"sourceMap": false, "outputHashing": "all",
"extractCss": true, "sourceMap": false,
"namedChunks": false, "extractCss": true,
"aot": true, "namedChunks": false,
"extractLicenses": true, "aot": true,
"vendorChunk": false, "extractLicenses": true,
"buildOptimizer": true, "vendorChunk": false,
"fileReplacements": [ "buildOptimizer": true,
{ "fileReplacements": [
"replace": "src/environments/environment.ts", {
"with": "src/environments/environment.prod.ts" "replace": "src/environments/environment.ts",
} "with": "src/environments/environment.prod.ts"
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "sengi:build"
},
"configurations": {
"production": {
"browserTarget": "sengi:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "sengi:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"karmaConfig": "./karma.conf.js",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"scripts": [],
"styles": [
"src/sass/styles.scss"
],
"assets": [
"src/assets",
"src/favicon.ico"
],
"stylePreprocessorOptions": {
"includePaths": [
"./src/sass",
"./node_modules/bootstrap/scss"
]
}
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
} }
],
"serviceWorker": true,
"ngswConfigPath": "src/ngsw-config.json"
} }
}
}, },
"sengi-e2e": { "serve": {
"root": "e2e", "builder": "@angular-devkit/build-angular:dev-server",
"sourceRoot": "e2e", "options": {
"projectType": "application", "browserTarget": "sengi:build"
"architect": { },
"e2e": { "configurations": {
"builder": "@angular-devkit/build-angular:protractor", "production": {
"options": { "browserTarget": "sengi:build:production"
"protractorConfig": "./protractor.conf.js",
"devServerTarget": "sengi:serve"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"e2e/tsconfig.e2e.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
} }
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "sengi:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"karmaConfig": "./karma.conf.js",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"scripts": [],
"styles": [
"src/sass/styles.scss"
],
"assets": [
"src/assets",
"src/favicon.ico",
"src/manifest.json"
],
"stylePreprocessorOptions": {
"includePaths": [
"./src/sass",
"./node_modules/bootstrap/scss"
]
}
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
} }
}
}, },
"defaultProject": "sengi", "sengi-e2e": {
"schematics": { "root": "e2e",
"@schematics/angular:component": { "sourceRoot": "e2e",
"prefix": "app", "projectType": "application",
"styleext": "scss" "architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "./protractor.conf.js",
"devServerTarget": "sengi:serve"
}
}, },
"@schematics/angular:directive": { "lint": {
"prefix": "app" "builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"e2e/tsconfig.e2e.json"
],
"exclude": [
"**/node_modules/**"
]
}
} }
}
} }
},
"defaultProject": "sengi",
"schematics": {
"@schematics/angular:component": {
"prefix": "app",
"styleext": "scss"
},
"@schematics/angular:directive": {
"prefix": "app"
}
}
} }

425
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -36,7 +36,9 @@
"@angular/http": "^7.2.7", "@angular/http": "^7.2.7",
"@angular/platform-browser": "^7.2.7", "@angular/platform-browser": "^7.2.7",
"@angular/platform-browser-dynamic": "^7.2.7", "@angular/platform-browser-dynamic": "^7.2.7",
"@angular/pwa": "^0.12.4",
"@angular/router": "^7.2.7", "@angular/router": "^7.2.7",
"@angular/service-worker": "^7.2.7",
"@ctrl/ngx-emoji-mart": "^0.17.0", "@ctrl/ngx-emoji-mart": "^0.17.0",
"@fortawesome/angular-fontawesome": "^0.3.0", "@fortawesome/angular-fontawesome": "^0.3.0",
"@fortawesome/fontawesome-svg-core": "^1.2.13", "@fortawesome/fontawesome-svg-core": "^1.2.13",

View File

@ -79,6 +79,8 @@ import { ScheduledStatusesComponent } from './components/floating-column/schedul
import { ScheduledStatusComponent } from './components/floating-column/scheduled-statuses/scheduled-status/scheduled-status.component'; import { ScheduledStatusComponent } from './components/floating-column/scheduled-statuses/scheduled-status/scheduled-status.component';
import { StreamNotificationsComponent } from './components/stream/stream-notifications/stream-notifications.component'; import { StreamNotificationsComponent } from './components/stream/stream-notifications/stream-notifications.component';
import { NotificationComponent } from './components/floating-column/manage-account/notifications/notification/notification.component'; import { NotificationComponent } from './components/floating-column/manage-account/notifications/notification/notification.component';
import { ServiceWorkerModule } from '@angular/service-worker';
import { environment } from '../environments/environment';
const routes: Routes = [ const routes: Routes = [
@ -167,7 +169,8 @@ const routes: Routes = [
]), ]),
NgxsStoragePluginModule.forRoot(), NgxsStoragePluginModule.forRoot(),
ContextMenuModule.forRoot(), ContextMenuModule.forRoot(),
HotkeyModule.forRoot() HotkeyModule.forRoot(),
ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production })
], ],
providers: [AuthService, NavigationService, NotificationService, MastodonWrapperService, MastodonService, StreamingService], providers: [AuthService, NavigationService, NotificationService, MastodonWrapperService, MastodonService, StreamingService],
bootstrap: [AppComponent], bootstrap: [AppComponent],

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 792 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 958 B

View File

@ -50,6 +50,8 @@
} }
} }
</style> </style>
<link rel="manifest" href="manifest.json">
<meta name="theme-color" content="#1976d2">
</head> </head>
<body ondragstart="return false;" ondrop="return false;"> <body ondragstart="return false;" ondrop="return false;">
@ -59,5 +61,6 @@
<div></div> <div></div>
</div> </div>
</app-root> </app-root>
<noscript>Please enable JavaScript to continue using this application.</noscript>
</body> </body>
</html> </html>

51
src/manifest.json Normal file
View File

@ -0,0 +1,51 @@
{
"name": "sengi",
"short_name": "sengi",
"theme_color": "#1976d2",
"background_color": "#fafafa",
"display": "standalone",
"scope": "/",
"start_url": "/",
"icons": [
{
"src": "assets/icons/icon-72x72.png",
"sizes": "72x72",
"type": "image/png"
},
{
"src": "assets/icons/icon-96x96.png",
"sizes": "96x96",
"type": "image/png"
},
{
"src": "assets/icons/icon-128x128.png",
"sizes": "128x128",
"type": "image/png"
},
{
"src": "assets/icons/icon-144x144.png",
"sizes": "144x144",
"type": "image/png"
},
{
"src": "assets/icons/icon-152x152.png",
"sizes": "152x152",
"type": "image/png"
},
{
"src": "assets/icons/icon-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "assets/icons/icon-384x384.png",
"sizes": "384x384",
"type": "image/png"
},
{
"src": "assets/icons/icon-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
]
}

27
src/ngsw-config.json Normal file
View File

@ -0,0 +1,27 @@
{
"index": "/index.html",
"assetGroups": [
{
"name": "app",
"installMode": "prefetch",
"resources": {
"files": [
"/favicon.ico",
"/index.html",
"/*.css",
"/*.js"
]
}
}, {
"name": "assets",
"installMode": "lazy",
"updateMode": "prefetch",
"resources": {
"files": [
"/assets/**",
"/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)"
]
}
}
]
}