summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/routes/api/v8/channels/#CHANNELID/messages.ts4
-rw-r--r--src/routes/api/v8/channels/#channel_id/followers.ts (renamed from src/routes/api/v8/channels/#CHANNELID/followers.ts)0
-rw-r--r--src/routes/api/v8/channels/#channel_id/index.ts (renamed from src/routes/api/v8/channels/#CHANNELID/index.ts)0
-rw-r--r--src/routes/api/v8/channels/#channel_id/invites.ts (renamed from src/routes/api/v8/channels/#CHANNELID/invites.ts)2
-rw-r--r--src/routes/api/v8/channels/#channel_id/messages.ts27
-rw-r--r--src/routes/api/v8/channels/#channel_id/permissions.ts (renamed from src/routes/api/v8/channels/#CHANNELID/permissions.ts)0
-rw-r--r--src/routes/api/v8/channels/#channel_id/pins.ts (renamed from src/routes/api/v8/channels/#CHANNELID/pins.ts)0
-rw-r--r--src/routes/api/v8/channels/#channel_id/recipients.ts (renamed from src/routes/api/v8/channels/#CHANNELID/recipients.ts)0
-rw-r--r--src/routes/api/v8/channels/#channel_id/typing.ts (renamed from src/routes/api/v8/channels/#CHANNELID/typing.ts)0
-rw-r--r--src/routes/api/v8/channels/#channel_id/webhooks.ts (renamed from src/routes/api/v8/channels/#CHANNELID/webhooks.ts)0
10 files changed, 28 insertions, 5 deletions
diff --git a/src/routes/api/v8/channels/#CHANNELID/messages.ts b/src/routes/api/v8/channels/#CHANNELID/messages.ts
deleted file mode 100644

index 9a4e81fa..00000000 --- a/src/routes/api/v8/channels/#CHANNELID/messages.ts +++ /dev/null
@@ -1,4 +0,0 @@ -import { Router } from "express"; -const router: Router = Router(); - -export default router; diff --git a/src/routes/api/v8/channels/#CHANNELID/followers.ts b/src/routes/api/v8/channels/#channel_id/followers.ts
index 9a4e81fa..9a4e81fa 100644 --- a/src/routes/api/v8/channels/#CHANNELID/followers.ts +++ b/src/routes/api/v8/channels/#channel_id/followers.ts
diff --git a/src/routes/api/v8/channels/#CHANNELID/index.ts b/src/routes/api/v8/channels/#channel_id/index.ts
index 9a4e81fa..9a4e81fa 100644 --- a/src/routes/api/v8/channels/#CHANNELID/index.ts +++ b/src/routes/api/v8/channels/#channel_id/index.ts
diff --git a/src/routes/api/v8/channels/#CHANNELID/invites.ts b/src/routes/api/v8/channels/#channel_id/invites.ts
index ee71d1ee..2bf8664f 100644 --- a/src/routes/api/v8/channels/#CHANNELID/invites.ts +++ b/src/routes/api/v8/channels/#channel_id/invites.ts
@@ -13,7 +13,7 @@ const router: Router = Router(); router.post("/", check(InviteCreateSchema), async (req: Request, res: Response) => { const usID = req.userid; - const chID = BigInt(req.params.channelid); + const chID = BigInt(req.params.channel_id); const channel = await ChannelModel.findOne({ id: chID }).exec(); if (!channel || !channel.guild_id) { diff --git a/src/routes/api/v8/channels/#channel_id/messages.ts b/src/routes/api/v8/channels/#channel_id/messages.ts new file mode 100644
index 00000000..0826cf94 --- /dev/null +++ b/src/routes/api/v8/channels/#channel_id/messages.ts
@@ -0,0 +1,27 @@ +import { Router } from "express"; +import { ChannelModel, ChannelType, getPermission, MessageModel } from "fosscord-server-util"; +import { HTTPError } from "lambert-server"; +const router: Router = Router(); + +export default router; + +router.get("/", async (req, res) => { + const channel_id = BigInt(req.params.channel_id); + const channel = await ChannelModel.findOne( + { id: channel_id }, + { guild_id: true, type: true, permission_overwrites: true } + ).exec(); + if (!channel) throw new HTTPError("Channel not found", 404); + + const type: ChannelType = channel.type; + + getPermission(req.userid, channel.guild_id, channel_id); + + if (channel.guild_id) { + channel.permission_overwrites; + } else if (channel.recipients) { + // group/dm channel + } else { + // idk what this channel is, can probably be removed + } +}); diff --git a/src/routes/api/v8/channels/#CHANNELID/permissions.ts b/src/routes/api/v8/channels/#channel_id/permissions.ts
index 9a4e81fa..9a4e81fa 100644 --- a/src/routes/api/v8/channels/#CHANNELID/permissions.ts +++ b/src/routes/api/v8/channels/#channel_id/permissions.ts
diff --git a/src/routes/api/v8/channels/#CHANNELID/pins.ts b/src/routes/api/v8/channels/#channel_id/pins.ts
index 9a4e81fa..9a4e81fa 100644 --- a/src/routes/api/v8/channels/#CHANNELID/pins.ts +++ b/src/routes/api/v8/channels/#channel_id/pins.ts
diff --git a/src/routes/api/v8/channels/#CHANNELID/recipients.ts b/src/routes/api/v8/channels/#channel_id/recipients.ts
index 9a4e81fa..9a4e81fa 100644 --- a/src/routes/api/v8/channels/#CHANNELID/recipients.ts +++ b/src/routes/api/v8/channels/#channel_id/recipients.ts
diff --git a/src/routes/api/v8/channels/#CHANNELID/typing.ts b/src/routes/api/v8/channels/#channel_id/typing.ts
index 9a4e81fa..9a4e81fa 100644 --- a/src/routes/api/v8/channels/#CHANNELID/typing.ts +++ b/src/routes/api/v8/channels/#channel_id/typing.ts
diff --git a/src/routes/api/v8/channels/#CHANNELID/webhooks.ts b/src/routes/api/v8/channels/#channel_id/webhooks.ts
index 9a4e81fa..9a4e81fa 100644 --- a/src/routes/api/v8/channels/#CHANNELID/webhooks.ts +++ b/src/routes/api/v8/channels/#channel_id/webhooks.ts