Skip to content

Commit

Permalink
WOOOOOOOOOOO
Browse files Browse the repository at this point in the history
  • Loading branch information
wont-stream committed Sep 23, 2024
1 parent 4d4dae5 commit 9d0e254
Show file tree
Hide file tree
Showing 17 changed files with 342 additions and 166 deletions.
132 changes: 90 additions & 42 deletions plugins/eurotilities/components/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,56 +2,104 @@ import modules from "../helpers/modules.ts";

const {
plugin: { store },
ui: { SwitchItem, tooltip },
ui: {
Header,
HeaderTags,
Divider,
SwitchItem,
openModal,
ModalRoot,
ModalSizes,
ModalHeader,
ModalBody,
ModalConfirmFooter,
Button,
ButtonLooks,
ButtonColors,
ButtonSizes,
},
React,
} = shelter;

const handleSettingChange = (key, value) => {
store[key] = value;
};

export const settings = () => {
return (
<>
<div use:tooltip="Remove the colorblind-friendly icons from statuses.">
<SwitchItem
value={store.colorSighted}
onChange={(v) => handleSettingChange("colorSighted", v)}
hideBorder
// biome-ignore lint/correctness/noChildrenProp: N/A
children="Color Sighted"
/>
</div>

<div use:tooltip="Remove ALL of Discord's nitro upsells by tricking the client into thinking you have nitro.">
<SwitchItem
value={store.noNitroUpsell}
onChange={(v) => handleSettingChange("noNitroUpsell", v)}
hideBorder
// biome-ignore lint/correctness/noChildrenProp: N/A
children="No Nitro Upsell"
/>
</div>
const camelize = (str: string) => {
return str
.replace(/(?:^\w|[A-Z]|\b\w)/g, (word, index) =>
index === 0 ? word.toLowerCase() : word.toUpperCase(),
)
.replace(/\s+/g, "");
};

<div use:tooltip="Disable the CPU-intensive typing dots animation.">
<SwitchItem
value={store.noTypingAnimation}
onChange={(v) => handleSettingChange("noTypingAnimation", v)}
hideBorder
// biome-ignore lint/correctness/noChildrenProp: N/A
children="No Typing Animation"
/>
</div>
const makeModal = () => {
const remove = openModal(() => (
<ModalRoot size={ModalSizes.SMALL}>
<ModalHeader
close={() => {
remove();
}}
>
€tilities Settings
</ModalHeader>
<ModalBody>
<Divider mb />
{Object.keys(modules).map((module) => {
const mod = modules[module];
return (
<div key={module}>
<SwitchItem
value={store[camelize(module)]}
onChange={(v) => handleSettingChange(camelize(module), v)}
hideBorder
// biome-ignore lint/correctness/noChildrenProp: <explanation>
children=""
>
{mod.title}
<br />
{mod.content}
</SwitchItem>
<Divider mb />
</div>
);
})}
</ModalBody>
<ModalConfirmFooter
close={() => {
remove();
}}
cancelText="Close"
confirmText="Apply"
onConfirm={() => {
location.reload();
}}
/>
</ModalRoot>
));
};

<div use:tooltip="Sync your Steam Status to your Discord Status.">
<SwitchItem
value={store.steamStatusSync}
onChange={(v) => handleSettingChange("steamStatusSync", v)}
hideBorder
// biome-ignore lint/correctness/noChildrenProp: N/A
children="Steam Status Sync"
/>
</div>
</>
export const settings = () => {
return (
<Button
look={ButtonLooks.FILLED}
color={ButtonColors.BRAND}
size={ButtonSizes.XLARGE}
onClick={() => {
(
document.querySelector('[aria-label="close modal"]') as HTMLElement
)?.click();
(
document.querySelector('[class^="_mroot_"]') as HTMLElement
)?.classList.add("_active_1dl10_1");
makeModal();
}}
style={{
width: "100%",
height: "100%",
}}
// biome-ignore lint/correctness/noChildrenProp: N/A
children="Open Settings"
/>
);
};
18 changes: 18 additions & 0 deletions plugins/eurotilities/helpers/modules.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
import alwaysTrust from "../modules/alwaysTrust.ts";
import antiTrack from "../modules/antiTrack.ts";
import colorSighted from "../modules/colorSighted.ts";
import muteNewGuild from "../modules/muteNewGuild.ts";
import noCallIdle from "../modules/noCallIdle.ts";
import noConsoleSpam from "../modules/noConsoleSpam.ts";
import noDevtoolsDetection from "../modules/noDevtoolsDetection.ts";
import noNitroUpsell from "../modules/noNitroUpsell.ts";
import noReplyMention from "../modules/noReplyMention.ts";
import noTyping from "../modules/noTyping.ts";
import noTypingAnimation from "../modules/noTypingAnimation.ts";
import steamStatusSync from "../modules/steamStatusSync.ts";
import timestampedFiles from "../modules/timestampedFiles.ts";

export default {
alwaysTrust,
antiTrack,
colorSighted,
muteNewGuild,
noCallIdle,
noConsoleSpam,
noDevtoolsDetection,
noNitroUpsell,
noReplyMention,
noTyping,
noTypingAnimation,
steamStatusSync,
timestampedFiles,
};
43 changes: 12 additions & 31 deletions plugins/eurotilities/index.ts
Original file line number Diff line number Diff line change
@@ -1,48 +1,29 @@
import modules from "./helpers/modules.ts";

const {
plugin: { store },
plugin: { store, showSettings },
ui: { showToast },
} = shelter;

export function onLoad() {
for (const module of Object.keys(store)) {
if (store[module]) {
if (modules[module].start()) {
showToast({
...modules[module],
title: `${modules[module].title} - Enabled`,
content: null,
duration: 0,
});
}
modules[module].start();
}
}

showSettings();
}

export function onUnload() {
for (const module of Object.keys(store)) {
if (store[module]) {
if (modules[module].stop()) {
showToast({
...modules[module],
title: `${modules[module].title} - Disabled`,
content: null,
duration: 0,
});
} else {
showToast({
...modules[module],
title: "Restat Required",
content: `${modules[module].title} requires a restart to disable.`,
onClick() {
location.reload();
},
duration: Number.POSITIVE_INFINITY,
});
}
}
}
showToast({
title: "Restart Required",
content: "€tilities requires a restart to disable.",
onClick() {
location.reload();
},
duration: Number.POSITIVE_INFINITY,
});
}

export * from "./components/settings.tsx";
12 changes: 12 additions & 0 deletions plugins/eurotilities/modules/alwaysTrust.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const { flux, patcher } = shelter;
const { stores } = flux;
const { instead } = patcher;
const { MaskedLinkStore } = stores;

export default {
title: "Always Trust",
content: 'Remove the "You are leaving Discord" popup.',
start: () => {
instead("isTrustedDomain", MaskedLinkStore, () => true, false);
},
};
28 changes: 28 additions & 0 deletions plugins/eurotilities/modules/antiTrack.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const { http } = shelter;
const { intercept } = http;

export default {
title: "Anti Track",
content: "Stop some tracking, not all.",
start: () => {
try {
(
window as unknown as {
__SENTRY__: {
hub: {
getClient: () => { getOptions: () => { enabled: boolean } };
};
};
}
).__SENTRY__.hub
.getClient()
.getOptions().enabled = false;
for (const x of Object.keys(console)) {
console[x] = console[x].__sentry_original__ ?? console[x];
}
} catch {}

// @ts-ignore
intercept("post", /^\/science|^\/error-reporting-proxy/, () => {});
},
};
87 changes: 17 additions & 70 deletions plugins/eurotilities/modules/colorSighted.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,6 @@ import { findByProps } from "../helpers/webpack.ts";

const { Masks } = findByProps("Masks");

const masks = {
STATUS_ONLINE: Masks.STATUS_ONLINE,
STATUS_IDLE: Masks.STATUS_IDLE,
STATUS_DND: Masks.STATUS_DND,
STATUS_OFFLINE: Masks.STATUS_OFFLINE,
STATUS_STREAMING: Masks.STATUS_STREAMING,
STATUS_ONLINE_MOBILE: Masks.STATUS_ONLINE_MOBILE,

AVATAR_STATUS_ROUND_16: Masks.AVATAR_STATUS_ROUND_16,
AVATAR_STATUS_ROUND_20: Masks.AVATAR_STATUS_ROUND_20,
AVATAR_STATUS_ROUND_24: Masks.AVATAR_STATUS_ROUND_24,
AVATAR_STATUS_ROUND_32: Masks.AVATAR_STATUS_ROUND_32,
AVATAR_STATUS_ROUND_40: Masks.AVATAR_STATUS_ROUND_40,
AVATAR_STATUS_ROUND_48: Masks.AVATAR_STATUS_ROUND_48,
AVATAR_STATUS_ROUND_56: Masks.AVATAR_STATUS_ROUND_56,
AVATAR_STATUS_ROUND_80: Masks.AVATAR_STATUS_ROUND_80,
AVATAR_STATUS_ROUND_100: Masks.AVATAR_STATUS_ROUND_100,
AVATAR_STATUS_ROUND_120: Masks.AVATAR_STATUS_ROUND_120,

AVATAR_STATUS_MOBILE_16: Masks.AVATAR_STATUS_MOBILE_16,
AVATAR_STATUS_MOBILE_20: Masks.AVATAR_STATUS_MOBILE_20,
AVATAR_STATUS_MOBILE_24: Masks.AVATAR_STATUS_MOBILE_24,
AVATAR_STATUS_MOBILE_32: Masks.AVATAR_STATUS_MOBILE_32,
AVATAR_STATUS_MOBILE_40: Masks.AVATAR_STATUS_MOBILE_40,
AVATAR_STATUS_MOBILE_48: Masks.AVATAR_STATUS_MOBILE_48,
AVATAR_STATUS_MOBILE_56: Masks.AVATAR_STATUS_MOBILE_56,
AVATAR_STATUS_MOBILE_80: Masks.AVATAR_STATUS_MOBILE_80,
AVATAR_STATUS_MOBILE_100: Masks.AVATAR_STATUS_MOBILE_100,
AVATAR_STATUS_MOBILE_120: Masks.AVATAR_STATUS_MOBILE_120,
};

const style = document.createElement("style");
style.id = "__eurotilities-moduleStyle_color-sighted";
style.textContent = `[mask="url(#svg-mask-status-online)"] { width: 10px; height: 10px; x: 22px; y: 22px; }`;
Expand All @@ -42,44 +11,22 @@ export default {
content: "Remove the colorblind-friendly icons from statuses.",
start: () => {
document.head.appendChild(style);
Masks.STATUS_DND = masks.STATUS_ONLINE;
Masks.STATUS_IDLE = masks.STATUS_ONLINE;
Masks.STATUS_OFFLINE = masks.STATUS_ONLINE;
Masks.STATUS_STREAMING = masks.STATUS_ONLINE;

Masks.STATUS_ONLINE_MOBILE = masks.STATUS_ONLINE;

Masks.AVATAR_STATUS_MOBILE_16 = masks.AVATAR_STATUS_ROUND_16;
Masks.AVATAR_STATUS_MOBILE_20 = masks.AVATAR_STATUS_ROUND_20;
Masks.AVATAR_STATUS_MOBILE_24 = masks.AVATAR_STATUS_ROUND_24;
Masks.AVATAR_STATUS_MOBILE_32 = masks.AVATAR_STATUS_ROUND_32;
Masks.AVATAR_STATUS_MOBILE_40 = masks.AVATAR_STATUS_ROUND_40;
Masks.AVATAR_STATUS_MOBILE_48 = masks.AVATAR_STATUS_ROUND_48;
Masks.AVATAR_STATUS_MOBILE_56 = masks.AVATAR_STATUS_ROUND_56;
Masks.AVATAR_STATUS_MOBILE_80 = masks.AVATAR_STATUS_ROUND_80;
Masks.AVATAR_STATUS_MOBILE_100 = masks.AVATAR_STATUS_ROUND_100;
Masks.AVATAR_STATUS_MOBILE_120 = masks.AVATAR_STATUS_ROUND_120;
return true;
},
stop: () => {
document.head.removeChild(style);
Masks.STATUS_DND = masks.STATUS_DND;
Masks.STATUS_IDLE = masks.STATUS_IDLE;
Masks.STATUS_OFFLINE = masks.STATUS_OFFLINE;
Masks.STATUS_STREAMING = masks.STATUS_STREAMING;

Masks.STATUS_ONLINE_MOBILE = masks.STATUS_ONLINE_MOBILE;

Masks.AVATAR_STATUS_MOBILE_16 = masks.AVATAR_STATUS_MOBILE_16;
Masks.AVATAR_STATUS_MOBILE_20 = masks.AVATAR_STATUS_MOBILE_20;
Masks.AVATAR_STATUS_MOBILE_24 = masks.AVATAR_STATUS_MOBILE_24;
Masks.AVATAR_STATUS_MOBILE_32 = masks.AVATAR_STATUS_MOBILE_32;
Masks.AVATAR_STATUS_MOBILE_40 = masks.AVATAR_STATUS_MOBILE_40;
Masks.AVATAR_STATUS_MOBILE_48 = masks.AVATAR_STATUS_MOBILE_48;
Masks.AVATAR_STATUS_MOBILE_56 = masks.AVATAR_STATUS_MOBILE_56;
Masks.AVATAR_STATUS_MOBILE_80 = masks.AVATAR_STATUS_MOBILE_80;
Masks.AVATAR_STATUS_MOBILE_100 = masks.AVATAR_STATUS_MOBILE_100;
Masks.AVATAR_STATUS_MOBILE_120 = masks.AVATAR_STATUS_MOBILE_120;
return true;
Masks.STATUS_DND = Masks.STATUS_ONLINE;
Masks.STATUS_IDLE = Masks.STATUS_ONLINE;
Masks.STATUS_OFFLINE = Masks.STATUS_ONLINE;
Masks.STATUS_STREAMING = Masks.STATUS_ONLINE;

Masks.STATUS_ONLINE_MOBILE = Masks.STATUS_ONLINE;

Masks.AVATAR_STATUS_MOBILE_16 = Masks.AVATAR_STATUS_ROUND_16;
Masks.AVATAR_STATUS_MOBILE_20 = Masks.AVATAR_STATUS_ROUND_20;
Masks.AVATAR_STATUS_MOBILE_24 = Masks.AVATAR_STATUS_ROUND_24;
Masks.AVATAR_STATUS_MOBILE_32 = Masks.AVATAR_STATUS_ROUND_32;
Masks.AVATAR_STATUS_MOBILE_40 = Masks.AVATAR_STATUS_ROUND_40;
Masks.AVATAR_STATUS_MOBILE_48 = Masks.AVATAR_STATUS_ROUND_48;
Masks.AVATAR_STATUS_MOBILE_56 = Masks.AVATAR_STATUS_ROUND_56;
Masks.AVATAR_STATUS_MOBILE_80 = Masks.AVATAR_STATUS_ROUND_80;
Masks.AVATAR_STATUS_MOBILE_100 = Masks.AVATAR_STATUS_ROUND_100;
Masks.AVATAR_STATUS_MOBILE_120 = Masks.AVATAR_STATUS_ROUND_120;
},
};
Loading

0 comments on commit 9d0e254

Please sign in to comment.