Skip to content

Commit

Permalink
Merge branch 'dev' into sqaaakoi-stable-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
Sqaaakoi committed Oct 25, 2024
2 parents b5e062d + f5f59be commit 06df26b
Show file tree
Hide file tree
Showing 21 changed files with 184 additions and 101 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vencord",
"private": "true",
"version": "1.10.4",
"version": "1.10.5",
"description": "The cutest Discord client mod",
"homepage": "https://github.com/Vendicated/Vencord#readme",
"bugs": {
Expand Down
24 changes: 24 additions & 0 deletions src/plugins/_api/dynamicImageModalApi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Vencord, a Discord client mod
* Copyright (c) 2024 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/

import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";


export default definePlugin({
name: "DynamicImageModalAPI",
authors: [Devs.sadan, Devs.Nuckyz],
description: "Allows you to omit either width or height when opening an image modal",
patches: [
{
find: "SCALE_DOWN:",
replacement: {
match: /!\(null==(\i)\|\|0===\i\|\|null==(\i)\|\|0===\i\)/,
replace: (_, width, height) => `!((null == ${width} || 0 === ${width}) && (null == ${height} || 0 === ${height}))`
}
}
]
});
2 changes: 1 addition & 1 deletion src/plugins/_core/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ export default definePlugin({
},

get electronVersion() {
return VencordNative.native.getVersions().electron || window.armcord?.electron || null;
return VencordNative.native.getVersions().electron || window.legcord?.electron || null;
},

get chromiumVersion() {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/_core/supportHelper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ async function generateDebugInfoMessage() {
const client = (() => {
if (IS_DISCORD_DESKTOP) return `Discord Desktop v${DiscordNative.app.getVersion()}`;
if (IS_VESKTOP) return `Vesktop v${VesktopNative.app.getVersion()}`;
if ("armcord" in window) return `ArmCord v${window.armcord.version}`;
if ("legcord" in window) return `Legcord v${window.legcord.version}`;

// @ts-expect-error
const name = typeof unsafeWindow !== "undefined" ? "UserScript" : "Web";
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/arRPC.web/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ export default definePlugin({
},

async start() {
// ArmCord comes with its own arRPC implementation, so this plugin just confuses users
if ("armcord" in window) return;
// Legcord comes with its own arRPC implementation, so this plugin just confuses users
if ("legcord" in window) return;

if (ws) ws.close();
ws = new WebSocket("ws://127.0.0.1:1337"); // try to open WebSocket
Expand Down
6 changes: 5 additions & 1 deletion src/plugins/betterRoleContext/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,11 @@ export default definePlugin({
id="vc-view-role-icon"
label="View Role Icon"
action={() => {
openImageModal(`${location.protocol}//${window.GLOBAL_ENV.CDN_HOST}/role-icons/${role.id}/${role.icon}.${settings.store.roleIconFileFormat}`);
openImageModal({
url: `${location.protocol}//${window.GLOBAL_ENV.CDN_HOST}/role-icons/${role.id}/${role.icon}.${settings.store.roleIconFileFormat}`,
height: 128,
width: 128
});
}}
icon={ImageIcon}
/>
Expand Down
6 changes: 5 additions & 1 deletion src/plugins/biggerStreamPreview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ export const handleViewPreview = async ({ guildId, channelId, ownerId }: Applica
const previewUrl = await ApplicationStreamPreviewStore.getPreviewURL(guildId, channelId, ownerId);
if (!previewUrl) return;

openImageModal(previewUrl);
openImageModal({
url: previewUrl,
height: 720,
width: 1280
});
};

export const addViewStreamContext: NavContextMenuPatchCallback = (children, { userId }: { userId: string | bigint; }) => {
Expand Down
7 changes: 7 additions & 0 deletions src/plugins/consoleJanitor/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ export default definePlugin({
},

patches: [
{
find: 'react-spring: The "interpolate" function',
replacement: {
match: /,console.warn\('react-spring: The "interpolate" function is deprecated in v10 \(use "to" instead\)'\)/,
replace: ""
}
},
{
find: 'console.warn("Window state not initialized"',
replacement: {
Expand Down
27 changes: 13 additions & 14 deletions src/plugins/imageZoom/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,10 @@ export default definePlugin({

patches: [
{
find: "Messages.OPEN_IN_BROWSER",
find: ".contain,SCALE_DOWN:",
replacement: {
// there are 2 image thingies. one for carosuel and one for the single image.
// so thats why i added global flag.
// also idk if this patch is good, should it be more specific?
// https://regex101.com/r/xfvNvV/1
match: /return.{1,200}\.wrapper.{1,200}src:\i,/g,
replace: `$&id: '${ELEMENT_ID}',`
match: /\.slide,\i\),/g,
replace: `$&id:"${ELEMENT_ID}",`
}
},

Expand All @@ -183,15 +179,13 @@ export default definePlugin({
{
match: /componentWillUnmount\(\){/,
replace: "$&$self.unMountMagnifier();"
},

{
match: /componentDidUpdate\(\i\){/,
replace: "$&$self.updateMagnifier(this);"
}
]
},
{
find: ".carouselModal",
replacement: {
match: /(?<=\.carouselModal.{0,100}onClick:)\i,/,
replace: "()=>{},"
}
}
],

Expand Down Expand Up @@ -226,6 +220,11 @@ export default definePlugin({
}
},

updateMagnifier(instance) {
this.unMountMagnifier();
this.renderMagnifier(instance);
},

unMountMagnifier() {
this.root?.unmount();
this.currentMagnifierElement = null;
Expand Down
9 changes: 0 additions & 9 deletions src/plugins/imageZoom/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,3 @@

/* https://googlechrome.github.io/samples/image-rendering-pixelated/index.html */
}

/* make the carousel take up less space so we can click the backdrop and exit out of it */
[class*="modalCarouselWrapper_"] {
top: 0 !important;
}

[class*="carouselModal_"] {
height: 0 !important;
}
11 changes: 5 additions & 6 deletions src/plugins/mutualGroupDMs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const SelectedChannelActionCreators = findByPropsLazy("selectPrivateChannel");
const UserUtils = findByPropsLazy("getGlobalName");

const ProfileListClasses = findByPropsLazy("emptyIconFriends", "emptyIconGuilds");
const ExpandableList = findComponentByCodeLazy(".mutualFriendItem]");
const ExpandableList = findComponentByCodeLazy('"PRESS_SECTION"');
const GuildLabelClasses = findByPropsLazy("guildNick", "guildAvatarWithoutIcon");

function getGroupDMName(channel: Channel) {
Expand Down Expand Up @@ -142,16 +142,15 @@ export default definePlugin({
const mutualGDms = getMutualGroupDms(user.id);
if (mutualGDms.length === 0) return null;

const header = getMutualGDMCountText(user);

return (
<>
{Divider}
<ExpandableList
className={listStyle}
header={header}
isLoadingHeader={false}
children={renderClickableGDMs(mutualGDms, () => { })}
listClassName={listStyle}
header={"Mutual Groups"}
isLoading={false}
items={renderClickableGDMs(mutualGDms, () => { })}
/>
</>
);
Expand Down
9 changes: 0 additions & 9 deletions src/plugins/openInApp/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,6 @@ export default definePlugin({
replace: "async function $1 if(await $self.handleLink(...arguments)) return;"
}
},
// Make Spotify profile activity links open in app on web
{
find: "WEB_OPEN(",
predicate: () => !IS_DISCORD_DESKTOP && pluginSettings.store.spotify,
replacement: {
match: /\i\.\i\.isProtocolRegistered\(\)(.{0,100})window.open/g,
replace: "true$1VencordNative.native.openExternal"
}
},
{
find: "no artist ids in metadata",
predicate: () => !IS_DISCORD_DESKTOP && pluginSettings.store.spotify,
Expand Down
21 changes: 18 additions & 3 deletions src/plugins/serverInfo/GuildInfoModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ function GuildInfoModal({ guild }: GuildProps) {
className={cl("banner")}
src={bannerUrl}
alt=""
onClick={() => openImageModal(bannerUrl)}
onClick={() => openImageModal({
url: bannerUrl,
width: 1024
})}
/>
)}

Expand All @@ -89,7 +92,11 @@ function GuildInfoModal({ guild }: GuildProps) {
? <img
src={iconUrl}
alt=""
onClick={() => openImageModal(iconUrl)}
onClick={() => openImageModal({
url: iconUrl,
height: 512,
width: 512,
})}
/>
: <div aria-hidden className={classes(IconClasses.childWrapper, IconClasses.acronym)}>{guild.acronym}</div>
}
Expand Down Expand Up @@ -151,7 +158,15 @@ function Owner(guildId: string, owner: User) {

return (
<div className={cl("owner")}>
<img src={ownerAvatarUrl} alt="" onClick={() => openImageModal(ownerAvatarUrl)} />
<img
src={ownerAvatarUrl}
alt=""
onClick={() => openImageModal({
url: ownerAvatarUrl,
height: 512,
width: 512
})}
/>
{Parser.parse(`<@${owner.id}>`)}
</div>
);
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/serverInfo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ export default definePlugin({
name: "ServerInfo",
description: "Allows you to view info about a server",
authors: [Devs.Ven, Devs.Nuckyz],
dependencies: ["DynamicImageModalAPI"],
tags: ["guild", "info", "ServerProfile"],

contextMenus: {
"guild-context": Patch,
"guild-header-popout": Patch
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/spotifyControls/PlayerComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ function AlbumContextMenu({ track }: { track: Track; }) {
id="view-cover"
label="View Album Cover"
// trolley
action={() => openImageModal(track.album.image.url)}
action={() => openImageModal(track.album.image)}
icon={ImageIcon}
/>
<Menu.MenuControlItem
Expand Down
Loading

0 comments on commit 06df26b

Please sign in to comment.