End to end encrypted attachment upload and streaming
This commit is contained in:
parent
6f292756ed
commit
603d969972
63 changed files with 1926 additions and 156 deletions
16
src/index.ts
16
src/index.ts
|
|
@ -2,6 +2,7 @@ import Fastify from "fastify";
|
|||
import cors from "@fastify/cors";
|
||||
import cookie from "@fastify/cookie";
|
||||
import websocket from "@fastify/websocket";
|
||||
import multipart from "@fastify/multipart";
|
||||
|
||||
import { config } from "./config.js";
|
||||
|
||||
|
|
@ -16,7 +17,9 @@ import { channelRoutes } from "./controllers/channel/routes.js";
|
|||
import { roleRoutes } from "./controllers/role/routes.js";
|
||||
import { inviteRoutes } from "./controllers/invite/routes.js";
|
||||
import { messageRoutes } from "./controllers/message/routes.js";
|
||||
import { fileRoutes } from "./controllers/file/routes.js";
|
||||
import { websocketRoutes } from "./controllers/websocket/routes.js";
|
||||
|
||||
import { initializeCommunitiesWithReadableUsersCache } from "./services/user/user.js";
|
||||
|
||||
const app = Fastify({
|
||||
|
|
@ -28,10 +31,18 @@ app.register(cors, {
|
|||
credentials: true,
|
||||
methods: ["GET", "POST", "PATCH", "DELETE", "OPTIONS"],
|
||||
});
|
||||
|
||||
app.register(cookie, { secret: getCookieSecret() });
|
||||
|
||||
app.register(websocket);
|
||||
app.register(multipart, {
|
||||
attachFieldsToBody: true,
|
||||
sharedSchemaId: "MultipartFileType",
|
||||
limits: {
|
||||
fileSize: 10 * 1024 * 1024,
|
||||
files: 1,
|
||||
fields: 10,
|
||||
fieldSize: 1024 * 1024,
|
||||
},
|
||||
});
|
||||
|
||||
app.register(testRoutes);
|
||||
app.register(authRoutes, { prefix: "/api/v1/auth" });
|
||||
|
|
@ -42,6 +53,7 @@ app.register(channelRoutes, { prefix: "/api/v1/channel" });
|
|||
app.register(roleRoutes, { prefix: "/api/v1/role" });
|
||||
app.register(inviteRoutes, { prefix: "/api/v1/invite" });
|
||||
app.register(messageRoutes, { prefix: "/api/v1/message" });
|
||||
app.register(fileRoutes, { prefix: "/api/v1/file" });
|
||||
app.register(websocketRoutes, { prefix: "/ws" });
|
||||
|
||||
app.listen({ port: config.port }, (err, address) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue