ACCESS=accounts (config/access.ts; open stays the default and behaves as before): Newznab and the catalog's releases routes name a user (apikey or the web interface's token), whose tier sets searches and NZBs per UTC day (Newznab 500/501, the catalog 429) and how far back they see (102/403). Counted in one upsert per use, so the last one can't be taken twice; caps, stats and refused requests aren't counted. Signup takes an invite (SIGNUP), which may give a tier; ace access:invite, access:tier (extends a running tier), access:suspend. The web interface signs in and shows the day's usage and the Newznab key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
29 lines
771 B
TypeScript
29 lines
771 B
TypeScript
import vine from '@vinejs/vine'
|
|
|
|
/**
|
|
* Shared rules for email and password.
|
|
*/
|
|
const email = () => vine.string().email().maxLength(254)
|
|
const password = () => vine.string().minLength(8).maxLength(32)
|
|
|
|
/**
|
|
* Validator to use when performing self-signup
|
|
*/
|
|
export const signupValidator = vine.create({
|
|
fullName: vine.string().nullable(),
|
|
email: email().unique({ table: 'users', column: 'email' }),
|
|
password: password(),
|
|
passwordConfirmation: password().sameAs('password'),
|
|
// Needed when SIGNUP is `invite` (config/access.ts).
|
|
invite: vine.string().trim().maxLength(32).optional(),
|
|
})
|
|
|
|
/**
|
|
* Validator to use before validating user credentials
|
|
* during login
|
|
*/
|
|
export const loginValidator = vine.create({
|
|
email: email(),
|
|
password: vine.string(),
|
|
})
|