mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-09-11 13:46:10 -05:00
Remove bad custom urls script
This commit is contained in:
@@ -66,11 +66,9 @@ const userEditActionSchema = z
|
||||
.refine((val) => val === null || isCustomUrl(val), {
|
||||
message: "forms.errors.invalidCustomUrl.numbers",
|
||||
})
|
||||
.refine(
|
||||
// validate val only contains numbers and letters
|
||||
(val) => val === null || /^[a-zA-Z0-9-_]+$/.test(val),
|
||||
{ message: "forms.errors.invalidCustomUrl.strangeCharacter" }
|
||||
)
|
||||
.refine((val) => val === null || /^[a-zA-Z0-9-_]+$/.test(val), {
|
||||
message: "forms.errors.invalidCustomUrl.strangeCharacter",
|
||||
})
|
||||
.transform((val) => val?.toLowerCase())
|
||||
.nullable()
|
||||
),
|
||||
|
||||
9
scripts/remove-bad-custom-urls.ts
Normal file
9
scripts/remove-bad-custom-urls.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
/* eslint-disable no-console */
|
||||
import "dotenv/config";
|
||||
import { sql } from "~/db/sql";
|
||||
|
||||
sql.prepare(
|
||||
`update "User" set "customUrl" = NULL where "customUrl" like '%/%'`
|
||||
);
|
||||
|
||||
console.log("Done");
|
||||
Reference in New Issue
Block a user