feat: public shopping list links can allow editing
Owner opts in per-list via a new "Allow editing" toggle next to the existing public-link switch. Anonymous writes are scoped to that one list only — the link id is the sole credential, enforced in getShoppingListAccess and the item routes (no session required there now), with an IP rate limit on genuinely anonymous requests. Turning off the public link also revokes editing. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -13,6 +13,12 @@ export async function requireSession() {
|
||||
return { session, response: null };
|
||||
}
|
||||
|
||||
/** Like requireSession, but never 401s — for endpoints that also accept anonymous
|
||||
* access via a resource-scoped capability (e.g. a public-editable share link). */
|
||||
export async function getOptionalSession() {
|
||||
return auth.api.getSession({ headers: await headers() });
|
||||
}
|
||||
|
||||
export async function requireAdmin() {
|
||||
const { session, response } = await requireSession();
|
||||
if (response) return { session: null, response };
|
||||
|
||||
Reference in New Issue
Block a user