const usage = await api.hosts.usage();
if (!usage.maxHosts) {
// This plan has no hosting. Show the limit, with a link to the plans.
}usage = api.hosts.usage()
if not usage["maxHosts"]:
pass # This plan has no hosting. Show the limit, with a link to the plans.packstringWhich plan.
hosts · maxHostsintegerHow many exist, and how many the plan allows.
usedBytesintegerWhat the hosts keep online.
quotaBytesintegerThe account's object storage quota.
Read the zero
The same shape as maxMailboxes: 0 for mail. Read the number rather than matching on a plan's name — the day the plans change, the page that matches is the one that lies.
quotaBytes is not a hosting allowance
It is the account's object storage — shared with files, mailboxes and everything else kept for the account. cloud.usage() shows the same number from the other side, with object.hostingBytes saying how much of it is hosting.
Showing it
const u = await api.hosts.usage();
if (!u.maxHosts) return showPlanLimit();
if (u.hosts >= u.maxHosts) return showAtLimit();
return showCreateButton();def hosting_screen():
u = api.hosts.usage()
if not u["maxHosts"]:
return show_plan_limit()
if u["hosts"] >= u["maxHosts"]:
return show_at_limit()
return show_create_button()