1
0
mirror of https://github.com/spacebarchat/docs.git synced 2024-11-21 17:52:31 +01:00
This commit is contained in:
Madeline 2023-01-02 20:13:12 +11:00
parent 6536f2e1fe
commit 779dc55dd8
No known key found for this signature in database
GPG Key ID: 1958E017C36F2E47
8 changed files with 148 additions and 136 deletions

View File

@ -1,3 +1,11 @@
{ {
"tabWidth": 4 "trailingComma": "all",
"tabWidth": 4,
"semi": true,
"arrowParens": "always",
"bracketSameLine": false,
"bracketSpacing": true,
"quoteProps": "as-needed",
"useTabs": true,
"singleQuote": false
} }

14
.vscode/settings.json vendored
View File

@ -1,9 +1,9 @@
{ {
"cSpell.words": [ "cSpell.words": [
"Fosscord", "Fosscord",
"landingpage", "landingpage",
"Middlewares", "Middlewares",
"Roadmap", "Roadmap",
"screenshare" "screenshare"
] ]
} }

View File

@ -1,7 +1,7 @@
.md-typeset__table { .md-typeset__table {
min-width: 100%; min-width: 100%;
} }
.md-typeset table:not([class]) { .md-typeset table:not([class]) {
display: table; display: table;
} }

View File

