PageSourceSearch

https://fetasgyros.com/sw.js

js fetasgyros.com collected 2026-10-08 06:14:17 UTC 5,436 bytes, 171 lines download raw bytes

1/**
2 * Welcome to your Workbox-powered service worker!
3 *
4 * You'll need to register this file in your web app and you should
5 * disable HTTP caching for this file too.
6 * See https://goo.gl/nhQhGp
7 *
8 * The rest of the code is auto-generated. Please don't update this file
9 * directly; instead, make changes to your Workbox build configuration
10 * and re-run your build process.
11 * See https://goo.gl/2aRDsh
12 */
13
14importScripts("workbox-v4.3.1/workbox-sw.js");
15workbox.setConfig({modulePathPrefix: "workbox-v4.3.1"});
16
17workbox.core.setCacheNameDetails({prefix: "gatsby-plugin-offline"});
18
19workbox.core.skipWaiting();
20
21workbox.core.clientsClaim();
22
23/**
24 * The workboxSW.precacheAndRoute() method efficiently caches and responds to
25 * requests for URLs in the manifest.
26 * See https://goo.gl/S9QRab
27 */
28self.__precacheManifest = [
29  {
30    "url": "webpack-runtime-c54df37cdc0d8c47d81b.js"
31  },
32  {
33    "url": "styles.d9c05cb96378cb8e4baf.css"
34  },
35  {
36    "url": "framework-f090ec8506681a54d7ff.js"
37  },
38  {
39    "url": "28455a0b-8e382ee68bd32ee376f7.js"
40  },
41  {
42    "url": "8c469d57-2017d43fb945ba080238.js"
43  },
44  {
45    "url": "app-e401f6372d601a5074dd.js"
46  },
47  {
48    "url": "offline-plugin-app-shell-fallback/index.html",
49    "revision": "d6d91b62d8a2d53884cd232a2e69578e"
50  },
51  {
52    "url": "component---cache-caches-gatsby-plugin-offline-app-shell-js-2a8e1045683c33fa1a6b.js"
53  },
54  {
55    "url": "manifest.webmanifest",
56    "revision": "3f657e54d4a8b00bddce46d772aa04d1"
57  }
58].concat(self.__precacheManifest || []);
59workbox.precaching.precacheAndRoute(self.__precacheManifest, {});
60
61workbox.routing.registerRoute(/^https?:\/\/fonts\.gstatic\.com\//, new workbox.strategies.CacheFirst({ "cacheName":"google-fonts-webfonts", plugins: [new workbox.expiration.Plugin({ maxAgeSeconds: 31536000, maxEntries: 30, purgeOnQuotaError: false }), new workbox.cacheableResponse.Plugin({ statuses: [ 200 ] })] }), 'GET');
62workbox.routing.registerRoute(/(\.js$|\.css$|static\/)/, new workbox.strategies.CacheFirst(), 'GET');
63workbox.routing.registerRoute(/^https?:.*\/page-data\/.*\.json$/, new workbox.strategies.NetworkFirst({ "networkTimeoutSeconds":10, plugins: [] }), 'GET');
64workbox.routing.registerRoute(/^https?:.*\.(png|jpg|jpeg|webp|svg|gif|tiff|js|woff|woff2|json|css)$/, new workbox.strategies.StaleWhileRevalidate(), 'GET');
65workbox.routing.registerRoute(/^https?:\/\/fonts\.googleapis\.com\/css/, new workbox.strategies.StaleWhileRevalidate(), 'GET');
66workbox.routing.registerRoute(/\/$/, new workbox.strategies.NetworkFirst({ "networkTimeoutSeconds":10, plugins: [] }), 'GET');
67
68/* global importScripts, workbox, idbKeyval */
69importScripts(`idb-keyval-3.2.0-iife.min.js`)
70
71const { NavigationRoute } = workbox.routing
72
73let lastNavigationRequest = null
74let offlineShellEnabled = true
75
76// prefer standard object syntax to support more browsers
77const MessageAPI = {
78  setPathResources: (event, { path, resources }) => {
79    event.waitUntil(idbKeyval.set(`resources:${path}`, resources))
80  },
81
82  clearPathResources: event => {
83    event.waitUntil(idbKeyval.clear())
84  },
85
86  enableOfflineShell: () => {
87    offlineShellEnabled = true
88  },
89
90  disableOfflineShell: () => {
91    offlineShellEnabled = false
92  },
93}
94
95self.addEventListener(`message`, event => {
96  const { gatsbyApi: api } = event.data
97  if (api) MessageAPI[api](event, event.data)
98})
99
100function handleAPIRequest({ event }) {
101  const { pathname } = new URL(event.request.url)
102
103  const params = pathname.match(/:(.+)/)[1]
104  const data = {}
105
106  if (params.includes(`=`)) {
107    params.split(`&`).forEach(param => {
108      const [key, val] = param.split(`=`)
109      data[key] = val
110    })
111  } else {
112    data.api = params
113  }
114
115  if (MessageAPI[data.api] !== undefined) {
116    MessageAPI[data.api]()
117  }
118
119  if (!data.redirect) {
120    return new Response()
121  }
122
123  return new Response(null, {
124    status: 302,
125    headers: {
126      Location: lastNavigationRequest,
127    },
128  })
129}
130
131const navigationRoute = new NavigationRoute(async ({ event }) => {
132  // handle API requests separately to normal navigation requests, so do this
133  // check first
134  if (event.request.url.match(/\/.gatsby-plugin-offline:.+/)) {
135    return handleAPIRequest({ event })
136  }
137
138  if (!offlineShellEnabled) {
139    return await fetch(event.request)
140  }
141
142  lastNavigationRequest = event.request.url
143
144  let { pathname } = new URL(event.request.url)
145  pathname = pathname.replace(new RegExp(`^`), ``)
146
147  // Check for resources + the app bundle
148  // The latter may not exist if the SW is updating to a new version
149  const resources = await idbKeyval.get(`resources:${pathname}`)
150  if (!resources || !(await caches.match(`/app-e401f6372d601a5074dd.js`))) {
151    return await fetch(event.request)
152  }
153
154  for (const resource of resources) {
155    // As soon as we detect a failed resource, fetch the entire page from
156    // network - that way we won't risk being in an inconsistent state with
157    // some parts of the page failing.
158    if (!(await caches.match(resource))) {
159      return await fetch(event.request)
160    }
161  }
162
163  const offlineShell = `/offline-plugin-app-shell-fallback/index.html`
164  const offlineShellWithKey = workbox.precaching.getCacheKeyForURL(offlineShell)
165  return await caches.match(offlineShellWithKey)
166})
167
168workbox.routing.registerRoute(navigationRoute)
169
170// this route is used when performing a non-navigation request (e.g. fetch)
171workbox.routing.registerRoute(/\/.gatsby-plugin-offline:.+/, handleAPIRequest)

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.