1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-25 11:43:07 +01:00

Added scripts for changelogs and removed premium references

This commit is contained in:
Madeline 2022-10-27 14:46:20 +11:00
parent 5f0d16d4bf
commit 8443d1da2d
4 changed files with 61 additions and 1 deletions

13
assets/changelog.txt Normal file
View File

@ -0,0 +1,13 @@
---changelog---
date: "2022-10-27"
locale: "en-US"
revision: 1
---
Changelogs now work! {added marginTop}
======================
In the future, they'll be sent out like this, as well as in the default guild.
If you aren't in the default guild, you're missing out.
We talk mostly about Slowcord itself, and its the first place you'll find out about new features and bug fixes being worked on.
Be sure to join it, with
https://slowcord.understars.dev/invite/slowcord

View File

@ -0,0 +1,18 @@
/* hide premium references */
a[href="/store"],
div[aria-controls="slowcord-premium-tab"],
div[aria-controls="premium-guild-boost-tab"],
div[aria-controls="subscriptions-tab"],
div[aria-controls="library-inventory-tab"],
div[aria-controls="billing-tab"],
div[aria-label="User Settings"] div.header-2Kx1US:nth-child(8), /* billing settings header */
div[aria-label="User Settings"] div.separator-2wx7h6:nth-child(7), /* billing settings separator */
button[aria-label="Send a gift"],
div#guild-header-popout-premium-subscribe,
#guild-header-popout div.separator-1So4YB:nth-child(2),
div[aria-controls="guild_premium-tab"],
div#stickers-tab .upsellContainer-22N_CL,
div#stickers-tab .divider-wz_a_k,
div.separator-2wx7h6:nth-child(20) {
display: none !important;
}

View File

@ -9,7 +9,8 @@
"setup": "npm run build && npm run generate:schema",
"generate:rights": "node scripts/rights.js",
"generate:schema": "node scripts/schema.js",
"generate:client": "node scripts/client.js"
"generate:client": "node scripts/client.js",
"generate:changelog": "node scripts/changelog.js"
},
"main": "dist/bundle/index.js",
"types": "src/bundle/index.ts",

28
scripts/changelog.js Normal file
View File

@ -0,0 +1,28 @@
const fetch = require("node-fetch");
const fs = require("fs/promises");
const path = require("path");
const CACHE_PATH = path.join(__dirname, "..", "assets", "cache");
const CHANGELOG_PATH = path.join(__dirname, "..", "assets", "changelog.txt");
const BASE_URL = "https://discord.com";
const CHANGELOG_SCRIPT = "9c4b2d313c6e1c864e89.js";
(async () => {
const res = await fetch(`${BASE_URL}/assets/${CHANGELOG_SCRIPT}`);
const text = await res.text();
const newChangelogText = (await fs.readFile(CHANGELOG_PATH))
.toString()
.replaceAll("\r", "")
.replaceAll("\n", "\\n")
.replaceAll("\'", "\\'");
const index = text.indexOf("e.exports='---changelog---") + 11;
const endIndex = text.indexOf("'\n", index); // hmm
await fs.writeFile(
path.join(CACHE_PATH, CHANGELOG_SCRIPT),
text.substring(0, index) + newChangelogText + text.substring(endIndex)
);
})();