@ -1,65 +1,65 @@
(() => { (() => {
const NUM_COLUMNS = 3; const NUM_COLUMNS = 3;
// Grab it from the above markdown table and parse it. Simply don't have multiple tables in the page lol // Grab it from the above markdown table and parse it. Simply don't have multiple tables in the page lol
const rights = const rights =
// grab the table data elements // grab the table data elements
[...document.querySelectorAll("td")] [...document.querySelectorAll("td")]
.map((x) => x.innerText) // get their content .map((x) => x.innerText) // get their content
.map((x, i) => .map((x, i) =>
x.indexOf("<<") == 2 // if this column is the `value` column x.indexOf("<<") == 2 // if this column is the `value` column
? x.split(" ").reverse()[0] // get the value we shift by ? x.split(" ").reverse()[0] // get the value we shift by
: x : x,
); // otherwise dont do anything ); // otherwise dont do anything
const mount = document.getElementById("rights-container"); const mount = document.getElementById("rights-container");
const outputMount = document.getElementById("rights-output"); const outputMount = document.getElementById("rights-output");
var calculated = 0n; var calculated = 0n;
for (var i = 0; i < rights.length; i += NUM_COLUMNS) { for (var i = 0; i < rights.length; i += NUM_COLUMNS) {
const name = rights[i]; const name = rights[i];
const shift = rights[i + 1]; const shift = rights[i + 1];
const desc = rights[i + 2]; const desc = rights[i + 2];
const div = document.createElement("div"); const div = document.createElement("div");
const input = document.createElement("input"); const input = document.createElement("input");
input.setAttribute("type", "checkbox"); input.setAttribute("type", "checkbox");
input.setAttribute("id", shift); input.setAttribute("id", shift);
const label = document.createElement("label"); const label = document.createElement("label");
label.setAttribute("for", label.id); label.setAttribute("for", label.id);
label.innerText = name.toUpperCase(); label.innerText = name.toUpperCase();
div.appendChild(input); div.appendChild(input);
div.appendChild(label); div.appendChild(label);
mount.append(div); mount.append(div);
input.addEventListener("click", (event) => { input.addEventListener("click", (event) => {
const value = 1n << BigInt(event.target.getAttribute("id")); const value = 1n << BigInt(event.target.getAttribute("id"));
// bit messy, oh well // bit messy, oh well
if (value == 1n) { if (value == 1n) {
if (event.target.checked) { if (event.target.checked) {
for (var elem of mount.children) { for (var elem of mount.children) {
elem.children[0].setAttribute("disabled", true); elem.children[0].setAttribute("disabled", true);
} }
event.target.removeAttribute("disabled"); event.target.removeAttribute("disabled");
outputMount.innerText = "1"; outputMount.innerText = "1";
return; return;
} else { } else {
for (var elem of mount.children) { for (var elem of mount.children) {
elem.children[0].removeAttribute("disabled"); elem.children[0].removeAttribute("disabled");
} }
outputMount.innerText = calculated; outputMount.innerText = calculated;
return; return;
} }
} }
calculated = event.target.checked calculated = event.target.checked
? calculated + value ? calculated + value
: calculated - value; : calculated - value;
outputMount.innerText = calculated; outputMount.innerText = calculated;
}); });
} }
})(); })();

View File

@ -3,10 +3,11 @@
!!! info "[Have you read the Code of Conduct?](conduct.md)" !!! info "[Have you read the Code of Conduct?](conduct.md)"
## Notable Technologies ## Notable Technologies
* Typescript
* [Typeorm](https://www.npmjs.com/package/typeorm) - Typescript
* [WS](https://www.npmjs.com/package/ws) - [Typeorm](https://www.npmjs.com/package/typeorm)
* [Express](https://www.npmjs.com/package/express) - [WS](https://www.npmjs.com/package/ws)
- [Express](https://www.npmjs.com/package/express)
## Structure ## Structure
@ -27,4 +28,4 @@ The API is a HTTP REST server which does the bulk of the database reads/writes.
## Documentation ## Documentation
Unfortunately writing documentation is quite annoying. There's tons of comments in the codebase tho, so don't worry :) Unfortunately writing documentation is quite annoying. There's tons of comments in the codebase tho, so don't worry :)

View File

@ -2,86 +2,86 @@
??? info "Voice/Video when???" ??? info "Voice/Video when???"
Currently there is no voice or video support in any Fosscord instance. Currently there is no voice or video support in any Fosscord instance.
This is a very difficult feature to get working, especially given that This is a very difficult feature to get working, especially given that
we must implement it the exact same way as Discord.com for client compatibility. we must implement it the exact same way as Discord.com for client compatibility.
[We would be incredibly thankful for any assistance.](/contributing) [We would be incredibly thankful for any assistance.](/contributing)
??? info "Free Nitro???" ??? info "Free Nitro???"
Please do not use Discord trademarks to refer to anything regarding Fosscord. Please do not use Discord trademarks to refer to anything regarding Fosscord.
As an instance owner, you can grant yourself or others *premium* features which may be used to determine your abilities As an instance owner, you can grant yourself or others *premium* features which may be used to determine your abilities
*client-side*. However, Fosscord-server currently does not have any distinction between premium and free users. *client-side*. However, Fosscord-server currently does not have any distinction between premium and free users.
All users can access all features, given they have the [right](security/rights.md) to do so. All users can access all features, given they have the [right](security/rights.md) to do so.
You cannot give yourself premium features on Discord.com using a Fosscord instance. You cannot give yourself premium features on Discord.com using a Fosscord instance.
??? info "Can I log in with my Discord account?" ??? info "Can I log in with my Discord account?"
No. Fosscord and Discord are entirely separate services, with their own separate databases No. Fosscord and Discord are entirely separate services, with their own separate databases
and authentication. Fosscord cannot access any private data from Discord.com. and authentication. Fosscord cannot access any private data from Discord.com.
As always, you should not provide login credentials for Discord.com, or any other service, As always, you should not provide login credentials for Discord.com, or any other service,
to others. to others.
??? info "Does Fosscord use the same servers as Discord?" ??? info "Does Fosscord use the same servers as Discord?"
No. Discord servers, as in the bare-metal running the service, are completely inaccessible No. Discord servers, as in the bare-metal running the service, are completely inaccessible
to people, outside of course the Discord.com service provided. It is impossible for us to use their to people, outside of course the Discord.com service provided. It is impossible for us to use their
infrastructure. Fosscord is hosted entirely by you, the instance owner (or whoever is the owner of your instance). infrastructure. Fosscord is hosted entirely by you, the instance owner (or whoever is the owner of your instance).
If you mean Discord 'server' as in a *guild*, also no. Fosscord is not a proxy for If you mean Discord 'server' as in a *guild*, also no. Fosscord is not a proxy for
Discord guilds. Fosscord does not create Discord.com accounts, or ask for your own, at any time Discord guilds. Fosscord does not create Discord.com accounts, or ask for your own, at any time
(outside of a Discord.com account connection for your Fosscord user, which is still not us asking for your credentials). (outside of a Discord.com account connection for your Fosscord user, which is still not us asking for your credentials).
If Fosscord was to try this, Discord's automated spam filters would surely block your instance. If Fosscord was to try this, Discord's automated spam filters would surely block your instance.
Lastly, you can simply view [our codebase](https://github.com/fosscord/fosscord-server). Lastly, you can simply view [our codebase](https://github.com/fosscord/fosscord-server).
A simple proxy would not need to be this complex or large. A simple proxy would not need to be this complex or large.
We implement the entire Discord.com API, Gateway, among others. We implement the entire Discord.com API, Gateway, among others.
None of this would be necessary if we were simply abusing Discord.com. None of this would be necessary if we were simply abusing Discord.com.
??? info "Do you use Discord.com code?" ??? info "Do you use Discord.com code?"
Absolutely not. If a potential contributor makes any indication of being a Discord employee, Absolutely not. If a potential contributor makes any indication of being a Discord employee,
or to have access to leaked Discord.com code, we take measures in line with our [Code of Conduct](/contributing/conduct.md) or to have access to leaked Discord.com code, we take measures in line with our [Code of Conduct](/contributing/conduct.md)
to ensure the Fosscord codebase is free of any proprietary code. We want absolutely nothing to do with it. to ensure the Fosscord codebase is free of any proprietary code. We want absolutely nothing to do with it.
??? info "What about the test client? That's just the Discord.com one!" ??? info "What about the test client? That's just the Discord.com one!"
Yes, this is true. However, this is purely for testing and development purposes. Yes, this is true. However, this is purely for testing and development purposes.
Fosscord is first and foremost a *backend* server implementation, and we simply use Discord.com's client Fosscord is first and foremost a *backend* server implementation, and we simply use Discord.com's client
to achieve our goals. Efforts are being made to move away from this with our own client, but as you may have guessed, to achieve our goals. Efforts are being made to move away from this with our own client, but as you may have guessed,
building a Discord-compatible client is difficult. building a Discord-compatible client is difficult.
You can read more about the test client [here](Test%20Client/index.md) You can read more about the test client [here](Test%20Client/index.md)
??? info "Is this illegal?" ??? info "Is this illegal?"
The person writing this does not believe it to be illegal, no. The person writing this does not believe it to be illegal, no.
The only aspect of Fosscord that is not entirely written by us is the test client which we simply proxy from Discord.com, The only aspect of Fosscord that is not entirely written by us is the test client which we simply proxy from Discord.com,
and we take measures to show that the client is purely for development and research purposes. and we take measures to show that the client is purely for development and research purposes.
??? info "Why are you doing this, anyway?" ??? info "Why are you doing this, anyway?"
Personally, it's because it's fun. But if you ask 'Officially': Personally, it's because it's fun. But if you ask 'Officially':
1. We love free, open source software. 1. We love free, open source software.
2. There are many existing bots, applications, users, features, and ideas surrounding Discord.com. 2. There are many existing bots, applications, users, features, and ideas surrounding Discord.com.
3. Fosscord allows these users and developers to maintain a familiar ecosystem with minimal friction. 3. Fosscord allows these users and developers to maintain a familiar ecosystem with minimal friction.
4. Reimplementing allows us to extend the Discord protocol in ways Discord.com may not deem feasible, economical, whateverical. 4. Reimplementing allows us to extend the Discord protocol in ways Discord.com may not deem feasible, economical, whateverical.
5. This includes privacy features, such as end to end encryption for example. 5. This includes privacy features, such as end to end encryption for example.
6. The reverse engineering effort by our team may be useful to outside developers looking to understand how similar services work. 6. The reverse engineering effort by our team may be useful to outside developers looking to understand how similar services work.
7. The Discord protocol despite it's API complexity is quite simple and linear, which makes this project more feasible. 7. The Discord protocol despite it's API complexity is quite simple and linear, which makes this project more feasible.
??? info "Editing the database is annoying, is there a graphical interface for this?" ??? info "Editing the database is annoying, is there a graphical interface for this?"
Currently no, there is no graphical interface for managing your Fosscord instance. Currently no, there is no graphical interface for managing your Fosscord instance.
An admin dashboard is planned, but we currently have higher priorities right now. An admin dashboard is planned, but we currently have higher priorities right now.
??? info "When will this feature be available?" ??? info "When will this feature be available?"
We do not provide ETAs. Users tend to take them as deadlines, and for a small team of <5 maintainers We do not provide ETAs. Users tend to take them as deadlines, and for a small team of <5 maintainers
who do not get payment for their work, this is unreasonable. who do not get payment for their work, this is unreasonable.
??? info "It's pretty funny how you have a Discord.com guild for support." ??? info "It's pretty funny how you have a Discord.com guild for support."
We know. Also that's not a question. We know. Also that's not a question.

View File

@ -18,12 +18,12 @@ the endpoints used.
const { Client } = require("discord.js"); const { Client } = require("discord.js");
const client = new Client({ const client = new Client({
http: { http: {
version: 9, version: 9,
api: "https://api.fosscord.com", api: "https://api.fosscord.com",
cdn: "https://cdn.fosscord.com", cdn: "https://cdn.fosscord.com",
invite: "https://fosscord.com/invite", invite: "https://fosscord.com/invite",
}, },
}); });
client.login("your token here"); client.login("your token here");

View File

@ -3,30 +3,33 @@
There are 3 options, all of which require the Fosscord server have [erlpack](https://npmjs.com/package/@yukikaze-bot/erlpack) installed. There are 3 options, all of which require the Fosscord server have [erlpack](https://npmjs.com/package/@yukikaze-bot/erlpack) installed.
1. The simpler one is to set the `DISCORD_WEBAPP_ENDPOINT` environment variable on the machine running the client 1. The simpler one is to set the `DISCORD_WEBAPP_ENDPOINT` environment variable on the machine running the client
to the Fosscord web app URL. This assumes the Fosscord instance has the [test client](../server/Test%20Client/index.md) enabled. to the Fosscord web app URL. This assumes the Fosscord instance has the [test client](../server/Test%20Client/index.md) enabled.
1. You may edit your desktop client's `settings.json` file at 1. You may edit your desktop client's `settings.json` file at
`%appdata%/discord/settings.json`, `%appdata%/discord/settings.json`, adding the following line
adding the following line
```json ```json
"WEBAPP_ENDPOINT" : "https://your_fosscord_instance_url" "WEBAPP_ENDPOINT" : "https://your_fosscord_instance_url"
``` ```
such that it looks like this, as an example such that it looks like this, as an example
```json ```json
{ {
"IS_MAXIMIZED": true, "IS_MAXIMIZED": true,
"IS_MINIMIZED": false, "IS_MINIMIZED": false,
"WINDOW_BOUNDS": { "WINDOW_BOUNDS": {
"x": 335, "x": 335,
"y": 86, "y": 86,
"width": 940, "width": 940,
"height": 600 "height": 600
}, },
"BACKGROUND_COLOR": "#202225", "BACKGROUND_COLOR": "#202225",
"WEBAPP_ENDPOINT" : "https://your_fosscord_instance_url" "WEBAPP_ENDPOINT": "https://your_fosscord_instance_url"
} }
``` ```
This also assumes the Fosscord instance has enabled the test client. This also assumes the Fosscord instance has enabled the test client.
1. If an instance does not have the test client enabled, you can [host the proxy yourself](https://github.com/fosscord/Discord-Client-Proxy), 1. If an instance does not have the test client enabled, you can [host the proxy yourself](https://github.com/fosscord/Discord-Client-Proxy),
and simply set it to use your desired Fosscord instance. and simply set it to use your desired Fosscord instance.