Skip to content

Commit d09bc4d

Browse files
Merge branch 'master' into patch-4
2 parents 2d81dcd + 41cd8d6 commit d09bc4d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+897
-562
lines changed

.github/workflows/build.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
name: Build to GitHub Pages
22
on:
3+
workflow_dispatch:
34
push:
45
branches:
56
- master
@@ -12,7 +13,8 @@ jobs:
1213
- uses: actions/setup-python@v2
1314
with:
1415
python-version: 3.x
15-
- run: python3 -m pip install mkdocs-material mkdocs-swagger-ui-tag mkdocs-section-index mkdocs-macros-plugin
16+
- run: curl https://raw.githubusercontent.com/spacebarchat/spacebarchat/master/CODE_OF_CONDUCT.md -o docs/contributing/conduct.md
17+
- run: python3 -m pip install -r requirements.txt
1618
- run: mkdocs build
1719
- run: echo docs.spacebar.chat >> site/CNAME
1820
- name: Deploy 🚀

.vscode/settings.json

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
11
{
2-
"cSpell.words": [
3-
"landingpage",
4-
"Middlewares",
5-
"Roadmap",
6-
"screenshare"
7-
]
2+
"cSpell.words": ["landingpage", "Middlewares", "Roadmap", "screenshare"]
83
}

README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Spacebar Docs
22

