Make everything case sensitive and also add a existing check for splash text thing
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user