diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 28b30bc2f..4117a2065 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -4,6 +4,11 @@ on: branches: - main +env: + FORCE_COLOR: true + +permissions: write-all + jobs: release: runs-on: ubuntu-latest diff --git a/src/components/settings/tabs/plugins/components/Common.tsx b/src/components/settings/tabs/plugins/components/Common.tsx index 3d84859bf..61c3da529 100644 --- a/src/components/settings/tabs/plugins/components/Common.tsx +++ b/src/components/settings/tabs/plugins/components/Common.tsx @@ -36,7 +36,7 @@ export function resolveError(isValidResult: boolean | string) { interface SettingsSectionProps extends PropsWithChildren { name: string; description: string; - error: string | null; + error?: string | null; inlineSetting?: boolean; } diff --git a/src/equicordplugins/downloadify/index.tsx b/src/equicordplugins/downloadify/index.tsx index 7a09fc6c4..3b0fb0618 100644 --- a/src/equicordplugins/downloadify/index.tsx +++ b/src/equicordplugins/downloadify/index.tsx @@ -91,23 +91,13 @@ export default definePlugin({ replacement: [ { // Make use of the download function. - match: /(let{item:\i}=(\i).{0,450}?)(await \i.\i.saveImage\(\i,\i.contentType,\i.\i\)),/, + match: /(let{item:\i}=(\i).{0,450}?)(\i\(!0\);try{.{0,400}?finally{\i\(!1\)})/, replace: "$1await $self.handleExpandedModalDownloadButtonClicked($2,async()=>{$3});", }, - { - // Disable default success toast. - match: /(\(0,.{0,85}?ToastType.SUCCESS\)\))/, - replace: "", - }, - { - // Disable default failure toast. - match: /(\(0,.{0,85}?ToastType.FAILURE\)\))/, - replace: "", - }, { // Prevent videos from opening in browser. - match: /(let{item:\i}=\i.{0,350}?)(SAVE_MEDIA_PRESSED\)).{0,100}?(\i\(!0\);)/, - replace: "$1$2,true){$3" + match: /(let{item:\i}=\i.{0,350}?)(SAVE_MEDIA_PRESSED\)).{0,100}?type\){/, + replace: "$1$2,true){" } ], } diff --git a/src/equicordplugins/downloadify/utils/handlers.tsx b/src/equicordplugins/downloadify/utils/handlers.tsx index 42dd32fc7..43f336578 100644 --- a/src/equicordplugins/downloadify/utils/handlers.tsx +++ b/src/equicordplugins/downloadify/utils/handlers.tsx @@ -677,7 +677,7 @@ export async function handleHoverDownloadButtonClicked(props: HoverDownloadProps if (!originalItem) { // Fallback to default behavior. DownloadifyLogger.info(`[${getFormattedNow()}] [UNRECOGNIZED HOVER DOWNLOAD ITEM]`, props.item); - displayStatus && showToast("File Opened in Browser", Toasts.Type.MESSAGE, { duration: statusDuration * 1000 }); + displayStatus && showToast("Unknown Media Item. Falling Back to Default Behavior", Toasts.Type.MESSAGE, { duration: statusDuration * 1250 }); window.open(downloadUrl, "_blank"); } else { contentType ??= (await DownloadifyNative.queryURL(downloadUrl) || ""); @@ -700,15 +700,8 @@ export async function handleExpandedModalDownloadButtonClicked(props: ExpandedMo if (!url && !original) { // Fallback to default behavior. DownloadifyLogger.info(`[${getFormattedNow()}] [UNRECOGNIZED EXPANDED MODAL DOWNLOAD ITEM]`, props.item); - displayStatus && showToast("Download Started", Toasts.Type.MESSAGE, { duration: statusDuration * 1000 }); - - try { - await fallback(); - displayStatus && showToast("Download Success", Toasts.Type.SUCCESS, { duration: statusDuration * 1000 }); - } catch (error) { - DownloadifyLogger.info(`[${getFormattedNow()}] [FALLBACK DOWNLOAD FAILED]`, error); - displayStatus && showToast("Download Failed", Toasts.Type.FAILURE, { duration: statusDuration * 1000 }); - } + displayStatus && showToast("Unknown Media Item. Falling Back to Default Behavior", Toasts.Type.MESSAGE, { duration: statusDuration * 1250 }); + await fallback(); } else { contentType ??= (await DownloadifyNative.queryURL(url) || ""); let aliasBasename = sourceMetadata?.identifier.title ?? null; diff --git a/src/plugins/consoleJanitor/index.tsx b/src/plugins/consoleJanitor/index.tsx index 4981ac2ca..fb4117c1e 100644 --- a/src/plugins/consoleJanitor/index.tsx +++ b/src/plugins/consoleJanitor/index.tsx @@ -6,11 +6,10 @@ import { definePluginSettings } from "@api/Settings"; import ErrorBoundary from "@components/ErrorBoundary"; -import { Flex } from "@components/Flex"; +import { SettingsSection } from "@components/settings/tabs/plugins/components/Common"; import { Devs } from "@utils/constants"; -import { Margins } from "@utils/margins"; import definePlugin, { defineDefault, OptionType, StartAt } from "@utils/types"; -import { Checkbox, Forms, Text } from "@webpack/common"; +import { Checkbox, Text } from "@webpack/common"; const Noop = () => { }; const NoopLogger = { @@ -58,15 +57,13 @@ function AllowLevelSetting({ settingKey }: AllowLevelSettingProps) { const AllowLevelSettings = ErrorBoundary.wrap(() => { return ( - - Filter List - Always allow loggers of these types - + +
{Object.keys(settings.store.allowLevel).map(key => ( ))} - - +
+
); }); diff --git a/src/plugins/mutualGroupDMs/index.tsx b/src/plugins/mutualGroupDMs/index.tsx index 8d81e43db..288899237 100644 --- a/src/plugins/mutualGroupDMs/index.tsx +++ b/src/plugins/mutualGroupDMs/index.tsx @@ -109,14 +109,14 @@ export default definePlugin({ }, // User Profile Modal v2 { - find: ".tabBarPanel,children:", + find: ".tabBarPanel,{[", replacement: [ { match: /items:(\i),.+?(?=return\(0,\i\.jsxs?\)\("div)/, replace: "$&$self.pushSection($1,arguments[0].user);" }, { - match: /\.tabBarPanel,children:(?=.+?section:(\i))/, + match: /\.tabBarPanel,.+?children:(?=.+?section:(\i))/, replace: "$&$1==='MUTUAL_GDMS'?$self.renderMutualGDMs(arguments[0]):" }, // Make the gap between each item smaller so our tab can fit. diff --git a/src/plugins/showHiddenChannels/index.tsx b/src/plugins/showHiddenChannels/index.tsx index 755aa4530..e6acc0994 100644 --- a/src/plugins/showHiddenChannels/index.tsx +++ b/src/plugins/showHiddenChannels/index.tsx @@ -264,7 +264,7 @@ export default definePlugin({ replace: (m, channel) => `${m}if($self.isHiddenChannel(${channel}))break;` }, { - match: /(?<="renderHeaderBar",\i=>{.+?hideSearch:(\i)\.isDirectory\(\))/, + match: /(?<="renderHeaderBar",\(\)=>{.+?hideSearch:(\i)\.isDirectory\(\))/, replace: (_, channel) => `||$self.isHiddenChannel(${channel})` }, { diff --git a/src/plugins/showMeYourName/index.tsx b/src/plugins/showMeYourName/index.tsx index 5eca3a0b3..3700cef94 100644 --- a/src/plugins/showMeYourName/index.tsx +++ b/src/plugins/showMeYourName/index.tsx @@ -776,12 +776,21 @@ export default definePlugin({ replace: "$1$self.getMessageNameElement(arguments[0])??($2),\"data-text\":$self.getMessageNameText(arguments[0])??($3)" }, { - // Animate gradients for message authors. - match: /(let{setAnimate:\i}=(\i);)/, - replace: "$1if($2.animate){$self.addHoveringMessage(arguments[0].message.id)}else{$self.removeHoveringMessage(arguments[0].message.id)};" + // Pass the message object to the should-animate checker. + match: /(\(\{)(shouldSubscribe)/, + replace: "$1message:arguments[0].message,$2" } ] }, + { + find: /setAnimate.{0,50}\.ANIMATE_CHAT_AVATAR,/, + replacement: { + // Track hovering on messages to animate names since Discord's + // built-in hover tracking is buggy. Used by a patch below. + match: /(let{setAnimate:\i}=(\i);)/, + replace: "$1if(arguments[0].message){if($2.animate){$self.addHoveringMessage(arguments[0].message.id)}else{$self.removeHoveringMessage(arguments[0].message.id)}};" + } + }, { // Replace names in mentions. find: ".USER_MENTION)", @@ -810,9 +819,9 @@ export default definePlugin({ // Track hovering over second-level messages to animate gradients. // Tack on the groupId, which is how the client groups messages from // the same author together, to the message temporarily so that mentions - // across a group can animate together. By default, Discord handles this - // by animating the second-level message if you are hovering the first-level - // message, but not the other way around. This patch allows both. + // across a group can animate together. By default, Discord handles this, + // but moving between messages can cause a race condition where the animation + // stops on one of the messages in the group. This patch fixes that. find: "CUSTOM_GIFT?\"\":", replacement: { match: /(\(\i,\i,\i\);)(let \i=\i.id===\i(?:.{0,500}?)hovering:(\i))/,