mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-24 19:32:46 +01:00
Clean up imports
Signed-off-by: TheArcaneBrony <myrainbowdash949@gmail.com>
This commit is contained in:
parent
32b93c857f
commit
45432dd9c8
15
.vscode/tasks.json
vendored
Normal file
15
.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"type": "typescript",
|
||||
"tsconfig": "tsconfig.json",
|
||||
"option": "watch",
|
||||
"problemMatcher": [
|
||||
"$tsc-watch"
|
||||
],
|
||||
"group": "build",
|
||||
"label": "tsc: watch - tsconfig.json"
|
||||
}
|
||||
]
|
||||
}
|
@ -1,7 +1,13 @@
|
||||
import "missing-native-js-functions";
|
||||
import { Server, ServerOptions } from "lambert-server";
|
||||
import { Authentication, CORS } from "./middlewares/";
|
||||
import { Config, initDatabase, initEvent, Sentry } from "@fosscord/util";
|
||||
import {
|
||||
Config,
|
||||
initDatabase,
|
||||
initEvent,
|
||||
Sentry,
|
||||
registerRoutes,
|
||||
} from "@fosscord/util";
|
||||
import { ErrorHandler } from "./middlewares/ErrorHandler";
|
||||
import { BodyParser } from "./middlewares/BodyParser";
|
||||
import { Router, Request, Response, NextFunction } from "express";
|
||||
@ -11,7 +17,6 @@ import TestClient from "./middlewares/TestClient";
|
||||
import { initTranslation } from "./middlewares/Translation";
|
||||
import morgan from "morgan";
|
||||
import { initInstance } from "./util/handlers/Instance";
|
||||
import { registerRoutes } from "@fosscord/util";
|
||||
import { red } from "picocolors";
|
||||
|
||||
export interface FosscordServerOptions extends ServerOptions {}
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { Request, Response, Router } from "express";
|
||||
import { route } from "@fosscord/api";
|
||||
import { Application, OrmUtils, Team, trimSpecial, User } from "@fosscord/util";
|
||||
|
||||
const router: Router = Router();
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { Router, Request, Response } from "express";
|
||||
import { route } from "@fosscord/api";
|
||||
import { getIpAdress, IPAnalysis } from "@fosscord/api";
|
||||
import { route, getIpAdress, IPAnalysis } from "@fosscord/api";
|
||||
const router = Router();
|
||||
|
||||
router.get("/", route({}), async (req: Request, res: Response) => {
|
||||
|
@ -2,7 +2,6 @@ import { Router, Response, Request } from "express";
|
||||
import {
|
||||
Attachment,
|
||||
Channel,
|
||||
ChannelType,
|
||||
Config,
|
||||
DmChannelDTO,
|
||||
emitEvent,
|
||||
@ -13,22 +12,13 @@ import {
|
||||
Snowflake,
|
||||
uploadFile,
|
||||
Member,
|
||||
Role,
|
||||
MessageCreateSchema,
|
||||
ReadState,
|
||||
DiscordApiErrors,
|
||||
getRights,
|
||||
Rights,
|
||||
} from "@fosscord/util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import {
|
||||
handleMessage,
|
||||
postHandleMessage,
|
||||
route,
|
||||
getIpAdress,
|
||||
} from "@fosscord/api";
|
||||
import { handleMessage, postHandleMessage, route } from "@fosscord/api";
|
||||
import multer from "multer";
|
||||
import { yellow } from "picocolors";
|
||||
import { FindManyOptions, LessThan, MoreThan } from "typeorm";
|
||||
import { URL } from "url";
|
||||
|
||||
|
@ -9,9 +9,9 @@ import {
|
||||
Webhook,
|
||||
WebhookCreateSchema,
|
||||
WebhookType,
|
||||
DiscordApiErrors,
|
||||
} from "@fosscord/util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { DiscordApiErrors } from "@fosscord/util";
|
||||
import crypto from "crypto";
|
||||
|
||||
const router: Router = Router();
|
||||
|
@ -10,7 +10,7 @@ router.get("/", route({}), async (req: Request, res: Response) => {
|
||||
const { limit, personalization_disabled } = req.query;
|
||||
let showAllGuilds = Config.get().guild.discovery.showAllGuilds;
|
||||
|
||||
const genLoadId = (size: Number) =>
|
||||
const genLoadId = (size: number) =>
|
||||
[...Array(size)]
|
||||
.map(() => Math.floor(Math.random() * 16).toString(16))
|
||||
.join("");
|
||||
|
@ -1,14 +1,4 @@
|
||||
import {
|
||||
Channel,
|
||||
emitEvent,
|
||||
GuildDeleteEvent,
|
||||
Guild,
|
||||
Member,
|
||||
Message,
|
||||
Role,
|
||||
Invite,
|
||||
Emoji,
|
||||
} from "@fosscord/util";
|
||||
import { emitEvent, GuildDeleteEvent, Guild } from "@fosscord/util";
|
||||
import { Router, Request, Response } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { route } from "@fosscord/api";
|
||||
|
@ -1,5 +1,3 @@
|
||||
import { Guild, Config } from "@fosscord/util";
|
||||
|
||||
import { Router, Request, Response } from "express";
|
||||
import { route } from "@fosscord/api";
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { getPermission, Invite, PublicInviteRelation } from "@fosscord/util";
|
||||
import { Invite, PublicInviteRelation } from "@fosscord/util";
|
||||
import { route } from "@fosscord/api";
|
||||
import { Request, Response, Router } from "express";
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { getPermission, Member } from "@fosscord/util";
|
||||
import { Member } from "@fosscord/util";
|
||||
import { route } from "@fosscord/api";
|
||||
import { Request, Response, Router } from "express";
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { Config, Guild, Member } from "@fosscord/util";
|
||||
import { Guild } from "@fosscord/util";
|
||||
import { Request, Response, Router } from "express";
|
||||
import { getVoiceRegions, route } from "@fosscord/api";
|
||||
import { getIpAdress } from "@fosscord/api";
|
||||
import { getVoiceRegions, route, getIpAdress } from "@fosscord/api";
|
||||
|
||||
const router = Router();
|
||||
|
||||
|
@ -9,9 +9,6 @@ import {
|
||||
Member,
|
||||
Permissions,
|
||||
User,
|
||||
getRights,
|
||||
Rights,
|
||||
MemberPrivateProjection,
|
||||
} from "@fosscord/util";
|
||||
const router = Router();
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Router, Request, Response } from "express";
|
||||
import { Guild, Member, User } from "@fosscord/util";
|
||||
import { Member, User } from "@fosscord/util";
|
||||
import { route } from "@fosscord/api";
|
||||
import bcrypt from "bcrypt";
|
||||
import { HTTPError } from "lambert-server";
|
||||
|
@ -7,10 +7,10 @@ import {
|
||||
emitEvent,
|
||||
Relationship,
|
||||
Config,
|
||||
DiscordApiErrors,
|
||||
} from "@fosscord/util";
|
||||
import { Router, Response, Request } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { DiscordApiErrors } from "@fosscord/util";
|
||||
import { route } from "@fosscord/api";
|
||||
|
||||
const router = Router();
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Router, Response, Request } from "express";
|
||||
import { OrmUtils, User, UserSettingsSchema } from "@fosscord/util";
|
||||
import { User, UserSettingsSchema } from "@fosscord/util";
|
||||
import { route } from "@fosscord/api";
|
||||
|
||||
const router = Router();
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { Router, Request, Response } from "express";
|
||||
import { getIpAdress, route } from "@fosscord/api";
|
||||
import { getVoiceRegions } from "@fosscord/api";
|
||||
import { getIpAdress, route, getVoiceRegions } from "@fosscord/api";
|
||||
|
||||
const router: Router = Router();
|
||||
|
||||
|
@ -24,16 +24,14 @@ import {
|
||||
UserGuildSettings,
|
||||
ReadyGuildDTO,
|
||||
Guild,
|
||||
Recipient,
|
||||
} from "@fosscord/util";
|
||||
import { Send } from "../util/Send";
|
||||
import { CLOSECODES, OPCODES } from "../util/Constants";
|
||||
import { genSessionId } from "../util/SessionUtils";
|
||||
import { setupListener } from "../listener/listener";
|
||||
// import experiments from "./experiments.json";
|
||||
const experiments: any = [];
|
||||
import { check } from "./instanceOf";
|
||||
import { Recipient } from "@fosscord/util";
|
||||
|
||||
// TODO: user sharding
|
||||
// TODO: check privileged intents, if defined in the config
|
||||
// TODO: check if already identified
|
||||
@ -50,11 +48,11 @@ export async function onIdentify(this: WebSocket, data: Payload) {
|
||||
try {
|
||||
const { jwtSecret } = Config.get().security;
|
||||
let { decoded } = await checkToken(identify.token, jwtSecret); // will throw an error if invalid
|
||||
this.user_id = decoded.id;
|
||||
} catch (error) {
|
||||
console.error("invalid token", error);
|
||||
return this.close(CLOSECODES.Authentication_failed);
|
||||
}
|
||||
this.user_id = decoded.id;
|
||||
let session_id = this.session_id;
|
||||
|
||||
const [user, read_states, members, recipients, session, application] =
|
||||
|
@ -2,7 +2,6 @@ import {
|
||||
Column,
|
||||
Entity,
|
||||
JoinColumn,
|
||||
ManyToMany,
|
||||
ManyToOne,
|
||||
OneToMany,
|
||||
RelationId,
|
||||
|
@ -1,6 +1,4 @@
|
||||
import {
|
||||
BeforeInsert,
|
||||
BeforeUpdate,
|
||||
Column,
|
||||
Entity,
|
||||
FindOneOptions,
|
||||
|
Loading…
Reference in New Issue
Block a user