feat: instance invites

This commit is contained in:
Zoe
2026-10-08 13:50:44 -05:00
parent f6e1bc1f47
commit fae05ebc4c
17 changed files with 3962 additions and 26 deletions
+22
View File
@@ -0,0 +1,22 @@
/**
* Tells the register page whether an invite link still works and who it is
* from. Public on purpose, the person opening the link has no account yet.
*/
export default defineEventHandler(async (event) => {
const invite = await findUsableInvite(getRouterParam(event, 'token')!);
if (!invite) {
return { valid: false as const };
}
return {
valid: true as const,
expiresAt: invite.expiresAt,
singleUse: invite.maxUses === 1,
inviter: {
id: invite.inviterId,
name: invite.inviterName,
image: invite.inviterImage,
},
};
});