Merge branch 'dev'
This commit is contained in:
commit
e2ca7935b3
8 changed files with 36 additions and 42 deletions
5
.github/workflows/publish.yml
vendored
5
.github/workflows/publish.yml
vendored
|
|
@ -4,6 +4,11 @@ on:
|
|||
branches:
|
||||
- main
|
||||
|
||||
env:
|
||||
FORCE_COLOR: true
|
||||
|
||||
permissions: write-all
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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){"
|
||||
}
|
||||
],
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 (
|
||||
<Forms.FormSection>
|
||||
<Forms.FormTitle tag="h3">Filter List</Forms.FormTitle>
|
||||
<Forms.FormText className={Margins.bottom8}>Always allow loggers of these types</Forms.FormText>
|
||||
<Flex flexDirection="row">
|
||||
<SettingsSection name="Filter List" description="Always allow loggers of these types">
|
||||
<div style={{ display: "flex", flexDirection: "row" }}>
|
||||
{Object.keys(settings.store.allowLevel).map(key => (
|
||||
<AllowLevelSetting key={key} settingKey={key as keyof AllowLevels} />
|
||||
))}
|
||||
</Flex>
|
||||
</Forms.FormSection>
|
||||
</div>
|
||||
</SettingsSection>
|
||||
);
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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})`
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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))/,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue