1
0
mirror of https://github.com/spacebarchat/docs.git synced 2024-11-22 10:12:31 +01:00

test client, client plugins (vencord), embeds (twitter), and rabbitmq docs

This commit is contained in:
Madeline 2022-12-29 17:28:30 +11:00
parent 47141ea407
commit be1968e576
No known key found for this signature in database
GPG Key ID: 1958E017C36F2E47
12 changed files with 115 additions and 61 deletions

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

View File

@ -1,3 +1,3 @@
## [Server](server)
## [Bots](bots)
## [Bots](bots)

View File

@ -0,0 +1,20 @@
# Test Client
!!! warning "The test client included with fosscord-server is deprecated and will be removed in favour of [Dicord-Client-Proxy](http://github.com/fosscord/Discord-Client-Proxy) in the future"
The test client is a proxy to the Discord.com client used for development purposes.
You can enable the test client by setting the `client_useTestClient` [config](../configuration/index.md) value.
By editing the `GLOBAL_ENV` variable used by the client, we can trick it into sending requests to the API/Gateway/CDN/etc to us,
instead of Discord.com.
## Updating
To update the client version served, edit the 4 `<script>` tags in the `<body>` of `assets/client_test/index.html`,
with ones used by a client version you wish to use.
To get the latest client scripts, simply download the HTML served by [https://discord.com/app](https://discord.com/app) (through `wget https://discord.com/app`, for example)
Do not replace the `assets/client_test/index.html` file with a fresh one from Discord.com, as there are additional changes made to the file by the Fosscord team.
## [Theming](theming.md)
## [Plugins](plugins.md)

View File

@ -0,0 +1,7 @@
There is no plugin API available to use with the test client currently.
You cannot install BetterDiscord, Powercord/Replugged, or other client mod plugins without heavy modification at this time.
However, you _can_ install [Vencord](https://github.com/Vendicated/Vencord)
quite easily with only slight modifications to the [user script](https://github.com/Vendicated/Vencord#installing-on-browser).
Simply find and replace all mentions of `GM_xmlhttpRequest` with `new XMLHttpRequest`, and `unsafeWindow` with `window`.
Throw the edited file into the `assets/preload-plugins` directory, restart the server, and you now have Vencord installed instance-wide!

View File

@ -0,0 +1,11 @@
# Embeds
Embeds in Fosscord are external content that is displayed within your messages when linked to.
Fosscord tries its best to fetch content from these external sites,
but sometimes we require an API key or other authentication with the site to display their content (or nicer looking embeds).
## Twitter
Go to the [Twitter developer portal](https://developer.twitter.com/) and sign up for developer access.
Create an application for use with the Twitter API (We don't need to post messages to Twitter itself).
Once you have your API key, set the `external_twitter` [config](index.md) value to your API key, wrapped in quotes.

View File

@ -0,0 +1,14 @@
# RabbitMQ
[RabbitMQ](https://www.rabbitmq.com/) is an open source message broker.
Fosscord can be configured to use it for communication between the API server and Gateway server.
RabbitMQ is required to be set up when you run the API and Gateway servers separately (outside of bundle).
Without it, the Gateway server won't know when you send new events for things such as message creation.
In the message create case, you will be able to send messages, but will have to reload the client to view new messages from others.
After you've downloaded and installed RabbitMQ,
edit Fosscord's [config](index.md), set `rabbitmq_host` to `"amqp://guest:guest@host:5672"`
The `guest` RabbitMQ account can only be accessed via localhost, by default.
If you want to run Fosscord over multiple systems,
you'll need to set up [access control](https://www.rabbitmq.com/access-control.html) in RabbitMQ.

View File

@ -50,4 +50,4 @@ Well, now you can configure Fosscord to your liking!
- [Skip to server configuration](configuration)
- [Skip to reverse proxy / SSL](reverseProxy.md)
- [Skip to security](security.md)
- [Skip to security](security)

View File

@ -31,7 +31,7 @@ Downloads a (mostly) complete discord.com web client and runs some basic patches
- Replaces "Discord" -> "Fosscord"
- "Nitro" -> "Premium"
- Replaces the Discord logo home button with a Fosscord logo
- Prevents `localStorage` deletion (for [plugins](plugins.md))
- Prevents `localStorage` deletion (for [plugins](Test%20Client/plugins.md))
- Adds `fast-identify` support
The script can only search for all javascript client files,

View File

@ -104,4 +104,4 @@ is generated through the `npm run generate:rights` script.
</div>
</div>
<script src="/assets/js/rightsCalculator.js"></script>
<script src="/assets/js/rightsCalculator.js"></script>

View File

@ -1,9 +1,9 @@
If you had followed the [setup guide](index.md), you'll have installed Fosscord using [Git](https://git-scm.com/).
Thus, you can update the server by running `git pull`.
Thus, you can update the server by running `git pull`.
If you had made any changes locally, you may run into merge conflicts,
where the Fosscord team has made changes to the same code you changed. If it's not important to you, you can simply run `git reset --hard HEAD`
*which will delete all your changes*. If you want to keep them, you'll have to go through each conflict and resolve them.
_which will delete all your changes_. If you want to keep them, you'll have to go through each conflict and resolve them.
After downloading the new version, go through the setup guide as normal again:
@ -18,4 +18,4 @@ npm run setup
# Start the server
npm run start
```
```

View File

@ -33,4 +33,6 @@ markdown_extensions:
- pymdownx.highlight
- pymdownx.inlinehilite
- pymdownx.superfences
- pymdownx.tabbed:
alternate_style: true
extra_css: [assets/extra.css]