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