Merge remote-tracking branch 'upstream/dev' into dev

This commit is contained in:
thororen1234 2025-12-06 17:28:46 -05:00
commit fbb4f5e120
No known key found for this signature in database
8 changed files with 69 additions and 16 deletions

View file

@ -1,7 +1,7 @@
{ {
"name": "equicord", "name": "equicord",
"private": "true", "private": "true",
"version": "1.13.6.4", "version": "1.13.7",
"description": "The other cutest Discord client mod", "description": "The other cutest Discord client mod",
"homepage": "https://github.com/Equicord/Equicord#readme", "homepage": "https://github.com/Equicord/Equicord#readme",
"bugs": { "bugs": {

View file

@ -2,7 +2,7 @@ import { CommandOption } from './Commands';
import { User, UserJSON } from '../User'; import { User, UserJSON } from '../User';
import { Embed, EmbedJSON } from './Embed'; import { Embed, EmbedJSON } from './Embed';
import { DiscordRecord } from "../Record"; import { DiscordRecord } from "../Record";
import { MessageFlags, MessageType, StickerFormatType } from "../../../enums"; import { ApplicationIntegrationType, MessageFlags, MessageType, StickerFormatType } from "../../../enums";
/* /*
* TODO: looks like discord has moved over to Date instead of Moment; * TODO: looks like discord has moved over to Date instead of Moment;
@ -71,6 +71,19 @@ export class Message extends DiscordRecord {
type: number; type: number;
version: string; version: string;
}[]; }[];
interactionMetadata?: {
id: string;
type: number;
name?: string;
command_type?: number;
ephemerality_reason?: number;
user: User;
authorizing_integration_owners: Record<ApplicationIntegrationType, string>;
original_response_message_id?: string;
interacted_message_id?: string;
target_user?: User;
target_message_id?: string;
};
interactionError: unknown[]; interactionError: unknown[];
isSearchHit: boolean; isSearchHit: boolean;
loggingName: unknown; loggingName: unknown;

View file

@ -1,7 +1,7 @@
{ {
"name": "@equicord/types", "name": "@equicord/types",
"private": false, "private": false,
"version": "1.13.6", "version": "1.13.7",
"description": "", "description": "",
"types": "index.d.ts", "types": "index.d.ts",
"scripts": { "scripts": {

View file

@ -26,6 +26,21 @@ const toastFailure = (err: any) =>
const logger = new Logger("SettingsSync:Offline", "#39b7e0"); const logger = new Logger("SettingsSync:Offline", "#39b7e0");
function isSafeObject(obj: any) {
if (obj == null || typeof obj !== "object") return true;
for (const key in obj) {
if (["__proto__", "constructor", "prototype"].includes(key)) {
return false;
}
if (!isSafeObject(obj[key])) {
return false;
}
}
return true;
}
export async function importSettings(data: string) { export async function importSettings(data: string) {
try { try {
var parsed = JSON.parse(data); var parsed = JSON.parse(data);
@ -34,6 +49,9 @@ export async function importSettings(data: string) {
throw new Error("Failed to parse JSON: " + String(err)); throw new Error("Failed to parse JSON: " + String(err));
} }
if (!isSafeObject(parsed))
throw new Error("Unsafe Settings");
if ("settings" in parsed && "quickCss" in parsed) { if ("settings" in parsed && "quickCss" in parsed) {
Object.assign(PlainSettings, parsed.settings); Object.assign(PlainSettings, parsed.settings);
await VencordNative.settings.set(parsed.settings); await VencordNative.settings.set(parsed.settings);

View file

@ -17,6 +17,11 @@
*/ */
import { definePluginSettings } from "@api/Settings"; import { definePluginSettings } from "@api/Settings";
import { LinkButton } from "@components/Button";
import { Card } from "@components/Card";
import { Heading } from "@components/Heading";
import { Margins } from "@components/margins";
import { Paragraph } from "@components/Paragraph";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import { Logger } from "@utils/Logger"; import { Logger } from "@utils/Logger";
import definePlugin, { OptionType } from "@utils/types"; import definePlugin, { OptionType } from "@utils/types";
@ -63,6 +68,10 @@ function setActivity(activity: Activity | null) {
} }
const settings = definePluginSettings({ const settings = definePluginSettings({
apiKey: {
description: "Custom Last.fm API key. Not required but highly recommended to avoid rate limiting with our shared key",
type: OptionType.STRING,
},
username: { username: {
description: "Last.fm username", description: "Last.fm username",
type: OptionType.STRING, type: OptionType.STRING,
@ -172,10 +181,6 @@ const settings = definePluginSettings({
type: OptionType.BOOLEAN, type: OptionType.BOOLEAN,
default: false, default: false,
}, },
apiKey: {
description: "Custom Last.fm API key. You shouldn't need to set this",
type: OptionType.STRING,
},
}); });
export default definePlugin({ export default definePlugin({
@ -185,6 +190,16 @@ export default definePlugin({
settings, settings,
settingsAboutComponent() {
return (
<Card>
<Heading tag="h5">How to create an API key</Heading>
<Paragraph>Set <strong>Application name</strong> and <strong>Application description</strong> to anything and leave the rest blank.</Paragraph>
<LinkButton size="small" href="https://www.last.fm/api/account/create" className={Margins.top8}>Create API Key</LinkButton>
</Card>
);
},
start() { start() {
this.updatePresence(); this.updatePresence();
updateInterval = setInterval(() => { this.updatePresence(); }, 16000); updateInterval = setInterval(() => { this.updatePresence(); }, 16000);

View file

@ -21,9 +21,9 @@ import { definePluginSettings } from "@api/Settings";
import NoReplyMentionPlugin from "@plugins/noReplyMention"; import NoReplyMentionPlugin from "@plugins/noReplyMention";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types"; import definePlugin, { OptionType } from "@utils/types";
import { MessageFlags } from "@vencord/discord-types/enums"; import { ApplicationIntegrationType, MessageFlags } from "@vencord/discord-types/enums";
import { findByPropsLazy } from "@webpack"; import { findByPropsLazy } from "@webpack";
import { FluxDispatcher, MessageTypeSets, PermissionsBits, PermissionStore, UserStore, WindowStore } from "@webpack/common"; import { AuthenticationStore, FluxDispatcher, MessageTypeSets, PermissionsBits, PermissionStore, WindowStore } from "@webpack/common";
const MessageActions = findByPropsLazy("deleteMessage", "startEditMessage"); const MessageActions = findByPropsLazy("deleteMessage", "startEditMessage");
const EditStore = findByPropsLazy("isEditing", "isEditingAny"); const EditStore = findByPropsLazy("isEditing", "isEditingAny");
@ -76,7 +76,9 @@ export default definePlugin({
}, },
onMessageClick(msg, channel, event) { onMessageClick(msg, channel, event) {
const isMe = msg.author.id === UserStore.getCurrentUser().id; const myId = AuthenticationStore.getId();
const isMe = msg.author.id === myId;
const isSelfInvokedUserApp = msg.interactionMetadata?.authorizing_integration_owners[ApplicationIntegrationType.USER_INSTALL] === myId;
if (!isDeletePressed) { if (!isDeletePressed) {
if (event.detail < 2) return; if (event.detail < 2) return;
if (settings.store.requireModifier && !event.ctrlKey && !event.shiftKey) return; if (settings.store.requireModifier && !event.ctrlKey && !event.shiftKey) return;
@ -106,7 +108,7 @@ export default definePlugin({
showMentionToggle: channel.guild_id !== null showMentionToggle: channel.guild_id !== null
}); });
} }
} else if (settings.store.enableDeleteOnClick && (isMe || PermissionStore.can(PermissionsBits.MANAGE_MESSAGES, channel))) { } else if (settings.store.enableDeleteOnClick && (isMe || PermissionStore.can(PermissionsBits.MANAGE_MESSAGES, channel) || isSelfInvokedUserApp)) {
if (msg.deleted) { if (msg.deleted) {
FluxDispatcher.dispatch({ FluxDispatcher.dispatch({
type: "MESSAGE_DELETE", type: "MESSAGE_DELETE",

View file

@ -483,11 +483,11 @@ export default definePlugin({
// Filter hidden channels from GuildChannelStore.getChannels unless told otherwise // Filter hidden channels from GuildChannelStore.getChannels unless told otherwise
match: /(?<=getChannels\(\i)(\){.*?)return (.+?)}/, match: /(?<=getChannels\(\i)(\){.*?)return (.+?)}/,
replace: (_, rest, channels) => `,shouldIncludeHidden${rest}return $self.resolveGuildChannels(${channels},shouldIncludeHidden??arguments[0]==="@favorites");}` replace: (_, rest, channels) => `,shouldIncludeHidden${rest}return $self.resolveGuildChannels(${channels},shouldIncludeHidden??arguments[0]==="@favorites");}`
} },
] ]
}, },
{ {
find: "#{intl::FORM_LABEL_MUTED}", find: ".invitesDisabledTooltip",
replacement: { replacement: {
// Make GuildChannelStore.getChannels return hidden channels // Make GuildChannelStore.getChannels return hidden channels
match: /(?<=getChannels\(\i)(?=\))/, match: /(?<=getChannels\(\i)(?=\))/,

View file

@ -52,7 +52,7 @@ export const useDrag = findByCodeLazy("useDrag::spec.begin was deprecated");
// you cant make a better finder i love that they remove display names sm // you cant make a better finder i love that they remove display names sm
export const useDrop = findByCodeLazy(".options);return", ".collect,"); export const useDrop = findByCodeLazy(".options);return", ".collect,");
export const { match, P }: Pick<typeof TSPattern, "match" | "P"> = mapMangledModuleLazy("@ts-pattern/matcher", { export const { match, P }: { match: typeof TSPattern["match"], P: typeof TSPattern["P"]; } = mapMangledModuleLazy("@ts-pattern/matcher", {
match: filters.byCode("return new"), match: filters.byCode("return new"),
P: filters.byProps("when") P: filters.byProps("when")
}); });
@ -175,6 +175,11 @@ export const { zustandPersist } = mapMangledModuleLazy(".onRehydrateStorage)?",
zustandPersist: filters.byCode(/(\(\i,\i\))=>.+?\i\1/) zustandPersist: filters.byCode(/(\(\i,\i\))=>.+?\i\1/)
}); });
export const { openUserSettings } = findByPropsLazy("openUserSettings");
export function openUserSettingsPanel(panel: string) {
openUserSettings(panel + "_panel");
}
export const MessageActions = findByPropsLazy("editMessage", "sendMessage"); export const MessageActions = findByPropsLazy("editMessage", "sendMessage");
export const MessageCache = findByPropsLazy("clearCache", "_channelMessages"); export const MessageCache = findByPropsLazy("clearCache", "_channelMessages");
export const UserProfileActions = findByPropsLazy("openUserProfileModal", "closeUserProfileModal"); export const UserProfileActions = findByPropsLazy("openUserProfileModal", "closeUserProfileModal");