mirror of
https://github.com/spacebarchat/server.git
synced 2026-08-23 13:59:52 +00:00
Move more extensions to extensions
This commit is contained in:
@@ -16,9 +16,9 @@
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Session } from "@spacebar/database";
|
||||
import { TimeSpan } from "@spacebar/util";
|
||||
import { setInterval } from "node:timers";
|
||||
import { Session } from "@spacebar/database";
|
||||
import { TimeSpan } from "@spacebar/extensions";
|
||||
|
||||
export async function initInstance() {
|
||||
// TODO: clean up database and delete tombstone data
|
||||
|
||||
@@ -20,7 +20,7 @@ import { HTTPError } from "lambert-server/HTTPError";
|
||||
import { Equal, In, Or } from "typeorm";
|
||||
import { fillMessageUrlEmbeds, randomString } from "@spacebar/api";
|
||||
import { getDatabase, Application, Attachment, Channel, CloudAttachment, Guild, Member, Message, ReadState, Role, Session, Sticker, User, Webhook } from "@spacebar/database";
|
||||
import { mathLogBase, arrayDistributeSequentially } from "@spacebar/extensions";
|
||||
import { mathLogBase, arrayDistributeSequentially, Stopwatch } from "@spacebar/extensions";
|
||||
import {
|
||||
Config,
|
||||
DiscordApiErrors,
|
||||
@@ -36,7 +36,6 @@ import {
|
||||
Permissions,
|
||||
ROLE_MENTION,
|
||||
Snowflake,
|
||||
Stopwatch,
|
||||
TraceNode,
|
||||
TraceRoot,
|
||||
TraceSubTree,
|
||||
|
||||
@@ -22,7 +22,6 @@ export * from "./handlers/Message";
|
||||
export * from "./utility/passwordStrength";
|
||||
export * from "./utility/RandomInviteID";
|
||||
export * from "./handlers/route";
|
||||
export * from "./utility/String";
|
||||
export * from "./handlers/Voice";
|
||||
export * from "./utility/captcha";
|
||||
export * from "./utility/EmbedHandlers";
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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));
|
||||
}
|
||||
Reference in New Issue
Block a user