1
0
mirror of https://github.com/spacebarchat/docs.git synced 2024-11-26 04:02:32 +01:00

Update contributing

This commit is contained in:
Madeline 2023-01-08 16:06:12 +11:00
parent 4ec439d122
commit 135e55a18b
No known key found for this signature in database
GPG Key ID: 1958E017C36F2E47

View File

@ -2,12 +2,15 @@
!!! info "[Have you read the Code of Conduct?](conduct.md)" !!! info "[Have you read the Code of Conduct?](conduct.md)"
## Notable Technologies ## Style and a note on etiquette
- Typescript - We use [prettier](https://www.npmjs.com/package/prettier) for code formatting. We have a `.prettierrc` file in fosscord-server's root
- [Typeorm](https://www.npmjs.com/package/typeorm) and use a git precommit hook to autorun it.
- [WS](https://www.npmjs.com/package/ws) - Try to stay consistent with the rest of the project
- [Express](https://www.npmjs.com/package/express) - Try to keep each commit to a single feature or idea, with descriptions of what it is and why it is done. No "Large refactor" commits that touch every file.
- Leave comments in your code about why something is done when appropriate, not just what it is doing.
- If you're working on a feature, please announce that you're working on it (in the relevant GH issue or our Discord, preferably both), so that we can work more effectively.
Additionally, please do not try to snipe features that others are working on.
## Structure ## Structure
@ -18,14 +21,17 @@ Fosscord is written in Typescript and is comprised of 4 main parts:
- HTTP CDN server for storing user file content. - HTTP CDN server for storing user file content.
- `utils` module to separate our database models, schemas, and other things from the above 3 components. - `utils` module to separate our database models, schemas, and other things from the above 3 components.
### Gateway ## Implementing endpoints, opcodes, etc
The Gateway is a WebSocket server that is responsible for listening and emitting events to/from connected clients. Generally, the approach is to just see what the Discord.com client sends and receives from Discord.com (through your browsers devtools, for example)
and guessing about any functionality server-side, if it's undocumented.
### API For a lot of things it's pretty simple to guess, `GET /api/users/@me` returns private details about your user for example.
This route is also detailed in [Discords own documentation](https://discord.com/developers/), [here specifically](https://discord.com/developers/docs/resources/user#get-current-user).
The API is a HTTP REST server which does the bulk of the database reads/writes. Discords does not document anything that is not related to application/bot development, though.
As an example, `GET /api/updates?platform={}` which returns the `url`, `pub_date`, `name` and any `notes` about the latest client release for a platform.
## Documentation For the Gateway it's the same procedure, except now you can't use the network logger of your devtools
because the gateway returns responses encoded with [erlpack](https://github.com/discord/erlpack).
Unfortunately writing documentation is quite annoying. There's tons of comments in the codebase tho, so don't worry :) Easy fix though, just edit the `DeveloperOptionsStore` localStorage key so that `logGatewayEvents` is true, and reload the client.