mirror of
https://github.com/koreanbots/core.git
synced 2025-12-16 14:30:22 +00:00
* chore(deps): update dependency typescript to v4.2.4 (#314) Co-authored-by: Renovate Bot <bot@renovateapp.com> * fix(deps): update dependency core-js to v3.10.1 (#315) Co-authored-by: Renovate Bot <bot@renovateapp.com> * feat: camo images in bot desc * chore: added bot delete api * feat: delete button working * feat: added bot remove method * chore: added csrfCaptchaSchema * deps: update * fix: some error at callback * fix(deps): pin dependency abort-controller to 3.0.0 (#313) Co-authored-by: Renovate Bot <bot@renovateapp.com> * chore(deps): update dependency @types/node-fetch to v2.5.10 (#316) Co-authored-by: Renovate Bot <bot@renovateapp.com> * chore(deps): update dependency eslint-plugin-react to v7.23.2 (#317) Co-authored-by: Renovate Bot <bot@renovateapp.com> * style: fixed for deepscan * chore: improved user login interaction * fix(deps): update dependency @sentry/webpack-plugin to v1.15.0 (#318) * chore(deps): update dependency eslint to v7.24.0 (#320) * fix(deps): update dependency postcss to v8.2.10 (#321) Co-authored-by: Renovate Bot <bot@renovateapp.com> * ci: updated ci stuff * style: removed unnecessary script * fix: not using SENTRY_RELEASE env * chore: defaulting mysql password * chore: added sentry_dsn env and only uploading for master * ci: updated trigger * ci: passing source branch env only at push * chore(deps): update typescript-eslint monorepo to v4.22.0 (#322) Co-authored-by: Renovate Bot <bot@renovateapp.com> * chore(deps): update dependency eslint-config-prettier to v8.2.0 (#323) Co-authored-by: Renovate Bot <bot@renovateapp.com> * chore(deps): update dependency @types/react-select to v4.0.15 (#325) Co-authored-by: Renovate Bot <bot@renovateapp.com> * chore(deps): update dependency eslint-plugin-prettier to v3.4.0 (#326) Co-authored-by: Renovate Bot <bot@renovateapp.com> * chore(deps): update dependency @types/sanitize-html to v2 (#328) Co-authored-by: Renovate Bot <bot@renovateapp.com> * chore(deps): update dependency @types/node to v14.14.41 (#324) Co-authored-by: Renovate Bot <bot@renovateapp.com> * chore(deps): update dependency ts-jest to v26.5.5 (#327) Co-authored-by: Renovate Bot <bot@renovateapp.com> * ci: debugging * Update components/DeveloperLayout.tsx Co-authored-by: zero734kr <zero734kr@gmail.com> * Update components/Loader.tsx Co-authored-by: zero734kr <zero734kr@gmail.com> * Update components/ColorCard.tsx Co-authored-by: zero734kr <zero734kr@gmail.com> * Update components/ColorCard.tsx Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * fix(deps): update dependency core-js to v3.11.0 (#329) Co-authored-by: Renovate Bot <bot@renovateapp.com> * chore(deps): update dependency @types/sanitize-html to v2.3.1 (#330) Co-authored-by: Renovate Bot <bot@renovateapp.com> * fix(deps): update dependency postcss to v8.2.13 (#333) Co-authored-by: Renovate Bot <bot@renovateapp.com> * fix(deps): update dependency tailwindcss to v2.1.2 (#334) Co-authored-by: Renovate Bot <bot@renovateapp.com> * chore(deps): update dependency eslint to v7.25.0 (#335) Co-authored-by: Renovate Bot <bot@renovateapp.com> * fix(deps): update dependency @sentry/webpack-plugin to v1.15.1 (#332) Co-authored-by: Renovate Bot <bot@renovateapp.com> * chore(deps): update dependency @types/node to v14.14.43 (#339) Co-authored-by: Renovate Bot <bot@renovateapp.com> * chore(deps): update dependency @types/jest to v26.0.23 (#337) Co-authored-by: Renovate Bot <bot@renovateapp.com> * chore(deps): update dependency eslint-config-prettier to v8.3.0 (#336) Co-authored-by: Renovate Bot <bot@renovateapp.com> * chore(deps): update dependency @types/react to v17.0.4 (#338) Co-authored-by: Renovate Bot <bot@renovateapp.com> * Update utils/ShowdownExtensions.ts Co-authored-by: zero734kr <zero734kr@gmail.com> * style: fixed some styles * chore: updated api-docs git * refactor: made change on sentry * style: removed debug code * deps: removed node-mock * ci: removed env * style: code style * test: module names * chore: docker using python * chore: docker using build-base * ci: fixed syntax error * chore: changed sql type * feat: added vote * fix: version for v1 * feat: added v1 bot vote check * feat: clearing cache for deleted bot * chore: delete bot real working IMPORTANT: NOW DELETE BOT REAL WORKS! * fix: router called at non-client * style: removed space * feat: added vote check endpoint * fix: router called at non-client * fix(deps): update sentry monorepo to v6.3.5 (#331) Co-authored-by: Renovate Bot <bot@renovateapp.com> * fix(deps): update dependency core-js to v3.11.2 (#340) Co-authored-by: Renovate Bot <bot@renovateapp.com> * chore(deps): update dependency @types/react to v17.0.5 (#345) Co-authored-by: Renovate Bot <bot@renovateapp.com> * chore(deps): update typescript-eslint monorepo to v4.22.1 (#343) Co-authored-by: Renovate Bot <bot@renovateapp.com> * fix: BotCard button component rendered as Tag * feat: update docs * feat: using koreanbots cdn for og image * fix: missing querystring label * docs: some text change https://github.com/koreanbots/v2-testing/issues/72#issuecomment-807929228 * fix: removed unexpected char close: https://github.com/koreanbots/v2-testing/issues/76 * fix: redirecting at serverside * fix(deps): pin dependencies (#342) Co-authored-by: Renovate Bot <bot@renovateapp.com> * chore(deps): update dependency ts-jest to v26.5.6 (#347) Co-authored-by: Renovate Bot <bot@renovateapp.com> * fix(deps): update dependency postcss to v8.2.14 (#349) Co-authored-by: Renovate Bot <bot@renovateapp.com> * fix(deps): update dependency core-js to v3.11.3 (#348) Co-authored-by: Renovate Bot <bot@renovateapp.com> * fix: router instance called at serverside while rendering * Merge branch 'master' of https://github.com/koreanbots/koreanbots * feat: Sentry enabled only at production * fix: menu not closing close: https://github.com/koreanbots/v2-testing/issues/50 * chore: improved mobile design * fix: tooltip overflows screen close: https://github.com/koreanbots/v2-testing/issues/28 * fix: router called at server-side close: https://github.com/koreanbots/v2-testing/issues/77 * typo: fixed typo issue * typo: improved typo * fix: router called at serverside * chore: removed custom scrollbar style * style: fixed null checks * feat: added owner transfer and edit * chore: clearing cache for updates * chore: redirecting on update * chore: added button margin * feat: disabled webhook * chore: added some spaces * feat: added padding for ad * feat: remove wave * feat: added security page * chore: some margin * feat: added bug reporters * style: fixed eslint * fix(developers): https://github.com/koreanbots/v2-testing/issues/74 * chore: improved ad * feat: migrated to @sentry/nextjs * fix: card invite button fixed * chore: not releasing * chore: debugging * chore: skiping sentry auto release * feat: added docker hub build hook * fix: docker hook * fix: docker hook geting sentry dsn as build-arg * chore: added sentry envs * chore(docker): cleanup * fix: bugs at card * typo: fixed * chore: margin top at message * fix: card building weird * fix: sentry disabled * fix: query string invalid fix: https://github.com/koreanbots/v2-testing/issues/92 * fix: https://github.com/koreanbots/v2-testing/issues/94 * chore: improved style close: https://github.com/koreanbots/v2-testing/issues/83 * fix: scrollbar shown even its not overflowed fix: https://github.com/koreanbots/v2-testing/issues/86 * fix: home not displayed at dev portal fix: https://github.com/koreanbots/v2-testing/issues/84 * types: searchParams is optional prop * feat: added required field notice close: https://github.com/koreanbots/v2-testing/issues/90 * typo: fixed typo issues For https://github.com/koreanbots/v2-testing/issues/79 * fix: causing error on other git url ISSUE: https://sentry.io/share/issue/a13341dc1aab4e5aa994fee8857afff7/ * fix: handle AbortError * chore(deps): update dependency eslint to v7.26.0 (#353) Co-authored-by: Renovate Bot <bot@renovateapp.com> * fix(deps): update dependency core-js to v3.12.1 (#350) Co-authored-by: Renovate Bot <bot@renovateapp.com> * chore: reordered bot section * typo: fixed typo issue from https://github.com/koreanbots/v2-testing/issues/79 * feat: opening new tab for discord link close: https://github.com/koreanbots/v2-testing/issues/99 * feat: added opensearch * Update renovate.json * chore: prevent clickjacking * chore: added moz SearchForm for opensearch xml * fix(deps): update dependency rc-tooltip to v5 (#351) Co-authored-by: Renovate Bot <bot@renovateapp.com> * fix(deps): update sentry monorepo to v6.3.6 (#354) Co-authored-by: Renovate Bot <bot@renovateapp.com> * chore(deps): update dependency prettier to v2.3.0 (#355) Co-authored-by: Renovate Bot <bot@renovateapp.com> * chore(deps): update typescript-eslint monorepo to v4.23.0 (#356) Co-authored-by: Renovate Bot <bot@renovateapp.com> * fix(deps): update dependency postcss to v8.2.15 (#357) Co-authored-by: Renovate Bot <bot@renovateapp.com> * fix(deps): update dependency react-select to v4.3.1 (#358) Co-authored-by: Renovate Bot <bot@renovateapp.com> * fix(deps): update dependency knex to v0.95.5 (#359) Co-authored-by: Renovate Bot <bot@renovateapp.com> * style: added space * feat: added get botSubmits list api * chore: updated endpoint * typo: fixed and improved typo issues * chore: improved message for empty category close: https://github.com/koreanbots/v2-testing/issues/100 * feat: support pwa * types: added missing typing * chore: changed manifest * fix: catching error for ga blocked * fix: added missing argument * chore: made some changes * style: could be null * chore: improved pwa * fix: https://github.com/koreanbots/v2-testing/issues/105 * feat: added staff missing permission * fix: https://github.com/koreanbots/v2-testing/issues/104 * feat: added width style * Update pages/_app.tsx Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * style: suggestions at review * feat: updated api-docs * chore: added dest option * chore: changed icon path * feat: just commiting service worker * feat: added bug bounty group * ci: removed reviewdog * feat: added google optimize * chore: added maskable icon and changed short_name * ci: made some changes on renovate * Create SECURITY.md * feat: fetching docs from github * feat: added tos at footer * feat(iOS): added pwa splash screen * types: improved component typing * feat: discord rebranded * ci: configured renovate ignore * [TYPO] 기여 규칙 링크 수정 (#367) * fix(deps): update sentry monorepo to v6.4.0 (#364) * feat: added logging * style: reordered import * feat: improved logging * feat: private api changes * feat: added OG * chore: updated migrate.sql * ci: updated renovate * fix: seo * feat: added approve api * chore: some changes at deny * feat: added approve * refactor: using next-seo for seo * ci(renovate): removed unused option * chore: not passing pwa at navbar * style: removed line break * fix: https://github.com/koreanbots/v2-testing/issues/89 * feat: directly fetching from discord * feat: support searching with index * style: fix deepscan * fix: invalid avatar url * fix: https://github.com/koreanbots/v2-testing/issues/110 reopen: https://github.com/koreanbots/v2-testing/issues/89 * feat: added error message at submit button * fix: https://github.com/koreanbots/v2-testing/issues/89 * feat: added deny presets article * feat: added query aliases * chore: update docs * chore: remvoed empty file * feat: increased ratelimit * feat: added bot lists * style: removed unused variable * fix(deps): update dependency knex to v0.95.6 (#365) * chore(deps): update typescript-eslint monorepo to v4.24.0 (#366) * chore(deps): update dependency @types/react to v17.0.6 (#368) * fix(deps): update dependency formik to v2.2.8 (#369) * fix(deps): update dependency next to v10.2.2 (#370) * fix(deps): update sentry monorepo to v6.4.1 (#371) * fix(deps): update dependency sanitize-html to v2.4.0 (#372) * fix(deps): update dependency postcss to v8.3.0 (#373) * docs: updated license * feat: added refresh data * feat: better image size close: https://github.com/koreanbots/v2-testing/issues/81 * chore: changed slogan * fix: invalid v1 api * fix: forbidden error * feat: added char count at textarea close: https://github.com/koreanbots/v2-testing/issues/112 * feat: changed edit page route * fix(deps): update dependency next to v10.2.3 (#376) Co-authored-by: Renovate Bot <bot@renovateapp.com> * chore(deps): update dependency typescript to v4.3.2 (#383) Co-authored-by: Renovate Bot <bot@renovateapp.com> * chore(deps): update dependency eslint to v7.27.0 (#374) Co-authored-by: Renovate Bot <bot@renovateapp.com> * deps: removed core-js * deps: lock updated * feat: added stable docker compose file Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Renovate Bot <bot@renovateapp.com> Co-authored-by: zero734kr <zero734kr@gmail.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: MintyU <deathcat@outlook.kr>
324 lines
9.6 KiB
TypeScript
324 lines
9.6 KiB
TypeScript
import * as Yup from 'yup'
|
|
import YupKorean from 'yup-locales-ko'
|
|
import { ListType } from '@types'
|
|
import { categories, library, reportCats } from '@utils/Constants'
|
|
import { HTTPProtocol, ID, Prefix, Url, Vanity } from '@utils/Regex'
|
|
|
|
Yup.setLocale(YupKorean)
|
|
Yup.addMethod(Yup.array, 'unique', function(message, mapper = a => a) {
|
|
return this.test('unique', message || 'array must be unique', function(list) {
|
|
return list.length === new Set(list.map(mapper)).size
|
|
})
|
|
})
|
|
|
|
export const botListArgumentSchema: Yup.SchemaOf<botListArgument> = Yup.object({
|
|
type: Yup.mixed()
|
|
.oneOf(['VOTE', 'TRUSTED', 'NEW', 'PARTNERED', 'CATEGORY', 'SEARCH'])
|
|
.required(),
|
|
page: Yup.number()
|
|
.positive()
|
|
.integer()
|
|
.notRequired()
|
|
.default(1),
|
|
query: Yup.string().notRequired(),
|
|
})
|
|
|
|
export interface botListArgument {
|
|
type: ListType
|
|
page?: number
|
|
query?: string
|
|
}
|
|
|
|
export const ImageOptionsSchema: Yup.SchemaOf<ImageOptions> = Yup.object({
|
|
id: Yup.string().required(),
|
|
ext: Yup.mixed<ext>()
|
|
.oneOf(['webp', 'png', 'gif'])
|
|
.required(),
|
|
size: Yup.mixed<ImageSize>()
|
|
.oneOf(['128', '256', '512'])
|
|
.required(),
|
|
})
|
|
|
|
interface ImageOptions {
|
|
id: string
|
|
ext: ext
|
|
size: ImageSize
|
|
}
|
|
|
|
type ext = 'webp' | 'png' | 'gif'
|
|
type ImageSize = '128' | '256' | '512'
|
|
|
|
export const WidgetOptionsSchema: Yup.SchemaOf<WidgetOptions> = Yup.object({
|
|
id: Yup.string().required(),
|
|
ext: Yup.mixed<widgetExt>()
|
|
.oneOf(['svg'])
|
|
.required(),
|
|
type: Yup.mixed<widgetType>()
|
|
.oneOf(['votes', 'servers', 'status'])
|
|
.required(),
|
|
scale: Yup.number()
|
|
.positive()
|
|
.min(0.5)
|
|
.max(3)
|
|
.required(),
|
|
style: Yup.mixed<'flat' | 'classic'>()
|
|
.oneOf(['flat', 'classic'])
|
|
.default('flat'),
|
|
icon: Yup.boolean().default(true),
|
|
})
|
|
|
|
interface WidgetOptions {
|
|
id: string
|
|
ext: widgetExt
|
|
type: widgetType
|
|
scale: number
|
|
style: 'flat' | 'classic'
|
|
icon: boolean
|
|
}
|
|
|
|
type widgetType = 'votes' | 'servers' | 'status'
|
|
type widgetExt = 'svg'
|
|
|
|
export const PageCount = Yup.number()
|
|
.integer()
|
|
.positive()
|
|
.required()
|
|
|
|
export const OauthCallbackSchema: Yup.SchemaOf<OauthCallback> = Yup.object({
|
|
code: Yup.string().required(),
|
|
})
|
|
|
|
export const botCategoryListArgumentSchema: Yup.SchemaOf<botCategoryListArgument> = Yup.object({
|
|
page: PageCount,
|
|
category: Yup.mixed()
|
|
.oneOf(categories)
|
|
.required(),
|
|
})
|
|
|
|
interface botCategoryListArgument {
|
|
page: number
|
|
category: string
|
|
}
|
|
|
|
interface OauthCallback {
|
|
code: string
|
|
}
|
|
|
|
export const SearchQuerySchema: Yup.SchemaOf<SearchQuery> = Yup.object({
|
|
q: Yup.string()
|
|
.min(2, '최소 2글자 이상 입력해주세요.')
|
|
.max(50)
|
|
.required('검색어를 입력해주세요.')
|
|
.label('검색어'),
|
|
page: Yup.number()
|
|
.positive()
|
|
.integer()
|
|
.notRequired()
|
|
.default(1)
|
|
.label('페이지'),
|
|
})
|
|
|
|
interface SearchQuery {
|
|
q: string
|
|
page: number
|
|
}
|
|
|
|
export const AddBotSubmitSchema: Yup.SchemaOf<AddBotSubmit> = Yup.object({
|
|
agree: Yup.boolean()
|
|
.oneOf([true], '상단의 체크박스를 클릭해주세요.')
|
|
.required('상단의 체크박스를 클릭해주세요.'),
|
|
id: Yup.string()
|
|
.matches(ID, '올바른 봇 ID를 입력해주세요.')
|
|
.required('봇 ID는 필수 항목입니다.'),
|
|
prefix: Yup.string()
|
|
.matches(Prefix, '접두사는 띄어쓰기로 시작할 수 없습니다.')
|
|
.min(1, '접두사는 최소 1자여야합니다.')
|
|
.max(32, '접두사는 최대 32자까지만 가능합니다.')
|
|
.required('접두사는 필수 항목입니다.'),
|
|
library: Yup.string()
|
|
.oneOf(library)
|
|
.required('라이브러리는 필수 항목입니다.'),
|
|
website: Yup.string()
|
|
.matches(HTTPProtocol, 'http:// 또는 https:// 로 시작해야합니다.')
|
|
.matches(Url, '올바른 웹사이트 URL을 입력해주세요.')
|
|
.max(64, 'URL은 최대 64자까지만 가능합니다.')
|
|
.nullable(),
|
|
url: Yup.string()
|
|
.matches(HTTPProtocol, 'http:// 또는 https:// 로 시작해야합니다.')
|
|
.matches(Url, '올바른 초대링크 URL을 입력해주세요.')
|
|
.max(128, 'URL은 최대 128자까지만 가능합니다.')
|
|
.nullable(),
|
|
git: Yup.string()
|
|
.matches(HTTPProtocol, 'http:// 또는 https:// 로 시작해야합니다.')
|
|
.matches(Url, '올바른 깃 URL을 입력해주세요.')
|
|
.max(64, 'URL은 최대 64자까지만 가능합니다.')
|
|
.nullable(),
|
|
discord: Yup.string()
|
|
.matches(Vanity, '디스코드 초대코드 형식을 지켜주세요.')
|
|
.min(2, '지원 디스코드는 최소 2자여야합니다.')
|
|
.max(32, '지원 디스코드는 최대 32자까지만 가능합니다.')
|
|
.nullable(),
|
|
category: Yup.array(Yup.string().oneOf(categories))
|
|
.min(1, '최소 한 개의 카테고리를 선택해주세요.')
|
|
.unique('카테고리는 중복될 수 없습니다.')
|
|
.required('카테고리는 필수 항목입니다.'),
|
|
intro: Yup.string()
|
|
.min(2, '봇 소개는 최소 2자여야합니다.')
|
|
.max(60, '봇 소개는 최대 60자여야합니다.')
|
|
.required('봇 소개는 필수 항목입니다.'),
|
|
desc: Yup.string()
|
|
.min(100, '봇 설명은 최소 100자여야합니다.')
|
|
.max(1500, '봇 설명은 최대 1500자여야합니다.')
|
|
.required('봇 설명은 필수 항목입니다.'),
|
|
_csrf: Yup.string().required(),
|
|
_captcha: Yup.string().required()
|
|
})
|
|
|
|
export interface AddBotSubmit {
|
|
agree: boolean
|
|
id: string
|
|
prefix: string
|
|
library: string
|
|
website?: string
|
|
url?: string
|
|
git?: string
|
|
discord?: string
|
|
category: string | string[]
|
|
intro: string
|
|
desc: string
|
|
_csrf: string
|
|
_captcha?: string
|
|
}
|
|
|
|
export const BotStatUpdateSchema: Yup.SchemaOf<BotStatUpdate> = Yup.object({
|
|
servers: Yup.number()
|
|
.positive('서버 수는 양수여야합니다.')
|
|
.integer('서버 수는 정수여야합니다.')
|
|
.required()
|
|
})
|
|
|
|
export interface BotStatUpdate {
|
|
servers: number
|
|
}
|
|
|
|
export const ReportSchema: Yup.SchemaOf<Report> = Yup.object({
|
|
category: Yup.mixed().oneOf(reportCats, '신고 구분은 필수 항목입니다.').required('신고 구분은 필수 항목입니다.'),
|
|
description: Yup.string().min(100, '최소 100자여야합니다.').max(1500, '1500자 이하로 입력해주세요.').required('설명은 필수 항목입니다.'),
|
|
_csrf: Yup.string()
|
|
})
|
|
|
|
export interface Report {
|
|
category: string
|
|
description: string
|
|
_csrf: string
|
|
}
|
|
|
|
export const ManageBotSchema: Yup.SchemaOf<ManageBot> = Yup.object({
|
|
prefix: Yup.string()
|
|
.matches(Prefix, '접두사는 띄어쓰기로 시작할 수 없습니다.')
|
|
.min(1, '접두사는 최소 1자여야합니다.')
|
|
.max(32, '접두사는 최대 32자까지만 가능합니다.')
|
|
.required('접두사는 필수 항목입니다.'),
|
|
library: Yup.string()
|
|
.oneOf(library)
|
|
.required('라이브러리는 필수 항목입니다.'),
|
|
website: Yup.string()
|
|
.matches(HTTPProtocol, 'http:// 또는 https:// 로 시작해야합니다.')
|
|
.matches(Url, '올바른 웹사이트 URL을 입력해주세요.')
|
|
.max(64, 'URL은 최대 64자까지만 가능합니다.')
|
|
.nullable(),
|
|
url: Yup.string()
|
|
.matches(HTTPProtocol, 'http:// 또는 https:// 로 시작해야합니다.')
|
|
.matches(Url, '올바른 초대링크 URL을 입력해주세요.')
|
|
.max(128, 'URL은 최대 128자까지만 가능합니다.')
|
|
.nullable(),
|
|
git: Yup.string()
|
|
.matches(HTTPProtocol, 'http:// 또는 https:// 로 시작해야합니다.')
|
|
.matches(Url, '올바른 깃 URL을 입력해주세요.')
|
|
.max(64, 'URL은 최대 64자까지만 가능합니다.')
|
|
.nullable(),
|
|
discord: Yup.string()
|
|
.matches(Vanity, '디스코드 초대코드 형식을 지켜주세요.')
|
|
.min(2, '지원 디스코드는 최소 2자여야합니다.')
|
|
.max(32, '지원 디스코드는 최대 32자까지만 가능합니다.')
|
|
.nullable(),
|
|
category: Yup.array(Yup.string().oneOf(categories))
|
|
.min(1, '최소 한 개의 카테고리를 선택해주세요.')
|
|
.unique('카테고리는 중복될 수 없습니다.')
|
|
.required('카테고리는 필수 항목입니다.'),
|
|
intro: Yup.string()
|
|
.min(2, '봇 소개는 최소 2자여야합니다.')
|
|
.max(60, '봇 소개는 최대 60자여야합니다.')
|
|
.required('봇 소개는 필수 항목입니다.'),
|
|
desc: Yup.string()
|
|
.min(100, '봇 설명은 최소 100자여야합니다.')
|
|
.max(1500, '봇 설명은 최대 1500자여야합니다.')
|
|
.required('봇 설명은 필수 항목입니다.'),
|
|
_csrf: Yup.string().required(),
|
|
})
|
|
|
|
export interface ManageBot {
|
|
prefix: string
|
|
library: string
|
|
website: string
|
|
url: string
|
|
git: string
|
|
discord: string
|
|
category: string[]
|
|
intro: string
|
|
desc: string
|
|
_csrf: string
|
|
}
|
|
|
|
export const CsrfCaptchaSchema: Yup.SchemaOf<CsrfCaptcha> = Yup.object({
|
|
_csrf: Yup.string().required(),
|
|
_captcha: Yup.string().required()
|
|
})
|
|
|
|
export interface CsrfCaptcha {
|
|
_csrf: string
|
|
_captcha: string
|
|
}
|
|
|
|
export const DeveloperBotSchema: Yup.SchemaOf<DeveloperBot> = Yup.object({
|
|
webhook: Yup.string()
|
|
.matches(HTTPProtocol, 'http:// 또는 https:// 로 시작해야합니다.')
|
|
.matches(Url, '올바른 웹훅 URL을 입력해주세요.')
|
|
.max(150, 'URL은 최대 150자까지만 가능합니다.')
|
|
.nullable(),
|
|
_csrf: Yup.string().required(),
|
|
})
|
|
|
|
export interface DeveloperBot {
|
|
webhook: string | null
|
|
_csrf: string
|
|
}
|
|
|
|
export const ResetBotTokenSchema: Yup.SchemaOf<ResetBotToken> = Yup.object({
|
|
token: Yup.string().required(),
|
|
_csrf: Yup.string().required(),
|
|
})
|
|
|
|
export interface ResetBotToken {
|
|
token: string
|
|
_csrf: string
|
|
}
|
|
|
|
export const EditBotOwnerSchema: Yup.SchemaOf<EditBotOwner> = Yup.object({
|
|
owners: Yup.array(Yup.string())
|
|
.min(1, '최소 한 명의 소유자는 입력해주세요.')
|
|
.max(10, '소유자는 최대 10명까지만 가능합니다.')
|
|
.unique('소유자 아이디는 중복될 수 없습니다.')
|
|
.required('소유자는 필수 항목입니다.'),
|
|
_csrf: Yup.string().required(),
|
|
_captcha: Yup.string().required()
|
|
})
|
|
|
|
export interface EditBotOwner {
|
|
owners: string[]
|
|
_csrf: string
|
|
_captcha: string
|
|
}
|
|
|
|
export default Yup
|