diff --git a/plugins/eurotilities/helpers/modules.ts b/plugins/eurotilities/helpers/modules.ts index 46b12fa..2661d0d 100644 --- a/plugins/eurotilities/helpers/modules.ts +++ b/plugins/eurotilities/helpers/modules.ts @@ -1,6 +1,5 @@ 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"; @@ -15,7 +14,6 @@ import timestampedFiles from "../modules/timestampedFiles.ts"; export default { alwaysTrust, antiTrack, - colorSighted, muteNewGuild, noCallIdle, noConsoleSpam, diff --git a/plugins/eurotilities/index.ts b/plugins/eurotilities/index.ts index abda04c..001cb61 100644 --- a/plugins/eurotilities/index.ts +++ b/plugins/eurotilities/index.ts @@ -6,7 +6,7 @@ const { export function onLoad() { for (const module of Object.keys(modules)) { - modules[module].start(); + modules[module](); } } diff --git a/plugins/eurotilities/modules/alwaysTrust.ts b/plugins/eurotilities/modules/alwaysTrust.ts index 52b4a35..51bd1d1 100644 --- a/plugins/eurotilities/modules/alwaysTrust.ts +++ b/plugins/eurotilities/modules/alwaysTrust.ts @@ -3,10 +3,6 @@ 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); - }, +export default () => { + instead("isTrustedDomain", MaskedLinkStore, () => true, false); }; diff --git a/plugins/eurotilities/modules/antiTrack.ts b/plugins/eurotilities/modules/antiTrack.ts index 31aa3a1..3bf7460 100644 --- a/plugins/eurotilities/modules/antiTrack.ts +++ b/plugins/eurotilities/modules/antiTrack.ts @@ -1,28 +1,24 @@ 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 } }; - }; +export default () => { + 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 {} + ).__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/, () => {}); - }, + // @ts-ignore + intercept("post", /^\/science|^\/error-reporting-proxy/, () => {}); }; diff --git a/plugins/eurotilities/modules/colorSighted.ts b/plugins/eurotilities/modules/colorSighted.ts deleted file mode 100644 index 9474132..0000000 --- a/plugins/eurotilities/modules/colorSighted.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { findByProps } from "../helpers/webpack.ts"; - -const { Masks } = findByProps("Masks"); - -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; }`; - -export default { - title: "Color Sighted", - 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; - }, -}; diff --git a/plugins/eurotilities/modules/muteNewGuild.ts b/plugins/eurotilities/modules/muteNewGuild.ts index ea2f415..448076d 100644 --- a/plugins/eurotilities/modules/muteNewGuild.ts +++ b/plugins/eurotilities/modules/muteNewGuild.ts @@ -2,29 +2,25 @@ const { flux, http } = shelter; const { dispatcher } = flux; const { patch } = http; -export default { - title: "Mute New Guilds", - content: "Auto mute guilds on join.", - start: () => { - dispatcher.subscribe( - "INVITE_ACCEPT_SUCCESS", - ({ - invite: { - guild: { id }, - }, - }) => { - if (patch) { - patch({ - body: { - muted: true, - suppress_everyone: true, - suppress_roles: true, - }, - url: `/users/@me/guilds/${id}/settings`, - oldFormErrors: false, - }); - } +export default () => { + dispatcher.subscribe( + "INVITE_ACCEPT_SUCCESS", + ({ + invite: { + guild: { id }, }, - ); - }, + }) => { + if (patch) { + patch({ + body: { + muted: true, + suppress_everyone: true, + suppress_roles: true, + }, + url: `/users/@me/guilds/${id}/settings`, + oldFormErrors: false, + }); + } + }, + ); }; diff --git a/plugins/eurotilities/modules/noCallIdle.ts b/plugins/eurotilities/modules/noCallIdle.ts index fa3edde..cd0a96c 100644 --- a/plugins/eurotilities/modules/noCallIdle.ts +++ b/plugins/eurotilities/modules/noCallIdle.ts @@ -3,20 +3,16 @@ const { intercept, dispatcher } = flux; const dispatchTypes = ["EMBEDDED_ACTIVITY_DISCONNECT", "VOICE_STATE_UPDATES"]; -export default { - title: "No Call Idle", - content: "Stay in VC forever.", - start: () => { - intercept(({ type }) => { - if (dispatchTypes.includes(type)) { - const actionHandlers = dispatcher._subscriptions[type] ?? []; +export default () => { + intercept(({ type }) => { + if (dispatchTypes.includes(type)) { + const actionHandlers = dispatcher._subscriptions[type] ?? []; - for (const handler of actionHandlers) { - if (handler.toString().includes("idleTimeout.start")) { - actionHandlers.delete(handler); - } + for (const handler of actionHandlers) { + if (handler.toString().includes("idleTimeout.start")) { + actionHandlers.delete(handler); } } - }); - }, + } + }); }; diff --git a/plugins/eurotilities/modules/noConsoleSpam.ts b/plugins/eurotilities/modules/noConsoleSpam.ts index ba7c7b3..7ade582 100644 --- a/plugins/eurotilities/modules/noConsoleSpam.ts +++ b/plugins/eurotilities/modules/noConsoleSpam.ts @@ -1,23 +1,19 @@ const originalConsoleMethods: { [key: string]: (...args: unknown[]) => void } = {}; -export default { - title: "No Console Spam", - content: "Filter the console spam.", - start: () => { - for (const method of Object.keys(console)) { - originalConsoleMethods[method] = console[method]; +export default () => { + for (const method of Object.keys(console)) { + originalConsoleMethods[method] = console[method]; - console[method] = (...args: unknown[]) => { - const message = args[0]; - if ( - typeof message === "string" && - (message.includes("%c[") || message.toLowerCase().includes("sentry")) - ) { - return; - } - originalConsoleMethods[method].apply(console, args); - }; - } - }, + console[method] = (...args: unknown[]) => { + const message = args[0]; + if ( + typeof message === "string" && + (message.includes("%c[") || message.toLowerCase().includes("sentry")) + ) { + return; + } + originalConsoleMethods[method].apply(console, args); + }; + } }; diff --git a/plugins/eurotilities/modules/noDevtoolsDetection.ts b/plugins/eurotilities/modules/noDevtoolsDetection.ts index e547d71..96ef8db 100644 --- a/plugins/eurotilities/modules/noDevtoolsDetection.ts +++ b/plugins/eurotilities/modules/noDevtoolsDetection.ts @@ -6,16 +6,12 @@ const nativeWindow = window as unknown as { }; }; -export default { - title: "No Devtools Detection", - content: "Prevent annoying devtools detection. (Desktop only)", - start: () => { - if (nativeWindow.DiscordNative) { - // desktop, cannot be unloaded easily - nativeWindow.DiscordNative.window.setDevtoolsCallbacks( - () => {}, - () => {}, - ); - } - }, +export default () => { + if (nativeWindow.DiscordNative) { + // desktop, cannot be unloaded easily + nativeWindow.DiscordNative.window.setDevtoolsCallbacks( + () => {}, + () => {}, + ); + } }; diff --git a/plugins/eurotilities/modules/noNitroUpsell.ts b/plugins/eurotilities/modules/noNitroUpsell.ts index c7af2f0..094f125 100644 --- a/plugins/eurotilities/modules/noNitroUpsell.ts +++ b/plugins/eurotilities/modules/noNitroUpsell.ts @@ -26,14 +26,9 @@ const getUser = async () => { return user; }; -export default { - title: "No Nitro Upsell", - content: - "Remove ALL of Discord's nitro upsells by tricking the client into thinking you have nitro.", - start: async () => { - const user = await getUser(); - - user._eurotilities__premiumType = user.premiumType; - user.premiumType = 2; - }, +export default async () => { + const user = await getUser(); + + user._eurotilities__premiumType = user.premiumType; + user.premiumType = 2; }; diff --git a/plugins/eurotilities/modules/noReplyMention.ts b/plugins/eurotilities/modules/noReplyMention.ts index be1ec29..6469a99 100644 --- a/plugins/eurotilities/modules/noReplyMention.ts +++ b/plugins/eurotilities/modules/noReplyMention.ts @@ -1,14 +1,10 @@ const { flux } = shelter; const { intercept } = flux; -export default { - title: "No Reply Mention", - content: "Disable replies by default.", - start: () => { - intercept((dispatch) => { - if (dispatch.type !== "CREATE_PENDING_REPLY") return; +export default () => { + intercept((dispatch) => { + if (dispatch.type !== "CREATE_PENDING_REPLY") return; - dispatch.shouldMention = false; - }); - }, + dispatch.shouldMention = false; + }); }; diff --git a/plugins/eurotilities/modules/noTyping.ts b/plugins/eurotilities/modules/noTyping.ts index 1555887..47bb688 100644 --- a/plugins/eurotilities/modules/noTyping.ts +++ b/plugins/eurotilities/modules/noTyping.ts @@ -1,11 +1,7 @@ const { http } = shelter; const { intercept } = http; -export default { - title: "No Typing", - content: "Stop Discord from sending your typing status.", - start: () => { - // @ts-ignore - intercept("post", /.*typing$/, () => {}); - }, +export default () => { + // @ts-ignore + intercept("post", /.*typing$/, () => {}); }; diff --git a/plugins/eurotilities/modules/noTypingAnimation.ts b/plugins/eurotilities/modules/noTypingAnimation.ts index 45fc10d..c56f94b 100644 --- a/plugins/eurotilities/modules/noTypingAnimation.ts +++ b/plugins/eurotilities/modules/noTypingAnimation.ts @@ -1,9 +1,5 @@ -export default { - title: "No Typing Animation", - content: "Disable the CPU-intensive typing dots animation.", - start: () => { - document.hasFocus = () => { - return false; - }; - }, +export default () => { + document.hasFocus = () => { + return false; + }; }; diff --git a/plugins/eurotilities/modules/steamStatusSync.ts b/plugins/eurotilities/modules/steamStatusSync.ts index b04c933..4e3660c 100644 --- a/plugins/eurotilities/modules/steamStatusSync.ts +++ b/plugins/eurotilities/modules/steamStatusSync.ts @@ -8,23 +8,17 @@ const statusMap = { invisible: "invisible", }; -const listener = ({ settings }) => { - const protoStatus = settings.proto.status; - const discordStatus = protoStatus.status.value; - const showCurrentGame = protoStatus.showCurrentGame.value; - const steamStatus = statusMap[discordStatus]; +export default () => { + dispatcher.subscribe("USER_SETTINGS_PROTO_UPDATE", ({ settings }) => { + const protoStatus = settings.proto.status; + const discordStatus = protoStatus.status.value; + const showCurrentGame = protoStatus.showCurrentGame.value; + const steamStatus = statusMap[discordStatus]; - if (!showCurrentGame) { - return open("steam://friends/status/invisible"); - } + if (!showCurrentGame) { + return open("steam://friends/status/invisible"); + } - return open(`steam://friends/status/${steamStatus}`); -}; - -export default { - title: "Steam Status Sync", - content: "Sync your Steam Status to your Discord Status.", - start: () => { - dispatcher.subscribe("USER_SETTINGS_PROTO_UPDATE", listener); - }, + return open(`steam://friends/status/${steamStatus}`); + }); }; diff --git a/plugins/eurotilities/modules/timestampedFiles.ts b/plugins/eurotilities/modules/timestampedFiles.ts index a17c926..a615633 100644 --- a/plugins/eurotilities/modules/timestampedFiles.ts +++ b/plugins/eurotilities/modules/timestampedFiles.ts @@ -1,27 +1,23 @@ const { flux } = shelter; const { intercept } = flux; -export default { - title: "Timestamped Files", - content: "Rename uploaded files to the current timestamp.", - start: () => { - intercept((dispatch) => { - if (dispatch?.type === "UPLOAD_ATTACHMENT_ADD_FILES") { - for (const { file } of dispatch?.files ?? []) { - if (!file?.name) continue; +export default () => { + intercept((dispatch) => { + if (dispatch?.type === "UPLOAD_ATTACHMENT_ADD_FILES") { + for (const { file } of dispatch?.files ?? []) { + if (!file?.name) continue; - let newFilename = Date.now().toString(); + let newFilename = Date.now().toString(); - if (file.name.includes(".")) { - newFilename += file.name.slice(file.name.lastIndexOf(".")); - } - - Object.defineProperty(file, "name", { - value: newFilename, - }); + if (file.name.includes(".")) { + newFilename += file.name.slice(file.name.lastIndexOf(".")); } - return dispatch; + + Object.defineProperty(file, "name", { + value: newFilename, + }); } - }); - }, + return dispatch; + } + }); };