Skip to content

Commit

Permalink
Fix Minipopover patch (closes #16)
Browse files Browse the repository at this point in the history
  • Loading branch information
SammCheese committed Feb 5, 2023
1 parent 047279d commit e79a445
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"discordID": "372148345894076416",
"github": "SammCheese"
},
"version": "1.2.0",
"version": "1.2.1",
"updater": {
"type": "github",
"id": "SammCheese/invisible-chat"
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "invisible-chat",
"version": "1.2.0",
"version": "1.2.1",
"description": "Encrypt your Discord Messages",
"engines": {
"node": ">=14.0.0"
Expand All @@ -20,7 +20,7 @@
},
"keywords": [],
"author": "",
"license": "ISC",
"license": "Unlicensed",
"devDependencies": {
"@electron/asar": "^3.2.1",
"@types/node": "^18.11.2",
Expand Down
1 change: 0 additions & 1 deletion src/components/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const { TextInput, Text, Divider } = components;

export function Settings() {
let [passwords, setPasswords] = React.useState(InvSettings.get("passwords", []));

let [defaultSetting, setDefaultSetting] = React.useState(
InvSettings.get("defaultPassword", "password"),
);
Expand Down
5 changes: 2 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,11 @@ export { Settings } from "./components/Settings";

// Grab the data from the above Plaintext Patches
async function receiver(message: DiscordMessage): Promise<void> {
// if a stored password leads to the decrypted string, skip the modal
await interatePasswords(message).then((res) => {
if (res) return void buildEmbed(message, res);
return void buildDecModal({ message });
});
// if a stored password leads to the decrypted string, skip the modal
// if (passwordCheck) return void buildEmbed(message, passwordCheck);
// return void buildDecModal({ message });
}

export async function buildEmbed(message: DiscordMessage, revealed: string): Promise<void> {
Expand All @@ -50,6 +48,7 @@ export async function buildEmbed(message: DiscordMessage, revealed: string): Pro
},
};

// Convert discords existing embeds to sendable ones. Prevents existing embeds from breaking
message.embeds = message.embeds.map((embed: rawDiscordEmbed) => cleanupEmbed(embed));
message.embeds.push(embed);
if (urlCheck?.length) message.embeds.push(await getEmbed(new URL(urlCheck[0])));
Expand Down
2 changes: 1 addition & 1 deletion src/plaintextPatches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const patches: types.PlaintextPatch[] = [
{
// Minipopover Lock
match:
/.\?(..)\(\{key:"reply",label:.{1,40},icon:.{1,40},channel:(.{1,3}),message:(.{1,3}),onClick:.{1,5}\}\):null/gm,
/.\?(..)\(\{key:"reply-other",channel:(.{1,5}),message:(.{1,5}),label:.{1,50},icon:.{1,5},onClick:.{1,6}\}\):null/gm,
replace: `$&,$3.content.match(window.invisiblechat?.INV_DETECTION)?$1({key:"decrypt",label:"Decrypt Message",icon:window.invisiblechat.popoverIcon,channel:$2,message:$3,onClick:()=>window.invisiblechat.receiver($3)}):null`,
},
{
Expand Down
1 change: 1 addition & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export let InvSettings: settings.SettingsManager<
never
>;

// Load
export async function stegInit(): Promise<void> {
StegCloak = (await getStegCloak).default;
steggo = await new StegCloak(true, false);
Expand Down

0 comments on commit e79a445

Please sign in to comment.