Builtin Library
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,cardanddisplay.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 whendigestis not a hex sha256. Asizeoutsidecovers.SIZESreadscard.covers.digestOf(url?) -> string?: the cover digest an addresscovers.addressreturned 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)