health: drop hair_progress; owner = Stan's account email only
All checks were successful
Deploy production / deploy (push) Successful in 2m22s
All checks were successful
Deploy production / deploy (push) Successful in 2m22s
Regenerated the (not yet deployed) health migration without hair_progress.
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
import { error } from '@sveltejs/kit';
|
||||
|
||||
// The site has one owner (Stan). Owner-only data, such as the health tracker, needs both
|
||||
// the admin role and the owner's account email, so granting someone else `admin` (e.g. to
|
||||
// moderate Animaldex) never exposes it. Override with OWNER_EMAIL if the address changes.
|
||||
const OWNER_EMAIL = (process.env.OWNER_EMAIL || 'stan@stanrunge.dev').toLowerCase();
|
||||
// The site has exactly one owner: Stan's account (prod auth.user id tfn6OZDOpiQvMARIH65HQ2XJuaVvmGEe).
|
||||
// Owner-only data, such as the health tracker, is gated on that account's email, not on
|
||||
// a role, so other users (now or later, e.g. on a public tracking project) never see it.
|
||||
// Override with OWNER_EMAIL if the address ever changes.
|
||||
const OWNER_EMAIL = (process.env.OWNER_EMAIL || 'stan@stanrunge.dev').trim().toLowerCase();
|
||||
|
||||
type OwnerEvent = { locals: App.Locals };
|
||||
|
||||
export function isOwner(event: OwnerEvent): boolean {
|
||||
const user = event.locals.user;
|
||||
return !!user && user.role === 'admin' && user.email?.toLowerCase() === OWNER_EMAIL;
|
||||
return event.locals.user?.email?.trim().toLowerCase() === OWNER_EMAIL;
|
||||
}
|
||||
|
||||
/** Owner-only routes answer 404 to everyone else, so they don't reveal that they exist. */
|
||||
|
||||
Reference in New Issue
Block a user