3-
[![Build to GitHub Pages](https://github.com/spacebarchat/docs/actions/workflows/build.yml/badge.svg)](https://github.com/spacebarchat/docs/actions/workflows/build.yml) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
3+
[![Build to GitHub Pages](https://github.com/spacebarchat/docs/actions/workflows/build.yml/badge.svg)](https://github.com/spacebarchat/docs/actions/workflows/build.yml)
4+
[![Netlify Status](https://api.netlify.com/api/v1/badges/86622c9d-4952-4da5-9825-cc016e4a5e5f/deploy-status)](https://app.netlify.com/sites/spacebar-chat/deploys)
5+
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
46

57
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/spacebarchat/docs)
68

@@ -16,7 +18,7 @@
1618
3. Install dependencies.
1719

1820
```bash
19-
python3 -m pip install mkdocs-material mkdocs-swagger-ui-tag mkdocs-section-index mkdocs-macros-plugin
21+
python3 -m pip install -r requirements.txt
2022
```
2123

2224
4. Edit documents(s).

docs/assets/extra.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@
2323
display: grid;
2424
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
2525
margin-bottom: 15px;
26-
}
26+
}

docs/assets/js/missingroutes.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,16 @@ document
1616

1717
(async () => {
1818
const res = await fetch(MISSING_ROUTES_LIST);
19-
const missingRoutes = await res.json();
19+
const json = await res.json();
20+
const missingRoutes = json.routes;
21+
22+
document.getElementById("counter").textContent =
23+
`We implement ${json.discord - json.missing}/${
24+
json.discord
25+
} endpoints from Discord.com ` +
26+
`as well as ${
27+
json.spacebar + json.missing - json.discord
28+
} additional endpoints.`;
2029

2130
for (let route of missingRoutes) {
2231
const elem = document.createElement("li");

docs/assets/overrides/routes.html

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<!doctype html>
2+
<html>
3+
4+
<head>
5+
<meta charset="utf-8">
6+
<script type="module" src="https://unpkg.com/rapidoc/dist/rapidoc-min.js"></script>
7+
</head>
8+
9+
<body>
10+
<rapi-doc
11+
spec-url = "https://raw.githubusercontent.com/spacebarchat/server/master/assets/openapi.json"
12+
theme="dark"
13+
sort-endpoints-by="none"
14+
header-color="#4051b5"
15+
primary-color="#4051b5"
16+
render-style="focused"
17+
schema-expand-level=1
18+
schema-style="table"
19+
default-schema-tab="schema"
20+
show-components="true"
21+
heading-text="Spacebar HTTP API Documentation"
22+
show-curl-before-try="true"
23+
allow-spec-url-load="false"
24+
allow-spec-file-load="false"
25+
>
26+
<a slot="logo" href="https://docs.spacebar.chat" style="margin-left: 20px; width: 30px; height: 30px;">
27+
<img style="width: 30px; height: 30px;" src="https://docs.spacebar.chat/assets/logo.svg" />
28+
</a>
29+
</body>
30+
31+
</html>

docs/assets/swagger.css

-3
This file was deleted.

docs/contributing/conduct.md

-51
This file was deleted.

docs/contributing/index.md

+13-13
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,32 @@
44

55
## Style and a note on etiquette
66

7-
- We use [prettier](https://www.npmjs.com/package/prettier) for code formatting. We have a `.prettierrc` file in {{ project.name.lower() }}-server's root
7+
- We use [prettier](https://www.npmjs.com/package/prettier) for code formatting. We have a `.prettierrc` file in {{ project.name.lower() }}-server's root
88
and use a git precommit hook to autorun it.
9-
- Try to stay consistent with the rest of the project
10-
- 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,
9+
- Try to stay consistent with the rest of the project
10+
- 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,
1111
unless absolutely required due to the nature of change.
12-
- Leave comments in your code about why something is done when appropriate, not just what it is doing.
13-
- 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),
12+
- Leave comments in your code about why something is done when appropriate, not just what it is doing.
13+
- 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),
1414
so that we can work more effectively and minimise conflicting change attempts.
1515
Additionally, please do not try to snipe features that others are working on.
1616

1717
## Structure
1818

19-
{{ project.name }} is written in Typescript and is comprised of 4 main parts:
19+
{{ project.name }} is written in TypeScript and is comprised of 4 main parts:
2020

21-
- REST HTTP API server
22-
- Websocket Gateway server for realtime communication with clients
23-
- HTTP CDN server for storing user file content.
24-
- `utils` module to separate our database models, schemas, and other things from the above 3 components.
21+
- REST HTTP API server
22+
- Websocket Gateway server for realtime communication with clients
23+
- HTTP CDN server for storing user file content.
24+
- `utils` module to separate our database models, schemas, and other things from the above 3 components.
2525

2626
## Implementing endpoints, opcodes, etc
2727

2828
Generally, the approach is to just see what the Discord.com client sends and receives from Discord.com (through your browsers devtools, for example)
2929
and guessing about any functionality server-side, if it's undocumented.
3030

3131
For a lot of things it's pretty simple to guess, `GET /api/users/@me` returns private details about your user for example.
32-
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).
32+
This route is also detailed in [Discords own documentation](https://discord.com/developers/docs/intro), [here specifically](https://discord.com/developers/docs/resources/user#get-current-user).
3333

3434
Discord generally does not document anything that is not related to application/bot development, though.
3535
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.
@@ -40,5 +40,5 @@ Easy fix though, just edit the `DeveloperOptionsStore` localStorage key so that
4040

4141
!!! warning
4242

43-
Make sure you rerun `npm run build` every time you edit source code. Additionally, make sure you run `npm run generate:schema` whenever you change a
44-
schema. If you want to do both, there's a shortcut: `npm run setup`.
43+
Make sure you rerun `npm run build` every time you edit source code, or just use `npm run watch` to make TypeScript automatically recompile on code changes.
44+
Wenn making changes to schemas or HTTP routes, run `npm run generate:schemas` and `npm run generate:openapi` to update the schemas used for validating incoming requests and generating the API documentation.

docs/contributing/instances.md

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# For Instance Owners
2+
3+
The below are the rules for instance owners who look to be featured in our [community instances](https://github.com/spacebarchat/spacebarchat/tree/master/instances) list.
4+
If you do not meet these criteria, your instance will simply not be featured on our website.
5+
6+
Your instance:
7+
8+
1. Rules must be in line with our [Code of Conduct](conduct.md).
9+
2. Must not contain any Discord Inc. branding, such as including "cord" in the name or the Discord logo in promotional material.
10+
3. Must not host the Discord Inc. client in any capacity.
11+
4. Must be moderated for _at least_ publically accessible guilds. This includes guilds accessible from Discovery or a 'guild directory' channel in an auto join guild.
12+
5. Must have at least regular uptime, meaning it is available at a consistent time of day.
13+
6. Must have a valid and monitored [`general_correspondenceEmail` config](/setup/server/configuration) set.
14+
7. Must not have default [rights](/setup/server/security/rights) that include operator or other administrative rights.
15+
8. Use an [image proxy](/setup/server/configuration/imageProxy), e.g. Imagor, as no image proxy allows attackers to learn user IP addresses.
16+
9. Have a valid SSL/TLS certificate for all endpoints.
17+
18+
We recommend (not required) that you:
19+
20+
- Enable [Email verification](/setup/server/email), for anti-spam purposes.
21+
- Enable [Captcha](/setup/server/security/captcha), for anti-spam purposes.
22+
- Run your instance under [SystemD](/setup/server/systemd) or a similar system in your distro, for automatic restarting.
23+
- Provide some mechanism for users to report content. This may be as simple as more openly advertising your correspondence email (i.e. outside `GET /api/policies/instance` or `/api/ping`).
24+
- Provide some mechanism for instance status, such as [Grafana](https://grafana.com/).
25+
- Host a [`/.well-known/spacebar`](/setup/server/wellknown) file on the domain you wish users associate with your instance, e.g. `spacebar.chat`.
26+
If doing so, use this domain as the `url` field in your community instances PR.

docs/contributing/server/migrations.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
## What you need to know
44

5-
- SQL
6-
- Preferably the various syntax of SQL used by MariaDB/MySQL and Postgres.
5+
- SQL
6+
- Preferably the various syntax of SQL used by MariaDB/MySQL and Postgres.
77
Although if you only write the migration for one, making a PR so others can is good enough.
88

99
## Generating Migrations
@@ -20,6 +20,7 @@ To generate a database migration in {{ project.name.lower() }}-server:
2020
2121
where `:dbms:` is the db you use, and `:migrationName:` is whatever you wish to call it.
2222
The migration must be named a valid Javascript class name.
23+
2324
3. The generated file is what TypeORM will do if you were to run `npm run sync:db`.
2425
Obviously, this is not always what you want. Edit it to preserve as much of the original data as possible.
2526
+13-12
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
# Missing Routes
22

3-
Below is a list of routes available on Discord.com {{ project.name }}-server does not currently implement.
3+
Below is a list of routes available on Discord.com that the {{ project.name }} server does not currently implement.
44

5-
It does not account for different HTTP methods (GET, POST, etc). A single method implemented by {{ project.name }} will remove it from this list,
5+
It does not account for different HTTP methods (GET, POST, etc). A single method implemented will remove it from this list,
66
so be sure to double check in the {{ project.name }} [source code]({{ repositories.base_url }}/{{ repositories.server }}/tree/master/src/api/routes).
77

8-
It is generated daily by [{{ repositories.missing_routes }}]({{ repositories.base_url }}/{{ repositories.missing_routes }}/),
8+
It is generated automatically by [{{ repositories.missing_routes }}]({{ repositories.base_url }}/{{ repositories.missing_routes }}/),
99
by scraping the latest Discord.com client.
1010

1111
<div>
12-
<div class="fc-search">
13-
<input
14-
id="missing-routes-search"
15-
class="md-input md-input--stretch"
16-
placeholder="Search missing routes"
17-
/>
18-
</div>
19-
<ul id="missing-routes-list">
20-
</ul>
12+
<div class="fc-search">
13+
<input
14+
id="missing-routes-search"
15+
class="md-input md-input--stretch"
16+
placeholder="Search missing routes"
17+
/>
18+
</div>
19+
<p id="counter"></p>
20+
<ul id="missing-routes-list">
21+
</ul>
2122
</div>
2223

2324
<script src="/assets/js/missingroutes.js"></script>

docs/faq.md

+24
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,29 @@
11
# Frequently Asked Questions
22

3+
??? info "Is {{ project.name }} still in development? Production Ready?"
4+
5+
Yes, {{ project.name }} is still in development. Our unpaid team of volunteers is very small though, and so progress is very dependant on our motivation
6+
and outside life.
7+
8+
The [{{ project.name }} server]({{ repositories.base_url }}/{{ repositories.server }}) program has been in development since at least 28/11/2020,
9+
and has most core features implemented. API compatibility is reasonable although not quite perfect and so some third party clients may not function,
10+
although the official Discord.com client which we test against functions correctly for the most part.
11+
12+
The big Discord.com features currently left unimplemented or with partial implementations are:
13+
14+
* Voice/Video support
15+
* Voice activities
16+
* OAuth2 scopes and other applications (Bot applications work by are left unscoped)
17+
* Message threads
18+
* Pomelo (new username system without discriminators)
19+
* Auto moderation
20+
21+
For a more complete overview of what is left unimplemented, please refer to [the missing routes viewer](./contributing/server/missingroute.md)
22+
23+
The [{{ project.name }} client]({{ repositories.base_url }}/{{ repositories.client }}) however is very premature, starting development around 1/03/2023.
24+
It is not ready production use or as your daily driver. It lacks many core features and is not recommended to be used.
25+
Please setup a third party client, or help contribute to our codebase! Any and all help is appreciated.
26+
327
??? info "How do you use the Client?"
428

529
As described in [Clients](/setup/clients), the official client is not ready yet. You are free to use

docs/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ to multiple {{ project.name }}-compatible instances with rich theming and plugin
3030
## Support
3131

3232
For any kind of support regarding {{ project.name }}, feel free to ask questions in our [discord.com guild](https://discord.gg/Ms5Ev7S6bF)
33-
or our [official {{ project.name }} instance](https://staging.{{ project.domain }}).
33+
or our [official {{ project.name }} instance](https://api.old.server.{{ project.domain }}).
3434

3535
For bug reporting and feature requests please create an [issue]({{ repositories.base_url }}/{{ repositories.server }}/issues/new/choose) on Github.

docs/routes.md

+4-10
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
# API Routes
2-
3-
<style>
4-
#api-routes, .md-sidebar--secondary {
5-
display: none !important;
6-
}
7-
</style>
8-
9-
<swagger-ui src="https://raw.githubusercontent.com/{{ repositories.server }}/master/assets/openapi.json"/>
10-
<!-- <swagger-ui src="/assets/openapi.json"/> -->
1+
---
2+
title: HTTP API Docs
3+
template: routes.html
4+
---

0 commit comments

Comments
 (0)