First pass of removing Slowcord mentions

This commit is contained in:
Madeline
2022-12-17 17:14:49 +11:00
parent be818cadd5
commit 118a30ca1e
21 changed files with 168 additions and 515 deletions
+10
View File
@@ -1,3 +1,13 @@
/*
Changelogs are baked inside the discord.com web client.
To change them, we simply need to update the changelog in a specific file of the client.
For v134842, thats 9c4b2d313c6e1c864e89.js, but it'll be different for every version.
To find which file the changelog is stored in your client, simply grep for the changelog text given by the client,
and update the `CHANGELOG_SCRIPT` variable to use that instead.
This grabs the new changelog from `fosscord-server/assets/changelog.txt`
*/
const fetch = require("node-fetch");
const fs = require("fs/promises");
const path = require("path");
+31 -11
View File
@@ -1,3 +1,21 @@
/*
This file downloads a ( mostly ) complete discord.com web client for testing,
and performs some basic patching:
* Replaces all mentions of "Server" -> "Guild"
* Replaces "Discord" -> `INSTANCE_NAME` variable
* "Nitro" -> "Premium"
* Prevents `localStorage` deletion ( for `plugins`/`preload-plugins` )
* Adds `fast-identify` support ( TODO: add documentation )
This script can only download javascript client files.
It cannot download images, sounds, video, etc.
For that, a `cacheMisses` file in `fosscord-server/assets` is used.
After running the server for a while, uncached assets will be appended to that file
and downloaded after the next run of this script.
TODO: Make this configurable easily.
*/
const path = require("path");
const fetch = require("node-fetch");
const http = require('http');
@@ -13,7 +31,7 @@ const agent = (_parsedURL) => _parsedURL.protocol == 'http:' ? httpAgent : https
const CACHE_PATH = path.join(__dirname, "..", "assets", "cache");
const BASE_URL = "https://discord.com";
const INSTANCE_NAME = "Slowcord";
const INSTANCE_NAME = "Fosscord";
// Manual for now
const INDEX_SCRIPTS = [
@@ -95,15 +113,15 @@ const doPatch = (content) => {
);
// app download links
content = content.replaceAll(
"https://play.google.com/store/apps/details?id=com.discord",
"https://slowcord.understars.dev/api/download?platform=android",
);
// content = content.replaceAll(
// "https://play.google.com/store/apps/details?id=com.discord",
// "https://slowcord.understars.dev/api/download?platform=android",
// );
content = content.replaceAll(
"https://itunes.apple.com/app/discord/id985746746",
"https://slowcord.understars.dev/api/download?platform=ios"
);
// content = content.replaceAll(
// "https://itunes.apple.com/app/discord/id985746746",
// "https://slowcord.understars.dev/api/download?platform=ios"
// );
// TODO change public test build link
// content = content.replaceAll(
@@ -111,9 +129,11 @@ const doPatch = (content) => {
// ""
// )
content = content.replaceAll("status.discord.com", "status.understars.dev");
content = content.replaceAll("discordstatus.com", "status.understars.dev");
// TODO: Easy config for this
// content = content.replaceAll("status.discord.com", "status.understars.dev");
// content = content.replaceAll("discordstatus.com", "status.understars.dev");
// Stop client from deleting `localStorage` global. Makes `plugins` and `preload-plugins` less annoying.
content = content.replaceAll(
"delete window.localStorage",
"console.log('Prevented deletion of localStorage')"
+4
View File
@@ -1,3 +1,7 @@
/*
Calculates a discord.com-like rights value.
*/
require("module-alias/register");
const { Rights } = require("..");
+4 -2
View File
@@ -1,5 +1,7 @@
// https://mermade.github.io/openapi-gui/#
// https://editor.swagger.io/
/*
Regenerates the `fosscord-server/assets/schemas.json` file, used for API/Gateway input validation.
*/
const path = require("path");
const fs = require("fs");
const TJS = require("typescript-json-schema");