Skip to content

Commit

Permalink
Fix offline functionality after dependency upgrades
Browse files Browse the repository at this point in the history
  • Loading branch information
aeharding committed May 5, 2024
1 parent ca3a3e8 commit e448244
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 260 deletions.
13 changes: 1 addition & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,7 @@
"react-transition-group": "^4.4.2",
"suncalc": "^1.9.0",
"typescript": "^5.0.2",
"velitherm": "^1.2.0",
"workbox-background-sync": "^7.1.0",
"workbox-broadcast-update": "^7.1.0",
"workbox-cacheable-response": "^7.1.0",
"workbox-core": "^7.1.0",
"workbox-expiration": "^7.1.0",
"workbox-navigation-preload": "^7.1.0",
"workbox-precaching": "^7.1.0",
"workbox-range-requests": "^7.1.0",
"workbox-routing": "^7.1.0",
"workbox-strategies": "^7.1.0",
"workbox-streams": "^7.1.0"
"velitherm": "^1.2.0"
},
"scripts": {
"start": "vite",
Expand Down
33 changes: 0 additions & 33 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

213 changes: 0 additions & 213 deletions src/service-worker.ts

This file was deleted.

105 changes: 103 additions & 2 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,111 @@ export default defineConfig(() => {
}),
svgr(),
VitePWA({
strategies: "injectManifest",
srcDir: "src",
filename: "service-worker.ts",
registerType: "autoUpdate",
workbox: {
runtimeCaching: [
{
handler: "CacheFirst",
urlPattern: /\/api\/position.*/,
options: {
cacheName: "apiPositionCache",
expiration: {
maxEntries: 100,
maxAgeSeconds: 60 * 60 * 24 * 7, // 7 Days
},
},
},
{
handler: "NetworkFirst",
urlPattern: /\/api\/rap.*/,
options: {
cacheName: "apiRapCache",
expiration: {
maxEntries: 100,
maxAgeSeconds: 60 * 60 * 4, // 4 Hours
},
},
},
{
handler: "NetworkFirst",
urlPattern: /\/api\/weather.*/,
options: {
cacheName: "apiWeatherCache",
expiration: {
maxEntries: 100,
maxAgeSeconds: 60 * 60 * 4, // 4 Hours
},
},
},
{
handler: "NetworkFirst",
urlPattern: /\/api\/weather.*/,
options: {
cacheName: "apiWeatherCache",
expiration: {
maxEntries: 100,
maxAgeSeconds: 60 * 60 * 4, // 4 Hours
},
},
},
{
handler: "NetworkFirst",
urlPattern: /\/api\/tfr.*/,
options: {
cacheName: "apiTfrCache",
expiration: {
maxEntries: 100,
maxAgeSeconds: 60 * 60 * 4, // 4 Hours
},
},
},
{
handler: "NetworkFirst",
urlPattern: /\/api\/pqs.*/,
options: {
cacheName: "apiElevationCache",
expiration: {
maxEntries: 100,
maxAgeSeconds: 60 * 60 * 24 * 7, // 7 Days
},
},
},
{
handler: "NetworkFirst",
urlPattern: /\/api\/googleelevation.*/,
options: {
cacheName: "apiGoogleElevationCache",
expiration: {
maxEntries: 100,
maxAgeSeconds: 60 * 60 * 24 * 7, // 7 Days
},
},
},
{
handler: "NetworkFirst",
urlPattern: /\/api\/aviationweather.*/,
options: {
cacheName: "apiAviationWeatherCache",
expiration: {
maxEntries: 100,
maxAgeSeconds: 60 * 60 * 4, // 4 Hours
},
},
},
{
handler: "NetworkFirst",
urlPattern: /\/api\/aviationalerts.*/,
options: {
cacheName: "apiAviationAlertsCache",
expiration: {
maxEntries: 100,
maxAgeSeconds: 60 * 60 * 4, // 4 Hours
},
},
},
],
},
manifest: {
name: "PPG.report",
short_name: "PPG.report",
Expand Down

0 comments on commit e448244

Please sign in to comment.