summary refs log tree commit diff
path: root/api
diff options
context:
space:
mode:
Diffstat (limited to 'api')
-rw-r--r--api/client_test/index.html10
-rw-r--r--api/package-lock.json4
-rw-r--r--api/src/routes/channels/#channel_id/messages/index.ts7
-rw-r--r--api/src/routes/channels/#channel_id/webhooks.ts4
-rw-r--r--api/src/routes/guilds/#guild_id/audit-logs.ts20
-rw-r--r--api/src/routes/guilds/#guild_id/integrations.ts12
-rw-r--r--api/src/routes/guilds/#guild_id/webhooks.ts12
7 files changed, 62 insertions, 7 deletions
diff --git a/api/client_test/index.html b/api/client_test/index.html

index 0b3a775a..384c598a 100644 --- a/api/client_test/index.html +++ b/api/client_test/index.html
@@ -65,11 +65,11 @@ localStorage.setItem("UserSettingsStore", JSON.stringify(settings)); } </script> - <script src="/assets/checkLocale.js"></script> - <script src="/assets/479a2f1e7d625dc134b9.js"></script> - <script src="/assets/a15fd133a1d2d77a2424.js"></script> - <script src="/assets/97e6fa22aa08ee4daa5e.js"></script> - <script src="/assets/9b2b7f0632acd0c5e781.js"></script> + <script src="/assets/checkLocale.js"></script> + <script src="/assets/1e18f2aac02e172db283.js"></script> + <script src="/assets/681e53cdfefa5b82249a.js"></script> + <script src="/assets/7a036838c0a0e73f59d8.js"></script> + <script src="/assets/b6cf2184a7a05e7525ce.js"></script> <!-- plugin marker --> </body> </html> diff --git a/api/package-lock.json b/api/package-lock.json
index 28af2e8b..75945cbe 100644 --- a/api/package-lock.json +++ b/api/package-lock.json
@@ -80,7 +80,7 @@ "lambert-server": "^1.2.12", "missing-native-js-functions": "^1.2.18", "multer": "^1.4.3", - "node-fetch": "^2.6.1", + "node-fetch": "^2.6.2", "patch-package": "^6.4.7", "pg": "^8.7.1", "picocolors": "^1.0.0", @@ -16640,7 +16640,7 @@ "lambert-server": "^1.2.12", "missing-native-js-functions": "^1.2.18", "multer": "^1.4.3", - "node-fetch": "^2.6.1", + "node-fetch": "^2.6.2", "patch-package": "^6.4.7", "pg": "^8.7.1", "picocolors": "^1.0.0", diff --git a/api/src/routes/channels/#channel_id/messages/index.ts b/api/src/routes/channels/#channel_id/messages/index.ts
index 1ae9d676..5fdab623 100644 --- a/api/src/routes/channels/#channel_id/messages/index.ts +++ b/api/src/routes/channels/#channel_id/messages/index.ts
@@ -126,6 +126,13 @@ router.get("/", async (req: Request, res: Response) => { y.proxy_url = `${endpoint == null ? "" : endpoint}${new URL(uri).pathname}`; }); + //Some clients ( discord.js ) only check if a property exists within the response, + //which causes erorrs when, say, the `application` property is `null`. + for (var curr in x) { + if (x[curr] === null) + delete x[curr]; + } + return x; }) ); diff --git a/api/src/routes/channels/#channel_id/webhooks.ts b/api/src/routes/channels/#channel_id/webhooks.ts
index 7b894455..92895da6 100644 --- a/api/src/routes/channels/#channel_id/webhooks.ts +++ b/api/src/routes/channels/#channel_id/webhooks.ts
@@ -14,6 +14,10 @@ export interface WebhookCreateSchema { name: string; avatar: string; } +//TODO: implement webhooks +router.get("/", route({}), async (req: Request, res: Response) => { + res.json([]); +}); // TODO: use Image Data Type for avatar instead of String router.post("/", route({ body: "WebhookCreateSchema", permission: "MANAGE_WEBHOOKS" }), async (req: Request, res: Response) => { diff --git a/api/src/routes/guilds/#guild_id/audit-logs.ts b/api/src/routes/guilds/#guild_id/audit-logs.ts new file mode 100644
index 00000000..a4f2f800 --- /dev/null +++ b/api/src/routes/guilds/#guild_id/audit-logs.ts
@@ -0,0 +1,20 @@ +import { Router, Response, Request } from "express"; +import { Channel, ChannelUpdateEvent, getPermission, emitEvent } from "@fosscord/util"; +import { HTTPError } from "lambert-server"; +import { route } from "@fosscord/api"; +import { ChannelModifySchema } from "../../channels/#channel_id"; +const router = Router(); + +//TODO: implement audit logs +router.get("/", route({}), async (req: Request, res: Response) => { + res.json({ + audit_log_entries: [], + users: [], + integrations: [], + webhooks: [], + guild_scheduled_events: [], + threads: [], + application_commands: [] + }); +}); +export default router; diff --git a/api/src/routes/guilds/#guild_id/integrations.ts b/api/src/routes/guilds/#guild_id/integrations.ts new file mode 100644
index 00000000..abf997c9 --- /dev/null +++ b/api/src/routes/guilds/#guild_id/integrations.ts
@@ -0,0 +1,12 @@ +import { Router, Response, Request } from "express"; +import { Channel, ChannelUpdateEvent, getPermission, emitEvent } from "@fosscord/util"; +import { HTTPError } from "lambert-server"; +import { route } from "@fosscord/api"; +import { ChannelModifySchema } from "../../channels/#channel_id"; +const router = Router(); + +//TODO: implement integrations list +router.get("/", route({}), async (req: Request, res: Response) => { + res.json([]); +}); +export default router; diff --git a/api/src/routes/guilds/#guild_id/webhooks.ts b/api/src/routes/guilds/#guild_id/webhooks.ts new file mode 100644
index 00000000..8b2febea --- /dev/null +++ b/api/src/routes/guilds/#guild_id/webhooks.ts
@@ -0,0 +1,12 @@ +import { Router, Response, Request } from "express"; +import { Channel, ChannelUpdateEvent, getPermission, emitEvent } from "@fosscord/util"; +import { HTTPError } from "lambert-server"; +import { route } from "@fosscord/api"; +import { ChannelModifySchema } from "../../channels/#channel_id"; +const router = Router(); + +//TODO: implement webhooks +router.get("/", route({}), async (req: Request, res: Response) => { + res.json([]); +}); +export default router;