Skip to content

Commit

Permalink
dump dependencies & store
Browse files Browse the repository at this point in the history
  • Loading branch information
SammCheese committed Jun 4, 2023
1 parent 8d42ef7 commit 1be3e97
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 51 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

Encrypt or Sign your messages with GPG :D

# Installation
## Installation

Just click the button below!

[![Install](https://img.shields.io/badge/-Install%20for%20Replugged-blue?style=for-the-badge&logo=none)](https://replugged.dev/install?identifier=SammCheese/RepluggedPGP&source=github)
[![Install](https://img.shields.io/badge/-Install%20for%20Replugged-blue?style=for-the-badge&logo=none)](https://replugged.dev/install?identifier=dev.sammcheese.RepluggedPGP)

## Contributing

Expand Down
6 changes: 3 additions & 3 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"discordID": "372148345894076416",
"github": "SammCheese"
},
"version": "1.4.3",
"version": "1.4.4",
"updater": {
"type": "github",
"id": "SammCheese/RepluggedPGP"
"type": "store",
"id": "dev.sammcheese.RepluggedPGP"
},
"license": "Unlicensed",
"type": "replugged-plugin",
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": "repluggedpgp",
"version": "1.4.3",
"version": "1.4.4",
"description": "Encrypt, Sign and Decrypt messages with the power of GPG",
"engines": {
"node": ">=14.0.0"
Expand Down Expand Up @@ -32,7 +32,7 @@
"eslint-plugin-react": "^7.31.10",
"openpgp": "^5.5.0",
"prettier": "^2.8.1",
"replugged": "4.2.6",
"replugged": "4.3.0",
"typescript": "^4.8.4"
},
"dependencies": {
Expand Down
56 changes: 36 additions & 20 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions src/components/KeyPassword.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,18 @@ function PasswordField(props: any) {
<Divider style={{ marginTop: "15px", marginBottom: "15px" }} />
<Flex>
<Switch
style={{ marginTop: "15px", marginBottom: "15px" }}
checked={savePassword}
onChange={(e) => {
setSavePassword(e);
}}
/>
<Text.Eyebrow
style={{ left: "20px", top: "4px", position: "relative", marginBottom: "15px" }}>
style={{
left: "20px",
top: "4px",
position: "relative",
marginBottom: "15px",
}}>
Remember Password for 30 Minutes
</Text.Eyebrow>
</Flex>
Expand Down
30 changes: 8 additions & 22 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ import { PGPCONSTS } from "./constants";
import { DiscordMessage, RPGPWindow } from "./repluggedpgp";
import { buildAddKeyModal } from "./components/AddKey";
import { del } from "idb-keyval";
import {
OutgoingMessage,
OutgoingMessageOptions,
} from "replugged/dist/renderer/modules/common/messages";

const { channels, messages } = common;

Expand Down Expand Up @@ -105,30 +101,19 @@ async function receiver(message: DiscordMessage): Promise<void> {
}
}

function fetchRecepients(
args: [
channelId: string,
message: OutgoingMessage,
promise?: boolean | undefined,
options?: OutgoingMessageOptions | undefined,
],
): string[] {
let recipients = [];
const DM = channels.getChannel(args[0])?.recipients;
const Reply = args[3]?.messageReference;
if (DM) recipients = DM;
if (Reply?.channel_id && Reply?.message_id)
recipients = [messages.getMessage(Reply.channel_id, Reply.message_id).author.id];
return recipients;
}

// eslint-disable-next-line @typescript-eslint/require-await
async function injectSendMessage(): Promise<void> {
injector.instead(common.messages, "sendMessage", async (args, fn) => {
const { signingActive, encryptionActive, asFile, onlyOnce } = PGPSettings.all();

if (encryptionActive) {
const expectedRecipients = await calculateRecipients(fetchRecepients(args));
let recipients = [];
const DM = channels.getChannel(args[0])?.recipients;
const Reply = args[3]?.messageReference;
if (DM) recipients = DM;
if (Reply?.channel_id && Reply?.message_id)
recipients = [messages.getMessage(Reply.channel_id, Reply.message_id).author.id];
const expectedRecipients = await calculateRecipients(recipients);
args[1].content = await encryptMessage(args[1].content, expectedRecipients, signingActive);
}

Expand Down Expand Up @@ -157,6 +142,7 @@ async function injectSendMessage(): Promise<void> {

// eslint-disable-next-line @typescript-eslint/require-await
async function injectPopover(): Promise<void> {
// @ts-expect-error eat a dick
injector.utils.addPopoverButton((message: DiscordMessage) => {
const actionType = {
"Add Key": /BEGIN PGP PUBLIC KEY BLOCK/,
Expand Down

0 comments on commit 1be3e97

Please sign in to comment.