diff --git a/.expo/README.md b/.expo/README.md new file mode 100644 index 00000000..d8971e42 --- /dev/null +++ b/.expo/README.md @@ -0,0 +1,17 @@ +> Why do I have a folder named ".expo" in my project? + +The ".expo" folder is created when an Expo project is started using "expo start" command. + +> What does the "packager-info.json" file contain? + +The "packager-info.json" file contains port numbers and process PIDs that are used to serve the application to the mobile device/simulator. + +> What does the "settings.json" file contain? + +The "settings.json" file contains the server configuration that is used to serve the application manifest. + +> Should I commit the ".expo" folder? + +No, you should not share the ".expo" folder. It does not contain any information that is relevant for other developers working on the project, it is specific to your machine. + +Upon project creation, the ".expo" folder is already added to your ".gitignore" file. diff --git a/.expo/settings.json b/.expo/settings.json new file mode 100644 index 00000000..92bc513b --- /dev/null +++ b/.expo/settings.json @@ -0,0 +1,8 @@ +{ + "hostType": "lan", + "lanType": "ip", + "dev": true, + "minify": false, + "urlRandomness": null, + "https": false +} diff --git a/jsconfig.json b/jsconfig.json new file mode 100644 index 00000000..41c4cb9a --- /dev/null +++ b/jsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "baseUrl": ".", + "paths": { + "@util/*": ["./src/util/*"], + "@middlewares/*": ["./src/middlewares/*"], + "@schema/*": ["./src/schema/*"] + } + }, + "include": ["src"] +} diff --git a/package-lock.json b/package-lock.json index 70a846c8..3df732b4 100644 Binary files a/package-lock.json and b/package-lock.json differ diff --git a/package.json b/package.json index deded2a4..956b1841 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,7 @@ "@types/multer": "^1.4.5", "@types/node": "^14.14.22", "@types/node-fetch": "^2.5.7", + "@zerollup/ts-transform-paths": "^1.7.18", "0x": "^4.10.2", "node-fetch": "^2.6.1", "ts-node": "^9.1.1", diff --git a/src/routes/api/v8/channels/#channel_id/invites.ts b/src/routes/api/v8/channels/#channel_id/invites.ts index e3f2b77e..0e09c00c 100644 --- a/src/routes/api/v8/channels/#channel_id/invites.ts +++ b/src/routes/api/v8/channels/#channel_id/invites.ts @@ -1,11 +1,11 @@ import { Router, Request, Response } from "express"; import { HTTPError } from "lambert-server"; -import { check } from "@util/instanceOf"; -import { random } from "@util/RandomInviteID"; -import { emitEvent } from "@util/Event"; +import { check } from "../../../../../util/instanceOf"; +import { random } from "../../../../../util/RandomInviteID"; +import { emitEvent } from "../../../../../util/Event"; -import { InviteCreateSchema } from "@schema/Invite"; +import { InviteCreateSchema } from "../../../../../schema/Invite"; import { getPermission, ChannelModel, InviteModel, InviteCreateEvent } from "fosscord-server-util"; diff --git a/src/routes/api/v8/channels/#channel_id/messages/bulk-delete.ts b/src/routes/api/v8/channels/#channel_id/messages/bulk-delete.ts index dc7d5f66..c805cf08 100644 --- a/src/routes/api/v8/channels/#channel_id/messages/bulk-delete.ts +++ b/src/routes/api/v8/channels/#channel_id/messages/bulk-delete.ts @@ -1,9 +1,9 @@ import { Router } from "express"; import { ChannelModel, getPermission, MessageDeleteBulkEvent, MessageModel } from "fosscord-server-util"; import { HTTPError } from "lambert-server"; -import Config from "@util/Config"; -import { emitEvent } from "@util/Event"; -import { check } from "@util/instanceOf"; +import Config from "../../../../../../util/Config"; +import { emitEvent } from "../../../../../../util/Event"; +import { check } from "../../../../../../util/instanceOf"; const router: Router = Router(); diff --git a/src/routes/api/v8/channels/#channel_id/messages/index.ts b/src/routes/api/v8/channels/#channel_id/messages/index.ts index 2f383056..b214275d 100644 --- a/src/routes/api/v8/channels/#channel_id/messages/index.ts +++ b/src/routes/api/v8/channels/#channel_id/messages/index.ts @@ -1,11 +1,11 @@ import { Router } from "express"; import { ChannelModel, ChannelType, getPermission, Message, MessageCreateEvent, MessageModel, Snowflake } from "fosscord-server-util"; import { HTTPError } from "lambert-server"; -import { MessageCreateSchema } from "@schema/Message"; -import { check, instanceOf, Length } from "@util/instanceOf"; -import { PublicUserProjection } from "@util/User"; +import { MessageCreateSchema } from "../../../../../../schema/Message"; +import { check, instanceOf, Length } from "../../../../../../util/instanceOf"; +import { PublicUserProjection } from "../../../../../../util/User"; import multer from "multer"; -import { emitEvent } from "@util/Event"; +import { emitEvent } from "../../../../../../util/Event"; const router: Router = Router(); export default router; @@ -111,6 +111,7 @@ router.post("/", check(MessageCreateSchema), async (req, res) => { // TODO: should it be checked if the message exists? } + // TODO: properly build message object const message: Message = { id: Snowflake.generate(), channel_id, @@ -118,6 +119,13 @@ router.post("/", check(MessageCreateSchema), async (req, res) => { author_id: req.user_id, content: req.body, timestamp: new Date(), + mention_channels_ids: [], + mention_role_ids: [], + mention_user_ids: [], + attachments: [], + embeds: [], + reactions: [], + type: 0, }; await new MessageModel(message).save(); diff --git a/src/routes/api/v8/guilds/#id/bans.ts b/src/routes/api/v8/guilds/#id/bans.ts index 9fbcf01c..5133ee3c 100644 --- a/src/routes/api/v8/guilds/#id/bans.ts +++ b/src/routes/api/v8/guilds/#id/bans.ts @@ -1,12 +1,12 @@ import { Request, Response, Router } from "express"; import { BanModel, getPermission, GuildBanAddEvent, GuildBanRemoveEvent, GuildModel } from "fosscord-server-util"; import { HTTPError } from "lambert-server"; -import { getIpAdress } from "@middlewares/GlobalRateLimit"; -import { BanCreateSchema } from "@schema/Ban"; -import { emitEvent } from "@util/Event"; -import { check } from "@util/instanceOf"; -import { removeMember } from "@util/Member"; -import { getPublicUser } from "@util/User"; +import { getIpAdress } from "../../../../../middlewares/GlobalRateLimit"; +import { BanCreateSchema } from "../../../../../schema/Ban"; +import { emitEvent } from "../../../../../util/Event"; +import { check } from "../../../../../util/instanceOf"; +import { removeMember } from "../../../../../util/Member"; +import { getPublicUser } from "../../../../../util/User"; const router: Router = Router(); diff --git a/tsconfig.json b/tsconfig.json index e803612b..97773b99 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -43,12 +43,6 @@ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ - "baseUrl": "./src" /* Base directory to resolve non-absolute module names. */, - "paths": { - "@util/*": ["util/*"], - "@middlewares/*": ["middlewares/*"], - "@schema/*": ["schema/*"] - } /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */, // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ // "typeRoots": [], /* List of folders to include type definitions from. */ "types": ["node"] /* Type declaration files to be included in compilation. */,