Merge remote-tracking branch 'upstream/dev' into dev
This commit is contained in:
commit
b0555266f9
5 changed files with 28 additions and 20 deletions
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "equicord",
|
||||
"private": "true",
|
||||
"version": "1.12.4",
|
||||
"version": "1.12.5",
|
||||
"description": "The other cutest Discord client mod",
|
||||
"homepage": "https://github.com/Equicord/Equicord#readme",
|
||||
"bugs": {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ export default definePlugin({
|
|||
{
|
||||
find: "#{intl::MESSAGE_UTILITIES_A11Y_LABEL}",
|
||||
replacement: {
|
||||
match: /(?<=:null),(.{0,40}togglePopout:.+?}\)),(.+?)\]}\):null,(?<=\((\i\.\i),{label:.+?:null,(\i&&!\i)\?\(0,\i\.jsxs?\)\(\i\.Fragment.+?message:(\i).+?)/,
|
||||
match: /(?<=:null),(.{0,40}togglePopout:.+?}\)),(.+?)\]}\):null,(?<=\((\i\.\i),{label:.+?children:\[(\i&&!\i)\?\(0,\i\.jsxs?\)\(\i\.Fragment.+?message:(\i).+?)/,
|
||||
replace: (_, ReactButton, PotionButton, ButtonComponent, showReactButton, message) => "" +
|
||||
`]}):null,Vencord.Api.MessagePopover._buildPopoverElements(${ButtonComponent},${message}),${showReactButton}?${ReactButton}:null,${showReactButton}&&${PotionButton},`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ interface RemoteData {
|
|||
let cachedRemoteData: { id: string, data: RemoteData; } | { id: string, failures: number; } | null = null;
|
||||
|
||||
const APPLE_MUSIC_BUNDLE_REGEX = /<script type="module" crossorigin src="([a-zA-Z0-9.\-/]+)"><\/script>/;
|
||||
const APPLE_MUSIC_TOKEN_REGEX = canonicalizeMatch(/Promise.allSettled\(\i\)\}const \i="([A-Za-z0-9-_]*\.[A-Za-z0-9-_]*\.[A-Za-z0-9-_]*)"/);
|
||||
const APPLE_MUSIC_TOKEN_REGEX = canonicalizeMatch(/\b(\i)="([A-Za-z0-9-_]*\.[A-Za-z0-9-_]*\.[A-Za-z0-9-_]*)"(?=.+?Bearer \$\{\1\})/);
|
||||
|
||||
let cachedToken: string | undefined = undefined;
|
||||
|
||||
|
|
@ -38,7 +38,7 @@ const getToken = async () => {
|
|||
const bundleUrl = new URL(html.match(APPLE_MUSIC_BUNDLE_REGEX)![1], "https://music.apple.com/");
|
||||
|
||||
const bundle = await fetch(bundleUrl).then(r => r.text());
|
||||
const token = bundle.match(APPLE_MUSIC_TOKEN_REGEX)![1];
|
||||
const token = bundle.match(APPLE_MUSIC_TOKEN_REGEX)![2];
|
||||
|
||||
cachedToken = token;
|
||||
return token;
|
||||
|
|
|
|||
|
|
@ -69,26 +69,29 @@ function TypingIndicator({ channelId, guildId }: { channelId: string; guildId: s
|
|||
|
||||
const myId = UserStore.getCurrentUser()?.id;
|
||||
|
||||
const typingUsersArray = Object.keys(typingUsers).filter(id => id !== myId && !(RelationshipStore.isBlocked(id) && !settings.store.includeBlockedUsers));
|
||||
const typingUsersArray = Object.keys(typingUsers).filter(id =>
|
||||
id !== myId && !(RelationshipStore.isBlocked(id) && !settings.store.includeBlockedUsers)
|
||||
);
|
||||
const [a, b, c] = typingUsersArray;
|
||||
let tooltipText: string;
|
||||
|
||||
switch (typingUsersArray.length) {
|
||||
case 0: break;
|
||||
case 1: {
|
||||
tooltipText = getIntlMessage("ONE_USER_TYPING", { a: getDisplayName(guildId, typingUsersArray[0]) });
|
||||
tooltipText = getIntlMessage("ONE_USER_TYPING", { a: getDisplayName(guildId, a) });
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
tooltipText = getIntlMessage("TWO_USERS_TYPING", { a: getDisplayName(guildId, typingUsersArray[0]), b: getDisplayName(guildId, typingUsersArray[1]) });
|
||||
tooltipText = getIntlMessage("TWO_USERS_TYPING", { a: getDisplayName(guildId, a), b: getDisplayName(guildId, b) });
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
tooltipText = getIntlMessage("THREE_USERS_TYPING", { a: getDisplayName(guildId, typingUsersArray[0]), b: getDisplayName(guildId, typingUsersArray[1]), c: getDisplayName(guildId, typingUsersArray[2]) });
|
||||
tooltipText = getIntlMessage("THREE_USERS_TYPING", { a: getDisplayName(guildId, a), b: getDisplayName(guildId, b), c: getDisplayName(guildId, c) });
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
tooltipText = Settings.plugins.TypingTweaks.enabled
|
||||
? buildSeveralUsers({ a: getDisplayName(guildId, typingUsersArray[0]), b: getDisplayName(guildId, typingUsersArray[1]), count: typingUsersArray.length - 2 })
|
||||
? buildSeveralUsers({ a: UserStore.getUser(a), b: UserStore.getUser(b), count: typingUsersArray.length - 2, guildId })
|
||||
: getIntlMessage("SEVERAL_USERS_TYPING");
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,14 +46,17 @@ const settings = definePluginSettings({
|
|||
}
|
||||
});
|
||||
|
||||
export function buildSeveralUsers({ a, b, count }: { a: string, b: string, count: number; }) {
|
||||
return [
|
||||
<strong key="0">{a}</strong>,
|
||||
", ",
|
||||
<strong key="1">{b}</strong>,
|
||||
`, and ${count} others are typing...`
|
||||
];
|
||||
}
|
||||
export const buildSeveralUsers = ErrorBoundary.wrap(({ a, b, count, guildId }: { a: User, b: User, count: number; guildId: string; }) => {
|
||||
return (
|
||||
<>
|
||||
<TypingUser user={a} guildId={guildId} />
|
||||
{", "}
|
||||
<TypingUser user={b} guildId={guildId} />
|
||||
{", "}
|
||||
and {count} others are typing...
|
||||
</>
|
||||
);
|
||||
}, { noop: true });
|
||||
|
||||
interface Props {
|
||||
user: User;
|
||||
|
|
@ -108,11 +111,12 @@ export default definePlugin({
|
|||
patches: [
|
||||
{
|
||||
find: "#{intl::THREE_USERS_TYPING}",
|
||||
group: true,
|
||||
replacement: [
|
||||
{
|
||||
// Style the indicator and add function call to modify the children before rendering
|
||||
match: /(?<=children:\[(\i)\.length>0.{0,200}?"aria-atomic":!0,children:)\i(?<=guildId:(\i).+?)/,
|
||||
replace: "$self.renderTypingUsers({ users: $1, guildId: $2, children: $& })"
|
||||
match: /(?<=children:\[(\i)\.length>0.{0,300}?"aria-atomic":!0,children:)\i/,
|
||||
replace: "$self.renderTypingUsers({ users: $1, guildId: arguments[0]?.channel?.guild_id, children: $& })"
|
||||
},
|
||||
{
|
||||
// Changes the indicator to keep the user object when creating the list of typing users
|
||||
|
|
@ -122,7 +126,8 @@ export default definePlugin({
|
|||
{
|
||||
// Adds the alternative formatting for several users typing
|
||||
match: /(,{a:(\i),b:(\i),c:\i}\):\i\.length>3&&\(\i=)\i\.\i\.string\(\i\.\i#{intl::SEVERAL_USERS_TYPING}\)(?<=(\i)\.length.+?)/,
|
||||
replace: (_, rest, a, b, users) => `${rest}$self.buildSeveralUsers({ a: ${a}, b: ${b}, count: ${users}.length - 2 })`,
|
||||
replace: (_, rest, a, b, users) =>
|
||||
`${rest}$self.buildSeveralUsers({ a: ${a}, b: ${b}, count: ${users}.length - 2, channel: arguments[0]?.channel?.guild_id })`,
|
||||
predicate: () => settings.store.alternativeFormatting
|
||||
}
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue