From 03ecae4348182885b8aa06d2b42c2e7da88923b2 Mon Sep 17 00:00:00 2001 From: Rory& Date: Fri, 12 Jun 2026 16:27:38 +0200 Subject: Move more extensions to extensions --- src/api/util/utility/EmbedHandlers.ts | 4 ++-- src/api/util/utility/String.ts | 38 ----------------------------------- 2 files changed, 2 insertions(+), 40 deletions(-) delete mode 100644 src/api/util/utility/String.ts (limited to 'src/api/util/utility') diff --git a/src/api/util/utility/EmbedHandlers.ts b/src/api/util/utility/EmbedHandlers.ts index c18e4f79..9aedce11 100644 --- a/src/api/util/utility/EmbedHandlers.ts +++ b/src/api/util/utility/EmbedHandlers.ts @@ -22,8 +22,8 @@ import { yellow } from "picocolors"; import probe from "probe-image-size"; import { FindOptionsWhere, In } from "typeorm"; import { EmbedCache, Message } from "@spacebar/database"; -import { sleep, arrayDistinctBy, arrayGroupBy } from "@spacebar/extensions"; -import { Config, emitEvent, MessageUpdateEvent, normalizeUrl, OrmUtils } from "@spacebar/util"; +import { sleep, arrayDistinctBy, arrayGroupBy, normalizeUrl } from "@spacebar/extensions"; +import { Config, emitEvent, MessageUpdateEvent, OrmUtils } from "@spacebar/util"; import { Embed, EmbedImage, EmbedType } from "@spacebar/schemas"; export function getDefaultFetchOptions(): RequestInit { diff --git a/src/api/util/utility/String.ts b/src/api/util/utility/String.ts deleted file mode 100644 index e33613a3..00000000 --- a/src/api/util/utility/String.ts +++ /dev/null @@ -1,38 +0,0 @@ -/* - Spacebar: A FOSS re-implementation and extension of the Discord.com backend. - Copyright (C) 2023 Spacebar and Spacebar Contributors - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ - -import { Request } from "express"; -import { ntob } from "./Base64"; -import { FieldErrors, Random } from "@spacebar/util"; - -export function checkLength(str: string, min: number, max: number, key: string, req: Request) { - if (str.length < min || str.length > max) { - throw FieldErrors({ - [key]: { - code: "BASE_TYPE_BAD_LENGTH", - message: req.t("common:field.BASE_TYPE_BAD_LENGTH", { - length: `${min} - ${max}`, - }), - }, - }); - } -} - -export function generateCode() { - return ntob(Date.now() + Random.nextInt(0, 10000)); -} -- cgit 1.5.1