mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 08:28:19 +01:00
feat(api): ✨ Preliminary captcha support database tables
This commit is contained in:
parent
9d8c2e81e9
commit
a6159b9d55
6
drizzle/migrations/0026_neat_stranger.sql
Normal file
6
drizzle/migrations/0026_neat_stranger.sql
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
CREATE TABLE IF NOT EXISTS "CaptchaChallenges" (
|
||||
"id" uuid PRIMARY KEY DEFAULT uuid_generate_v7() NOT NULL,
|
||||
"challenge" jsonb NOT NULL,
|
||||
"expires_at" timestamp(3) DEFAULT NOW() + INTERVAL '5 minutes',
|
||||
"created_at" timestamp(3) DEFAULT now() NOT NULL
|
||||
);
|
||||
2137
drizzle/migrations/meta/0026_snapshot.json
Normal file
2137
drizzle/migrations/meta/0026_snapshot.json
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -183,6 +183,13 @@
|
|||
"when": 1718147685855,
|
||||
"tag": "0025_violet_susan_delgado",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 26,
|
||||
"version": "7",
|
||||
"when": 1718234302625,
|
||||
"tag": "0026_neat_stranger",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import type { EntityValidator } from "@lysand-org/federation";
|
||||
import type { Challenge } from "altcha-lib/types";
|
||||
import { relations, sql } from "drizzle-orm";
|
||||
import {
|
||||
type AnyPgColumn,
|
||||
|
|
@ -15,6 +16,21 @@ import {
|
|||
} from "drizzle-orm/pg-core";
|
||||
import type { Source as APISource } from "~/types/mastodon/source";
|
||||
|
||||
export const CaptchaChallenges = pgTable("CaptchaChallenges", {
|
||||
id: uuid("id").default(sql`uuid_generate_v7()`).primaryKey().notNull(),
|
||||
challenge: jsonb("challenge").notNull().$type<Challenge>(),
|
||||
expiresAt: timestamp("expires_at", {
|
||||
precision: 3,
|
||||
mode: "string",
|
||||
}).default(
|
||||
// 5 minutes
|
||||
sql`NOW() + INTERVAL '5 minutes'`,
|
||||
),
|
||||
createdAt: timestamp("created_at", { precision: 3, mode: "string" })
|
||||
.defaultNow()
|
||||
.notNull(),
|
||||
});
|
||||
|
||||
export const Emojis = pgTable("Emojis", {
|
||||
id: uuid("id").default(sql`uuid_generate_v7()`).primaryKey().notNull(),
|
||||
shortcode: text("shortcode").notNull(),
|
||||
|
|
|
|||
|
|
@ -103,6 +103,7 @@
|
|||
"@lysand-org/federation": "^1.2.0",
|
||||
"@oclif/core": "^4.0.4",
|
||||
"@tufjs/canonical-json": "^2.0.0",
|
||||
"altcha-lib": "^0.3.0",
|
||||
"blurhash": "^2.0.5",
|
||||
"chalk": "^5.3.0",
|
||||
"cli-progress": "^3.12.0",
|
||||
|
|
|
|||
Loading…
Reference in a new issue