openvibers/openvibe.games Commits
Defer theme-loader and preconnect to openvibe.network in shells (#356)
Changes
@@@ -23,6 +23,7 @@<meta name="twitter:image" content="https://openvibe.games/shared/social/games.jpg?v=a77ab4204f47" /><link rel="stylesheet" href="/src/pages/play-pages.css" /><!-- The OpenVibe Frame: the user's theme before first paint, then navbar + footer. -->++ <link rel="preconnect" href="https://openvibe.network" crossorigin><script src="/shared/theme-loader.js" defer></script><script src="/shared/navbar.js" defer></script><script src="/shared/footer.js" defer></script>@@@ -8,7 +8,8 @@<!--casual:head--><meta name="robots" content="index, follow" /><!-- The OpenVibe Frame: the user's theme before first paint, then navbar + footer. -->-- <script src="/shared/theme-loader.js"></script>++ <link rel="preconnect" href="https://openvibe.network" crossorigin>++ <script src="/shared/theme-loader.js" defer></script><script src="/shared/navbar.js" defer></script><script src="/shared/footer.js" defer></script><script>@@@ -23,6 +23,7 @@<meta name="twitter:image" content="https://openvibe.games/shared/social/games.jpg?v=a77ab4204f47" /><link rel="stylesheet" href="/src/pages/play-pages.css" /><!-- The OpenVibe Frame: the user's theme before first paint, then navbar + footer. -->++ <link rel="preconnect" href="https://openvibe.network" crossorigin><script src="/shared/theme-loader.js" defer></script><script src="/shared/navbar.js" defer></script><script src="/shared/footer.js" defer></script>@@@ -26,7 +26,8 @@<meta name="twitter:card" content="summary_large_image" /><meta name="twitter:image" content="https://openvibe.games/shared/social/games.jpg?v=a77ab4204f47" /><!-- The OpenVibe Frame: the user's theme before first paint, then navbar + footer. -->-- <script src="/shared/theme-loader.js"></script>++ <link rel="preconnect" href="https://openvibe.network" crossorigin>++ <script src="/shared/theme-loader.js" defer></script><script src="/shared/navbar.js" defer></script><script src="/shared/footer.js" defer></script><script>@@@ -14,6 +14,7 @@<!-- The OpenVibe Frame: the user's theme before first paint, then navbar + footer. --><!-- Deferred: a slow or unreachable openvibe.network never holds the first paint (the inline colours above cover it). --><link rel="stylesheet" href="/shared/kit.css" />++ <link rel="preconnect" href="https://openvibe.network" crossorigin><script src="/shared/theme-loader.js" defer></script><script src="/shared/navbar.js" defer></script><script src="/shared/footer.js" defer></script>@@@ -23,6 +23,7 @@<meta name="twitter:image" content="https://openvibe.games/shared/social/games.jpg?v=a77ab4204f47" /><link rel="stylesheet" href="/src/pages/play-pages.css" /><!-- The OpenVibe Frame: the user's theme before first paint, then navbar + footer. -->++ <link rel="preconnect" href="https://openvibe.network" crossorigin><script src="/shared/theme-loader.js" defer></script><script src="/shared/navbar.js" defer></script><script src="/shared/footer.js" defer></script>@@@ -7,7 +7,8 @@<title>Scraplandia — OpenVibe.Games</title><meta name="description" content="Play Scraplandia: scrappy multiplayer survival-building in and around Scrap City, in your browser, no download. Part of the OpenVibe network." /><!-- The OpenVibe Frame: the user's theme before first paint, then navbar + footer. -->-- <script src="/shared/theme-loader.js"></script>++ <link rel="preconnect" href="https://openvibe.network" crossorigin>++ <script src="/shared/theme-loader.js" defer></script><script src="/shared/navbar.js" defer></script><script src="/shared/footer.js" defer></script><link rel="canonical" href="https://play.openvibe.games/" />@@@ -392,7 +392,8 @@<script type="module" src="/src/pages/worlds.ts"></script><!-- The OpenVibe Frame (navbar + footer), as on every other page of the site: this page had only its own row oflinks (phone sweep, 2026-11-01). -->-- <script src="/shared/theme-loader.js"></script>++ <link rel="preconnect" href="https://openvibe.network" crossorigin>++ <script src="/shared/theme-loader.js" defer></script><script src="/shared/navbar.js" defer></script><script src="/shared/footer.js" defer></script><script>nnew file mode 100644@@@ -0,0 +1,30 @@++import { readdirSync, readFileSync } from 'node:fs'++import { dirname, join } from 'node:path'++import { fileURLToPath } from 'node:url'++import { describe, expect, it } from 'vitest'++++// Every client shell defers the shared scripts (the inline colours above cover the first paint) and++// preconnects to openvibe.network once, with crossorigin, before theme-loader runs.++const clientDir = join(dirname(fileURLToPath(import.meta.url)), '../../../client')++const shells = readdirSync(clientDir).filter((f) => f.endsWith('.html')).sort()++++describe('client shells', () => {++ it('has shells to check', () => {++ expect(shells.length).toBeGreaterThanOrEqual(8)++ })++ for (const name of shells) {++ it(`${name}: deferred shared scripts + one crossorigin preconnect`, () => {++ const html = readFileSync(join(clientDir, name), 'utf8')++ for (const m of html.matchAll(/<script\b[^>]*>/gi)) {++ const tag = m[0]++ if (!/\ssrc\s*=\s*"\/shared\//.test(tag)) continue++ expect(/\bdefer\b|\basync\b/.test(tag) || /type\s*=\s*"module"/.test(tag)).toBe(true)++ }++ const pcs = [...html.matchAll(/<link rel="preconnect" href="https:\/\/openvibe\.network"[^>]*>/g)]++ expect(pcs.length).toBe(1)++ expect(pcs[0]![0]).toContain('crossorigin')++ expect(html).toContain('<script src="/shared/theme-loader.js" defer></script>')++ expect(html).toContain('<script src="/shared/navbar.js" defer></script>')++ })++ }++})nnew file mode 100644@@@ -0,0 +1,3 @@++// file: 'apps/server/src/net/clientShells.test.ts'++// covers: 'apps/server/src/net'++// Generated by node test/run.js --index; do not edit.
@@ -23,6 +23,7 @@
@@ -23,6 +23,7 @@
<meta name="twitter:image" content="https://openvibe.games/shared/social/games.jpg?v=a77ab4204f47" />
<meta name="twitter:image" content="https://openvibe.games/shared/social/games.jpg?v=a77ab4204f47" />
<link rel="stylesheet" href="/src/pages/play-pages.css" />
<link rel="stylesheet" href="/src/pages/play-pages.css" />
<!-- The OpenVibe Frame: the user's theme before first paint, then navbar + footer. -->
<!-- The OpenVibe Frame: the user's theme before first paint, then navbar + footer. -->
+ <link rel="preconnect" href="https://openvibe.network" crossorigin>
<script src="/shared/theme-loader.js" defer></script>
<script src="/shared/theme-loader.js" defer></script>
<script src="/shared/navbar.js" defer></script>
<script src="/shared/navbar.js" defer></script>
<script src="/shared/footer.js" defer></script>
<script src="/shared/footer.js" defer></script>
@@ -8,7 +8,8 @@
@@ -8,7 +8,8 @@
<!--casual:head-->
<!--casual:head-->
<meta name="robots" content="index, follow" />
<meta name="robots" content="index, follow" />
<!-- The OpenVibe Frame: the user's theme before first paint, then navbar + footer. -->
<!-- The OpenVibe Frame: the user's theme before first paint, then navbar + footer. -->
- <script src="/shared/theme-loader.js"></script>
+ <link rel="preconnect" href="https://openvibe.network" crossorigin>
+ <script src="/shared/theme-loader.js" defer></script>
<script src="/shared/navbar.js" defer></script>
<script src="/shared/navbar.js" defer></script>
<script src="/shared/footer.js" defer></script>
<script src="/shared/footer.js" defer></script>
<script>
<script>
@@ -23,6 +23,7 @@
@@ -23,6 +23,7 @@
<meta name="twitter:image" content="https://openvibe.games/shared/social/games.jpg?v=a77ab4204f47" />
<meta name="twitter:image" content="https://openvibe.games/shared/social/games.jpg?v=a77ab4204f47" />
<link rel="stylesheet" href="/src/pages/play-pages.css" />
<link rel="stylesheet" href="/src/pages/play-pages.css" />
<!-- The OpenVibe Frame: the user's theme before first paint, then navbar + footer. -->
<!-- The OpenVibe Frame: the user's theme before first paint, then navbar + footer. -->
+ <link rel="preconnect" href="https://openvibe.network" crossorigin>
<script src="/shared/theme-loader.js" defer></script>
<script src="/shared/theme-loader.js" defer></script>
<script src="/shared/navbar.js" defer></script>
<script src="/shared/navbar.js" defer></script>
<script src="/shared/footer.js" defer></script>
<script src="/shared/footer.js" defer></script>
@@ -26,7 +26,8 @@
@@ -26,7 +26,8 @@
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:image" content="https://openvibe.games/shared/social/games.jpg?v=a77ab4204f47" />
<meta name="twitter:image" content="https://openvibe.games/shared/social/games.jpg?v=a77ab4204f47" />
<!-- The OpenVibe Frame: the user's theme before first paint, then navbar + footer. -->
<!-- The OpenVibe Frame: the user's theme before first paint, then navbar + footer. -->
- <script src="/shared/theme-loader.js"></script>
+ <link rel="preconnect" href="https://openvibe.network" crossorigin>
+ <script src="/shared/theme-loader.js" defer></script>
<script src="/shared/navbar.js" defer></script>
<script src="/shared/navbar.js" defer></script>
<script src="/shared/footer.js" defer></script>
<script src="/shared/footer.js" defer></script>
<script>
<script>
@@ -14,6 +14,7 @@
@@ -14,6 +14,7 @@
<!-- The OpenVibe Frame: the user's theme before first paint, then navbar + footer. -->
<!-- The OpenVibe Frame: the user's theme before first paint, then navbar + footer. -->
<!-- Deferred: a slow or unreachable openvibe.network never holds the first paint (the inline colours above cover it). -->
<!-- Deferred: a slow or unreachable openvibe.network never holds the first paint (the inline colours above cover it). -->
<link rel="stylesheet" href="/shared/kit.css" />
<link rel="stylesheet" href="/shared/kit.css" />
+ <link rel="preconnect" href="https://openvibe.network" crossorigin>
<script src="/shared/theme-loader.js" defer></script>
<script src="/shared/theme-loader.js" defer></script>
<script src="/shared/navbar.js" defer></script>
<script src="/shared/navbar.js" defer></script>
<script src="/shared/footer.js" defer></script>
<script src="/shared/footer.js" defer></script>
@@ -23,6 +23,7 @@
@@ -23,6 +23,7 @@
<meta name="twitter:image" content="https://openvibe.games/shared/social/games.jpg?v=a77ab4204f47" />
<meta name="twitter:image" content="https://openvibe.games/shared/social/games.jpg?v=a77ab4204f47" />
<link rel="stylesheet" href="/src/pages/play-pages.css" />
<link rel="stylesheet" href="/src/pages/play-pages.css" />
<!-- The OpenVibe Frame: the user's theme before first paint, then navbar + footer. -->
<!-- The OpenVibe Frame: the user's theme before first paint, then navbar + footer. -->
+ <link rel="preconnect" href="https://openvibe.network" crossorigin>
<script src="/shared/theme-loader.js" defer></script>
<script src="/shared/theme-loader.js" defer></script>
<script src="/shared/navbar.js" defer></script>
<script src="/shared/navbar.js" defer></script>
<script src="/shared/footer.js" defer></script>
<script src="/shared/footer.js" defer></script>
@@ -7,7 +7,8 @@
@@ -7,7 +7,8 @@
<title>Scraplandia — OpenVibe.Games</title>
<title>Scraplandia — OpenVibe.Games</title>
<meta name="description" content="Play Scraplandia: scrappy multiplayer survival-building in and around Scrap City, in your browser, no download. Part of the OpenVibe network." />
<meta name="description" content="Play Scraplandia: scrappy multiplayer survival-building in and around Scrap City, in your browser, no download. Part of the OpenVibe network." />
<!-- The OpenVibe Frame: the user's theme before first paint, then navbar + footer. -->
<!-- The OpenVibe Frame: the user's theme before first paint, then navbar + footer. -->
- <script src="/shared/theme-loader.js"></script>
+ <link rel="preconnect" href="https://openvibe.network" crossorigin>
+ <script src="/shared/theme-loader.js" defer></script>
<script src="/shared/navbar.js" defer></script>
<script src="/shared/navbar.js" defer></script>
<script src="/shared/footer.js" defer></script>
<script src="/shared/footer.js" defer></script>
<link rel="canonical" href="https://play.openvibe.games/" />
<link rel="canonical" href="https://play.openvibe.games/" />
@@ -392,7 +392,8 @@
@@ -392,7 +392,8 @@
<script type="module" src="/src/pages/worlds.ts"></script>
<script type="module" src="/src/pages/worlds.ts"></script>
<!-- The OpenVibe Frame (navbar + footer), as on every other page of the site: this page had only its own row of
<!-- The OpenVibe Frame (navbar + footer), as on every other page of the site: this page had only its own row of
links (phone sweep, 2026-11-01). -->
links (phone sweep, 2026-11-01). -->
- <script src="/shared/theme-loader.js"></script>
+ <link rel="preconnect" href="https://openvibe.network" crossorigin>
+ <script src="/shared/theme-loader.js" defer></script>
<script src="/shared/navbar.js" defer></script>
<script src="/shared/navbar.js" defer></script>
<script src="/shared/footer.js" defer></script>
<script src="/shared/footer.js" defer></script>
<script>
<script>
new file mode 100644
new file mode 100644
@@ -0,0 +1,30 @@
@@ -0,0 +1,30 @@
+import { readdirSync, readFileSync } from 'node:fs'
+import { dirname, join } from 'node:path'
+import { fileURLToPath } from 'node:url'
+import { describe, expect, it } from 'vitest'
+
+// Every client shell defers the shared scripts (the inline colours above cover the first paint) and
+// preconnects to openvibe.network once, with crossorigin, before theme-loader runs.
+const clientDir = join(dirname(fileURLToPath(import.meta.url)), '../../../client')
+const shells = readdirSync(clientDir).filter((f) => f.endsWith('.html')).sort()
+
+describe('client shells', () => {
+ it('has shells to check', () => {
+ expect(shells.length).toBeGreaterThanOrEqual(8)
+ })
+ for (const name of shells) {
+ it(`${name}: deferred shared scripts + one crossorigin preconnect`, () => {
+ const html = readFileSync(join(clientDir, name), 'utf8')
+ for (const m of html.matchAll(/<script\b[^>]*>/gi)) {
+ const tag = m[0]
+ if (!/\ssrc\s*=\s*"\/shared\//.test(tag)) continue
+ expect(/\bdefer\b|\basync\b/.test(tag) || /type\s*=\s*"module"/.test(tag)).toBe(true)
+ }
+ const pcs = [...html.matchAll(/<link rel="preconnect" href="https:\/\/openvibe\.network"[^>]*>/g)]
+ expect(pcs.length).toBe(1)
+ expect(pcs[0]![0]).toContain('crossorigin')
+ expect(html).toContain('<script src="/shared/theme-loader.js" defer></script>')
+ expect(html).toContain('<script src="/shared/navbar.js" defer></script>')
+ })
+ }
+})
new file mode 100644
new file mode 100644
@@ -0,0 +1,3 @@
@@ -0,0 +1,3 @@
+// file: 'apps/server/src/net/clientShells.test.ts'
+// covers: 'apps/server/src/net'
+// Generated by node test/run.js --index; do not edit.