mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-20 03:47:01 -04:00
Merge remote-tracking branch 'upstream/dev' into dev
This commit is contained in:
commit
a1cc1bb826
15 changed files with 590 additions and 823 deletions
|
@ -22,7 +22,7 @@ import ErrorBoundary from "@components/ErrorBoundary";
|
|||
import { Flex } from "@components/Flex";
|
||||
import { Link } from "@components/Link";
|
||||
import { openUpdaterModal } from "@components/VencordSettings/UpdaterTab";
|
||||
import { CONTRIB_ROLE_ID, Devs, DONOR_ROLE_ID, EQUIBOP_CONTRIB_ROLE_ID, EQUICORD_TEAM, GUILD_ID, SUPPORT_CHANNEL_ID, SUPPORT_CHANNEL_IDS, VC_CONTRIB_ROLE_ID, VC_DONOR_ROLE_ID, VC_GUILD_ID, VC_KNOWN_ISSUES_CHANNEL_ID, VC_REGULAR_ROLE_ID, VC_SUPPORT_CHANNEL_ID, VENBOT_USER_ID, VENCORD_CONTRIB_ROLE_ID } from "@utils/constants";
|
||||
import { CONTRIB_ROLE_ID, Devs, DONOR_ROLE_ID, EQUCORD_HELPERS, EQUIBOP_CONTRIB_ROLE_ID, EQUICORD_TEAM, GUILD_ID, SUPPORT_CHANNEL_ID, VC_CONTRIB_ROLE_ID, VC_DONOR_ROLE_ID, VC_GUILD_ID, VC_REGULAR_ROLE_ID, VC_SUPPORT_CHANNEL_ID, VENCORD_CONTRIB_ROLE_ID } from "@utils/constants";
|
||||
import { sendMessage } from "@utils/discord";
|
||||
import { Logger } from "@utils/Logger";
|
||||
import { Margins } from "@utils/margins";
|
||||
|
@ -32,7 +32,7 @@ import { onlyOnce } from "@utils/onlyOnce";
|
|||
import { makeCodeblock } from "@utils/text";
|
||||
import definePlugin from "@utils/types";
|
||||
import { checkForUpdates, isOutdated, update } from "@utils/updater";
|
||||
import { Alerts, Button, Card, ChannelStore, Forms, GuildMemberStore, Parser, RelationshipStore, showToast, Text, Toasts, UserStore } from "@webpack/common";
|
||||
import { Alerts, Button, Card, ChannelStore, Forms, GuildMemberStore, Parser, PermissionsBits, PermissionStore, RelationshipStore, showToast, Text, Toasts, UserStore } from "@webpack/common";
|
||||
import { JSX } from "react";
|
||||
|
||||
import gitHash from "~git-hash";
|
||||
|
@ -196,7 +196,8 @@ export default definePlugin({
|
|||
|
||||
flux: {
|
||||
async CHANNEL_SELECT({ channelId }) {
|
||||
if (!SUPPORT_CHANNEL_IDS.includes(channelId)) return;
|
||||
const isSupportChannel = channelId === SUPPORT_CHANNEL_ID;
|
||||
if (!isSupportChannel) return;
|
||||
|
||||
const selfId = UserStore.getCurrentUser()?.id;
|
||||
if (!selfId || isPluginDev(selfId) || isEquicordPluginDev(selfId)) return;
|
||||
|
@ -281,11 +282,12 @@ export default definePlugin({
|
|||
renderMessageAccessory(props) {
|
||||
const buttons = [] as JSX.Element[];
|
||||
|
||||
const equicordSupport = GuildMemberStore.getMember(GUILD_ID, props.message.author.id)?.roles?.includes(EQUCORD_HELPERS);
|
||||
|
||||
const shouldAddUpdateButton =
|
||||
!IS_UPDATER_DISABLED
|
||||
&& (
|
||||
(props.channel.id === VC_KNOWN_ISSUES_CHANNEL_ID) ||
|
||||
(props.channel.id === VC_SUPPORT_CHANNEL_ID && props.message.author.id === VENBOT_USER_ID)
|
||||
(props.channel.id === SUPPORT_CHANNEL_ID && equicordSupport)
|
||||
)
|
||||
&& props.message.content?.includes("update");
|
||||
|
||||
|
@ -311,7 +313,7 @@ export default definePlugin({
|
|||
);
|
||||
}
|
||||
|
||||
if (props.channel.id === SUPPORT_CHANNEL_ID) {
|
||||
if (props.channel.id === SUPPORT_CHANNEL_ID && PermissionStore.can(PermissionsBits.SEND_MESSAGES, props.channel)) {
|
||||
if (props.message.content.includes("/equicord-debug") || props.message.content.includes("/equicord-plugins")) {
|
||||
buttons.push(
|
||||
<Button
|
||||
|
@ -334,7 +336,7 @@ export default definePlugin({
|
|||
);
|
||||
}
|
||||
|
||||
if (props.message.author.id === VENBOT_USER_ID) {
|
||||
if (equicordSupport) {
|
||||
const match = CodeBlockRe.exec(props.message.content || props.message.embeds[0]?.rawDescription || "");
|
||||
if (match) {
|
||||
buttons.push(
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Vencord, a modification for Discord's desktop app
|
||||
* Copyright (c) 2022 Vendicated and contributors
|
||||
* Copyright (c) 2025 Vendicated and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -26,17 +26,16 @@ export default definePlugin({
|
|||
patches: [
|
||||
{
|
||||
find: ".nsfwAllowed=null",
|
||||
replacement: {
|
||||
match: /(?<=\.nsfwAllowed=)null!==.+?(?=[,;])/,
|
||||
replace: "!0",
|
||||
},
|
||||
},
|
||||
{
|
||||
find: ".ageVerificationStatus=null",
|
||||
replacement: {
|
||||
match: /(?<=\.ageVerificationStatus=)null!==.+?(?=[,;])/,
|
||||
replace: "3",
|
||||
},
|
||||
},
|
||||
replacement: [
|
||||
{
|
||||
match: /(?<=\.nsfwAllowed=)null!==.+?(?=[,;])/,
|
||||
replace: "true",
|
||||
},
|
||||
{
|
||||
match: /(?<=\.ageVerificationStatus=)null!==.+?(?=[,;])/,
|
||||
replace: "3", // VERIFIED_ADULT
|
||||
}
|
||||
],
|
||||
}
|
||||
],
|
||||
});
|
||||
|
|
|
@ -30,12 +30,12 @@ export default definePlugin({
|
|||
// the second is the four guild preview icons
|
||||
// always show this one (the plain icons)
|
||||
{
|
||||
match: /\(\w\|\|\w\)&&(\(.{0,40}\(.{1,3}\.animated)/,
|
||||
match: /\(\i\|\|\i\)&&(\(.{0,40}\(\i\.animated)/,
|
||||
replace: "$1",
|
||||
},
|
||||
// and never show this one (the guild preview icons)
|
||||
{
|
||||
match: /\(\w\|\|!\w\)&&(\(.{0,40}\(.{1,3}\.animated)/,
|
||||
match: /\(\i\|\|!\i\)&&(\(.{0,40}\(\i\.animated)/,
|
||||
replace: "false&&$1",
|
||||
}
|
||||
]
|
||||
|
|
|
@ -310,7 +310,6 @@ function Info({ track }: { track: Track; }) {
|
|||
{track.artists.some(a => a.name) && (
|
||||
<Forms.FormText variant="text-sm/normal" className={cl(["ellipoverflow", "secondary-song-info"])}>
|
||||
<span className={cl("song-info-prefix")}>by </span>
|
||||
by
|
||||
{track.artists.map((a, i) => (
|
||||
<React.Fragment key={a.name}>
|
||||
<span
|
||||
|
@ -329,7 +328,6 @@ function Info({ track }: { track: Track; }) {
|
|||
{track.album.name && (
|
||||
<Forms.FormText variant="text-sm/normal" className={cl(["ellipoverflow", "secondary-song-info"])}>
|
||||
<span className={cl("song-info-prefix")}>on </span>
|
||||
on
|
||||
<span
|
||||
id={cl("album-title")}
|
||||
className={cl("album")}
|
||||
|
|
|
@ -12,8 +12,7 @@
|
|||
display: none;
|
||||
}
|
||||
|
||||
.vc-spotify-artist,
|
||||
.vc-spotify-album {
|
||||
.vc-spotify-artist, .vc-spotify-album {
|
||||
color: var(--header-primary);
|
||||
}
|
||||
|
||||
|
@ -27,26 +26,26 @@
|
|||
width: 100%;
|
||||
}
|
||||
|
||||
#vc-spotify-progress-bar>[class^="slider"] {
|
||||
#vc-spotify-progress-bar > [class^="slider"] {
|
||||
flex-grow: 1;
|
||||
width: 100%;
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
#vc-spotify-progress-bar>[class^="slider"] [class^="bar"] {
|
||||
#vc-spotify-progress-bar > [class^="slider"] [class^="bar"] {
|
||||
height: 3px !important;
|
||||
top: calc(12px - 4px / 2 + var(--bar-offset));
|
||||
}
|
||||
|
||||
#vc-spotify-progress-bar>[class^="slider"] [class^="barFill"] {
|
||||
#vc-spotify-progress-bar > [class^="slider"] [class^="barFill"] {
|
||||
background-color: var(--interactive-active);
|
||||
}
|
||||
|
||||
#vc-spotify-progress-bar>[class^="slider"]:hover [class^="barFill"] {
|
||||
#vc-spotify-progress-bar > [class^="slider"]:hover [class^="barFill"] {
|
||||
background-color: var(--vc-spotify-green);
|
||||
}
|
||||
|
||||
#vc-spotify-progress-bar>[class^="slider"] [class^="grabber"] {
|
||||
#vc-spotify-progress-bar > [class^="slider"] [class^="grabber"] {
|
||||
background-color: var(--interactive-active);
|
||||
width: 16px !important;
|
||||
height: 16px !important;
|
||||
|
@ -68,15 +67,11 @@
|
|||
border-radius: var(--radius-sm);
|
||||
}
|
||||
|
||||
.vc-spotify-repeat-context,
|
||||
.vc-spotify-repeat-track,
|
||||
.vc-spotify-shuffle-on {
|
||||
.vc-spotify-repeat-context, .vc-spotify-repeat-track, .vc-spotify-shuffle-on {
|
||||
background-color: var(--vc-spotify-green-90);
|
||||
}
|
||||
|
||||
.vc-spotify-repeat-context:hover,
|
||||
.vc-spotify-repeat-track:hover,
|
||||
.vc-spotify-shuffle-on:hover {
|
||||
.vc-spotify-repeat-context:hover, .vc-spotify-repeat-track:hover, .vc-spotify-shuffle-on:hover {
|
||||
background-color: var(--vc-spotify-green-80);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ export default definePlugin({
|
|||
],
|
||||
|
||||
getAvatarStyles(src: string | null) {
|
||||
if (src == null || src.startsWith("data:")) return {};
|
||||
if (!src || src.startsWith("data:")) return {};
|
||||
|
||||
return Object.fromEntries(
|
||||
[128, 256, 512, 1024, 2048, 4096].map(size => [
|
||||
|
|
|
@ -53,13 +53,16 @@ const settings = definePluginSettings({
|
|||
addBack: {
|
||||
type: OptionType.BOOLEAN,
|
||||
description: "Add back the Discord context menus for images, links and the chat input bar",
|
||||
default: false,
|
||||
restartNeeded: true,
|
||||
// Web slate menu has proper spellcheck suggestions and image context menu is also pretty good,
|
||||
// so disable this by default. Vesktop just doesn't, so enable by default
|
||||
default: result,
|
||||
restartNeeded: true
|
||||
// so disable this by default. Vesktop just doesn't, so we force enable it there
|
||||
hidden: result,
|
||||
}
|
||||
});
|
||||
|
||||
const shouldAddBackMenus = () => result || settings.store.addBack;
|
||||
|
||||
const MEDIA_PROXY_URL = "https://media.discordapp.net";
|
||||
const CDN_URL = "cdn.discordapp.com";
|
||||
|
||||
|
@ -92,7 +95,7 @@ export default definePlugin({
|
|||
settings,
|
||||
|
||||
start() {
|
||||
if (settings.store.addBack) {
|
||||
if (shouldAddBackMenus()) {
|
||||
window.removeEventListener("contextmenu", ctxMenuCallbacks.contextMenuCallbackWeb);
|
||||
window.addEventListener("contextmenu", ctxMenuCallbacks.contextMenuCallbackNative);
|
||||
this.changedListeners = true;
|
||||
|
@ -155,7 +158,7 @@ export default definePlugin({
|
|||
{
|
||||
find: 'navId:"image-context"',
|
||||
all: true,
|
||||
predicate: () => settings.store.addBack,
|
||||
predicate: shouldAddBackMenus,
|
||||
replacement: {
|
||||
// return IS_DESKTOP ? React.createElement(Menu, ...)
|
||||
match: /return \i\.\i(?=\?|&&)/,
|
||||
|
@ -166,7 +169,7 @@ export default definePlugin({
|
|||
// Add back link context menu
|
||||
{
|
||||
find: '"interactionUsernameProfile"',
|
||||
predicate: () => settings.store.addBack,
|
||||
predicate: shouldAddBackMenus,
|
||||
replacement: {
|
||||
match: /if\((?="A"===\i\.tagName&&""!==\i\.textContent)/,
|
||||
replace: "if(false&&"
|
||||
|
@ -176,7 +179,7 @@ export default definePlugin({
|
|||
// Add back slate / text input context menu
|
||||
{
|
||||
find: 'getElementById("slate-toolbar"',
|
||||
predicate: () => settings.store.addBack,
|
||||
predicate: shouldAddBackMenus,
|
||||
replacement: {
|
||||
match: /(?<=handleContextMenu\(\i\)\{.{0,200}isPlatformEmbedded)\)/,
|
||||
replace: "||true)"
|
||||
|
@ -184,7 +187,7 @@ export default definePlugin({
|
|||
},
|
||||
{
|
||||
find: ".SLASH_COMMAND_SUGGESTIONS_TOGGLED,{",
|
||||
predicate: () => settings.store.addBack,
|
||||
predicate: shouldAddBackMenus,
|
||||
replacement: [
|
||||
{
|
||||
// if (!IS_DESKTOP) return null;
|
||||
|
@ -200,7 +203,7 @@ export default definePlugin({
|
|||
},
|
||||
{
|
||||
find: '"add-to-dictionary"',
|
||||
predicate: () => settings.store.addBack,
|
||||
predicate: shouldAddBackMenus,
|
||||
replacement: {
|
||||
match: /let\{text:\i=""/,
|
||||
replace: "return [null,null];$&"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue