diff --git a/src/plugins/alwaysTrust/index.ts b/src/plugins/alwaysTrust/index.ts index 07e92afc..5113935f 100644 --- a/src/plugins/alwaysTrust/index.ts +++ b/src/plugins/alwaysTrust/index.ts @@ -16,27 +16,46 @@ * along with this program. If not, see . */ +import { definePluginSettings } from "@api/Settings"; import { Devs } from "@utils/constants"; -import definePlugin from "@utils/types"; +import definePlugin, { OptionType } from "@utils/types"; + +const settings = definePluginSettings({ + domain: { + type: OptionType.BOOLEAN, + default: true, + description: "Remove the untrusted domain popup when opening links", + restartNeeded: true + }, + file: { + type: OptionType.BOOLEAN, + default: true, + description: "Remove the 'Potentially Dangerous Download' popup when opening links", + restartNeeded: true + } +}); export default definePlugin({ name: "AlwaysTrust", description: "Removes the annoying untrusted domain and suspicious file popup", - authors: [Devs.zt], + authors: [Devs.zt, Devs.Trwy], patches: [ { find: ".displayName=\"MaskedLinkStore\"", replacement: { match: /(?<=isTrustedDomain\(\i\){)return \i\(\i\)/, replace: "return true" - } + }, + predicate: () => settings.store.domain }, { find: "isSuspiciousDownload:", replacement: { match: /function \i\(\i\){(?=.{0,60}\.parse\(\i\))/, replace: "$&return null;" - } + }, + predicate: () => settings.store.file } - ] + ], + settings }); diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 335ed5cc..5b540895 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -49,6 +49,10 @@ export const Devs = /* #__PURE__*/ Object.freeze({ name: "Cynosphere", id: 150745989836308480n }, + Trwy: { + name: "trey", + id: 354427199023218689n + }, Megu: { name: "Megumin", id: 545581357812678656n