diff options
Diffstat (limited to 'api')
-rw-r--r-- | api/assets/background.png | bin | 0 -> 319351 bytes | |||
-rw-r--r-- | api/assets/fosscord-login.css | 23 | ||||
-rw-r--r-- | api/assets/schemas.json | 2341 | ||||
-rw-r--r-- | api/scripts/generate_schema.js | 22 | ||||
-rw-r--r-- | api/src/middlewares/RateLimit.ts | 24 | ||||
-rw-r--r-- | api/src/routes/guilds/#guild_id/members/#member_id/index.ts | 3 | ||||
-rw-r--r-- | api/src/routes/users/@me/index.ts | 28 |
7 files changed, 1988 insertions, 453 deletions
diff --git a/api/assets/background.png b/api/assets/background.png new file mode 100644 index 00000000..58369ab8 --- /dev/null +++ b/api/assets/background.png Binary files differdiff --git a/api/assets/fosscord-login.css b/api/assets/fosscord-login.css index d507c545..ca0af064 100644 --- a/api/assets/fosscord-login.css +++ b/api/assets/fosscord-login.css @@ -14,7 +14,7 @@ } h3.title-jXR8lp.marginBottom8-AtZOdT.base-1x0h_U.size24-RIRrxO::after { margin-top: -32px; - content: "Welcome to Fosscord!"; + content: "Welcome to Slowcord!"; visibility: visible; display: block; } @@ -62,7 +62,22 @@ h3.title-jXR8lp.marginBottom8-AtZOdT.base-1x0h_U.size24-RIRrxO::after { margin-top: -16px; } -/* shrink login box to same size as register */ -.authBoxExpanded-2jqaBe { - width: 480px !important; +/* funny styling */ +.wrapper-6URcxg { + justify-content: flex-start !important; + + background: url("/assets/background.png"); + background-size: 100% 100%; + background-repeat: no-repeat; +} + +.authBoxExpanded-2jqaBe, +.authBox-hW6HRx { + width: max(40vw, 500px) !important; + height: 100vh !important; + padding: 100px !important; + display: flex; + justify-content: center; + align-items: center; + border-radius: 0 !important; } diff --git a/api/assets/schemas.json b/api/assets/schemas.json index 7a96be3c..eac24adb 100644 --- a/api/assets/schemas.json +++ b/api/assets/schemas.json @@ -1,4 +1,733 @@ { + "MessageCreateSchema": { + "type": "object", + "properties": { + "content": { + "type": "string" + }, + "nonce": { + "type": "string" + }, + "tts": { + "type": "boolean" + }, + "flags": { + "type": "string" + }, + "embeds": { + "type": "array", + "items": { + "$ref": "#/definitions/Embed" + } + }, + "embed": { + "$ref": "#/definitions/Embed" + }, + "allowed_mentions": { + "type": "object", + "properties": { + "parse": { + "type": "array", + "items": { + "type": "string" + } + }, + "roles": { + "type": "array", + "items": { + "type": "string" + } + }, + "users": { + "type": "array", + "items": { + "type": "string" + } + }, + "replied_user": { + "type": "boolean" + } + }, + "additionalProperties": false + }, + "message_reference": { + "type": "object", + "properties": { + "message_id": { + "type": "string" + }, + "channel_id": { + "type": "string" + }, + "guild_id": { + "type": "string" + }, + "fail_if_not_exists": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "channel_id", + "message_id" + ] + }, + "payload_json": { + "type": "string" + }, + "file": {}, + "attachments": { + "description": "TODO: we should create an interface for attachments\nTODO: OpenWAAO<-->attachment-style metadata conversion", + "type": "array", + "items": {} + }, + "sticker_ids": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false, + "definitions": { + "Embed": { + "type": "object", + "properties": { + "title": { + "type": "string" + }, + "type": { + "enum": [ + "article", + "gifv", + "image", + "link", + "rich", + "video" + ], + "type": "string" + }, + "description": { + "type": "string" + }, + "url": { + "type": "string" + }, + "timestamp": { + "type": "string", + "format": "date-time" + }, + "color": { + "type": "integer" + }, + "footer": { + "type": "object", + "properties": { + "text": { + "type": "string" + }, + "icon_url": { + "type": "string" + }, + "proxy_icon_url": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "text" + ] + }, + "image": { + "$ref": "#/definitions/EmbedImage" + }, + "thumbnail": { + "$ref": "#/definitions/EmbedImage" + }, + "video": { + "$ref": "#/definitions/EmbedImage" + }, + "provider": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "url": { + "type": "string" + } + }, + "additionalProperties": false + }, + "author": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "url": { + "type": "string" + }, + "icon_url": { + "type": "string" + }, + "proxy_icon_url": { + "type": "string" + } + }, + "additionalProperties": false + }, + "fields": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "inline": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "name", + "value" + ] + } + } + }, + "additionalProperties": false + }, + "EmbedImage": { + "type": "object", + "properties": { + "url": { + "type": "string" + }, + "proxy_url": { + "type": "string" + }, + "height": { + "type": "integer" + }, + "width": { + "type": "integer" + } + }, + "additionalProperties": false + }, + "Record<string,string>": { + "type": "object", + "additionalProperties": false + }, + "ChannelPermissionOverwriteType": { + "enum": [ + 0, + 1, + 2 + ], + "type": "number" + }, + "ChannelModifySchema": { + "type": "object", + "properties": { + "name": { + "maxLength": 100, + "type": "string" + }, + "type": { + "enum": [ + 0, + 1, + 10, + 11, + 12, + 13, + 14, + 15, + 2, + 255, + 3, + 33, + 34, + 35, + 4, + 5, + 6, + 64, + 7, + 8, + 9 + ], + "type": "number" + }, + "topic": { + "type": "string" + }, + "icon": { + "type": [ + "null", + "string" + ] + }, + "bitrate": { + "type": "integer" + }, + "user_limit": { + "type": "integer" + }, + "rate_limit_per_user": { + "type": "integer" + }, + "position": { + "type": "integer" + }, + "permission_overwrites": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "type": { + "$ref": "#/definitions/ChannelPermissionOverwriteType" + }, + "allow": { + "type": "string" + }, + "deny": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "allow", + "deny", + "id", + "type" + ] + } + }, + "parent_id": { + "type": "string" + }, + "id": { + "type": "string" + }, + "nsfw": { + "type": "boolean" + }, + "rtc_region": { + "type": "string" + }, + "default_auto_archive_duration": { + "type": "integer" + } + }, + "additionalProperties": false + }, + "UserPublic": { + "type": "object", + "properties": { + "username": { + "type": "string" + }, + "discriminator": { + "type": "string" + }, + "id": { + "type": "string" + }, + "public_flags": { + "type": "integer" + }, + "avatar": { + "type": "string" + }, + "accent_color": { + "type": "integer" + }, + "banner": { + "type": "string" + }, + "bio": { + "type": "string" + }, + "bot": { + "type": "boolean" + }, + "premium_since": { + "type": "string", + "format": "date-time" + } + }, + "additionalProperties": false, + "required": [ + "bio", + "bot", + "discriminator", + "id", + "premium_since", + "public_flags", + "username" + ] + }, + "PublicConnectedAccount": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "type": { + "type": "string" + }, + "verified": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "name", + "type", + "verified" + ] + } + }, + "$schema": "http://json-schema.org/draft-07/schema#" + }, + "RouteResponse": { + "type": "object", + "properties": { + "status": { + "type": "integer" + }, + "body": { + "type": "array", + "items": { + "type": "string" + } + }, + "headers": { + "$ref": "#/definitions/Record<string,string>" + } + }, + "additionalProperties": false, + "definitions": { + "Embed": { + "type": "object", + "properties": { + "title": { + "type": "string" + }, + "type": { + "enum": [ + "article", + "gifv", + "image", + "link", + "rich", + "video" + ], + "type": "string" + }, + "description": { + "type": "string" + }, + "url": { + "type": "string" + }, + "timestamp": { + "type": "string", + "format": "date-time" + }, + "color": { + "type": "integer" + }, + "footer": { + "type": "object", + "properties": { + "text": { + "type": "string" + }, + "icon_url": { + "type": "string" + }, + "proxy_icon_url": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "text" + ] + }, + "image": { + "$ref": "#/definitions/EmbedImage" + }, + "thumbnail": { + "$ref": "#/definitions/EmbedImage" + }, + "video": { + "$ref": "#/definitions/EmbedImage" + }, + "provider": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "url": { + "type": "string" + } + }, + "additionalProperties": false + }, + "author": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "url": { + "type": "string" + }, + "icon_url": { + "type": "string" + }, + "proxy_icon_url": { + "type": "string" + } + }, + "additionalProperties": false + }, + "fields": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "inline": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "name", + "value" + ] + } + } + }, + "additionalProperties": false + }, + "EmbedImage": { + "type": "object", + "properties": { + "url": { + "type": "string" + }, + "proxy_url": { + "type": "string" + }, + "height": { + "type": "integer" + }, + "width": { + "type": "integer" + } + }, + "additionalProperties": false + }, + "Record<string,string>": { + "type": "object", + "additionalProperties": false + }, + "ChannelPermissionOverwriteType": { + "enum": [ + 0, + 1, + 2 + ], + "type": "number" + }, + "ChannelModifySchema": { + "type": "object", + "properties": { + "name": { + "maxLength": 100, + "type": "string" + }, + "type": { + "enum": [ + 0, + 1, + 10, + 11, + 12, + 13, + 14, + 15, + 2, + 255, + 3, + 33, + 34, + 35, + 4, + 5, + 6, + 64, + 7, + 8, + 9 + ], + "type": "number" + }, + "topic": { + "type": "string" + }, + "icon": { + "type": [ + "null", + "string" + ] + }, + "bitrate": { + "type": "integer" + }, + "user_limit": { + "type": "integer" + }, + "rate_limit_per_user": { + "type": "integer" + }, + "position": { + "type": "integer" + }, + "permission_overwrites": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "type": { + "$ref": "#/definitions/ChannelPermissionOverwriteType" + }, + "allow": { + "type": "string" + }, + "deny": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "allow", + "deny", + "id", + "type" + ] + } + }, + "parent_id": { + "type": "string" + }, + "id": { + "type": "string" + }, + "nsfw": { + "type": "boolean" + }, + "rtc_region": { + "type": "string" + }, + "default_auto_archive_duration": { + "type": "integer" + } + }, + "additionalProperties": false + }, + "UserPublic": { + "type": "object", + "properties": { + "username": { + "type": "string" + }, + "discriminator": { + "type": "string" + }, + "id": { + "type": "string" + }, + "public_flags": { + "type": "integer" + }, + "avatar": { + "type": "string" + }, + "accent_color": { + "type": "integer" + }, + "banner": { + "type": "string" + }, + "bio": { + "type": "string" + }, + "bot": { + "type": "boolean" + }, + "premium_since": { + "type": "string", + "format": "date-time" + } + }, + "additionalProperties": false, + "required": [ + "bio", + "bot", + "discriminator", + "id", + "premium_since", + "public_flags", + "username" + ] + }, + "PublicConnectedAccount": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "type": { + "type": "string" + }, + "verified": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "name", + "type", + "verified" + ] + } + }, + "$schema": "http://json-schema.org/draft-07/schema#" + }, "LoginSchema": { "type": "object", "properties": { @@ -26,6 +755,315 @@ "login", "password" ], + "definitions": { + "Embed": { + "type": "object", + "properties": { + "title": { + "type": "string" + }, + "type": { + "enum": [ + "article", + "gifv", + "image", + "link", + "rich", + "video" + ], + "type": "string" + }, + "description": { + "type": "string" + }, + "url": { + "type": "string" + }, + "timestamp": { + "type": "string", + "format": "date-time" + }, + "color": { + "type": "integer" + }, + "footer": { + "type": "object", + "properties": { + "text": { + "type": "string" + }, + "icon_url": { + "type": "string" + }, + "proxy_icon_url": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "text" + ] + }, + "image": { + "$ref": "#/definitions/EmbedImage" + }, + "thumbnail": { + "$ref": "#/definitions/EmbedImage" + }, + "video": { + "$ref": "#/definitions/EmbedImage" + }, + "provider": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "url": { + "type": "string" + } + }, + "additionalProperties": false + }, + "author": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "url": { + "type": "string" + }, + "icon_url": { + "type": "string" + }, + "proxy_icon_url": { + "type": "string" + } + }, + "additionalProperties": false + }, + "fields": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "inline": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "name", + "value" + ] + } + } + }, + "additionalProperties": false + }, + "EmbedImage": { + "type": "object", + "properties": { + "url": { + "type": "string" + }, + "proxy_url": { + "type": "string" + }, + "height": { + "type": "integer" + }, + "width": { + "type": "integer" + } + }, + "additionalProperties": false + }, + "Record<string,string>": { + "type": "object", + "additionalProperties": false + }, + "ChannelPermissionOverwriteType": { + "enum": [ + 0, + 1, + 2 + ], + "type": "number" + }, + "ChannelModifySchema": { + "type": "object", + "properties": { + "name": { + "maxLength": 100, + "type": "string" + }, + "type": { + "enum": [ + 0, + 1, + 10, + 11, + 12, + 13, + 14, + 15, + 2, + 255, + 3, + 33, + 34, + 35, + 4, + 5, + 6, + 64, + 7, + 8, + 9 + ], + "type": "number" + }, + "topic": { + "type": "string" + }, + "icon": { + "type": [ + "null", + "string" + ] + }, + "bitrate": { + "type": "integer" + }, + "user_limit": { + "type": "integer" + }, + "rate_limit_per_user": { + "type": "integer" + }, + "position": { + "type": "integer" + }, + "permission_overwrites": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "type": { + "$ref": "#/definitions/ChannelPermissionOverwriteType" + }, + "allow": { + "type": "string" + }, + "deny": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "allow", + "deny", + "id", + "type" + ] + } + }, + "parent_id": { + "type": "string" + }, + "id": { + "type": "string" + }, + "nsfw": { + "type": "boolean" + }, + "rtc_region": { + "type": "string" + }, + "default_auto_archive_duration": { + "type": "integer" + } + }, + "additionalProperties": false + }, + "UserPublic": { + "type": "object", + "properties": { + "username": { + "type": "string" + }, + "discriminator": { + "type": "string" + }, + "id": { + "type": "string" + }, + "public_flags": { + "type": "integer" + }, + "avatar": { + "type": "string" + }, + "accent_color": { + "type": "integer" + }, + "banner": { + "type": "string" + }, + "bio": { + "type": "string" + }, + "bot": { + "type": "boolean" + }, + "premium_since": { + "type": "string", + "format": "date-time" + } + }, + "additionalProperties": false, + "required": [ + "bio", + "bot", + "discriminator", + "id", + "premium_since", + "public_flags", + "username" + ] + }, + "PublicConnectedAccount": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "type": { + "type": "string" + }, + "verified": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "name", + "type", + "verified" + ] + } + }, "$schema": "http://json-schema.org/draft-07/schema#" }, "RegisterSchema": { @@ -69,6 +1107,315 @@ "consent", "username" ], + "definitions": { + "Embed": { + "type": "object", + "properties": { + "title": { + "type": "string" + }, + "type": { + "enum": [ + "article", + "gifv", + "image", + "link", + "rich", + "video" + ], + "type": "string" + }, + "description": { + "type": "string" + }, + "url": { + "type": "string" + }, + "timestamp": { + "type": "string", + "format": "date-time" + }, + "color": { + "type": "integer" + }, + "footer": { + "type": "object", + "properties": { + "text": { + "type": "string" + }, + "icon_url": { + "type": "string" + }, + "proxy_icon_url": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "text" + ] + }, + "image": { + "$ref": "#/definitions/EmbedImage" + }, + "thumbnail": { + "$ref": "#/definitions/EmbedImage" + }, + "video": { + "$ref": "#/definitions/EmbedImage" + }, + "provider": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "url": { + "type": "string" + } + }, + "additionalProperties": false + }, + "author": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "url": { + "type": "string" + }, + "icon_url": { + "type": "string" + }, + "proxy_icon_url": { + "type": "string" + } + }, + "additionalProperties": false + }, + "fields": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "inline": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "name", + "value" + ] + } + } + }, + "additionalProperties": false + }, + "EmbedImage": { + "type": "object", + "properties": { + "url": { + "type": "string" + }, + "proxy_url": { + "type": "string" + }, + "height": { + "type": "integer" + }, + "width": { + "type": "integer" + } + }, + "additionalProperties": false + }, + "Record<string,string>": { + "type": "object", + "additionalProperties": false + }, + "ChannelPermissionOverwriteType": { + "enum": [ + 0, + 1, + 2 + ], + "type": "number" + }, + "ChannelModifySchema": { + "type": "object", + "properties": { + "name": { + "maxLength": 100, + "type": "string" + }, + "type": { + "enum": [ + 0, + 1, + 10, + 11, + 12, + 13, + 14, + 15, + 2, + 255, + 3, + 33, + 34, + 35, + 4, + 5, + 6, + 64, + 7, + 8, + 9 + ], + "type": "number" + }, + "topic": { + "type": "string" + }, + "icon": { + "type": [ + "null", + "string" + ] + }, + "bitrate": { + "type": "integer" + }, + "user_limit": { + "type": "integer" + }, + "rate_limit_per_user": { + "type": "integer" + }, + "position": { + "type": "integer" + }, + "permission_overwrites": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "type": { + "$ref": "#/definitions/ChannelPermissionOverwriteType" + }, + "allow": { + "type": "string" + }, + "deny": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "allow", + "deny", + "id", + "type" + ] + } + }, + "parent_id": { + "type": "string" + }, + "id": { + "type": "string" + }, + "nsfw": { + "type": "boolean" + }, + "rtc_region": { + "type": "string" + }, + "default_auto_archive_duration": { + "type": "integer" + } + }, + "additionalProperties": false + }, + "UserPublic": { + "type": "object", + "properties": { + "username": { + "type": "string" + }, + "discriminator": { + "type": "string" + }, + "id": { + "type": "string" + }, + "public_flags": { + "type": "integer" + }, + "avatar": { + "type": "string" + }, + "accent_color": { + "type": "integer" + }, + "banner": { + "type": "string" + }, + "bio": { + "type": "string" + }, + "bot": { + "type": "boolean" + }, + "premium_since": { + "type": "string", + "format": "date-time" + } + }, + "additionalProperties": false, + "required": [ + "bio", + "bot", + "discriminator", + "id", + "premium_since", + "public_flags", + "username" + ] + }, + "PublicConnectedAccount": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "type": { + "type": "string" + }, + "verified": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "name", + "type", + "verified" + ] + } + }, "$schema": "http://json-schema.org/draft-07/schema#" }, "ChannelModifySchema": { @@ -86,6 +1433,8 @@ 11, 12, 13, + 14, + 15, 2, 255, 3, @@ -168,14 +1517,6 @@ }, "additionalProperties": false, "definitions": { - "ChannelPermissionOverwriteType": { - "enum": [ - 0, - 1, - 2 - ], - "type": "number" - }, "Embed": { "type": "object", "properties": { @@ -306,6 +1647,18 @@ }, "additionalProperties": false }, + "Record<string,string>": { + "type": "object", + "additionalProperties": false + }, + "ChannelPermissionOverwriteType": { + "enum": [ + 0, + 1, + 2 + ], + "type": "number" + }, "ChannelModifySchema": { "type": "object", "properties": { @@ -321,6 +1674,8 @@ 11, 12, 13, + 14, + 15, 2, 255, 3, @@ -472,104 +1827,39 @@ }, "$schema": "http://json-schema.org/draft-07/schema#" }, - "MessageCreateSchema": { + "InviteCreateSchema": { "type": "object", "properties": { - "content": { + "target_user_id": { "type": "string" }, - "nonce": { + "target_type": { "type": "string" }, - "tts": { - "type": "boolean" - }, - "flags": { + "validate": { "type": "string" }, - "embeds": { - "type": "array", - "items": { - "$ref": "#/definitions/Embed" - } + "max_age": { + "type": "integer" }, - "embed": { - "$ref": "#/definitions/Embed" + "max_uses": { + "type": "integer" }, - "allowed_mentions": { - "type": "object", - "properties": { - "parse": { - "type": "array", - "items": { - "type": "string" - } - }, - "roles": { - "type": "array", - "items": { - "type": "string" - } - }, - "users": { - "type": "array", - "items": { - "type": "string" - } - }, - "replied_user": { - "type": "boolean" - } - }, - "additionalProperties": false + "temporary": { + "type": "boolean" }, - "message_reference": { - "type": "object", - "properties": { - "message_id": { - "type": "string" - }, - "channel_id": { - "type": "string" - }, - "guild_id": { - "type": "string" - }, - "fail_if_not_exists": { - "type": "boolean" - } - }, - "additionalProperties": false, - "required": [ - "channel_id", - "message_id" - ] + "unique": { + "type": "boolean" }, - "payload_json": { + "target_user": { "type": "string" }, - "file": {}, - "attachments": { - "type": "array", - "items": {} - }, - "sticker_ids": { - "type": "array", - "items": { - "type": "string" - } + "target_user_type": { + "type": "integer" } }, "additionalProperties": false, "definitions": { - "ChannelPermissionOverwriteType": { - "enum": [ - 0, - 1, - 2 - ], - "type": "number" - }, "Embed": { "type": "object", "properties": { @@ -700,6 +1990,18 @@ }, "additionalProperties": false }, + "Record<string,string>": { + "type": "object", + "additionalProperties": false + }, + "ChannelPermissionOverwriteType": { + "enum": [ + 0, + 1, + 2 + ], + "type": "number" + }, "ChannelModifySchema": { "type": "object", "properties": { @@ -715,6 +2017,8 @@ 11, 12, 13, + 14, + 15, 2, 255, 3, @@ -866,47 +2170,18 @@ }, "$schema": "http://json-schema.org/draft-07/schema#" }, - "InviteCreateSchema": { + "MessageAcknowledgeSchema": { "type": "object", "properties": { - "target_user_id": { - "type": "string" - }, - "target_type": { - "type": "string" - }, - "validate": { - "type": "string" - }, - "max_age": { - "type": "integer" - }, - "max_uses": { - "type": "integer" - }, - "temporary": { - "type": "boolean" - }, - "unique": { + "manual": { "type": "boolean" }, - "target_user": { - "type": "string" - }, - "target_user_type": { + "mention_count": { "type": "integer" } }, "additionalProperties": false, "definitions": { - "ChannelPermissionOverwriteType": { - "enum": [ - 0, - 1, - 2 - ], - "type": "number" - }, "Embed": { "type": "object", "properties": { @@ -1037,6 +2312,18 @@ }, "additionalProperties": false }, + "Record<string,string>": { + "type": "object", + "additionalProperties": false + }, + "ChannelPermissionOverwriteType": { + "enum": [ + 0, + 1, + 2 + ], + "type": "number" + }, "ChannelModifySchema": { "type": "object", "properties": { @@ -1052,6 +2339,8 @@ 11, 12, 13, + 14, + 15, 2, 255, 3, @@ -1203,26 +2492,21 @@ }, "$schema": "http://json-schema.org/draft-07/schema#" }, - "MessageAcknowledgeSchema": { + "BulkDeleteSchema": { "type": "object", "properties": { - "manual": { - "type": "boolean" - }, - "mention_count": { - "type": "integer" + "messages": { + "type": "array", + "items": { + "type": "string" + } } }, "additionalProperties": false, + "required": [ + "messages" + ], "definitions": { - "ChannelPermissionOverwriteType": { - "enum": [ - 0, - 1, - 2 - ], - "type": "number" - }, "Embed": { "type": "object", "properties": { @@ -1353,6 +2637,18 @@ }, "additionalProperties": false }, + "Record<string,string>": { + "type": "object", + "additionalProperties": false + }, + "ChannelPermissionOverwriteType": { + "enum": [ + 0, + 1, + 2 + ], + "type": "number" + }, "ChannelModifySchema": { "type": "object", "properties": { @@ -1368,6 +2664,8 @@ 11, 12, 13, + 14, + 15, 2, 255, 3, @@ -1519,29 +2817,30 @@ }, "$schema": "http://json-schema.org/draft-07/schema#" }, - "BulkDeleteSchema": { + "ChannelPermissionOverwriteSchema": { "type": "object", "properties": { - "messages": { - "type": "array", - "items": { - "type": "string" - } + "allow": { + "type": "string" + }, + "deny": { + "type": "string" + }, + "id": { + "type": "string" + }, + "type": { + "$ref": "#/definitions/ChannelPermissionOverwriteType" } }, "additionalProperties": false, "required": [ - "messages" + "allow", + "deny", + "id", + "type" ], "definitions": { - "ChannelPermissionOverwriteType": { - "enum": [ - 0, - 1, - 2 - ], - "type": "number" - }, "Embed": { "type": "object", "properties": { @@ -1672,6 +2971,18 @@ }, "additionalProperties": false }, + "Record<string,string>": { + "type": "object", + "additionalProperties": false + }, + "ChannelPermissionOverwriteType": { + "enum": [ + 0, + 1, + 2 + ], + "type": "number" + }, "ChannelModifySchema": { "type": "object", "properties": { @@ -1687,6 +2998,8 @@ 11, 12, 13, + 14, + 15, 2, 255, 3, @@ -1838,38 +3151,22 @@ }, "$schema": "http://json-schema.org/draft-07/schema#" }, - "ChannelPermissionOverwriteSchema": { + "PurgeSchema": { "type": "object", "properties": { - "allow": { - "type": "string" - }, - "deny": { + "before": { "type": "string" }, - "id": { + "after": { "type": "string" - }, - "type": { - "$ref": "#/definitions/ChannelPermissionOverwriteType" } }, "additionalProperties": false, "required": [ - "allow", - "deny", - "id", - "type" + "after", + "before" ], "definitions": { - "ChannelPermissionOverwriteType": { - "enum": [ - 0, - 1, - 2 - ], - "type": "number" - }, "Embed": { "type": "object", "properties": { @@ -2000,6 +3297,18 @@ }, "additionalProperties": false }, + "Record<string,string>": { + "type": "object", + "additionalProperties": false + }, + "ChannelPermissionOverwriteType": { + "enum": [ + 0, + 1, + 2 + ], + "type": "number" + }, "ChannelModifySchema": { "type": "object", "properties": { @@ -2015,6 +3324,8 @@ 11, 12, 13, + 14, + 15, 2, 255, 3, @@ -2183,14 +3494,6 @@ "name" ], "definitions": { - "ChannelPermissionOverwriteType": { - "enum": [ - 0, - 1, - 2 - ], - "type": "number" - }, "Embed": { "type": "object", "properties": { @@ -2321,6 +3624,18 @@ }, "additionalProperties": false }, + "Record<string,string>": { + "type": "object", + "additionalProperties": false + }, + "ChannelPermissionOverwriteType": { + "enum": [ + 0, + 1, + 2 + ], + "type": "number" + }, "ChannelModifySchema": { "type": "object", "properties": { @@ -2336,6 +3651,8 @@ 11, 12, 13, + 14, + 15, 2, 255, 3, @@ -2528,14 +3845,6 @@ "url" ], "definitions": { - "ChannelPermissionOverwriteType": { - "enum": [ - 0, - 1, - 2 - ], - "type": "number" - }, "Embed": { "type": "object", "properties": { @@ -2666,6 +3975,18 @@ }, "additionalProperties": false }, + "Record<string,string>": { + "type": "object", + "additionalProperties": false + }, + "ChannelPermissionOverwriteType": { + "enum": [ + 0, + 1, + 2 + ], + "type": "number" + }, "ChannelModifySchema": { "type": "object", "properties": { @@ -2681,6 +4002,8 @@ 11, 12, 13, + 14, + 15, 2, 255, 3, @@ -2844,14 +4167,6 @@ "url" ], "definitions": { - "ChannelPermissionOverwriteType": { - "enum": [ - 0, - 1, - 2 - ], - "type": "number" - }, "Embed": { "type": "object", "properties": { @@ -2982,6 +4297,18 @@ }, "additionalProperties": false }, + "Record<string,string>": { + "type": "object", + "additionalProperties": false + }, + "ChannelPermissionOverwriteType": { + "enum": [ + 0, + 1, + 2 + ], + "type": "number" + }, "ChannelModifySchema": { "type": "object", "properties": { @@ -2997,6 +4324,8 @@ 11, 12, 13, + 14, + 15, 2, 255, 3, @@ -3160,14 +4489,6 @@ }, "additionalProperties": false, "definitions": { - "ChannelPermissionOverwriteType": { - "enum": [ - 0, - 1, - 2 - ], - "type": "number" - }, "Embed": { "type": "object", "properties": { @@ -3298,6 +4619,18 @@ }, "additionalProperties": false }, + "Record<string,string>": { + "type": "object", + "additionalProperties": false + }, + "ChannelPermissionOverwriteType": { + "enum": [ + 0, + 1, + 2 + ], + "type": "number" + }, "ChannelModifySchema": { "type": "object", "properties": { @@ -3313,6 +4646,8 @@ 11, 12, 13, + 14, + 15, 2, 255, 3, @@ -3494,14 +4829,6 @@ "user_id" ], "definitions": { - "ChannelPermissionOverwriteType": { - "enum": [ - 0, - 1, - 2 - ], - "type": "number" - }, "Embed": { "type": "object", "properties": { @@ -3632,6 +4959,18 @@ }, "additionalProperties": false }, + "Record<string,string>": { + "type": "object", + "additionalProperties": false + }, + "ChannelPermissionOverwriteType": { + "enum": [ + 0, + 1, + 2 + ], + "type": "number" + }, "ChannelModifySchema": { "type": "object", "properties": { @@ -3647,6 +4986,8 @@ 11, 12, 13, + 14, + 15, 2, 255, 3, @@ -3825,14 +5166,6 @@ "user_id" ], "definitions": { - "ChannelPermissionOverwriteType": { - "enum": [ - 0, - 1, - 2 - ], - "type": "number" - }, "Embed": { "type": "object", "properties": { @@ -3963,6 +5296,18 @@ }, "additionalProperties": false }, + "Record<string,string>": { + "type": "object", + "additionalProperties": false + }, + "ChannelPermissionOverwriteType": { + "enum": [ + 0, + 1, + 2 + ], + "type": "number" + }, "ChannelModifySchema": { "type": "object", "properties": { @@ -3978,6 +5323,8 @@ 11, 12, 13, + 14, + 15, 2, 255, 3, @@ -4153,14 +5500,6 @@ ] }, "definitions": { - "ChannelPermissionOverwriteType": { - "enum": [ - 0, - 1, - 2 - ], - "type": "number" - }, "Embed": { "type": "object", "properties": { @@ -4291,6 +5630,18 @@ }, "additionalProperties": false }, + "Record<string,string>": { + "type": "object", + "additionalProperties": false + }, + "ChannelPermissionOverwriteType": { + "enum": [ + 0, + 1, + 2 + ], + "type": "number" + }, "ChannelModifySchema": { "type": "object", "properties": { @@ -4306,6 +5657,8 @@ 11, 12, 13, + 14, + 15, 2, 255, 3, @@ -4484,14 +5837,6 @@ "image" ], "definitions": { - "ChannelPermissionOverwriteType": { - "enum": [ - 0, - 1, - 2 - ], - "type": "number" - }, "Embed": { "type": "object", "properties": { @@ -4622,6 +5967,18 @@ }, "additionalProperties": false }, + "Record<string,string>": { + "type": "object", + "additionalProperties": false + }, + "ChannelPermissionOverwriteType": { + "enum": [ + 0, + 1, + 2 + ], + "type": "number" + }, "ChannelModifySchema": { "type": "object", "properties": { @@ -4637,6 +5994,8 @@ 11, 12, 13, + 14, + 15, 2, 255, 3, @@ -4803,14 +6162,6 @@ }, "additionalProperties": false, "definitions": { - "ChannelPermissionOverwriteType": { - "enum": [ - 0, - 1, - 2 - ], - "type": "number" - }, "Embed": { "type": "object", "properties": { @@ -4941,6 +6292,18 @@ }, "additionalProperties": false }, + "Record<string,string>": { + "type": "object", + "additionalProperties": false + }, + "ChannelPermissionOverwriteType": { + "enum": [ + 0, + 1, + 2 + ], + "type": "number" + }, "ChannelModifySchema": { "type": "object", "properties": { @@ -4956,6 +6319,8 @@ 11, 12, 13, + 14, + 15, 2, 255, 3, @@ -5144,14 +6509,6 @@ "name" ], "definitions": { - "ChannelPermissionOverwriteType": { - "enum": [ - 0, - 1, - 2 - ], - "type": "number" - }, "Embed": { "type": "object", "properties": { @@ -5282,6 +6639,18 @@ }, "additionalProperties": false }, + "Record<string,string>": { + "type": "object", + "additionalProperties": false + }, + "ChannelPermissionOverwriteType": { + "enum": [ + 0, + 1, + 2 + ], + "type": "number" + }, "ChannelModifySchema": { "type": "object", "properties": { @@ -5297,6 +6666,8 @@ 11, 12, 13, + 14, + 15, 2, 255, 3, @@ -5524,14 +6895,6 @@ "name" ], "definitions": { - "ChannelPermissionOverwriteType": { - "enum": [ - 0, - 1, - 2 - ], - "type": "number" - }, "Embed": { "type": "object", "properties": { @@ -5662,6 +7025,18 @@ }, "additionalProperties": false }, + "Record<string,string>": { + "type": "object", + "additionalProperties": false + }, + "ChannelPermissionOverwriteType": { + "enum": [ + 0, + 1, + 2 + ], + "type": "number" + }, "ChannelModifySchema": { "type": "object", "properties": { @@ -5677,6 +7052,8 @@ 11, 12, 13, + 14, + 15, 2, 255, 3, @@ -5836,18 +7213,13 @@ "items": { "type": "string" } + }, + "nick": { + "type": "string" } }, "additionalProperties": false, "definitions": { - "ChannelPermissionOverwriteType": { - "enum": [ - 0, - 1, - 2 - ], - "type": "number" - }, "Embed": { "type": "object", "properties": { @@ -5978,6 +7350,18 @@ }, "additionalProperties": false }, + "Record<string,string>": { + "type": "object", + "additionalProperties": false + }, + "ChannelPermissionOverwriteType": { + "enum": [ + 0, + 1, + 2 + ], + "type": "number" + }, "ChannelModifySchema": { "type": "object", "properties": { @@ -5993,6 +7377,8 @@ 11, 12, 13, + 14, + 15, 2, 255, 3, @@ -6156,14 +7542,6 @@ "nick" ], "definitions": { - "ChannelPermissionOverwriteType": { - "enum": [ - 0, - 1, - 2 - ], - "type": "number" - }, "Embed": { "type": "object", "properties": { @@ -6294,6 +7672,18 @@ }, "additionalProperties": false }, + "Record<string,string>": { + "type": "object", + "additionalProperties": false + }, + "ChannelPermissionOverwriteType": { + "enum": [ + 0, + 1, + 2 + ], + "type": "number" + }, "ChannelModifySchema": { "type": "object", "properties": { @@ -6309,6 +7699,8 @@ 11, 12, 13, + 14, + 15, 2, 255, 3, @@ -6472,14 +7864,6 @@ "days" ], "definitions": { - "ChannelPermissionOverwriteType": { - "enum": [ - 0, - 1, - 2 - ], - "type": "number" - }, "Embed": { "type": "object", "properties": { @@ -6610,6 +7994,18 @@ }, "additionalProperties": false }, + "Record<string,string>": { + "type": "object", + "additionalProperties": false + }, + "ChannelPermissionOverwriteType": { + "enum": [ + 0, + 1, + 2 + ], + "type": "number" + }, "ChannelModifySchema": { "type": "object", "properties": { @@ -6625,6 +8021,8 @@ 11, 12, 13, + 14, + 15, 2, 255, 3, @@ -6806,14 +8204,6 @@ }, "additionalProperties": false, "definitions": { - "ChannelPermissionOverwriteType": { - "enum": [ - 0, - 1, - 2 - ], - "type": "number" - }, "Embed": { "type": "object", "properties": { @@ -6944,6 +8334,18 @@ }, "additionalProperties": false }, + "Record<string,string>": { + "type": "object", + "additionalProperties": false + }, + "ChannelPermissionOverwriteType": { + "enum": [ + 0, + 1, + 2 + ], + "type": "number" + }, "ChannelModifySchema": { "type": "object", "properties": { @@ -6959,6 +8361,8 @@ 11, 12, 13, + 14, + 15, 2, 255, 3, @@ -7129,14 +8533,6 @@ ] }, "definitions": { - "ChannelPermissionOverwriteType": { - "enum": [ - 0, - 1, - 2 - ], - "type": "number" - }, "Embed": { "type": "object", "properties": { @@ -7267,6 +8663,18 @@ }, "additionalProperties": false }, + "Record<string,string>": { + "type": "object", + "additionalProperties": false + }, + "ChannelPermissionOverwriteType": { + "enum": [ + 0, + 1, + 2 + ], + "type": "number" + }, "ChannelModifySchema": { "type": "object", "properties": { @@ -7282,6 +8690,8 @@ 11, 12, 13, + 14, + 15, 2, 255, 3, @@ -7456,14 +8866,6 @@ "tags" ], "definitions": { - "ChannelPermissionOverwriteType": { - "enum": [ - 0, - 1, - 2 - ], - "type": "number" - }, "Embed": { "type": "object", "properties": { @@ -7594,6 +8996,18 @@ }, "additionalProperties": false }, + "Record<string,string>": { + "type": "object", + "additionalProperties": false + }, + "ChannelPermissionOverwriteType": { + "enum": [ + 0, + 1, + 2 + ], + "type": "number" + }, "ChannelModifySchema": { "type": "object", "properties": { @@ -7609,6 +9023,8 @@ 11, 12, 13, + 14, + 15, 2, 255, 3, @@ -7775,14 +9191,6 @@ "name" ], "definitions": { - "ChannelPermissionOverwriteType": { - "enum": [ - 0, - 1, - 2 - ], - "type": "number" - }, "Embed": { "type": "object", "properties": { @@ -7913,6 +9321,18 @@ }, "additionalProperties": false }, + "Record<string,string>": { + "type": "object", + "additionalProperties": false + }, + "ChannelPermissionOverwriteType": { + "enum": [ + 0, + 1, + 2 + ], + "type": "number" + }, "ChannelModifySchema": { "type": "object", "properties": { @@ -7928,6 +9348,8 @@ 11, 12, 13, + 14, + 15, 2, 255, 3, @@ -8094,14 +9516,6 @@ "name" ], "definitions": { - "ChannelPermissionOverwriteType": { - "enum": [ - 0, - 1, - 2 - ], - "type": "number" - }, "Embed": { "type": "object", "properties": { @@ -8232,6 +9646,18 @@ }, "additionalProperties": false }, + "Record<string,string>": { + "type": "object", + "additionalProperties": false + }, + "ChannelPermissionOverwriteType": { + "enum": [ + 0, + 1, + 2 + ], + "type": "number" + }, "ChannelModifySchema": { "type": "object", "properties": { @@ -8247,6 +9673,8 @@ 11, 12, 13, + 14, + 15, 2, 255, 3, @@ -8409,14 +9837,6 @@ }, "additionalProperties": false, "definitions": { - "ChannelPermissionOverwriteType": { - "enum": [ - 0, - 1, - 2 - ], - "type": "number" - }, "Embed": { "type": "object", "properties": { @@ -8547,6 +9967,18 @@ }, "additionalProperties": false }, + "Record<string,string>": { + "type": "object", + "additionalProperties": false + }, + "ChannelPermissionOverwriteType": { + "enum": [ + 0, + 1, + 2 + ], + "type": "number" + }, "ChannelModifySchema": { "type": "object", "properties": { @@ -8562,6 +9994,8 @@ 11, 12, 13, + 14, + 15, 2, 255, 3, @@ -8744,14 +10178,6 @@ "channel_id" ], "definitions": { - "ChannelPermissionOverwriteType": { - "enum": [ - 0, - 1, - 2 - ], - "type": "number" - }, "Embed": { "type": "object", "properties": { @@ -8882,6 +10308,18 @@ }, "additionalProperties": false }, + "Record<string,string>": { + "type": "object", + "additionalProperties": false + }, + "ChannelPermissionOverwriteType": { + "enum": [ + 0, + 1, + 2 + ], + "type": "number" + }, "ChannelModifySchema": { "type": "object", "properties": { @@ -8897,6 +10335,8 @@ 11, 12, 13, + 14, + 15, 2, 255, 3, @@ -9086,14 +10526,6 @@ }, "additionalProperties": false, "definitions": { - "ChannelPermissionOverwriteType": { - "enum": [ - 0, - 1, - 2 - ], - "type": "number" - }, "Embed": { "type": "object", "properties": { @@ -9224,6 +10656,18 @@ }, "additionalProperties": false }, + "Record<string,string>": { + "type": "object", + "additionalProperties": false + }, + "ChannelPermissionOverwriteType": { + "enum": [ + 0, + 1, + 2 + ], + "type": "number" + }, "ChannelModifySchema": { "type": "object", "properties": { @@ -9239,6 +10683,8 @@ 11, 12, 13, + 14, + 15, 2, 255, 3, @@ -9406,14 +10852,6 @@ "enabled" ], "definitions": { - "ChannelPermissionOverwriteType": { - "enum": [ - 0, - 1, - 2 - ], - "type": "number" - }, "Embed": { "type": "object", "properties": { @@ -9544,6 +10982,18 @@ }, "additionalProperties": false }, + "Record<string,string>": { + "type": "object", + "additionalProperties": false + }, + "ChannelPermissionOverwriteType": { + "enum": [ + 0, + 1, + 2 + ], + "type": "number" + }, "ChannelModifySchema": { "type": "object", "properties": { @@ -9559,6 +11009,8 @@ 11, 12, 13, + 14, + 15, 2, 255, 3, @@ -9728,14 +11180,6 @@ "name" ], "definitions": { - "ChannelPermissionOverwriteType": { - "enum": [ - 0, - 1, - 2 - ], - "type": "number" - }, "Embed": { "type": "object", "properties": { @@ -9866,6 +11310,18 @@ }, "additionalProperties": false }, + "Record<string,string>": { + "type": "object", + "additionalProperties": false + }, + "ChannelPermissionOverwriteType": { + "enum": [ + 0, + 1, + 2 + ], + "type": "number" + }, "ChannelModifySchema": { "type": "object", "properties": { @@ -9881,6 +11337,8 @@ 11, 12, 13, + 14, + 15, 2, 255, 3, @@ -10056,14 +11514,6 @@ "user" ], "definitions": { - "ChannelPermissionOverwriteType": { - "enum": [ - 0, - 1, - 2 - ], - "type": "number" - }, "Embed": { "type": "object", "properties": { @@ -10194,6 +11644,18 @@ }, "additionalProperties": false }, + "Record<string,string>": { + "type": "object", + "additionalProperties": false + }, + "ChannelPermissionOverwriteType": { + "enum": [ + 0, + 1, + 2 + ], + "type": "number" + }, "ChannelModifySchema": { "type": "object", "properties": { @@ -10209,6 +11671,8 @@ 11, 12, 13, + 14, + 15, 2, 255, 3, @@ -10390,14 +11854,6 @@ "object" ], "definitions": { - "ChannelPermissionOverwriteType": { - "enum": [ - 0, - 1, - 2 - ], - "type": "number" - }, "Embed": { "type": "object", "properties": { @@ -10528,6 +11984,18 @@ }, "additionalProperties": false }, + "Record<string,string>": { + "type": "object", + "additionalProperties": false + }, + "ChannelPermissionOverwriteType": { + "enum": [ + 0, + 1, + 2 + ], + "type": "number" + }, "ChannelModifySchema": { "type": "object", "properties": { @@ -10543,6 +12011,8 @@ 11, 12, 13, + 14, + 15, 2, 255, 3, @@ -10712,14 +12182,6 @@ "recipients" ], "definitions": { - "ChannelPermissionOverwriteType": { - "enum": [ - 0, - 1, - 2 - ], - "type": "number" - }, "Embed": { "type": "object", "properties": { @@ -10850,6 +12312,18 @@ }, "additionalProperties": false }, + "Record<string,string>": { + "type": "object", + "additionalProperties": false + }, + "ChannelPermissionOverwriteType": { + "enum": [ + 0, + 1, + 2 + ], + "type": "number" + }, "ChannelModifySchema": { "type": "object", "properties": { @@ -10865,6 +12339,8 @@ 11, 12, 13, + 14, + 15, 2, 255, 3, @@ -11017,7 +12493,6 @@ "$schema": "http://json-schema.org/draft-07/schema#" }, "UserModifySchema": { - "additionalProperties": false, "type": "object", "properties": { "username": { @@ -11052,17 +12527,13 @@ }, "code": { "type": "string" + }, + "email": { + "type": "string" } }, + "additionalProperties": false, "definitions": { - "ChannelPermissionOverwriteType": { - "enum": [ - 0, - 1, - 2 - ], - "type": "number" - }, "Embed": { "type": "object", "properties": { @@ -11193,6 +12664,18 @@ }, "additionalProperties": false }, + "Record<string,string>": { + "type": "object", + "additionalProperties": false + }, + "ChannelPermissionOverwriteType": { + "enum": [ + 0, + 1, + 2 + ], + "type": "number" + }, "ChannelModifySchema": { "type": "object", "properties": { @@ -11208,6 +12691,8 @@ 11, 12, 13, + 14, + 15, 2, 255, 3, @@ -11374,14 +12859,6 @@ }, "additionalProperties": false, "definitions": { - "ChannelPermissionOverwriteType": { - "enum": [ - 0, - 1, - 2 - ], - "type": "number" - }, "Embed": { "type": "object", "properties": { @@ -11512,6 +12989,18 @@ }, "additionalProperties": false }, + "Record<string,string>": { + "type": "object", + "additionalProperties": false + }, + "ChannelPermissionOverwriteType": { + "enum": [ + 0, + 1, + 2 + ], + "type": "number" + }, "ChannelModifySchema": { "type": "object", "properties": { @@ -11527,6 +13016,8 @@ 11, 12, 13, + 14, + 15, 2, 255, 3, @@ -11694,14 +13185,6 @@ "username" ], "definitions": { - "ChannelPermissionOverwriteType": { - "enum": [ - 0, - 1, - 2 - ], - "type": "number" - }, "Embed": { "type": "object", "properties": { @@ -11832,6 +13315,18 @@ }, "additionalProperties": false }, + "Record<string,string>": { + "type": "object", + "additionalProperties": false + }, + "ChannelPermissionOverwriteType": { + "enum": [ + 0, + 1, + 2 + ], + "type": "number" + }, "ChannelModifySchema": { "type": "object", "properties": { @@ -11847,6 +13342,8 @@ 11, 12, 13, + 14, + 15, 2, 255, 3, @@ -12172,14 +13669,6 @@ }, "additionalProperties": false, "definitions": { - "ChannelPermissionOverwriteType": { - "enum": [ - 0, - 1, - 2 - ], - "type": "number" - }, "Embed": { "type": "object", "properties": { @@ -12310,6 +13799,18 @@ }, "additionalProperties": false }, + "Record<string,string>": { + "type": "object", + "additionalProperties": false + }, + "ChannelPermissionOverwriteType": { + "enum": [ + 0, + 1, + 2 + ], + "type": "number" + }, "ChannelModifySchema": { "type": "object", "properties": { @@ -12325,6 +13826,8 @@ 11, 12, 13, + 14, + 15, 2, 255, 3, diff --git a/api/scripts/generate_schema.js b/api/scripts/generate_schema.js index 7e742ec1..b56c3fbc 100644 --- a/api/scripts/generate_schema.js +++ b/api/scripts/generate_schema.js @@ -27,7 +27,16 @@ const Excluded = [ "Response", "e.Response", "request.Response", - "supertest.Response" + "supertest.Response", + + // TODO: Figure out how to exclude schemas from node_modules? + "SomeJSONSchema", + "UncheckedPartialSchema", + "PartialSchema", + "UncheckedPropertiesSchema", + "PropertiesSchema", + "AsyncSchema", + "AnySchema", ]; function modify(obj) { @@ -39,11 +48,18 @@ function modify(obj) { } function main() { - const program = TJS.getProgramFromFiles(walk(path.join(__dirname, "..", "src", "routes")), compilerOptions); + const files = [ + ...walk(path.join(__dirname, "..", "src", "routes")), + ...walk(path.join(__dirname, "..", "..", "util", "src")), + ]; + const program = TJS.getProgramFromFiles( + files, + compilerOptions + ); const generator = TJS.buildGenerator(program, settings); if (!generator || !program) return; - const schemas = generator.getUserSymbols().filter((x) => (x.endsWith("Schema") || x.endsWith("Response")) && !Excluded.includes(x)); + let schemas = generator.getUserSymbols().filter((x) => (x.endsWith("Schema") || x.endsWith("Response")) && !Excluded.includes(x)); console.log(schemas); var definitions = {}; diff --git a/api/src/middlewares/RateLimit.ts b/api/src/middlewares/RateLimit.ts index 13f1602c..1a38cfcf 100644 --- a/api/src/middlewares/RateLimit.ts +++ b/api/src/middlewares/RateLimit.ts @@ -1,4 +1,4 @@ -import { Config, getRights, listenEvent, Rights } from "@fosscord/util"; +import { Config, listenEvent } from "@fosscord/util"; import { NextFunction, Request, Response, Router } from "express"; import { getIpAdress } from "@fosscord/api"; import { API_PREFIX_TRAILING_SLASH } from "./Authentication"; @@ -9,7 +9,6 @@ import { API_PREFIX_TRAILING_SLASH } from "./Authentication"; /* ? bucket limit? Max actions/sec per bucket? -(ANSWER: a small fosscord instance might not need a complex rate limiting system) TODO: delay database requests to include multiple queries TODO: different for methods (GET/POST) @@ -45,12 +44,6 @@ export default function rateLimit(opts: { onlyIp?: boolean; }): any { return async (req: Request, res: Response, next: NextFunction): Promise<any> => { - // exempt user? if so, immediately short circuit - if (req.user_id) { - const rights = await getRights(req.user_id); - if (rights.has("BYPASS_RATE_LIMITS")) return; - } - const bucket_id = opts.bucket || req.originalUrl.replace(API_PREFIX_TRAILING_SLASH, ""); var executor_id = getIpAdress(req); if (!opts.onlyIp && req.user_id) executor_id = req.user_id; @@ -60,12 +53,12 @@ export default function rateLimit(opts: { if (opts.GET && ["GET", "OPTIONS", "HEAD"].includes(req.method)) max_hits = opts.GET; else if (opts.MODIFY && ["POST", "DELETE", "PATCH", "PUT"].includes(req.method)) max_hits = opts.MODIFY; - let offender = Cache.get(executor_id + bucket_id); + const offender = Cache.get(executor_id + bucket_id); if (offender) { - let reset = offender.expires_at.getTime(); - let resetAfterMs = reset - Date.now(); - let resetAfterSec = Math.ceil(resetAfterMs / 1000); + const reset = offender.expires_at.getTime(); + const resetAfterMs = reset - Date.now(); + const resetAfterSec = resetAfterMs / 1000; if (resetAfterMs <= 0) { offender.hits = 0; @@ -77,11 +70,6 @@ export default function rateLimit(opts: { if (offender.blocked) { const global = bucket_id === "global"; - // each block violation pushes the expiry one full window further - reset += opts.window * 1000; - offender.expires_at = new Date(offender.expires_at.getTime() + opts.window * 1000); - resetAfterMs = reset - Date.now(); - resetAfterSec = Math.ceil(resetAfterMs / 1000); console.log("blocked bucket: " + bucket_id, { resetAfterMs }); return ( @@ -163,7 +151,7 @@ export async function initRateLimits(app: Router) { app.use("/auth/register", rateLimit({ onlyIp: true, success: true, ...routes.auth.register })); } -async function hitRoute(opts: { executor_id: string; bucket_id: string; max_hits: number; window: number; }) { +async function hitRoute(opts: { executor_id: string; bucket_id: string; max_hits: number; window: number }) { const id = opts.executor_id + opts.bucket_id; var limit = Cache.get(id); if (!limit) { diff --git a/api/src/routes/guilds/#guild_id/members/#member_id/index.ts b/api/src/routes/guilds/#guild_id/members/#member_id/index.ts index c285abb3..2ff89eae 100644 --- a/api/src/routes/guilds/#guild_id/members/#member_id/index.ts +++ b/api/src/routes/guilds/#guild_id/members/#member_id/index.ts @@ -7,6 +7,7 @@ const router = Router(); export interface MemberChangeSchema { roles?: string[]; + nick?: string; } router.get("/", route({}), async (req: Request, res: Response) => { @@ -34,6 +35,8 @@ router.patch("/", route({ body: "MemberChangeSchema" }), async (req: Request, re member.roles = body.roles.map((x) => new Role({ id: x })); // foreign key constraint will fail if role doesn't exist } + if (body.nick) member.nick = body.nick; + await member.save(); member.roles = member.roles.filter((x) => x.id !== everyone.id); diff --git a/api/src/routes/users/@me/index.ts b/api/src/routes/users/@me/index.ts index 1af413c4..7ab30f03 100644 --- a/api/src/routes/users/@me/index.ts +++ b/api/src/routes/users/@me/index.ts @@ -1,7 +1,8 @@ import { Router, Request, Response } from "express"; -import { User, PrivateUserProjection, emitEvent, UserUpdateEvent, handleFile, FieldErrors } from "@fosscord/util"; +import { User, PrivateUserProjection, emitEvent, UserUpdateEvent, handleFile, FieldErrors, adjustEmail } from "@fosscord/util"; import { route } from "@fosscord/api"; import bcrypt from "bcrypt"; +import { HTTPError } from "lambert-server"; const router: Router = Router(); @@ -21,6 +22,7 @@ export interface UserModifySchema { password?: string; new_password?: string; code?: string; + email?: string; } router.get("/", route({}), async (req: Request, res: Response) => { @@ -28,6 +30,8 @@ router.get("/", route({}), async (req: Request, res: Response) => { }); router.patch("/", route({ body: "UserModifySchema" }), async (req: Request, res: Response) => { + if (req.user_id === "992772978150273216") throw new HTTPError("Demo user, sorry", 400); + const body = req.body as UserModifySchema; if (body.avatar) body.avatar = await handleFile(`/avatars/${req.user_id}`, body.avatar as string); @@ -46,6 +50,12 @@ router.patch("/", route({ body: "UserModifySchema" }), async (req: Request, res: } } + if (body.email) { + body.email = adjustEmail(body.email); + if (!body.email) + throw FieldErrors({ email: { message: req.t("auth:register.EMAIL_INVALID"), code: "EMAIL_INVALID" } }); + } + if (body.new_password) { if (!body.password && !user.email) { throw FieldErrors({ @@ -55,14 +65,14 @@ router.patch("/", route({ body: "UserModifySchema" }), async (req: Request, res: user.data.hash = await bcrypt.hash(body.new_password, 12); } - if(body.username){ - var check_username = body?.username?.replace(/\s/g, ''); - if(!check_username) { - throw FieldErrors({ - username: { code: "BASE_TYPE_REQUIRED", message: req.t("common:field.BASE_TYPE_REQUIRED") } - }); - } - } + if (body.username) { + var check_username = body?.username?.replace(/\s/g, ''); + if (!check_username) { + throw FieldErrors({ + username: { code: "BASE_TYPE_REQUIRED", message: req.t("common:field.BASE_TYPE_REQUIRED") } + }); + } + } user.assign(body); await user.save(); |