Log inGet started
Package

covers.module

Newest version

This package holds more than this page lists. See all of its files in its world.

README.md

launcher.covers

Where a world's cover is read from. A screen draws an image it fetched with no credential, so a cover's address is one ZeroMind answers without one:

  • a world anyone may open (public, and not a draft) is read at its sized thumbnail, /v1/worlds/<guid>/thumbnail?size=<size>&v=<digest>;
  • any other world's cover is read at the content address its digest names, /v1/content/<digest>.

A world ZeroMind lists with no cover digest has no cover, and so no address. The launcher reads every world's cover address through it.

API

  • covers.SIZES: the sizes ZeroMind serves a thumbnail at: thumb, card and display.
  • covers.openToAnyone(item) -> boolean: whether a world as a listing or a world record states it (visibility, draft) may be opened by anyone: a public world that is not a draft.
  • covers.address(issuer, guid, digest?, size?, openToAnyone) -> string?: the address of the world's cover, or nil when digest is not a hex sha256. A size outside covers.SIZES reads card.
  • covers.digestOf(url?) -> string?: the cover digest an address covers.address returned names, or nil.

Example

local Covers = require("@builtin::modules.api.engine.launcher.covers")

local open = Covers.openToAnyone(world)
local url = Covers.address("https://origozero.ai", world.guid, world.thumbnail_sha256, "card", open)
-- a public world: "https://origozero.ai/v1/worlds/<guid>/thumbnail?size=card&v=<sha>"
-- any other world: "https://origozero.ai/v1/content/<sha>"
assert(Covers.digestOf(url) == world.thumbnail_sha256)