-
Notifications
You must be signed in to change notification settings - Fork 0
/
ProgressiveWorker.js
131 lines (122 loc) · 3.2 KB
/
ProgressiveWorker.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
// Version: 11
self.addEventListener('install', function (event) {
console.log("Tetreml: Updating files...");
event.waitUntil(caches.open("TetremlCustomAssets"));
event.waitUntil(caches.delete("Tetreml"));
event.waitUntil(caches.open("Tetreml").then(function(cache) { return cache.addAll([
'Font/font.css',
'Font/Tetreml.ttf',
'Font/Tetreml italic.ttf',
'Font/Tetreml semilight.ttf',
'Font/Tetreml light.ttf',
'GIF/gif.js',
'GIF/gif.worker.js',
'Music/-1.mp3',
'Music/-2.mp3',
'Music/-3.mp3',
'Music/-4.mp3',
'Music/-5.mp3',
'Music/-6.mp3',
'Music/-7.mp3',
'Music/-8.mp3',
'Music/-9.mp3',
'Music/-10.mp3',
'Music/-11.mp3',
'Music/-12.mp3',
'Music/-13.mp3',
'Music/Level 999.mp3',
'Music/musicconfig.json',
'Pako/pako.min.js',
'Pako/utils/common.js',
'Pako/utils/strings.js',
'Pako/zlib/adler32.js',
'Pako/zlib/constants.js',
'Pako/zlib/crc32.js',
'Pako/zlib/deflate.js',
'Pako/zlib/gzheader.js',
'Pako/zlib/inffast.js',
'Pako/zlib/inflate.js',
'Pako/zlib/inftrees.js',
'Pako/zlib/messages.js',
'Pako/zlib/trees.js',
'Pako/zlib/zstream.js',
'SFX/-1.mp3',
'SFX/-2.mp3',
'SFX/-3.mp3',
'SFX/-4.mp3',
'SFX/-5.mp3',
'SFX/-6.mp3',
'SFX/-7.mp3',
'SFX/-8.mp3',
'SFX/-9.mp3',
'SFX/-10.mp3',
'SFX/-11.mp3',
'SFX/-12.mp3',
'SFX/-13.mp3',
'SFX/-14.mp3',
'SFX/-15.mp3',
'SFX/-16.mp3',
'SFX/-17.mp3',
'SFX/-18.mp3',
'SFX/-19.mp3',
'SFX/-20.mp3',
'SFX/-21.mp3',
'SFX/-22.mp3',
'SFX/-23.mp3',
'SFX/-24.mp3',
'SFX/-25.mp3',
'SFX/-26.mp3',
'SFX/-27.mp3',
'SFX/-28.mp3',
'SFX/-29.mp3',
'SFX/-30.mp3',
'SFX/-31.mp3',
'SFX/-32.mp3',
'SFX/-33.mp3',
'SFX/-34.mp3',
'SFX/-35.mp3',
'SFX/-36.mp3',
'SFX/sfxconfig.json',
'Textures/GIF background.png',
'Textures/Outline sprite singleplayer.png',
'Textures/Outline sprite two-player.png',
'Textures/Play screen singleplayer.png',
'Textures/Play screen two-player.png',
'Textures/Sandbox edit screen.png',
'Textures/Sprite singleplayer.png',
'Textures/Sprite two-player.png',
'Controls.js',
'Customizer.html',
'/favicon.ico',
'Fumen.js',
'HTMLHandler.js',
'index.html',
'MersenneTwister.js',
'ProgressiveInstaller.js',
'ReplayerSingleplayer.html',
'ReplayerSingleplayer.js',
'RulesetsSingleplayer.js',
'SingleplayerShirase.js',
'SingleplayerTGM.js',
'SoundHandler.js',
'Tetreml.html',
'Tetreml.js',
'Tetreml-2P.html',
'Tetreml-2P.js',
'Tetreml-sandbox.html',
'Tetreml-sandbox.js',
'Tetriminos.js',
'Utils.js'
]).catch((error) => { console.error(error); }) }));
self.skipWaiting();
});
self.addEventListener('activate', function (event) {
event.waitUntil(clients.claim());
console.log("Tetreml: Update successful.");
});
self.addEventListener('fetch', function (event) {
let params = new URL(event.request.url).searchParams;
event.respondWith(
(async () => { return (params.get("state") != "original" && (await caches.match(event.request, { cacheName: "TetremlCustomAssets", ignoreSearch: true, ignoreVary: true }))) || (await caches.match(event.request, { cacheName: "Tetreml", ignoreSearch: true, ignoreVary: true })) || (params.get("cacheonly") == "true" ? new Response(null, { status: 404 }) : fetch(event.request)); })()
);
});