forge
Clone
https://git.tahinli.com/Tahinli/forge.git
0 watching0 forksRustAGPL-3.07.1 MiB490f099Tahinli7 hours ago322 commits
| 1 | // Forge service worker. Served at /sw.js, so its scope is the whole origin. It shows Web Push |
| 2 | // notifications while no tab is open and opens the link of a clicked one. No inline code. The only |
| 3 | // thing it caches is the offline page: app pages are always fetched fresh. A full page load that |
| 4 | // finds the server down (or a proxy answering 502, 503 or 504 while forge restarts) gets that page |
| 5 | // instead of the browser's error page. Everything else passes straight through to the network. |
| 6 | |
| 7 | // Bump the version when the offline page changes, so the new one is precached on install. |
| 8 | var OFFLINE_CACHE = 'forge-offline-v2'; |
| 9 | var OFFLINE_URL = '/assets/offline.html'; |
| 10 | // The offline page and the two files it loads. They are precached: while the server is down the |
| 11 | // browser could not fetch them for the offline page otherwise. |
| 12 | var OFFLINE_FILES = ; |
| 13 | var RESTART_STATUS = ; |
| 14 | |
| 15 | self. |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | ; |
| 23 | |
| 24 | self. |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | ; |
| 32 | |
| 33 | // Navigations only, and only GET: the response is the network's, unless the network failed or the |
| 34 | // server is restarting. Subresources, the event stream and form posts are not touched, except the |
| 35 | // three offline-page files above (bare URLs, no query): network first, the precache when it fails. |
| 36 | self. |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | ; |
| 63 | |
| 64 | self. |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | ; |
| 81 | |
| 82 | // Focuses an open Forge tab and asks it to soft-navigate to the link, or opens a new window. |
| 83 | self. |
| 84 | |
| 85 | |
| 86 | |
| 87 | |
| 88 | |
| 89 | |
| 90 | |
| 91 | |
| 92 | |
| 93 | |
| 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | ; |