summary refs log tree commit diff
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-12-20 03:31:32 +0100
committerRory& <root@rory.gay>2025-12-20 03:31:32 +0100
commit0b27fb5a79bc3ab39ff5a1f0059bb57c716a1090 (patch)
tree121b176cb27c38508d13459859e485d5af100fdd
parentFix online member count (diff)
parentapparently it didn't get moved lol (diff)
downloadserver-ts-0b27fb5a79bc3ab39ff5a1f0059bb57c716a1090.tar.xz
Merge remote-tracking branch 'mathium05/dmFix'
-rw-r--r--assets/openapi.json563
-rw-r--r--assets/schemas.json377
-rw-r--r--src/api/routes/users/@me/channels.ts2
-rw-r--r--src/schemas/uncategorised/DmChannelCreateSchema.ts4
4 files changed, 277 insertions, 669 deletions
diff --git a/assets/openapi.json b/assets/openapi.json

index e7868ddc..edfae315 100644 --- a/assets/openapi.json +++ b/assets/openapi.json
@@ -300,301 +300,6 @@ "success" ] }, - "StoredEmailResponse": { - "type": "object", - "properties": { - "Content-Type": { - "type": "string" - }, - "From": { - "type": "string" - }, - "Message-Id": { - "type": "string" - }, - "Mime-Version": { - "type": "string" - }, - "Subject": { - "type": "string" - }, - "To": { - "type": "string" - }, - "sender": { - "type": "string" - }, - "recipients": { - "type": "string" - }, - "from": { - "type": "string" - }, - "subject": { - "type": "string" - }, - "body-html": { - "type": "string" - }, - "body-plain": { - "type": "string" - }, - "attachments": { - "type": "array", - "items": [ - { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "content-type": { - "type": "string" - }, - "size": { - "type": "integer" - }, - "url": { - "type": "string" - } - }, - "additionalProperties": false, - "required": [ - "content-type", - "name", - "size", - "url" - ] - } - ], - "minItems": 1, - "maxItems": 1 - }, - "content-id-map": { - "type": "object", - "properties": {}, - "additionalProperties": true - }, - "message-headers": { - "type": "array", - "items": { - "type": "array", - "items": [ - { - "type": "string" - }, - { - "type": "string" - } - ], - "minItems": 2, - "maxItems": 2 - } - }, - "stripped-html": { - "type": "string" - }, - "stripped-text": { - "type": "string" - }, - "stripped-signature": { - "type": "string" - }, - "Content-Transfer-Encoding": { - "type": "string" - }, - "X-Mailgun-Tag": { - "type": "string" - }, - "X-Mailgun-Template-Name": { - "type": "string" - }, - "X-Mailgun-Template-Variables": { - "type": "string" - }, - "X-Mailgun-Deliver-By": { - "type": "string" - } - }, - "required": [ - "Content-Type", - "From", - "Message-Id", - "Mime-Version", - "Subject", - "To", - "body-html", - "body-plain", - "message-headers", - "recipients", - "sender", - "stripped-html", - "stripped-signature", - "stripped-text" - ] - }, - "MessagesQueueStatusAPIResponse": { - "type": "object", - "properties": { - "regular": { - "type": "object", - "properties": { - "is_disabled": { - "type": "boolean" - }, - "disabled": { - "type": "object", - "properties": { - "until": { - "type": "string" - }, - "reason": { - "type": "string" - } - }, - "additionalProperties": false, - "required": [ - "reason", - "until" - ] - } - }, - "additionalProperties": false, - "required": [ - "disabled", - "is_disabled" - ] - }, - "scheduled": { - "type": "object", - "properties": { - "is_disabled": { - "type": "boolean" - }, - "disabled": { - "type": "object", - "properties": { - "until": { - "type": "string" - }, - "reason": { - "type": "string" - } - }, - "additionalProperties": false, - "required": [ - "reason", - "until" - ] - } - }, - "additionalProperties": false, - "required": [ - "disabled", - "is_disabled" - ] - } - }, - "required": [ - "regular", - "scheduled" - ] - }, - "SubaccountSendingLimitResponse": { - "type": "object", - "properties": { - "limit": { - "type": "integer" - }, - "current": { - "type": "integer" - }, - "period": { - "type": "string" - } - }, - "required": [ - "current", - "limit", - "period" - ] - }, - "SubaccountSetSendingLimitResponse": { - "type": "object", - "properties": { - "success": { - "type": "boolean" - } - }, - "required": [ - "success" - ] - }, - "SubaccountDestroyResponse": { - "type": "object", - "properties": { - "message": { - "type": "string" - } - }, - "required": [ - "message" - ] - }, - "ActivateDomainKeyResponse": { - "type": "object", - "properties": { - "message": { - "type": "string" - }, - "authority": { - "type": "string" - }, - "selector": { - "type": "string" - }, - "active": { - "type": "boolean" - }, - "status": { - "type": "integer" - } - }, - "required": [ - "active", - "authority", - "message", - "selector", - "status" - ] - }, - "DeactivateDomainKeyResponse": { - "type": "object", - "properties": { - "message": { - "type": "string" - }, - "authority": { - "type": "string" - }, - "selector": { - "type": "string" - }, - "active": { - "type": "boolean" - }, - "status": { - "type": "integer" - } - }, - "required": [ - "active", - "authority", - "message", - "selector", - "status" - ] - }, "FieldErrorResponse": { "type": "object", "properties": { @@ -2145,12 +1850,6 @@ "region": { "type": "string" }, - "features": { - "type": "array", - "items": { - "type": "string" - } - }, "icon": { "type": "string", "nullable": true @@ -2178,6 +1877,12 @@ "description": { "type": "string" }, + "features": { + "type": "array", + "items": { + "type": "string" + } + }, "verification_level": { "type": "integer" }, @@ -2975,12 +2680,6 @@ "id": { "type": "string" }, - "features": { - "type": "array", - "items": { - "type": "string" - } - }, "icon": { "type": "string" }, @@ -3040,6 +2739,12 @@ "description": { "type": "string" }, + "features": { + "type": "array", + "items": { + "type": "string" + } + }, "verification_level": { "type": "integer" }, @@ -3256,9 +2961,6 @@ "flags": { "type": "integer" }, - "disabled": { - "type": "boolean" - }, "verified": { "type": "boolean" }, @@ -3326,6 +3028,9 @@ "premium_usage_flags": { "type": "integer" }, + "disabled": { + "type": "boolean" + }, "settings": { "$ref": "#/components/schemas/UserSettingsSchema" } @@ -3383,9 +3088,6 @@ "flags": { "type": "integer" }, - "disabled": { - "type": "boolean" - }, "verified": { "type": "boolean" }, @@ -3453,6 +3155,9 @@ "premium_usage_flags": { "type": "integer" }, + "disabled": { + "type": "boolean" + }, "settings": { "$ref": "#/components/schemas/UserSettingsSchema" } @@ -3749,12 +3454,6 @@ "region": { "type": "string" }, - "features": { - "type": "array", - "items": { - "type": "string" - } - }, "icon": { "type": "string", "nullable": true @@ -3782,6 +3481,12 @@ "description": { "type": "string" }, + "features": { + "type": "array", + "items": { + "type": "string" + } + }, "verification_level": { "type": "integer" }, @@ -4778,11 +4483,17 @@ "items": { "type": "string" } + }, + "recipient_id": { + "type": "string" + }, + "access_tokens": { + "type": "array", + "items": { + "type": "string" + } } - }, - "required": [ - "recipients" - ] + } }, "EmailDomainLookupSchema": { "type": "object", @@ -12604,7 +12315,7 @@ "length": { "type": "integer" }, - "__@unscopables@698": { + "__@unscopables@700": { "type": "object", "additionalProperties": false, "patternProperties": { @@ -12733,17 +12444,17 @@ "remove": { "type": "boolean" }, - "__@iterator@696": { + "__@iterator@698": { "type": "boolean" }, - "__@unscopables@698": { + "__@unscopables@700": { "type": "boolean" } } } }, "required": [ - "__@unscopables@698", + "__@unscopables@700", "length" ] }, @@ -20105,6 +19816,42 @@ ] } }, + "/guilds/{guild_id}/force-recount/": { + "post": { + "x-right-required": "MANAGE_GUILDS", + "security": [ + { + "bearer": [] + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIGuild" + } + } + } + } + }, + "parameters": [ + { + "name": "guild_id", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "description": "guild_id" + } + ], + "tags": [ + "guilds" + ] + } + }, "/guilds/{guild_id}/emojis/": { "get": { "security": [ @@ -22798,6 +22545,56 @@ ] } }, + "/channels/{channel_id}/messages/{message_id}/threads/": { + "post": { + "security": [ + { + "bearer": [] + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MessageThreadCreationSchema" + } + } + } + }, + "responses": { + "200": { + "description": "No description available" + }, + "403": { + "description": "No description available" + } + }, + "parameters": [ + { + "name": "channel_id", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "description": "channel_id" + }, + { + "name": "message_id", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "description": "message_id" + } + ], + "tags": [ + "channels" + ] + } + }, "/channels/{channel_id}/messages/{message_id}/reactions/": { "delete": { "x-permission-required": "MANAGE_MESSAGES", @@ -24204,6 +24001,74 @@ ] } }, + "/auth/passwordless/start/": { + "post": { + "security": [ + { + "bearer": [] + } + ], + "responses": { + "400": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIErrorOrCaptchaResponse" + } + } + } + } + }, + "tags": [ + "auth" + ] + } + }, + "/auth/passwordless/finish/": { + "post": { + "security": [ + { + "bearer": [] + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebAuthnSSOSchema" + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TokenResponse" + } + } + } + }, + "400": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIErrorResponse" + } + } + } + } + }, + "tags": [ + "auth" + ] + } + }, "/auth/mfa/webauthn/": { "post": { "requestBody": { @@ -24475,6 +24340,50 @@ ] } }, + "/auth/conditional/finish/": { + "post": { + "security": [ + { + "bearer": [] + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebAuthnSSOSchema" + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TokenResponse" + } + } + } + }, + "400": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIErrorResponse" + } + } + } + } + }, + "tags": [ + "auth" + ] + } + }, "/attachments/refresh-urls/": { "post": { "security": [ diff --git a/assets/schemas.json b/assets/schemas.json
index 710cbb31..f691b79e 100644 --- a/assets/schemas.json +++ b/assets/schemas.json
@@ -289,315 +289,6 @@ ], "$schema": "http://json-schema.org/draft-07/schema#" }, - "StoredEmailResponse": { - "type": "object", - "properties": { - "Content-Type": { - "type": "string" - }, - "From": { - "type": "string" - }, - "Message-Id": { - "type": "string" - }, - "Mime-Version": { - "type": "string" - }, - "Subject": { - "type": "string" - }, - "To": { - "type": "string" - }, - "sender": { - "type": "string" - }, - "recipients": { - "type": "string" - }, - "from": { - "type": "string" - }, - "subject": { - "type": "string" - }, - "body-html": { - "type": "string" - }, - "body-plain": { - "type": "string" - }, - "attachments": { - "type": "array", - "items": [ - { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "content-type": { - "type": "string" - }, - "size": { - "type": "integer" - }, - "url": { - "type": "string" - } - }, - "additionalProperties": false, - "required": [ - "content-type", - "name", - "size", - "url" - ] - } - ], - "minItems": 1, - "maxItems": 1 - }, - "content-id-map": { - "type": "object", - "properties": {}, - "additionalProperties": true - }, - "message-headers": { - "type": "array", - "items": { - "type": "array", - "items": [ - { - "type": "string" - }, - { - "type": "string" - } - ], - "minItems": 2, - "maxItems": 2 - } - }, - "stripped-html": { - "type": "string" - }, - "stripped-text": { - "type": "string" - }, - "stripped-signature": { - "type": "string" - }, - "Content-Transfer-Encoding": { - "type": "string" - }, - "X-Mailgun-Tag": { - "type": "string" - }, - "X-Mailgun-Template-Name": { - "type": "string" - }, - "X-Mailgun-Template-Variables": { - "type": "string" - }, - "X-Mailgun-Deliver-By": { - "type": "string" - } - }, - "additionalProperties": false, - "required": [ - "Content-Type", - "From", - "Message-Id", - "Mime-Version", - "Subject", - "To", - "body-html", - "body-plain", - "message-headers", - "recipients", - "sender", - "stripped-html", - "stripped-signature", - "stripped-text" - ], - "$schema": "http://json-schema.org/draft-07/schema#" - }, - "MessagesQueueStatusAPIResponse": { - "type": "object", - "properties": { - "regular": { - "type": "object", - "properties": { - "is_disabled": { - "type": "boolean" - }, - "disabled": { - "type": "object", - "properties": { - "until": { - "type": "string" - }, - "reason": { - "type": "string" - } - }, - "additionalProperties": false, - "required": [ - "reason", - "until" - ] - } - }, - "additionalProperties": false, - "required": [ - "disabled", - "is_disabled" - ] - }, - "scheduled": { - "type": "object", - "properties": { - "is_disabled": { - "type": "boolean" - }, - "disabled": { - "type": "object", - "properties": { - "until": { - "type": "string" - }, - "reason": { - "type": "string" - } - }, - "additionalProperties": false, - "required": [ - "reason", - "until" - ] - } - }, - "additionalProperties": false, - "required": [ - "disabled", - "is_disabled" - ] - } - }, - "additionalProperties": false, - "required": [ - "regular", - "scheduled" - ], - "$schema": "http://json-schema.org/draft-07/schema#" - }, - "SubaccountSendingLimitResponse": { - "type": "object", - "properties": { - "limit": { - "type": "integer" - }, - "current": { - "type": "integer" - }, - "period": { - "type": "string" - } - }, - "additionalProperties": false, - "required": [ - "current", - "limit", - "period" - ], - "$schema": "http://json-schema.org/draft-07/schema#" - }, - "SubaccountSetSendingLimitResponse": { - "type": "object", - "properties": { - "success": { - "type": "boolean" - } - }, - "additionalProperties": false, - "required": [ - "success" - ], - "$schema": "http://json-schema.org/draft-07/schema#" - }, - "SubaccountDestroyResponse": { - "type": "object", - "properties": { - "message": { - "type": "string" - } - }, - "additionalProperties": false, - "required": [ - "message" - ], - "$schema": "http://json-schema.org/draft-07/schema#" - }, - "ActivateDomainKeyResponse": { - "type": "object", - "properties": { - "message": { - "type": "string" - }, - "authority": { - "type": "string" - }, - "selector": { - "type": "string" - }, - "active": { - "type": "boolean" - }, - "status": { - "type": "integer" - } - }, - "additionalProperties": false, - "required": [ - "active", - "authority", - "message", - "selector", - "status" - ], - "$schema": "http://json-schema.org/draft-07/schema#" - }, - "DeactivateDomainKeyResponse": { - "type": "object", - "properties": { - "message": { - "type": "string" - }, - "authority": { - "type": "string" - }, - "selector": { - "type": "string" - }, - "active": { - "type": "boolean" - }, - "status": { - "type": "integer" - } - }, - "additionalProperties": false, - "required": [ - "active", - "authority", - "message", - "selector", - "status" - ], - "$schema": "http://json-schema.org/draft-07/schema#" - }, "FieldErrorResponse": { "type": "object", "properties": { @@ -2228,12 +1919,6 @@ "region": { "type": "string" }, - "features": { - "type": "array", - "items": { - "type": "string" - } - }, "icon": { "type": [ "null", @@ -2267,6 +1952,12 @@ "description": { "type": "string" }, + "features": { + "type": "array", + "items": { + "type": "string" + } + }, "verification_level": { "type": "integer" }, @@ -3123,12 +2814,6 @@ "id": { "type": "string" }, - "features": { - "type": "array", - "items": { - "type": "string" - } - }, "icon": { "type": "string" }, @@ -3192,6 +2877,12 @@ "description": { "type": "string" }, + "features": { + "type": "array", + "items": { + "type": "string" + } + }, "verification_level": { "type": "integer" }, @@ -3416,9 +3107,6 @@ "flags": { "type": "integer" }, - "disabled": { - "type": "boolean" - }, "verified": { "type": "boolean" }, @@ -3486,6 +3174,9 @@ "premium_usage_flags": { "type": "integer" }, + "disabled": { + "type": "boolean" + }, "settings": { "$ref": "#/definitions/UserSettingsSchema" } @@ -3548,9 +3239,6 @@ "flags": { "type": "integer" }, - "disabled": { - "type": "boolean" - }, "verified": { "type": "boolean" }, @@ -3618,6 +3306,9 @@ "premium_usage_flags": { "type": "integer" }, + "disabled": { + "type": "boolean" + }, "settings": { "$ref": "#/definitions/UserSettingsSchema" } @@ -3944,12 +3635,6 @@ "region": { "type": "string" }, - "features": { - "type": "array", - "items": { - "type": "string" - } - }, "icon": { "type": [ "null", @@ -3983,6 +3668,12 @@ "description": { "type": "string" }, + "features": { + "type": "array", + "items": { + "type": "string" + } + }, "verification_level": { "type": "integer" }, @@ -5058,12 +4749,18 @@ "items": { "type": "string" } + }, + "recipient_id": { + "type": "string" + }, + "access_tokens": { + "type": "array", + "items": { + "type": "string" + } } }, "additionalProperties": false, - "required": [ - "recipients" - ], "$schema": "http://json-schema.org/draft-07/schema#" }, "EmailDomainLookupSchema": { @@ -13386,7 +13083,7 @@ "length": { "type": "integer" }, - "__@unscopables@698": { + "__@unscopables@700": { "type": "object", "additionalProperties": false, "patternProperties": { @@ -13515,17 +13212,17 @@ "remove": { "type": "boolean" }, - "__@iterator@696": { + "__@iterator@698": { "type": "boolean" }, - "__@unscopables@698": { + "__@unscopables@700": { "type": "boolean" } } } }, "required": [ - "__@unscopables@698", + "__@unscopables@700", "length" ] }, diff --git a/src/api/routes/users/@me/channels.ts b/src/api/routes/users/@me/channels.ts
index 897630ce..dc44935e 100644 --- a/src/api/routes/users/@me/channels.ts +++ b/src/api/routes/users/@me/channels.ts
@@ -53,7 +53,7 @@ router.post( }), async (req: Request, res: Response) => { const body = req.body as DmChannelCreateSchema; - res.json(await Channel.createDMChannel(body.recipients, req.user_id, body.name)); + res.json(await Channel.createDMChannel(body.recipients || (body.recipient_id ? [body.recipient_id] : []), req.user_id, body.name)); }, ); diff --git a/src/schemas/uncategorised/DmChannelCreateSchema.ts b/src/schemas/uncategorised/DmChannelCreateSchema.ts
index 3a58f664..0dd0c402 100644 --- a/src/schemas/uncategorised/DmChannelCreateSchema.ts +++ b/src/schemas/uncategorised/DmChannelCreateSchema.ts
@@ -18,5 +18,7 @@ export interface DmChannelCreateSchema { name?: string; - recipients: string[]; + recipients?: string[]; + recipient_id?: string; + access_tokens?: string[]; //Ignored in Spacebar for now, but makes bots happy }