Skip to content

Commit

Permalink
Minor changes (see changelog for 1.0.6)
Browse files Browse the repository at this point in the history
  • Loading branch information
SammCheese committed Dec 25, 2022
1 parent 1c1a111 commit 119412a
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 72 deletions.
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

3 changes: 3 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ rules:
node/no-unpublished-require: off
node/shebang: off
no-process-exit: off
no-undef: off
no-unused-vars: off
"@typescript-eslint/no-unused-vars": error

overrides:
- files: "**/*.ts"
Expand Down
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.0.5",
"version": "1.0.6",
"updater": {
"type": "github",
"id": "SammCheese/invisible-chat"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-react": "^7.31.10",
"prettier": "^2.8.1",
"replugged": "4.0.0-beta0.18",
"replugged": "4.0.0-beta0.19",
"tsx": "^3.10.3",
"typescript": "^4.8.4"
}
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

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

4 changes: 2 additions & 2 deletions scripts/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ const watch = process.argv.includes("--watch");
const common: esbuild.BuildOptions = {
absWorkingDir: path.join(__dirname, ".."),
bundle: true,
minify: false,
sourcemap: true,
minify: true,
sourcemap: false,
format: "cjs" as esbuild.Format,
logLevel: "info",
watch,
Expand Down
2 changes: 1 addition & 1 deletion src/assets/indicator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { React } = common;

export const Indicator = (
<img
src="https://cdn-icons-png.flaticon.com/32/3064/3064130.png"
src="https://github.com/SammCheese/invisible-chat/raw/NewReplugged/src/assets/lock.png"
width={20}
style={{ marginBottom: -4 }}></img>
);
26 changes: 22 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ const getStegCloak: Promise<StegCloakImport> = import(
"https://unpkg.com/stegcloak-dist@1.0.0/index.js"
);

// TYPES

type Constructor<StegCloak> = new (encrypt: boolean, useHmac: boolean) => Promise<StegCloak>;

interface StegCloak {
Expand All @@ -24,6 +26,23 @@ interface StegCloakImport {
default: Constructor<StegCloak>;
}

interface DiscordEmbed {
title: string;
type: string;
description: string;
url?: string;
timestamp?: EpochTimeStamp;
color?: number;
footer?: object;
image?: object;
thumbnail?: object;
video?: object;
provider?: object;
author?: object;
}

// CONSTANTS

const EMBED_URL = "https://embed.sammcheese.net";
const INV_DETECTION = new RegExp(/( \u200c|\u200d |[\u2060-\u2064])[^\u200b]/);
const URL_DETECTION = new RegExp(
Expand Down Expand Up @@ -52,8 +71,6 @@ export async function start(): Promise<void> {
chatbarLock,
Indicator,
};

console.log("%c [Invisible Chat] Started!", "color: aquamarine");
}

// Grab the data from the above Plantext Patches
Expand All @@ -62,7 +79,8 @@ function receiver(message: unknown): void {
}

// Gets the Embed of a Link
async function getEmbed(url: URL): Promise<JSON> {
async function getEmbed(url: URL): Promise<DiscordEmbed> {
// Timeout after 5 seconds
const controller = new AbortController();
const _timeout = setTimeout(() => controller.abort(), 5000);

Expand All @@ -84,7 +102,7 @@ async function getEmbed(url: URL): Promise<JSON> {
export async function buildEmbed(message: unknown, revealed: string): Promise<void> {
const urlCheck = revealed.match(URL_DETECTION) || [];

let attachment;
let attachment: DiscordEmbed;
if (urlCheck[0]) attachment = await getEmbed(new URL(urlCheck[0]));

let embed = {
Expand Down
2 changes: 1 addition & 1 deletion src/plaintextPatches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const patches: types.PlaintextPatch[] = [
},
{
// Chatbar Lock
match: /.=.\.activeCommand,.=.\.activeCommandOption,.{0,155}(.)=\[\];/,
match: /,.=.\.activeCommand,.=.\.activeCommandOption,.{0,255},(.)=\[\];/,
replace: "$&;try{$1.push(window.invisiblechat.chatbarLock)}catch{};",
},
{
Expand Down
56 changes: 0 additions & 56 deletions src/updater.ts

This file was deleted.

2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
"sourceMap": false /* Create source map files for emitted JavaScript files. */,
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
// "outDir": "./", /* Specify an output folder for all emitted files. */
// "removeComments": true, /* Disable emitting comments. */
Expand Down

0 comments on commit 119412a

Please sign in to comment.