Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Equicord #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules
package-lock.json

cache

Expand All @@ -7,6 +8,7 @@ cache
/branches/mod/betterdiscord/betterdiscord.asar
/branches/mod/kernel/kernel.asar
/branches/mod/vencord/vencord-desktop
/branches/mod/equicord/equicord-desktop

*.crt
*.key
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Check the [shelter documentation](https://github.com/uwu/shelter/blob/main/READM
The [uwu.network instance](https://inject.shelter.uwu.network) of sheltupdate hosts the branches exactly as found in this repository:
- `shelter` - injects shelter
- `vencord` - injects Vencord
- `equicord` - injects Equicord
- `betterdiscord` - injects BetterDiscord
- `reactdevtools` - adds React Developer Tools to your client
- `spotify_embed_volume` - adds a volume slider to Spotify embeds
Expand Down Expand Up @@ -51,7 +52,7 @@ Said directories are found below:
Set `UPDATE_ENDPOINT` and `NEW_UPDATE_ENDPOINT` in `settings.json` as follows:

```json
"UPDATE_ENDPOINT": "https://<instance URL>/branch"
"UPDATE_ENDPOINT": "https://<instance URL>/branch",
"NEW_UPDATE_ENDPOINT": "https://<instance URL>/branch/"
```

Expand Down
25 changes: 25 additions & 0 deletions branches/mod/equicord/meta.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { rm } from "fs/promises";
import { createWriteStream, mkdirSync } from "fs";
import { join } from "path";
import { Writable } from "stream";

export const name = "Equicord";
export const description = "Injects Equicord (Vencord Fork); This is not an officially supported Equicord install method";

export async function setup(target, log) {
const releaseUrl = "https://github.com/Equicord/Equicord/releases/download/latest/";

mkdirSync(join(target, "equicord-desktop"), { recursive: true });

for (const f of ["equicordDesktopMain.js", "equicordDesktopPreload.js", "renderer.js", "renderer.css"]) {
log(`Downloading ${f}...`);

const p = join(target, "equicord-desktop", f);
await rm(p, { force: true });

const req = await fetch(releaseUrl + f);
await req.body.pipeTo(Writable.toWeb(createWriteStream(p)));
}

log("Done!");
}
1 change: 1 addition & 0 deletions branches/mod/equicord/patch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require("./equicord-desktop/equicordDesktopMain.js");
9 changes: 9 additions & 0 deletions branches/mod/equicord/preload.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const { readFileSync } = require("fs");
const { join } = require("path");
const { webFrame } = require("electron");

// run equicord's preload
require("./equicord-desktop/equicordDesktopPreload.js");

// inject equicord renderer
webFrame.top.executeJavaScript(readFileSync(join(__dirname, "equicord-desktop/renderer.js"), "utf8"));
1 change: 1 addition & 0 deletions branches/mod/shelter/patch.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ Module.prototype.require = function (path) {
});

electron.ipcMain.handle("SHELTER_BRANCH_SET", (_, b) => {
if (b.includes("equicord")) b = b.filter(x => x !== "vencord"); // remove vencord if equicord is selected; just here for safety reasons
if (b.length) {
settingsApi.set("UPDATE_ENDPOINT", `https://inject.shelter.uwu.network/${b.join("+")}`);
settingsApi.set("NEW_UPDATE_ENDPOINT", `https://inject.shelter.uwu.network/${b.join("+")}/`);
Expand Down
14 changes: 10 additions & 4 deletions branches/mod/shelter/selector-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,15 @@
const [uninstallCache, setUninstallCache] = createSignal();

const [vencordOtherwiseLoaded, setVencordOtherwiseLoaded] = createSignal(false);
const [equicordOtherwiseLoaded, setEquicordOtherwiseLoaded] = createSignal(false);
const [bdOtherwiseLoaded, setBdOtherwiseLoaded] = createSignal(false);

const updateCurrent = () => SheltupdateNative.getCurrentBranches().then(setCurrentBranches);
updateCurrent().then(() => {
if (window.Vencord && !currentBranches().includes("vencord")) setVencordOtherwiseLoaded(true);
if (window.Vencord) {
if (!currentBranches().includes("vencord")) setVencordOtherwiseLoaded(true);
if (!currentBranches().includes("equicord")) setEquicordOtherwiseLoaded(true);
}

if (window.BdApi && !currentBranches().includes("betterdiscord")) setBdOtherwiseLoaded(true);
});
Expand Down Expand Up @@ -74,9 +78,11 @@
? "You need shelter to have access to this menu. Try uninstalling sheltupdate."
: props.name === "vencord" && vencordOtherwiseLoaded()
? "Vencord is currently loaded by some other mechanism."
: props.name === "betterdiscord" && bdOtherwiseLoaded()
? "BetterDiscord is currently loaded by some other mechanism."
: undefined;
: props.name === "equicord" && equicordOtherwiseLoaded()
? "Equicord is currently loaded by some other mechanism, or Vencord is loaded."
: props.name === "betterdiscord" && bdOtherwiseLoaded()
? "BetterDiscord is currently loaded by some other mechanism."
: undefined;

return html`
<${SwitchItem}
Expand Down
2 changes: 1 addition & 1 deletion branches/ordering.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
["shelter", "vencord", "betterdiscord", "reactdevtools"]
["shelter", "vencord", "equicord", "betterdiscord", "reactdevtools"]