Repository navigation
Union Chat v2 - #14
Merged
Merged
Conversation
- Controllers and middlewares separated from route declaration - es6 imports & Babel to transpile everything - eslint to have a beautiful code - ez installer
Will resolve conflicts later, too lazy rn
I can't find a clean way to support two versions of the websocket server. Partial support is just a waste of time, so let's do a breaking update
These tests are a bit useless. Important tests are in s_core
This was referenced Oct 26, 2018
Open
devoxin
requested changes
Oct 28, 2018
| "maxServersPerUser": 5, | ||
| "maxAppsPerUser": 5 | ||
| }, | ||
| "recaptcha (Remove this entirely if you don't want to setup it)": { |
Member
There was a problem hiding this comment.
Perhaps the note could be moved to a property within this object to save having to edit this line if the user wants recaptcha (mostly a nitpick here)
| |---------------|-----------|---------------------------------------| | ||
| | id | snowflake | User internal ID | | ||
| | username | string | Username | | ||
| | discriminator | int | Discriminator fo the user | |
Member
There was a problem hiding this comment.
Suggested change
| | discriminator | int | Discriminator fo the user | | |
| | discriminator | int | Discriminator for the user | |
| | discriminator | int | Discriminator fo the user | | ||
| | avatarUrl | string? | Url of the user's avatar | | ||
| | servers | int[] | List of the server IDs the user is in | | ||
| | online | boolean | Whenever or not the user is online | |
Member
There was a problem hiding this comment.
Suggested change
| | online | boolean | Whenever or not the user is online | | |
| | online | boolean | Whether or not the user is online | |
| <span class='api-endpoint'><span class='sun-flower-text'>POST</span> /servers</span> | ||
| <span class='api-auth'>Requires authentication</span> | ||
|
|
||
| **Note:** You can't create more server than specified in `maxServersPerUser` |
Member
There was a problem hiding this comment.
Suggested change
| **Note:** You can't create more server than specified in `maxServersPerUser` | |
| **Note:** You can't exceed the `maxServersPerUser` limit |
| | Field | Type | Description | | ||
| |---------------|--------------|--------------------------------------------------------------------| | ||
| | id | snowflake | User ID | | ||
| | username | string | | |
Member
|
this is so damn big. On another note, please lint with the old settings (semicolons, yoda, etc...) |
Contributor
Author
|
Done :D |
Contributor
Author
|
oof also just notices some stuff:
I'll fix that a bit later and add a comment when it's fixed |
s_core was inconsistent and didn't behave like a test should do (random failures and keeps the process alive) Rate limiting is here to prevent API abuse and is Cloudflare-proof (IP detection)
Contributor
Author
|
Fixed and changes pushed. Note that the rate limiter should use a Redis server in the future, to improve reliability and scalability |
Contributor
Author
|
And on another note, i'm just wondering, why you prefer yoda syntax? |
devoxin
approved these changes
Nov 22, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It's time to update Union backend owo
This PR is a major rewrite of the API (v2) and a v2 of the websocket! OwO
APIv2 implements more consistent endpoints with cleaner path, a brunch of new features and is covered by unit tests
WebSocket is also in a new version with fancy new features!
WARNING: Neither the old API nor the old websocket are supported by this version. Support of the old API is
not complicated, but it's not the case for the current websocket. Partial support would be just a waste of time imo
Features
yarn run test(note: you can skip long test with the env variableSKIP_LONG_TESTS=yes)yarn run setupEz installer
The installer will prepare the app to start working quickly and easily
Endpoints
POST /api/v2/users - Create an user
GET /api/v2/users/self - Get current user
PUT, PATCH /api/v2/users/self - Updates the current user
DELETE /api/v2/users/self - Delete the current user
POST /api/v2/servers - Create a server
PUT, PATCH /api/v2/servers/:serverId - Delete a server
DELETE /api/v2/servers/:serverId/leave - Leave a server
DELETE /api/v2/servers/:serverId - Delete a server
POST /api/v2/servers/:serverId/invites - Create an invite to a server
POST /api/v2/invites/:invite - Accept an invite
POST /api/v2/servers/:serverId/messages - Post a message
PUT/PATCH /api/v2/servers/:serverId/messages/:messageId - Update a message
DELETE /api/v2/servers/:serverId/messages/:messageId - Delete a message
Not implemented endpoints
GET /api/v2/themes - Get a list of all themes, ordered by votes (with pagination)
POST /api/v2/themes/:themeId/vote - Upvote a theme
DELETE /api/v2/themes/:themeId/vote - Remove the upvote for a theme
POST /api/v2/themes - Create a theme
PUT, PATCH /api/v2/themes/:themeId - Update a theme
DELETE /api/v2/themes/:themeId - Delete a theme
GET /api/v2/developers/applications - Get applications
POST /api/v2/developers/applications - Create an application
PUT, PATCH /api/v2/developers/applications/:applicationId - Update an application
DELETE /api/v2/developers/applications/:applicationId - Delete an application
GET /api/v2/oauth2/authorize - Oauth2 classic routes
POST /api/v2/oauth2/token - Oauth2 classic routes
POST /api/v2/oauth2/revoke - Oauth2 classic routes
New WebSocket server
Don't be a Discord. Union websocket is Subscription-based, for the happiness of your network and CPU
See the docs for more details
Some other ideas & stuff to do