openvibers/openvibe.games Commits
Home: Your stuff across OpenVibe (items, badges, achievements in every game) for whoever is signed in, from the shared profile panel; left out until the pinned openvibe-shared has it (#150)
Changes
@@@ -11,6 +11,7 @@ import {readPlayTitles,renderHome,renderStats,++ yourStuffSection,type HomeData,type HomeSources,} from './portalHome.js'@@@ -203,3 +204,16 @@ describe('the home page live sections', () => {expect(html).not.toContain('<!--ov:home')})})++++describe('your stuff across OpenVibe', () => {++ it('is a hidden section the shared profile panel fills for whoever is signed in', () => {++ const html = yourStuffSection(true)++ expect(html).toContain('id="your-stuff" data-ov-profile-section hidden')++ expect(html).toContain('<div data-ov-profile="me">')++ expect(html).toContain('src="/shared/profile-panel.js')++ expect(html).toContain('href="/shared/profile-panel.css')++ })++ it('is left out until the pinned openvibe-shared serves the panel', () => {++ expect(yourStuffSection(false)).toBe('')++ })++})@@@ -1,3 +1,4 @@++import { createRequire } from 'node:module'import { SCRAPLANDIA_PACK } from '@openvibe/content'import { SALVAGE_RUSH_PACK } from '@openvibe/content/salvage-rush'import type { CreatorWorld } from '@openvibe/persistence'@@@ -18,6 +19,14 @@ import type { SteamGame } from '../steam/steamCatalog.js'* slow Play or database never holds the page: the first request after boot waits at most FIRST_WAIT_MS.*/++// openvibe-shared's profile panel (4.13: profile-panel.js, data-ov-profile="me"): served at /shared/ once the pinned++// openvibe-shared has it, and only then does the home carry "Your stuff".++interface SharedFiles { isBrowserFile(name: string): boolean }++interface SharedServe { hashOf(name: string): string }++const sharedRequire = createRequire(import.meta.url)++const sharedFiles = sharedRequire('openvibe-shared/files') as SharedFiles++const sharedServe = sharedRequire('openvibe-shared/serve') as SharedServe++const CACHE_MS = 60_000const FIRST_WAIT_MS = 2_500const PLAY_SITE = 'https://play.openvibe.network'@@@ -426,6 +435,26 @@ export function homeExtraJsonLd(site: string, playSite: string): unknown[] {]}++/**++ * "Your stuff across OpenVibe" (the owner, 2026-10-25: see your inventory anywhere, Steam-style): the signed-in++ * person's items, badges and achievements in every game, drawn in the browser by openvibe-shared's profile panel for++ * whoever this site's /auth/me names. The page is one cached build for everyone, so the section ships hidden and the++ * panel shows it once drawn; for someone signed out it stays hidden. Left out until the pinned openvibe-shared has it.++ */++export function yourStuffSection(hasPanel = sharedFiles.isBrowserFile('profile-panel.js')): string {++ if (!hasPanel) return ''++ const v = (name: string): string => {++ try { return `?v=${sharedServe.hashOf(name)}` } catch { return '' }++ }++ return `<section class="home-sec" id="your-stuff" data-ov-profile-section hidden aria-labelledby="your-stuff-h">++<h2 id="your-stuff-h">Your stuff across OpenVibe</h2>++<p class="home-lede">Your items, badges and achievements in every game, the same on every OpenVibe site.</p>++<div data-ov-profile="me"><a href="https://openvibe.network/my">Your account</a></div>++<link rel="stylesheet" href="/shared/profile-panel.css${v('profile-panel.css')}">++<script src="/shared/profile-panel.js${v('profile-panel.js')}" defer></script>++</section>`++}++export function renderHome(d: HomeData,now: number,@@@ -435,6 +464,7 @@ export function renderHome(return {stats: renderStats(d),sections: [++ yourStuffSection(),boardsSection(d),achievementsSection(d),worldsSection(d, now),
@@ -11,6 +11,7 @@ import {
@@ -11,6 +11,7 @@ import {
readPlayTitles,
readPlayTitles,
renderHome,
renderHome,
renderStats,
renderStats,
+ yourStuffSection,
type HomeData,
type HomeData,
type HomeSources,
type HomeSources,
} from './portalHome.js'
} from './portalHome.js'
@@ -203,3 +204,16 @@ describe('the home page live sections', () => {
@@ -203,3 +204,16 @@ describe('the home page live sections', () => {
expect(html).not.toContain('<!--ov:home')
expect(html).not.toContain('<!--ov:home')
})
})
})
})
+
+describe('your stuff across OpenVibe', () => {
+ it('is a hidden section the shared profile panel fills for whoever is signed in', () => {
+ const html = yourStuffSection(true)
+ expect(html).toContain('id="your-stuff" data-ov-profile-section hidden')
+ expect(html).toContain('<div data-ov-profile="me">')
+ expect(html).toContain('src="/shared/profile-panel.js')
+ expect(html).toContain('href="/shared/profile-panel.css')
+ })
+ it('is left out until the pinned openvibe-shared serves the panel', () => {
+ expect(yourStuffSection(false)).toBe('')
+ })
+})
@@ -1,3 +1,4 @@
@@ -1,3 +1,4 @@
+import { createRequire } from 'node:module'
import { SCRAPLANDIA_PACK } from '@openvibe/content'
import { SCRAPLANDIA_PACK } from '@openvibe/content'
import { SALVAGE_RUSH_PACK } from '@openvibe/content/salvage-rush'
import { SALVAGE_RUSH_PACK } from '@openvibe/content/salvage-rush'
import type { CreatorWorld } from '@openvibe/persistence'
import type { CreatorWorld } from '@openvibe/persistence'
@@ -18,6 +19,14 @@ import type { SteamGame } from '../steam/steamCatalog.js'
@@ -18,6 +19,14 @@ import type { SteamGame } from '../steam/steamCatalog.js'
* slow Play or database never holds the page: the first request after boot waits at most FIRST_WAIT_MS.
* slow Play or database never holds the page: the first request after boot waits at most FIRST_WAIT_MS.
*/
*/
+// openvibe-shared's profile panel (4.13: profile-panel.js, data-ov-profile="me"): served at /shared/ once the pinned
+// openvibe-shared has it, and only then does the home carry "Your stuff".
+interface SharedFiles { isBrowserFile(name: string): boolean }
+interface SharedServe { hashOf(name: string): string }
+const sharedRequire = createRequire(import.meta.url)
+const sharedFiles = sharedRequire('openvibe-shared/files') as SharedFiles
+const sharedServe = sharedRequire('openvibe-shared/serve') as SharedServe
+
const CACHE_MS = 60_000
const CACHE_MS = 60_000
const FIRST_WAIT_MS = 2_500
const FIRST_WAIT_MS = 2_500
const PLAY_SITE = 'https://play.openvibe.network'
const PLAY_SITE = 'https://play.openvibe.network'
@@ -426,6 +435,26 @@ export function homeExtraJsonLd(site: string, playSite: string): unknown[] {
@@ -426,6 +435,26 @@ export function homeExtraJsonLd(site: string, playSite: string): unknown[] {
]
]
}
}
+/**
+ * "Your stuff across OpenVibe" (the owner, 2026-10-25: see your inventory anywhere, Steam-style): the signed-in
+ * person's items, badges and achievements in every game, drawn in the browser by openvibe-shared's profile panel for
+ * whoever this site's /auth/me names. The page is one cached build for everyone, so the section ships hidden and the
+ * panel shows it once drawn; for someone signed out it stays hidden. Left out until the pinned openvibe-shared has it.
+ */
+export function yourStuffSection(hasPanel = sharedFiles.isBrowserFile('profile-panel.js')): string {
+ if (!hasPanel) return ''
+ const v = (name: string): string => {
+ try { return `?v=${sharedServe.hashOf(name)}` } catch { return '' }
+ }
+ return `<section class="home-sec" id="your-stuff" data-ov-profile-section hidden aria-labelledby="your-stuff-h">
+<h2 id="your-stuff-h">Your stuff across OpenVibe</h2>
+<p class="home-lede">Your items, badges and achievements in every game, the same on every OpenVibe site.</p>
+<div data-ov-profile="me"><a href="https://openvibe.network/my">Your account</a></div>
+<link rel="stylesheet" href="/shared/profile-panel.css${v('profile-panel.css')}">
+<script src="/shared/profile-panel.js${v('profile-panel.js')}" defer></script>
+</section>`
+}
+
export function renderHome(
export function renderHome(
d: HomeData,
d: HomeData,
now: number,
now: number,
@@ -435,6 +464,7 @@ export function renderHome(
@@ -435,6 +464,7 @@ export function renderHome(
return {
return {
stats: renderStats(d),
stats: renderStats(d),
sections: [
sections: [
+ yourStuffSection(),
boardsSection(d),
boardsSection(d),
achievementsSection(d),
achievementsSection(d),
worldsSection(d, now),
worldsSection(d, now),