Expand description
Mini Apps database operations.
This module handles:
- Mini App history (recently opened apps)
- Mini App favorites
- Mini App permissions (per-app permission grants)
- Marketplace app version tracking
Structs§
- Mini
AppHistory Entry - Mini App history entry
- Peer
Advertisement Record - A persisted peer advertisement record from SQLite.
Functions§
- backfill_
marketplace_ ids - Backfill marketplace_id + installed_version for history entries that predate tracking. Matches the blossom hash in src_url filenames against the marketplace cache. Only hash-based matching is used — name matching is intentionally avoided to prevent phishing when public publishing is enabled.
- copy_
miniapp_ permissions - Copy all permissions from one file hash to another (for app updates)
- get_
active_ peer_ advertisements - Get active peer advertisements for a topic.
- get_
active_ peer_ advertisements_ in get_active_peer_advertisementslimited to one chat, newest first, at mostlimit. A topic is one chat’s session; an advertisement for it that arrived through any other chat (a stranger’s DM, a channel whose ban dropped the live signal) names nobody who is playing here.- get_
miniapp_ granted_ permissions - Get all granted permissions for a Mini App by its file hash Returns a comma-separated string of granted permission names
- get_
miniapp_ installed_ version - Get the installed version for a marketplace app by its marketplace_id
- get_
miniapps_ history - Get Mini Apps history sorted by last opened (most recent first)
- has_
miniapp_ permission_ prompt - Check if an app has been prompted for permissions yet (by file hash) Returns true if any permission record exists for this hash
- load_
marketplace_ cache - Load all marketplace apps from the SQLite cache.
- peer_
signal_ is_ current - Is this peer signal still the CURRENT word on
npub’s participation intopic? Gates the LIVE side of signal handling (session-peer add/remove, Iroh feed, lobby emit) so a replayed or out-of-order historical event can’t resurrect a departed player (ad after left) or evict an active one (stale left after a newer ad). Tie-break mirrorsget_active_peer_advertisements: on equal seconds the tombstone wins. - prune_
dangling_ miniapp_ history - Remove history entries whose package file no longer exists on disk (e.g. after a storage clear deleted the .xdc). A dead ref renders a broken tile that can only ever open to a file-not-found error.
- record_
miniapp_ opened - Record a Mini App being opened (upsert - insert or update) If the same name+src_url combo exists, update the attachment_ref, increment count, and update timestamp
- record_
miniapp_ opened_ with_ metadata - Record a Mini App being opened with additional metadata (categories, marketplace_id, and version)
- remove_
miniapp_ from_ history - Remove a Mini App from history by name
- revoke_
all_ miniapp_ permissions - Revoke all permissions for a Mini App by its file hash
- save_
marketplace_ cache - Save marketplace apps to the SQLite cache (full replace). Upserts all provided apps and deletes any IDs not in the new set.
- set_
miniapp_ favorite - Set the favorite status of a Mini App by its ID
- set_
miniapp_ permission - Set the granted status of a permission for a Mini App by its file hash
- set_
miniapp_ permissions - Set multiple permissions at once for a Mini App by its file hash Uses a transaction to ensure all permissions are set atomically
- toggle_
miniapp_ favorite - Toggle the favorite status of a Mini App by its ID
- update_
miniapp_ version - Update the installed version for a marketplace app