Skip to content

Commit

Permalink
feat: use william.js for discord validation
Browse files Browse the repository at this point in the history
  • Loading branch information
wdhdev committed Dec 22, 2023
1 parent ee32fb6 commit f53bb10
Show file tree
Hide file tree
Showing 3 changed files with 16,879 additions and 5 deletions.
6 changes: 2 additions & 4 deletions backend/UserConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { UserConfiguration, UserConfigTypeChecker, PostgresConfiguration } from
import fs from 'fs-extra';
import { path } from '@tycrek/joint';
import { log } from './log.js';
import { validate } from 'william.js';

const FILEPATH = path.join('.ass-data/userconfig.json');

Expand Down Expand Up @@ -40,10 +41,7 @@ const Checkers: UserConfigTypeChecker = {
idSize: numChecker,
gfySize: numChecker,
maximumFileSize: numChecker,
discordWebhook: (val) => {
const regex = /^https:\/\/discord\.com\/api\/webhooks\/\d+\/\S+$/;
return regex.test(val);
},
discordWebhook: (val) => validate.discord.webhook(val),

s3: {
endpoint: basicStringChecker,
Expand Down
Loading

0 comments on commit f53bb10

Please sign in to comment.