mirror of
https://github.com/spacebarchat/server.git
synced 2026-10-22 15:22:43 +00:00
🎨 remove long relatives paths -> short module paths
This commit is contained in:
1 parent
95830fa2fc
commit
d50073fc41
79 files changed
+392
-220
No files matched your search
+1
-10
@@ -1,12 +1,3 @@
|
||||
export * from "./Server";
|
||||
export * from "./middlewares/";
|
||||
export * from "./schema/Ban";
|
||||
export * from "./schema/Channel";
|
||||
export * from "./schema/Guild";
|
||||
export * from "./schema/Invite";
|
||||
export * from "./schema/Message";
|
||||
export * from "./util/instanceOf";
|
||||
export * from "./util/instanceOf";
|
||||
export * from "./util/RandomInviteID";
|
||||
export * from "./util/String";
|
||||
export { check as checkPassword } from "./util/passwordStrength";
|
||||
export * from "./util/";
|
||||
@@ -1,7 +1,7 @@
|
||||
import { NextFunction, Request, Response } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { EntityNotFoundError } from "typeorm";
|
||||
import { FieldError } from "../util/instanceOf";
|
||||
import { FieldError } from "@fosscord/api";
|
||||
import { ApiError } from "@fosscord/util";
|
||||
|
||||
export function ErrorHandler(error: Error, req: Request, res: Response, next: NextFunction) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Config, listenEvent } from "@fosscord/util";
|
||||
import { NextFunction, Request, Response, Router } from "express";
|
||||
import { getIpAdress } from "../util/ipAddress";
|
||||
import { getIpAdress } from "@fosscord/api";
|
||||
import { API_PREFIX_TRAILING_SLASH } from "./Authentication";
|
||||
|
||||
// Docs: https://discord.com/developers/docs/topics/rate-limits
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Request, Response, Router } from "express";
|
||||
import { check, FieldErrors, Length } from "../../util/instanceOf";
|
||||
import { check, FieldErrors, Length } from "@fosscord/api";
|
||||
import bcrypt from "bcrypt";
|
||||
import jwt from "jsonwebtoken";
|
||||
import { Config, User } from "@fosscord/util";
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Request, Response, Router } from "express";
|
||||
import { trimSpecial, User, Snowflake, Config, defaultSettings } from "@fosscord/util";
|
||||
import bcrypt from "bcrypt";
|
||||
import { check, Email, EMAIL_REGEX, FieldErrors, Length } from "../../util/instanceOf";
|
||||
import { check, Email, EMAIL_REGEX, FieldErrors, Length } from "@fosscord/api";
|
||||
import "missing-native-js-functions";
|
||||
import { generateToken } from "./login";
|
||||
import { getIpAdress, IPAnalysis, isProxy } from "../../util/ipAddress";
|
||||
import { getIpAdress, IPAnalysis, isProxy } from "@fosscord/api";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { In } from "typeorm";
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { ChannelDeleteEvent, Channel, ChannelUpdateEvent, emitEvent, getPermissi
|
||||
import { Router, Response, Request } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { ChannelModifySchema } from "../../../schema/Channel";
|
||||
import { check } from "../../../util/instanceOf";
|
||||
import { check } from "@fosscord/api";
|
||||
const router: Router = Router();
|
||||
// TODO: delete channel
|
||||
// TODO: Get channel
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Router, Request, Response } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { check } from "../../../util/instanceOf";
|
||||
import { random } from "../../../util/RandomInviteID";
|
||||
import { check } from "@fosscord/api";
|
||||
import { random } from "@fosscord/api";
|
||||
import { InviteCreateSchema } from "../../../schema/Invite";
|
||||
import { getPermission, Channel, Invite, InviteCreateEvent, emitEvent, User, Guild, PublicInviteRelation } from "@fosscord/util";
|
||||
import { isTextChannel } from "./messages";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { emitEvent, getPermission, MessageAckEvent, ReadState } from "@fosscord/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
|
||||
import { check } from "../../../../../util/instanceOf";
|
||||
import { check } from "@fosscord/api";
|
||||
|
||||
const router = Router();
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Channel, emitEvent, getPermission, MessageDeleteEvent, Message, MessageUpdateEvent } from "@fosscord/util";
|
||||
import { Router, Response, Request } from "express";
|
||||
import { MessageCreateSchema } from "../../../../../schema/Message";
|
||||
import { check } from "../../../../../util/instanceOf";
|
||||
import { handleMessage, postHandleMessage } from "../../../../../util/Message";
|
||||
import { check } from "@fosscord/api";
|
||||
import { handleMessage, postHandleMessage } from "@fosscord/api";
|
||||
|
||||
const router = Router();
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Router, Response, Request } from "express";
|
||||
import { Channel, Config, emitEvent, getPermission, MessageDeleteBulkEvent, Message } from "@fosscord/util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
|
||||
import { check } from "../../../../util/instanceOf";
|
||||
import { check } from "@fosscord/api";
|
||||
import { In } from "typeorm";
|
||||
|
||||
const router: Router = Router();
|
||||
|
||||
@@ -2,11 +2,11 @@ import { Router, Response, Request } from "express";
|
||||
import { Attachment, Channel, ChannelType, getPermission, Message } from "@fosscord/util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { MessageCreateSchema } from "../../../../schema/Message";
|
||||
import { check, instanceOf, Length } from "../../../../util/instanceOf";
|
||||
import { check, instanceOf, Length } from "@fosscord/api";
|
||||
import multer from "multer";
|
||||
import { Query } from "mongoose";
|
||||
import { sendMessage } from "../../../../util/Message";
|
||||
import { uploadFile } from "../../../../util/cdn";
|
||||
import { sendMessage } from "@fosscord/api";
|
||||
import { uploadFile } from "@fosscord/api";
|
||||
import { FindManyOptions, LessThan, MoreThan } from "typeorm";
|
||||
|
||||
const router: Router = Router();
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Channel, ChannelPermissionOverwrite, ChannelUpdateEvent, emitEvent, get
|
||||
import { Router, Response, Request } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
|
||||
import { check } from "../../../util/instanceOf";
|
||||
import { check } from "@fosscord/api";
|
||||
const router: Router = Router();
|
||||
|
||||
// TODO: Only permissions your bot has in the guild or channel can be allowed/denied (unless your bot has a MANAGE_ROLES overwrite in the channel)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Router, Response, Request } from "express";
|
||||
import { check, Length } from "../../../util/instanceOf";
|
||||
import { check, Length } from "@fosscord/api";
|
||||
import { Channel, Config, getPermission, trimSpecial, Webhook } from "@fosscord/util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { isTextChannel } from "./messages/index";
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { Request, Response, Router } from "express";
|
||||
import { emitEvent, getPermission, GuildBanAddEvent, GuildBanRemoveEvent, Guild, Ban, User, Member } from "@fosscord/util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { getIpAdress } from "../../../util/ipAddress";
|
||||
import { BanCreateSchema } from "../../../schema/Ban";
|
||||
import { check } from "../../../util/instanceOf";
|
||||
import { getIpAdress, check } from "@fosscord/api";
|
||||
import { BanCreateSchema } from "@fosscord/api/schema/Ban";
|
||||
|
||||
const router: Router = Router();
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Channel, ChannelUpdateEvent, getPermission, emitEvent } from "@fosscord
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { ChannelModifySchema } from "../../../schema/Channel";
|
||||
|
||||
import { check } from "../../../util/instanceOf";
|
||||
import { check } from "@fosscord/api";
|
||||
const router = Router();
|
||||
|
||||
router.get("/", async (req: Request, res: Response) => {
|
||||
|
||||
@@ -3,8 +3,8 @@ import { emitEvent, getPermission, Guild, GuildUpdateEvent, Member } from "@foss
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { GuildUpdateSchema } from "../../../schema/Guild";
|
||||
|
||||
import { check } from "../../../util/instanceOf";
|
||||
import { handleFile } from "../../../util/cdn";
|
||||
import { check } from "@fosscord/api";
|
||||
import { handleFile } from "@fosscord/api";
|
||||
import "missing-native-js-functions";
|
||||
|
||||
const router = Router();
|
||||
|
||||
@@ -11,8 +11,8 @@ import {
|
||||
emitEvent
|
||||
} from "@fosscord/util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { check } from "../../../../../util/instanceOf";
|
||||
import { MemberChangeSchema } from "../../../../../schema/Member";
|
||||
import { check } from "@fosscord/api";
|
||||
import { MemberChangeSchema } from "@fosscord/api/schema/Member";
|
||||
import { In } from "typeorm";
|
||||
|
||||
const router = Router();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Request, Response, Router } from "express";
|
||||
import { Guild, Member, PublicMemberProjection } from "@fosscord/util";
|
||||
import { instanceOf, Length } from "../../../../util/instanceOf";
|
||||
import { instanceOf, Length } from "@fosscord/api";
|
||||
import { MoreThan } from "typeorm";
|
||||
|
||||
const router = Router();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {Config, Guild, Member} from "@fosscord/util";
|
||||
import { Config, Guild, Member } from "@fosscord/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import {getVoiceRegions} from "../../../util/Voice";
|
||||
import {getIpAdress} from "../../../util/ipAddress";
|
||||
import { getVoiceRegions } from "@fosscord/api";
|
||||
import { getIpAdress } from "@fosscord/api";
|
||||
|
||||
const router = Router();
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
} from "@fosscord/util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
|
||||
import { check } from "../../../util/instanceOf";
|
||||
import { check } from "@fosscord/api";
|
||||
import { RoleModifySchema, RolePositionUpdateSchema } from "../../../schema/Roles";
|
||||
import { DiscordApiErrors } from "@fosscord/util";
|
||||
import { In } from "typeorm";
|
||||
|
||||
@@ -2,8 +2,8 @@ import { Request, Response, Router } from "express";
|
||||
import { Guild, getPermission, Template } from "@fosscord/util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { TemplateCreateSchema, TemplateModifySchema } from "../../../schema/Template";
|
||||
import { check } from "../../../util/instanceOf";
|
||||
import { generateCode } from "../../../util/String";
|
||||
import { check } from "@fosscord/api";
|
||||
import { generateCode } from "@fosscord/api";
|
||||
|
||||
const router: Router = Router();
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Channel, ChannelType, getPermission, Guild, Invite, trimSpecial } from "@fosscord/util";
|
||||
import { Router, Request, Response } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { check, Length } from "../../../util/instanceOf";
|
||||
import { check, Length } from "@fosscord/api";
|
||||
|
||||
const router = Router();
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import { check } from "../../../../../util/instanceOf";
|
||||
import { check } from "@fosscord/api";
|
||||
import { VoiceStateUpdateSchema } from "../../../../../schema";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { updateVoiceState } from "../../../../../util/VoiceState";
|
||||
import { updateVoiceState } from "@fosscord/api";
|
||||
|
||||
const router = Router();
|
||||
|
||||
router.patch("/", check(VoiceStateUpdateSchema), async (req: Request, res: Response) => {
|
||||
const body = req.body as VoiceStateUpdateSchema;
|
||||
const { guild_id, user_id } = req.params;
|
||||
await updateVoiceState(body, guild_id, req.user_id, user_id)
|
||||
await updateVoiceState(body, guild_id, req.user_id, user_id);
|
||||
return res.sendStatus(204);
|
||||
});
|
||||
|
||||
export default router;
|
||||
export default router;
|
||||
@@ -1,15 +1,15 @@
|
||||
import { check } from "../../../../../util/instanceOf";
|
||||
import { check } from "@fosscord/api";
|
||||
import { VoiceStateUpdateSchema } from "../../../../../schema";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { updateVoiceState } from "../../../../../util/VoiceState";
|
||||
import { updateVoiceState } from "@fosscord/api";
|
||||
|
||||
const router = Router();
|
||||
|
||||
router.patch("/", check(VoiceStateUpdateSchema), async (req: Request, res: Response) => {
|
||||
const body = req.body as VoiceStateUpdateSchema;
|
||||
const { guild_id } = req.params;
|
||||
await updateVoiceState(body, guild_id, req.user_id)
|
||||
await updateVoiceState(body, guild_id, req.user_id);
|
||||
return res.sendStatus(204);
|
||||
});
|
||||
|
||||
export default router;
|
||||
export default router;
|
||||
@@ -2,7 +2,7 @@ import { Request, Response, Router } from "express";
|
||||
import { Guild, getPermission, Snowflake, Member } from "@fosscord/util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
|
||||
import { check } from "../../../util/instanceOf";
|
||||
import { check } from "@fosscord/api";
|
||||
import { GuildUpdateWelcomeScreenSchema } from "../../../schema/Guild";
|
||||
|
||||
const router: Router = Router();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Request, Response, Router } from "express";
|
||||
import { Config, Permissions, Guild, Invite, Channel, Member } from "@fosscord/util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { random } from "../../../util/RandomInviteID";
|
||||
import { random } from "@fosscord/api";
|
||||
|
||||
const router: Router = Router();
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Request, Response, Router } from "express";
|
||||
import { getPermission, Guild } from "@fosscord/util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { check } from "../../../util/instanceOf";
|
||||
import { check } from "@fosscord/api";
|
||||
import { WidgetModifySchema } from "../../../schema/Widget";
|
||||
|
||||
const router: Router = Router();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Router, Request, Response } from "express";
|
||||
import { Role, Guild, Snowflake, Config, User, Member, Channel } from "@fosscord/util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { check } from "./../../util/instanceOf";
|
||||
import { check } from "@fosscord/api";
|
||||
import { GuildCreateSchema } from "../../schema/Guild";
|
||||
import { DiscordApiErrors } from "@fosscord/util";
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ const router: Router = Router();
|
||||
import { Template, Guild, Role, Snowflake, Config, User, Member } from "@fosscord/util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { GuildTemplateCreateSchema } from "../../../schema/Guild";
|
||||
import { check } from "../../../util/instanceOf";
|
||||
import { check } from "@fosscord/api";
|
||||
import { DiscordApiErrors } from "@fosscord/util";
|
||||
|
||||
router.get("/:code", async (req: Request, res: Response) => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Router, Request, Response } from "express";
|
||||
import { User } from "../../../../../util/dist";
|
||||
import { User } from "@fosscord/util";
|
||||
|
||||
const router: Router = Router();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Router, Request, Response } from "express";
|
||||
import { PublicConnectedAccount, PublicUser, User, UserPublic } from "../../../../../util/dist";
|
||||
import { PublicConnectedAccount, PublicUser, User, UserPublic } from "@fosscord/util";
|
||||
|
||||
const router: Router = Router();
|
||||
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
import { Router, Request, Response } from "express";
|
||||
import { Channel, ChannelCreateEvent, ChannelType, Snowflake, trimSpecial, User, emitEvent } from "@fosscord/util";
|
||||
import { Channel, ChannelCreateEvent, ChannelType, Snowflake, trimSpecial, User, emitEvent, Recipient } from "@fosscord/util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
|
||||
import { DmChannelCreateSchema } from "../../../schema/Channel";
|
||||
import { check } from "../../../util/instanceOf";
|
||||
import { check } from "@fosscord/api";
|
||||
import { In } from "typeorm";
|
||||
import { Recipient } from "../../../../../util/dist/entities/Recipient";
|
||||
|
||||
const router: Router = Router();
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Router, Request, Response } from "express";
|
||||
import { User, PrivateUserProjection } from "@fosscord/util";
|
||||
import { UserModifySchema } from "../../../schema/User";
|
||||
import { check } from "../../../util/instanceOf";
|
||||
import { handleFile } from "../../../util/cdn";
|
||||
import { check } from "@fosscord/api";
|
||||
import { handleFile } from "@fosscord/api";
|
||||
|
||||
const router: Router = Router();
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import { Router, Response, Request } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { DiscordApiErrors } from "@fosscord/util";
|
||||
|
||||
import { check, Length } from "../../../util/instanceOf";
|
||||
import { check, Length } from "@fosscord/api";
|
||||
|
||||
const router = Router();
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Router, Response, Request } from "express";
|
||||
import { User, UserSettings } from "@fosscord/util";
|
||||
import { check } from "../../../util/instanceOf";
|
||||
import { check } from "@fosscord/api";
|
||||
import { UserSettingsSchema } from "../../../schema/User";
|
||||
|
||||
const router = Router();
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { Router, Request, Response } from "express";
|
||||
import {getIpAdress} from "../../util/ipAddress";
|
||||
import {getVoiceRegions} from "../../util/Voice";
|
||||
import { getIpAdress } from "@fosscord/api";
|
||||
import { getVoiceRegions } from "@fosscord/api";
|
||||
|
||||
const router: Router = Router();
|
||||
|
||||
router.get("/", async (req: Request, res: Response) => {
|
||||
res.json(await getVoiceRegions(getIpAdress(req), true))//vip true?
|
||||
res.json(await getVoiceRegions(getIpAdress(req), true)); //vip true?
|
||||
});
|
||||
|
||||
export default router;
|
||||
@@ -1,12 +1,12 @@
|
||||
import { check } from "./../util/passwordStrength";
|
||||
import { checkPassword } from "@fosscord/api";
|
||||
|
||||
console.log(check("123456789012345"));
|
||||
console.log(checkPassword("123456789012345"));
|
||||
// -> 0.25
|
||||
console.log(check("ABCDEFGHIJKLMOPQ"));
|
||||
console.log(checkPassword("ABCDEFGHIJKLMOPQ"));
|
||||
// -> 0.25
|
||||
console.log(check("ABC123___...123"));
|
||||
console.log(checkPassword("ABC123___...123"));
|
||||
// ->
|
||||
console.log(check(""));
|
||||
console.log(checkPassword(""));
|
||||
// ->
|
||||
// console.log(check(""));
|
||||
// console.log(checkPassword(""));
|
||||
// // ->
|
||||
@@ -0,0 +1,11 @@
|
||||
export * from "./Base64";
|
||||
export * from "./cdn";
|
||||
export * from "./instanceOf";
|
||||
export * from "./ipAddress";
|
||||
export * from "./Message";
|
||||
export * from "./passwordStrength";
|
||||
export * from "./RandomInviteID";
|
||||
export * from "./route";
|
||||
export * from "./String";
|
||||
export * from "./Voice";
|
||||
export * from "./VoiceState";
|
||||
@@ -16,7 +16,7 @@ const blocklist: string[] = []; // TODO: update ones passwordblocklist is stored
|
||||
*
|
||||
* Returns: 0 > pw > 1
|
||||
*/
|
||||
export function check(password: string): number {
|
||||
export function checkPassword(password: string): number {
|
||||
const { minLength, minNumbers, minUpperCase, minSymbols } = Config.get().register.password;
|
||||
var strength = 0;
|
||||
|
||||
|
||||
Reference in new issue
Block a user