Skip to main content

Module miniapps

Module miniapps 

Source
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§

MiniAppHistoryEntry
Mini App history entry
PeerAdvertisementRecord
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_advertisements limited to one chat, newest first, at most limit. 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 in topic? 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 mirrors get_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