summaryrefslogtreecommitdiff
path: root/includes/external/signal/index.js
diff options
context:
space:
mode:
authorRaindropsSys <raindrops@equestria.dev>2024-03-30 23:40:33 +0100
committerRaindropsSys <raindrops@equestria.dev>2024-03-30 23:40:33 +0100
commit6b796258d413f00e498ce7f80f73a9f6c061f29c (patch)
tree49e64a5dd4cde2acff7f0a93ed3f8e20e1cb2dc8 /includes/external/signal/index.js
parent5860551daa0f60103ad24e93da29f401a653f144 (diff)
downloadpluralconnect-6b796258d413f00e498ce7f80f73a9f6c061f29c.tar.gz
pluralconnect-6b796258d413f00e498ce7f80f73a9f6c061f29c.tar.bz2
pluralconnect-6b796258d413f00e498ce7f80f73a9f6c061f29c.zip
Updated 5 files, added 2 files, deleted 495 files and renamed 7 files (automated)
Diffstat (limited to 'includes/external/signal/index.js')
-rw-r--r--includes/external/signal/index.js62
1 files changed, 0 insertions, 62 deletions
diff --git a/includes/external/signal/index.js b/includes/external/signal/index.js
deleted file mode 100644
index bcbb2b8..0000000
--- a/includes/external/signal/index.js
+++ /dev/null
@@ -1,62 +0,0 @@
-const user = process.argv[2];
-const number = require('../../app.json')['signal'][user];
-const fs = require('fs');
-
-if (typeof number !== "string") throw new Error("Unable to find info");
-
-const axios = require("axios");
-const child_process = require("child_process");
-
-(async () => {
- console.log("Ready");
-
- let system = require('../../data/' + (user === "raindrops" ? "gdapd" : (user === "Moonglow" ? "hrbom" : "other")) + "/general.json");
- let fronters = require('../../data/' + (user === "raindrops" ? "gdapd" : (user === "Moonglow" ? "hrbom" : "other")) + "/fronters.json");
-
- console.log(system.name);
- console.log(fronters.members.length + " member(s) at front");
-
- let name = system.name;
- let avatar1 = system.avatar_url;
- let avatar2 = null;
-
- if (fronters.members.length === 1) {
- name = fronters.members[0].display_name ?? fronters.members[0].name;
- avatar1 = fronters.members[0].avatar_url ?? avatar1;
- } else if (fronters.members.length >= 2) {
- name = (fronters.members[0].display_name ?? fronters.members[0].name) + " and " + (fronters.members[1].display_name ?? fronters.members[1].name);
- avatar1 = fronters.members[0].avatar_url ?? avatar1;
- avatar2 = fronters.members[1].avatar_url ?? avatar2;
- }
-
- let pfp;
-
- if (avatar2) {
- let img1 = (await axios.get(avatar1, {responseType: "arraybuffer"})).data;
- let img2 = (await axios.get(avatar2, {responseType: "arraybuffer"})).data;
-
- fs.writeFileSync("/tmp/chm-" + user + "-1", img1);
- fs.writeFileSync("/tmp/chm-" + user + "-2", img2);
-
- child_process.execSync("convert /tmp/chm-" + user + "-1 -gravity center -resize 512x512 -crop 50%x100% /tmp/chm-" + user + "-1.webp");
- child_process.execSync("convert /tmp/chm-" + user + "-2 -gravity center -resize 512x512 -crop 50%x100% /tmp/chm-" + user + "-2.webp");
- child_process.execSync("montage -mode concatenate -tile x1 /tmp/chm-" + user + "-1.webp /tmp/chm-" + user + "-2.webp /tmp/chm-" + user + ".webp");
-
- pfp = fs.readFileSync("/tmp/chm-" + user + ".webp");
-
- fs.unlinkSync("/tmp/chm-" + user + "-1");
- fs.unlinkSync("/tmp/chm-" + user + "-2");
- fs.unlinkSync("/tmp/chm-" + user + "-1.webp");
- fs.unlinkSync("/tmp/chm-" + user + "-2.webp");
- fs.unlinkSync("/tmp/chm-" + user + ".webp");
- } else {
- pfp = (await axios.get(avatar1, {responseType: "arraybuffer"})).data;
- }
-
- fs.writeFileSync("/tmp/chm-" + user + "-pfp-final", pfp);
-
- child_process.execFileSync("signal-cli", [ "-a", number, "updateProfile", "--given-name", name, "--family-name", "", "--avatar", "/tmp/chm-" + user + "-pfp-final" ]);
- child_process.execFileSync("signal-cli", [ "-a", number, "updateAccount", "--device-name", "Ponycule to Signal integration (v" + new Date().toISOString().split("T")[0].replaceAll("-", ".") + ")" ]);
- child_process.execFileSync("signal-cli", [ "-a", number, "sendSyncRequest" ]);
- fs.unlinkSync("/tmp/chm-" + user + "-pfp-final");
-})();