@indextools/index-games 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/public/config.js +28 -33
- package/public/games/10fastfingers.html +12 -0
- package/public/games/2048.html +12 -0
- package/public/games/absurdle.html +12 -0
- package/public/games/actorle.html +12 -0
- package/public/games/adventurecapitalist.html +12 -0
- package/public/games/agario.html +12 -0
- package/public/games/airhockey.html +12 -0
- package/public/games/among.html +12 -0
- package/public/games/anagram.html +12 -0
- package/public/games/angrybirds.html +12 -0
- package/public/games/archery.html +12 -0
- package/public/games/artquiz.html +12 -0
- package/public/games/asteroids.html +12 -0
- package/public/games/backgammon.html +12 -0
- package/public/games/ballblast.html +12 -0
- package/public/games/bandle.html +12 -0
- package/public/games/basketballstars.html +12 -0
- package/public/games/battleship.html +12 -0
- package/public/games/betweenle.html +12 -0
- package/public/games/bingo.html +12 -0
- package/public/games/blackjack.html +12 -0
- package/public/games/blockpuzzle.html +12 -0
- package/public/games/bobbleheadbrawl.html +12 -0
- package/public/games/bookworm.html +12 -0
- package/public/games/bowlingking.html +12 -0
- package/public/games/brutal.html +12 -0
- package/public/games/bubbshooter.html +12 -0
- package/public/games/candycrush.html +12 -0
- package/public/games/capitalcities.html +12 -0
- package/public/games/cardgame.html +12 -0
- package/public/games/carparking.html +12 -0
- package/public/games/castlevania.html +12 -0
- package/public/games/checkers.html +12 -0
- package/public/games/chess.html +12 -0
- package/public/games/citybuilder.html +12 -0
- package/public/games/clue.html +12 -0
- package/public/games/cluelike.html +12 -0
- package/public/games/codecombat.html +12 -0
- package/public/games/colonist.html +12 -0
- package/public/games/colonists.html +12 -0
- package/public/games/colorfle.html +12 -0
- package/public/games/connectfour.html +12 -0
- package/public/games/connections.html +12 -0
- package/public/games/contexto.html +12 -0
- package/public/games/cookieclicker.html +12 -0
- package/public/games/counterblox.html +12 -0
- package/public/games/crazycattle.html +12 -0
- package/public/games/cribbage.html +12 -0
- package/public/games/crossword.html +12 -0
- package/public/games/crossyroad.html +12 -0
- package/public/games/curling.html +12 -0
- package/public/games/cutherope.html +12 -0
- package/public/games/darts.html +12 -0
- package/public/games/defly.html +12 -0
- package/public/games/diablo2d.html +12 -0
- package/public/games/dice.html +12 -0
- package/public/games/diepio.html +12 -0
- package/public/games/dinogame.html +12 -0
- package/public/games/doctorgame.html +12 -0
- package/public/games/dominoes.html +12 -0
- package/public/games/dordle.html +12 -0
- package/public/games/doublicator.html +12 -0
- package/public/games/driftboss.html +12 -0
- package/public/games/drivertest.html +12 -0
- package/public/games/dungeoncrawl.html +12 -0
- package/public/games/euchre.html +12 -0
- package/public/games/ev.html +12 -0
- package/public/games/farmidler.html +12 -0
- package/public/games/fencing.html +12 -0
- package/public/games/fibble.html +12 -0
- package/public/games/finalfantasy.html +12 -0
- package/public/games/fishdom.html +12 -0
- package/public/games/flagle.html +12 -0
- package/public/games/flappybird.html +12 -0
- package/public/games/foosball.html +12 -0
- package/public/games/fortnite2d.html +12 -0
- package/public/games/framed.html +12 -0
- package/public/games/freecell.html +12 -0
- package/public/games/frutninja.html +12 -0
- package/public/games/galaxydefense.html +12 -0
- package/public/games/games.json +2843 -29
- package/public/games/garticphone.html +12 -0
- package/public/games/geoguessr.html +12 -0
- package/public/games/geoquiz.html +12 -0
- package/public/games/getaway.html +12 -0
- package/public/games/getgoodgames.html +12 -0
- package/public/games/gin.html +12 -0
- package/public/games/golfgame.html +12 -0
- package/public/games/guessr.html +12 -0
- package/public/games/gunblood.html +12 -0
- package/public/games/gunfight.html +12 -0
- package/public/games/hackeridler.html +12 -0
- package/public/games/hangaroo.html +12 -0
- package/public/games/heardle.html +12 -0
- package/public/games/heartsgame.html +12 -0
- package/public/games/heroquest.html +12 -0
- package/public/games/historyquiz.html +12 -0
- package/public/games/hospitallife.html +12 -0
- package/public/games/hoteltycoon.html +12 -0
- package/public/games/infinitecraft.html +12 -0
- package/public/games/islandtrivia.html +12 -0
- package/public/games/jelly.html +12 -0
- package/public/games/jewels.html +12 -0
- package/public/games/kahoot.html +12 -0
- package/public/games/kirka.html +12 -0
- package/public/games/knifehit.html +12 -0
- package/public/games/krunker.html +12 -0
- package/public/games/leaguedle.html +12 -0
- package/public/games/letterle.html +12 -0
- package/public/games/life.html +12 -0
- package/public/games/lightbot.html +12 -0
- package/public/games/loldle.html +12 -0
- package/public/games/lordz.html +12 -0
- package/public/games/magicblast.html +12 -0
- package/public/games/mahjong.html +12 -0
- package/public/games/mario.html +12 -0
- package/public/games/matchmaster.html +12 -0
- package/public/games/mathblaster.html +12 -0
- package/public/games/mathgame.html +12 -0
- package/public/games/mathler.html +12 -0
- package/public/games/megaman.html +12 -0
- package/public/games/mergedragons.html +12 -0
- package/public/games/mergefight.html +12 -0
- package/public/games/minecraftclone.html +12 -0
- package/public/games/minesweeper.html +12 -0
- package/public/games/miniclip.html +12 -0
- package/public/games/monopoly.html +12 -0
- package/public/games/mope.html +12 -0
- package/public/games/moto3.html +12 -0
- package/public/games/moviedle.html +12 -0
- package/public/games/moviesquiz.html +12 -0
- package/public/games/musiquiz.html +12 -0
- package/public/games/nationle.html +12 -0
- package/public/games/nba2k.html +12 -0
- package/public/games/nerdle.html +12 -0
- package/public/games/ninjago.html +12 -0
- package/public/games/octordle.html +12 -0
- package/public/games/pacman.html +12 -0
- package/public/games/papergame.html +12 -0
- package/public/games/pilotsim.html +12 -0
- package/public/games/pinball.html +12 -0
- package/public/games/pinochle.html +12 -0
- package/public/games/pinturillo.html +12 -0
- package/public/games/pirateio.html +12 -0
- package/public/games/pizzamaking.html +12 -0
- package/public/games/pogo.html +12 -0
- package/public/games/pointerpointer.html +12 -0
- package/public/games/pokedle.html +12 -0
- package/public/games/pokedle2.html +12 -0
- package/public/games/pokemonbattle.html +12 -0
- package/public/games/pokerclassic.html +12 -0
- package/public/games/poolrush.html +12 -0
- package/public/games/popculturequiz.html +12 -0
- package/public/games/primel.html +12 -0
- package/public/games/prodigygame.html +12 -0
- package/public/games/questland.html +12 -0
- package/public/games/quizlet.html +12 -0
- package/public/games/quordle.html +12 -0
- package/public/games/reslife.html +12 -0
- package/public/games/reversi.html +12 -0
- package/public/games/ridleracing.html +12 -0
- package/public/games/risk.html +12 -0
- package/public/games/roadfury.html +12 -0
- package/public/games/rooftopsnipers.html +12 -0
- package/public/games/run3.html +12 -0
- package/public/games/schoolbus.html +12 -0
- package/public/games/sciencequiz.html +12 -0
- package/public/games/scrabble.html +12 -0
- package/public/games/scratch.html +12 -0
- package/public/games/sedecordle.html +12 -0
- package/public/games/semantle.html +12 -0
- package/public/games/shellshock.html +12 -0
- package/public/games/shipsim.html +12 -0
- package/public/games/skribbl.html +12 -0
- package/public/games/skyblock.html +12 -0
- package/public/games/slots.html +12 -0
- package/public/games/snakegame.html +12 -0
- package/public/games/snakeio.html +12 -0
- package/public/games/snowball.html +12 -0
- package/public/games/soccerskills.html +12 -0
- package/public/games/solitaire.html +12 -0
- package/public/games/sonic.html +12 -0
- package/public/games/spaceshipshooter.html +12 -0
- package/public/games/spacesurvive.html +12 -0
- package/public/games/spades.html +12 -0
- package/public/games/spellcast.html +12 -0
- package/public/games/spellinbee.html +12 -0
- package/public/games/spellingbee2.html +12 -0
- package/public/games/spidersolitaire.html +12 -0
- package/public/games/sportsquiz.html +12 -0
- package/public/games/squaredle.html +12 -0
- package/public/games/squirdle.html +12 -0
- package/public/games/stardew.html +12 -0
- package/public/games/starve.html +12 -0
- package/public/games/stickmanfight.html +12 -0
- package/public/games/stratego.html +12 -0
- package/public/games/strategydefense.html +12 -0
- package/public/games/stuntcar.html +12 -0
- package/public/games/sudoku.html +12 -0
- package/public/games/superhero.html +12 -0
- package/public/games/superhex.html +12 -0
- package/public/games/superhot.html +12 -0
- package/public/games/surviv.html +12 -0
- package/public/games/sushichef.html +12 -0
- package/public/games/tabletopia.html +12 -0
- package/public/games/tennisgame.html +12 -0
- package/public/games/terraria2d.html +12 -0
- package/public/games/tetris.html +12 -0
- package/public/games/theimpossiblequiz.html +12 -0
- package/public/games/timersniper.html +12 -0
- package/public/games/towerblitz.html +12 -0
- package/public/games/traindriver.html +12 -0
- package/public/games/truckgame.html +12 -0
- package/public/games/tunnel.html +12 -0
- package/public/games/typeracer.html +12 -0
- package/public/games/typingclub.html +12 -0
- package/public/games/typingtower.html +12 -0
- package/public/games/undergame.html +12 -0
- package/public/games/voxiom.html +12 -0
- package/public/games/wepons.html +12 -0
- package/public/games/wordle.html +12 -0
- package/public/games/worldflags.html +12 -0
- package/public/games/worldle.html +12 -0
- package/public/games/wormate.html +12 -0
- package/public/games/wormszone.html +12 -0
- package/public/games/zelda.html +12 -0
- package/public/games/zombiederby.html +12 -0
- package/public/games/zombiesurvive.html +12 -0
- package/public/games/zombs.html +12 -0
- package/public/games/zuma.html +12 -0
- package/public/index.html +416 -263
- package/public/index.svg +31 -1154
- package/public/register-sw.js +37 -21
- package/public/sw.js +35 -11
- package/index.svg +0 -1159
package/public/register-sw.js
CHANGED
|
@@ -1,29 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* List of hostnames that are allowed to run serviceworkers on http://
|
|
5
|
-
*/
|
|
6
3
|
const swAllowedHostnames = ["localhost", "127.0.0.1"];
|
|
7
4
|
|
|
8
|
-
/**
|
|
9
|
-
* Global util
|
|
10
|
-
* Used in index.html, 404.html, and games
|
|
11
|
-
*/
|
|
12
5
|
async function registerSW() {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
6
|
+
if (!navigator.serviceWorker) {
|
|
7
|
+
if (
|
|
8
|
+
location.protocol !== "https:" &&
|
|
9
|
+
!swAllowedHostnames.includes(location.hostname)
|
|
10
|
+
)
|
|
11
|
+
throw new Error("Service workers require https or localhost.");
|
|
12
|
+
throw new Error("Your browser does not support service workers.");
|
|
13
|
+
}
|
|
19
14
|
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
// Resolve publicDir from the actual page location, handling SVG wrapper:
|
|
16
|
+
// If we're inside an SVG foreignObject the document.baseURI still points
|
|
17
|
+
// to the HTML file, but location.href points to the SVG.
|
|
18
|
+
// We detect this and use document.baseURI instead when available.
|
|
19
|
+
let base = location.href;
|
|
20
|
+
if (document && document.baseURI && !document.baseURI.endsWith(".svg")) {
|
|
21
|
+
base = document.baseURI;
|
|
22
|
+
}
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
let publicDir = new URL("./", base).pathname;
|
|
25
|
+
// If loaded from a /games/ subdirectory, back up one
|
|
26
|
+
if (publicDir.endsWith("/games/")) {
|
|
27
|
+
publicDir = new URL("../", base).pathname;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const swUrl = publicDir + "sw.js";
|
|
31
|
+
const reg = await navigator.serviceWorker.register(swUrl, { scope: publicDir });
|
|
32
|
+
// Wait for SW to become active immediately
|
|
33
|
+
if (reg.installing || reg.waiting) {
|
|
34
|
+
await new Promise((resolve) => {
|
|
35
|
+
const sw = reg.installing || reg.waiting;
|
|
36
|
+
sw.addEventListener("statechange", function handler() {
|
|
37
|
+
if (sw.state === "activated") {
|
|
38
|
+
sw.removeEventListener("statechange", handler);
|
|
39
|
+
resolve();
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
if (reg.active) resolve();
|
|
43
|
+
});
|
|
44
|
+
}
|
|
29
45
|
}
|
package/public/sw.js
CHANGED
|
@@ -7,22 +7,46 @@ const { ScramjetServiceWorker } = $scramjetLoadWorker();
|
|
|
7
7
|
const scramjet = new ScramjetServiceWorker();
|
|
8
8
|
|
|
9
9
|
const baseDir = new URL("./", location.href).pathname;
|
|
10
|
+
|
|
11
|
+
// UV config - fix prefix so it always resolves relative to SW scope
|
|
10
12
|
if (self.__uv$config) {
|
|
11
|
-
|
|
13
|
+
self.__uv$config.prefix = baseDir + "uv/";
|
|
14
|
+
self.__uv$config.bare = baseDir + "bare/";
|
|
15
|
+
// Use epoxy (fastest Rust/Wasm transport) if config says so
|
|
16
|
+
self.__uv$config.encodeUrl = Ultraviolet.codec.xor.encode;
|
|
17
|
+
self.__uv$config.decodeUrl = Ultraviolet.codec.xor.decode;
|
|
12
18
|
}
|
|
13
|
-
|
|
19
|
+
|
|
20
|
+
const uv = new UVServiceWorker();
|
|
21
|
+
|
|
22
|
+
// Scramjet needs its prefix config too
|
|
23
|
+
scramjet.loadConfig().catch(() => {});
|
|
24
|
+
|
|
25
|
+
// Cache for routing decisions
|
|
26
|
+
const UV_PREFIX = baseDir + "uv/";
|
|
27
|
+
const SJ_PREFIX = baseDir + "service/";
|
|
14
28
|
|
|
15
29
|
async function handleRequest(event) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
30
|
+
const url = event.request.url;
|
|
31
|
+
|
|
32
|
+
// UV handles its prefix
|
|
33
|
+
if (url.includes(UV_PREFIX)) {
|
|
34
|
+
return uv.fetch(event);
|
|
35
|
+
}
|
|
36
|
+
// Scramjet handles its prefix
|
|
37
|
+
if (url.includes(SJ_PREFIX)) {
|
|
38
|
+
await scramjet.loadConfig();
|
|
39
|
+
if (scramjet.route(event)) {
|
|
40
|
+
return scramjet.fetch(event);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
// Fallthrough
|
|
44
|
+
return fetch(event.request);
|
|
24
45
|
}
|
|
25
46
|
|
|
26
47
|
self.addEventListener("fetch", (event) => {
|
|
27
|
-
|
|
48
|
+
event.respondWith(handleRequest(event));
|
|
28
49
|
});
|
|
50
|
+
|
|
51
|
+
self.addEventListener("install", () => self.skipWaiting());
|
|
52
|
+
self.addEventListener("activate", (e) => e.waitUntil(clients.claim()));
|