mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-02-25 07:48:32 +00:00
Fixed a couple things
This commit is contained in:
parent
9d6d8940b1
commit
0ffe846cf6
2 changed files with 7 additions and 8 deletions
|
@ -78,13 +78,13 @@ const ChatBarIcon: ChatBarButton = ({ isMainChat }) => {
|
||||||
tooltip={enabled ? "Send Unencrypted Messages" : "Send Encrypted Messages"}
|
tooltip={enabled ? "Send Unencrypted Messages" : "Send Encrypted Messages"}
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
if (await DataStore.get('encryptcordGroup') == false || (await DataStore.get('encryptcordChannelId') != getCurrentChannel().id)) {
|
if (await DataStore.get('encryptcordGroup') == false || (await DataStore.get('encryptcordChannelId') != getCurrentChannel().id)) {
|
||||||
await sendTempMessage(getCurrentChannel().id, `${await DataStore.get("encryptcordPublicKey")}`, "join", false);
|
await sendTempMessage(getCurrentChannel().id, "", `join\`\`\`\n${await DataStore.get("encryptcordPublicKey")}\`\`\``, false);
|
||||||
sendBotMessage(getCurrentChannel().id, { content: "*Checking for any groups in this channel...*" });
|
sendBotMessage(getCurrentChannel().id, { content: `*Checking for any groups in this channel...*\n> If none is found, a new one will be created <t:${Math.floor(Date.now() / 1000) + 5}:R>` });
|
||||||
await sleep(5000);
|
await sleep(5000);
|
||||||
if (await DataStore.get('encryptcordGroup') == true && (await DataStore.get('encryptcordChannelId') != getCurrentChannel().id)) {
|
if (await DataStore.get('encryptcordGroup') == true && (await DataStore.get('encryptcordChannelId') != getCurrentChannel().id)) {
|
||||||
sendBotMessage(getCurrentChannel().id, { content: "*Leaving current group...*" });
|
sendBotMessage(getCurrentChannel().id, { content: "*Leaving current group...*" });
|
||||||
await leave("", { channel: { id: await DataStore.get('encryptcordChannelId') } });
|
await leave("", { channel: { id: await DataStore.get('encryptcordChannelId') } });
|
||||||
} else {
|
} else if (await DataStore.get('encryptcordGroup') == true) {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
await startGroup("", { channel: { id: getCurrentChannel().id } });
|
await startGroup("", { channel: { id: getCurrentChannel().id } });
|
||||||
|
@ -168,7 +168,7 @@ export default definePlugin({
|
||||||
if (!message.content) return;
|
if (!message.content) return;
|
||||||
const encryptcordGroupMembers = await DataStore.get('encryptcordGroupMembers');
|
const encryptcordGroupMembers = await DataStore.get('encryptcordGroupMembers');
|
||||||
if (!Object.keys(encryptcordGroupMembers).some(key => key == message.author.id)) {
|
if (!Object.keys(encryptcordGroupMembers).some(key => key == message.author.id)) {
|
||||||
switch (message.content.toLowerCase()) {
|
switch (message.content.toLowerCase().split("```")[0]) {
|
||||||
case "groupdata":
|
case "groupdata":
|
||||||
const response = await fetch(message.attachments[0].url);
|
const response = await fetch(message.attachments[0].url);
|
||||||
const groupdata = await response.json();
|
const groupdata = await response.json();
|
||||||
|
@ -179,8 +179,7 @@ export default definePlugin({
|
||||||
if (!await DataStore.get("encryptcordGroup")) return;
|
if (!await DataStore.get("encryptcordGroup")) return;
|
||||||
const sender = await UserUtils.getUser(message.author.id).catch(() => null);
|
const sender = await UserUtils.getUser(message.author.id).catch(() => null);
|
||||||
if (!sender) return;
|
if (!sender) return;
|
||||||
const joinresponse = await fetch(message.attachments[0].url);
|
const userKey = message.content.split("```")[1];
|
||||||
const userKey = await joinresponse.text();
|
|
||||||
await handleJoin(sender.id, userKey, encryptcordGroupMembers);
|
await handleJoin(sender.id, userKey, encryptcordGroupMembers);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -80,7 +80,7 @@ const base64ToArrayBuffer = (base64String) => {
|
||||||
|
|
||||||
export const formatPemKey = (keyData, type) => {
|
export const formatPemKey = (keyData, type) => {
|
||||||
const base64Key = arrayBufferToBase64(keyData);
|
const base64Key = arrayBufferToBase64(keyData);
|
||||||
return `-----BEGIN ${type.toUpperCase()} KEY-----\n` + base64Key + `\n----- END ${type.toUpperCase()} KEY----- `;
|
return `-----BEGIN ${type.toUpperCase()} KEY-----\n` + base64Key + `\n-----END ${type.toUpperCase()} KEY----- `;
|
||||||
};
|
};
|
||||||
|
|
||||||
const importPemPublicKey = async (pemKey) => {
|
const importPemPublicKey = async (pemKey) => {
|
||||||
|
@ -89,7 +89,7 @@ const importPemPublicKey = async (pemKey) => {
|
||||||
|
|
||||||
const keyBody = trimmedPemKey
|
const keyBody = trimmedPemKey
|
||||||
.replace("-----BEGIN PUBLIC KEY-----", "")
|
.replace("-----BEGIN PUBLIC KEY-----", "")
|
||||||
.replace("----- END PUBLIC KEY-----", "");
|
.replace("-----END PUBLIC KEY-----", "");
|
||||||
|
|
||||||
const binaryDer = atob(keyBody);
|
const binaryDer = atob(keyBody);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue