• 🏠
  • Community stores
  • Your own page
View as Markdown

Your own page

A community's page is a normal website you write, shown in its Home and Store channels and at its gamescommunities.com/c/<id> address. Groups have one too. Games Communities' bar (Join, channels, Report) stays around it; prices and Buy are only on Games Communities' game pages, which your page opens with GC.open(ident).

Files

  • index.html is the front (shown in Home); store.html is shown in Store (the front if there's no Home).
  • Other pages and folders work as on any site: relative links such as about.html or css/site.css.
  • Write it however you like: plain HTML, any library or framework, or a build tool (upload the built files).
  • Up to the number of files and the size per file shown in the editor; PNG and JPEG are kept as WebP when that's smaller, under the same name.
  • Paths use letters, digits, -_.~()+@ and spaces; folders with /; no dot files.

Drafts, publishing and history

Every change goes to the draft. Publish shows it to everyone as a new version. The page's History keeps old versions; bring one back and it becomes the draft and goes live again.

Ways to change the files:

  • In the app: the Store channel's officers' menu, the page's files and code editor.
  • From your PC: gc-cli page pull <folder> --community=<id> downloads the files; gc-cli page push <folder> --community=<id> [--publish] sends them back.
  • With an AI helper: see AI helpers.
  • A whole folder as a zip: upload it, and it becomes the draft (one wrapping folder is taken off).

The seal

The page runs in a sealed frame of its own:

  • No cookies, logins, localStorage or IndexedDB (they throw). Keep state in memory, or in the community's data through its scripts.
  • Scripts, styles, fonts, pictures, media, workers and fetch() load only from the page's own files. Inline <script> and <style>, eval, WebAssembly, data: and blob: are fine; pictures may also use GC.games()' addresses.
  • No forms (handle submit in JavaScript), popups or new tabs. Links inside the page work; GC.go and GC.open leave it.

The GC bridge

Every HTML file gets the GC object first (don't add it). Each call returns a Promise.

CallAnswers
GC.homeThe page's folder address.
GC.me()The viewer if a member: { id, name, nick, rank }, else null. Asked once, shared with widgets.
GC.store()The store: name, tagline, about, tags, member, and its pieces (see below). No prices.
GC.games()Every game the store shows (up to 500), with their pictures' addresses.
GC.theme(){ accent, font, dark }.
GC.open(ident)Opens a game's page (from a click).
GC.addToCart()On game.html: adds its game to the viewer's cart and opens the cart (from a click).
GC.playtest()On game.html: starts its game's free minutes when GC.game().playtest has them (from a click).
GC.go(where)"channels", "join", { channel: id } or { member: id } (from a click).
GC.toast(text)A short message (one every 3 s).
GC.burst(name)Confetti, hearts, sparks or the design's own burst.
GC.data(key)A public. key of the community's data.
GC.picture(hash)An upload as a data: address.
GC.fetch(url)A GET of one of the sites gc.json lists, through Games Communities: { status, type, body }, text up to 256 KB.
GC.on(name, fn)Hears a script's live(name, data).

gc.json: outside sites, servers and devices

A page reaches only its own folder until a gc.json at its top says more:

{ "sites": ["api.example.com"], "connect": ["wss://game.example.com"], "devices": ["microphone", "camera", "gamepad", "fullscreen"] }
  • sites (up to 20 names, no addresses): what GC.fetch reads. Games Communities fetches them, so viewers' IP addresses stay theirs. Members under 18 outside private and 18+ groups get none.
  • connect (up to 10, wss:// or https:// and a name, a port maybe): your own servers (a game's WebSocket) the page reaches straight from the viewer's PC with fetch or WebSocket. They see the viewer's IP address, so Games Communities asks each member once first; until they say yes (and for those signed out, children, and under 18s outside private groups) the page runs without them.
  • devices: the microphone and camera work once a viewer says yes (Games Communities asks once for the group's page and widgets; Settings › What groups may do takes it back); members under 18 outside private groups are never asked. A gamepad and fullscreen work once listed. Anything not listed stays off.

A gc.json that doesn't read right stops the page publishing, with why.

GC.store()'s pieces: layout (the pieces in order), stage [{game, blurb}], shelves [{id, name, about, style, games}], events [{name, about, starts, ends, live, games}], deals [{game, ends}], bundles [{name, games}], studio, dlc, picks [{game, kind, blurb, author}], voted [{game, votes}], wanted [{game, members}], played [{game, players}], playing [{game, members}], nights [{title, game, starts, going}]. Games are idents.

<!doctype html>
<link rel="stylesheet" href="css/site.css">
<h1 id="name"></h1>
<div id="shelves"></div>
<script>
  const store = await GC.store();
  const games = Object.fromEntries((await GC.games()).map((g) => [g.ident, g]));
  document.getElementById("name").textContent = store.name;
  for (const shelf of store.shelves) {
    const row = document.createElement("section");
    row.innerHTML = `<h2>${shelf.name}</h2>`;
    for (const ident of shelf.games) {
      const b = document.createElement("button");
      b.textContent = games[ident]?.title ?? ident;
      b.onclick = () => GC.open(ident);
      row.append(b);
    }
    document.getElementById("shelves").append(row);
  }
</script>

Note

The example uses top-level await: put it in <script type="module"> in a real page.

The page tells Games Communities where it is (its path and #), so the store's link opens it there again.

Safety

Pages are checked when published: words asking for passwords, codes or cards, or speaking as Games Communities, are refused. Visitors can Report a page.