Make everything case sensitive and also add a existing check for splash text thing

This commit is contained in:
2026-01-31 13:59:49 -07:00
parent 4383695846
commit acddabb7aa
3 changed files with 53 additions and 35 deletions

View File

@@ -7,6 +7,7 @@ import {
} from '../../../lib/util'
import { checkAuthorization } from '../../../lib/auth'
import { berryDashSplashTexts } from '../../../lib/tables'
import { eq } from 'drizzle-orm'
type Body = {
token: string
@@ -89,6 +90,23 @@ export async function handler (context: Context) {
)
}
const exists = await db1
.select()
.from(berryDashSplashTexts)
.where(eq(berryDashSplashTexts.content, btoa(body.content)))
.limit(1)
.execute()
if (exists[0]) {
return jsonResponse(
{
success: false,
message: 'That splash text already exists, accepted or denied.'
},
409
)
}
const result = await validateTurnstile(body.token, ip)
if (!result.success) {
connection0.end()