mirror of
https://github.com/spacebarchat/server.git
synced 2026-09-16 15:02:42 +00:00
State update, havent tested
This commit is contained in:
+3
-5
@@ -1,7 +1,6 @@
|
||||
import "missing-native-js-functions";
|
||||
import { Server, ServerOptions } from "lambert-server";
|
||||
import { Authentication, CORS } from "./middlewares/";
|
||||
import { Config, initDatabase, initEvent } from "@fosscord/util";
|
||||
import { Config, initDatabase, initEvent, registerRoutes } from "@fosscord/util";
|
||||
import { ErrorHandler } from "./middlewares/ErrorHandler";
|
||||
import { BodyParser } from "./middlewares/BodyParser";
|
||||
import { Router, Request, Response, NextFunction } from "express";
|
||||
@@ -11,7 +10,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 {}
|
||||
@@ -50,7 +48,7 @@ export class FosscordServer extends Server {
|
||||
}
|
||||
})
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
this.app.use(CORS);
|
||||
this.app.use(BodyParser({ inflate: true, limit: "10mb" }));
|
||||
@@ -91,4 +89,4 @@ export class FosscordServer extends Server {
|
||||
|
||||
return super.start();
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { NextFunction, Request, Response } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { HTTPError } from "@fosscord/util";
|
||||
import { checkToken, Config, Rights } from "@fosscord/util";
|
||||
|
||||
export const NO_AUTHORIZATION_ROUTES = [
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import bodyParser, { OptionsJson } from "body-parser";
|
||||
import { NextFunction, Request, Response } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { HTTPError } from "@fosscord/util";
|
||||
|
||||
export function BodyParser(opts?: OptionsJson) {
|
||||
const jsonParser = bodyParser.json(opts);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { NextFunction, Request, Response } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { HTTPError } from "@fosscord/util";
|
||||
import { ApiError, FieldError } from "@fosscord/util";
|
||||
const EntityNotFoundErrorRegex = /"(\w+)"/;
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import express, { Request, Response, Application } from "express";
|
||||
import fs, { writeFile } from "fs";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import fetch, { Response as FetchResponse, Headers } from "node-fetch";
|
||||
import ProxyAgent from 'proxy-agent';
|
||||
import { Config } from "@fosscord/util";
|
||||
import { AssetCacheItem } from "../util/entities/AssetCacheItem"
|
||||
import { FileLogger } from "typeorm";
|
||||
|
||||
export default function TestClient(app: Application) {
|
||||
const agent = new ProxyAgent();
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { Request, Response, Router } from "express";
|
||||
import { Config, generateToken, Invite, FieldErrors, User, adjustEmail, trimSpecial } from "@fosscord/util";
|
||||
import { route, getIpAdress, IPAnalysis, isProxy } from "@fosscord/api";
|
||||
import "missing-native-js-functions";
|
||||
import bcrypt from "bcrypt";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { HTTPError } from "@fosscord/util";
|
||||
|
||||
const router: Router = Router();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Router, Request, Response } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { HTTPError } from "@fosscord/util";
|
||||
import { route } from "@fosscord/api";
|
||||
import { random } from "@fosscord/api";
|
||||
import { Channel, Invite, InviteCreateEvent, emitEvent, User, Guild, PublicInviteRelation } from "@fosscord/util";
|
||||
|
||||
@@ -19,7 +19,7 @@ import multer from "multer";
|
||||
import { route } from "@fosscord/api";
|
||||
import { handleMessage, postHandleMessage } from "@fosscord/api";
|
||||
import { MessageCreateSchema } from "../index";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { HTTPError } from "@fosscord/util";
|
||||
|
||||
const router = Router();
|
||||
// TODO: message content/embed string length limit
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
} from "@fosscord/util";
|
||||
import { route } from "@fosscord/api";
|
||||
import { Router, Response, Request } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { HTTPError } from "@fosscord/util";
|
||||
import { In } from "typeorm";
|
||||
|
||||
const router = Router();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Router, Response, Request } from "express";
|
||||
import { Channel, Config, emitEvent, getPermission, getRights, MessageDeleteBulkEvent, Message } from "@fosscord/util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { HTTPError } from "@fosscord/util";
|
||||
import { route } from "@fosscord/api";
|
||||
import { In } from "typeorm";
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
uploadFile,
|
||||
Member
|
||||
} from "@fosscord/util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { HTTPError } from "@fosscord/util";
|
||||
import { handleMessage, postHandleMessage, route } from "@fosscord/api";
|
||||
import multer from "multer";
|
||||
import { FindManyOptions, LessThan, MoreThan } from "typeorm";
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
Role
|
||||
} from "@fosscord/util";
|
||||
import { Router, Response, Request } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { HTTPError } from "@fosscord/util";
|
||||
|
||||
import { route } from "@fosscord/api";
|
||||
const router: Router = Router();
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
DiscordApiErrors
|
||||
} from "@fosscord/util";
|
||||
import { Router, Request, Response } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { HTTPError } from "@fosscord/util";
|
||||
import { route } from "@fosscord/api";
|
||||
|
||||
const router: Router = Router();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { HTTPError } from "@fosscord/util";
|
||||
import { route } from "@fosscord/api";
|
||||
import { isTextChannel } from "./messages";
|
||||
import { FindManyOptions, Between, Not } from "typeorm";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Router, Response, Request } from "express";
|
||||
import { route } from "@fosscord/api";
|
||||
import { Channel, Config, getPermission, trimSpecial, Webhook } from "@fosscord/util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { HTTPError } from "@fosscord/util";
|
||||
import { isTextChannel } from "./messages/index";
|
||||
import { DiscordApiErrors } from "@fosscord/util";
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { Guild, Config } from "@fosscord/util";
|
||||
|
||||
import { Router, Request, Response } from "express";
|
||||
import { route } from "@fosscord/api";
|
||||
import { route } from "..";
|
||||
import { Like } from "typeorm";
|
||||
|
||||
const router = Router();
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Categories } from "@fosscord/util";
|
||||
import { Router, Response, Request } from "express";
|
||||
import { route } from "@fosscord/api";
|
||||
import { route } from "..";
|
||||
|
||||
const router = Router();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Router, Response, Request } from "express";
|
||||
import { route } from "@fosscord/api";
|
||||
import { route } from "..";
|
||||
import { Release, Config } from "@fosscord/util";
|
||||
|
||||
const router = Router();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Router, Response, Request } from "express";
|
||||
import { route } from "@fosscord/api";
|
||||
import { route } from "..";
|
||||
|
||||
const router = Router();
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import fetch from "node-fetch";
|
||||
import ProxyAgent from 'proxy-agent';
|
||||
import { route } from "@fosscord/api";
|
||||
import { Config } from "@fosscord/util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { HTTPError } from "@fosscord/util";
|
||||
|
||||
const router = Router();
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { Guild, Config } from "@fosscord/util";
|
||||
|
||||
import { Router, Request, Response } from "express";
|
||||
import { route } from "@fosscord/api";
|
||||
import { route } from "..";
|
||||
import {Like} from "typeorm"
|
||||
|
||||
const router = Router();
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Router, Response, Request } from "express";
|
||||
import { Channel, ChannelUpdateEvent, getPermission, emitEvent } from "@fosscord/util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { HTTPError } from "@fosscord/util";
|
||||
import { route } from "@fosscord/api";
|
||||
import { ChannelModifySchema } from "../../channels/#channel_id";
|
||||
const router = Router();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Request, Response, Router } from "express";
|
||||
import { DiscordApiErrors, emitEvent, getPermission, GuildBanAddEvent, GuildBanRemoveEvent, Guild, Ban, User, Member } from "@fosscord/util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { HTTPError } from "@fosscord/util";
|
||||
import { getIpAdress, route } from "@fosscord/api";
|
||||
|
||||
export interface BanCreateSchema {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Router, Response, Request } from "express";
|
||||
import { Channel, ChannelUpdateEvent, getPermission, emitEvent } from "@fosscord/util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { HTTPError } from "@fosscord/util";
|
||||
import { route } from "@fosscord/api";
|
||||
import { ChannelModifySchema } from "../../channels/#channel_id";
|
||||
const router = Router();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Channel, emitEvent, GuildDeleteEvent, Guild, Member, Message, Role, Invite, Emoji } from "@fosscord/util";
|
||||
import { Router, Request, Response } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { HTTPError } from "@fosscord/util";
|
||||
import { route } from "@fosscord/api";
|
||||
|
||||
const router = Router();
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { Request, Response, Router } from "express";
|
||||
import { DiscordApiErrors, emitEvent, getPermission, getRights, Guild, GuildUpdateEvent, handleFile, Member } from "@fosscord/util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { HTTPError } from "@fosscord/util";
|
||||
import { route } from "@fosscord/api";
|
||||
import "missing-native-js-functions";
|
||||
import { GuildCreateSchema } from "../index";
|
||||
|
||||
const router = Router();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Router, Response, Request } from "express";
|
||||
import { Channel, ChannelUpdateEvent, getPermission, emitEvent } from "@fosscord/util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { HTTPError } from "@fosscord/util";
|
||||
import { route } from "@fosscord/api";
|
||||
import { ChannelModifySchema } from "../../channels/#channel_id";
|
||||
const router = Router();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Request, Response, Router } from "express";
|
||||
import { Member, getPermission, getRights, Role, GuildMemberUpdateEvent, emitEvent, Sticker, Emoji, Rights, Guild } from "@fosscord/util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { HTTPError } from "@fosscord/util";
|
||||
import { route } from "@fosscord/api";
|
||||
|
||||
const router = Router();
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Request, Response, Router } from "express";
|
||||
import { Guild, Member, PublicMemberProjection } from "@fosscord/util";
|
||||
import { route } from "@fosscord/api";
|
||||
import { MoreThan } from "typeorm";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { HTTPError } from "@fosscord/util";
|
||||
|
||||
const router = Router();
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Router, Request, Response } from "express";
|
||||
import { Role, Member, GuildRoleUpdateEvent, GuildRoleDeleteEvent, emitEvent, handleFile } from "@fosscord/util";
|
||||
import { route } from "@fosscord/api";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { HTTPError } from "@fosscord/util";
|
||||
import { RoleModifySchema } from "../";
|
||||
|
||||
const router = Router();
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
DiscordApiErrors,
|
||||
handleFile
|
||||
} from "@fosscord/util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { HTTPError } from "@fosscord/util";
|
||||
import { route } from "@fosscord/api";
|
||||
|
||||
const router: Router = Router();
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
import { Router, Request, Response } from "express";
|
||||
import { route } from "@fosscord/api";
|
||||
import multer from "multer";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { HTTPError } from "@fosscord/util";
|
||||
const router = Router();
|
||||
|
||||
router.get("/", route({}), async (req: Request, res: Response) => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Request, Response, Router } from "express";
|
||||
import { Guild, Template } from "@fosscord/util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { HTTPError } from "@fosscord/util";
|
||||
import { route } from "@fosscord/api";
|
||||
import { generateCode } from "@fosscord/api";
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Channel, ChannelType, getPermission, Guild, Invite, trimSpecial } from "@fosscord/util";
|
||||
import { Router, Request, Response } from "express";
|
||||
import { route } from "@fosscord/api";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { HTTPError } from "@fosscord/util";
|
||||
|
||||
const router = Router();
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Router, Response, Request } from "express";
|
||||
import { Channel, ChannelUpdateEvent, getPermission, emitEvent } from "@fosscord/util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { HTTPError } from "@fosscord/util";
|
||||
import { route } from "@fosscord/api";
|
||||
import { ChannelModifySchema } from "../../channels/#channel_id";
|
||||
const router = Router();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Request, Response, Router } from "express";
|
||||
import { Guild, getPermission, Snowflake, Member } from "@fosscord/util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { HTTPError } from "@fosscord/util";
|
||||
import { route } from "@fosscord/api";
|
||||
|
||||
const router: Router = Router();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Request, Response, Router } from "express";
|
||||
import { Config, Permissions, Guild, Invite, Channel, Member } from "@fosscord/util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { HTTPError } from "@fosscord/util";
|
||||
import { random, route } from "@fosscord/api";
|
||||
|
||||
const router: Router = Router();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Request, Response, Router } from "express";
|
||||
import { Guild } from "@fosscord/util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { HTTPError } from "@fosscord/util";
|
||||
import { route } from "@fosscord/api";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Router, Request, Response } from "express";
|
||||
import { emitEvent, getPermission, Guild, Invite, InviteDeleteEvent, User, PublicInviteRelation } from "@fosscord/util";
|
||||
import { route } from "@fosscord/api";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { HTTPError } from "@fosscord/util";
|
||||
|
||||
const router: Router = Router();
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Router, Request, Response } from "express";
|
||||
import { Guild, Member, User } from "@fosscord/util";
|
||||
import { route } from "@fosscord/api";
|
||||
import bcrypt from "bcrypt";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { HTTPError } from "@fosscord/util";
|
||||
|
||||
const router = Router();
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Router, Request, Response } from "express";
|
||||
import { Guild, Member, User, GuildDeleteEvent, GuildMemberRemoveEvent, emitEvent, Config } from "@fosscord/util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { HTTPError } from "@fosscord/util";
|
||||
import { route } from "@fosscord/api";
|
||||
|
||||
const router: Router = Router();
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
Config
|
||||
} from "@fosscord/util";
|
||||
import { Router, Response, Request } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { HTTPError } from "@fosscord/util";
|
||||
import { DiscordApiErrors } from "@fosscord/util";
|
||||
import { route } from "@fosscord/api";
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
process.on("uncaughtException", console.error);
|
||||
process.on("unhandledRejection", console.error);
|
||||
|
||||
import "missing-native-js-functions";
|
||||
import { config } from "dotenv";
|
||||
config();
|
||||
import { FosscordServer } from "./Server";
|
||||
|
||||
@@ -22,7 +22,7 @@ import {
|
||||
Attachment,
|
||||
Config,
|
||||
} from "@fosscord/util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { HTTPError } from "@fosscord/util";
|
||||
import fetch from "node-fetch";
|
||||
import cheerio from "cheerio";
|
||||
import { MessageCreateSchema } from "../../routes/channels/#channel_id/messages";
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { Config } from "@fosscord/util";
|
||||
import "missing-native-js-functions";
|
||||
|
||||
const reNUMBER = /[0-9]/g;
|
||||
const reUPPERCASELETTER = /[A-Z]/g;
|
||||
|
||||
Reference in New Issue
Block a user