WallpaperFree: Removed

This commit is contained in:
thororen1234 2026-04-24 12:31:43 -04:00
parent 4c668ec827
commit 0397b4a2df
No known key found for this signature in database
10 changed files with 14 additions and 386 deletions

View file

@ -28,7 +28,7 @@ export default definePlugin({
replace: ",$1.listType==='blocked'?$self.renderSearchInput():null"
},
{
match: /(?<=userId:(\i).*?\}\)\]\}\),)(\(.*?loading:\i\}\))/,
match: /(?<=\{userId:(\i).*?\.globalName.{0,25}\}\)\]\}\),)(\(.*?loading:\i\}\))/,
replace: "$self.renderUser($1,$2)",
},
{

View file

@ -177,14 +177,6 @@ export default definePlugin({
}
]
},
// Voice channel rows (alternate voice list implementation)
{
find: "handleClickChat",
replacement: {
match: /(?<=getModeClass\(\),.{0,50})"data-dnd-name":.{0,49},children:\[/,
replace: "draggable:!0,onDragStart:e=>$self.onChannelDragStart(e,{id:this?.props?.channel?.id,guild_id:this?.props?.channel?.guild_id}),$&"
}
},
// Thread rows in channel list (sidebar thread items)
{
find: "__invalid_threadMainContent",

View file

@ -80,7 +80,7 @@ export default definePlugin({
replacement: [
{
// Append messagelogger-deleted to classNames if deleted
match: /(?<=let (\i)=\i\.memo\(function\(\i\)\{.{0,200}\.THREAD_STARTER_MESSAGE.*?bg-flash-.{0,10}:\i\}\);)/,
match: /(?<=(\i)=\i\.memo\(function\(\i\)\{.{0,200}\.THREAD_STARTER_MESSAGE.*?bg-flash-.{0,10}:\i\}\);)/,
replace: "ChannelMessage=$1;"
},
],

View file

@ -25,8 +25,8 @@ import { lodash, ScrollerAuto, SearchableSelect, useEffect, useRef, useState } f
import { cl, decodeAudio, LANGUAGES, TranscriptionWorker } from "./utils";
const Native = VencordNative.pluginHelpers.VoiceMessageTranscriber as PluginNative<typeof import("./native")>;
const ManaBaseRadioGroup = findComponentByCodeLazy('"data-mana-component":"BaseRadioGroup"') as React.ComponentType<ManaBaseRadioGroupProps>;
const ChannelListIcon = findComponentByCodeLazy("1-1-1ZM2 8a1");
let ManaBaseRadioGroup: React.ComponentType<ManaBaseRadioGroupProps>;
const settings = definePluginSettings({
selectedModel: {
@ -322,8 +322,18 @@ export default definePlugin({
match: /"source",{src:(\i).{0,700}duration:\i}\),/,
replace: "$&$self.button($1),"
}
}
},
{
find: '"data-mana-component":"BaseRadioGroup"',
replacement: {
match: /(?=function (\i)\(\i\)\{.{0,400}"data-mana-component":"BaseRadioGroup")/,
replace: "$self.ManaBaseRadioGroup=$1;"
}
},
],
set ManaBaseRadioGroup(value: any) {
ManaBaseRadioGroup = value;
},
settings,
button(src: string) {

View file

@ -1,63 +0,0 @@
/*
* Vencord, a Discord client mod
* Copyright (c) 2025 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { NavContextMenuPatchCallback } from "@api/ContextMenu";
import { WallpaperFreeStore } from "@equicordplugins/wallpaperFree/store";
import { openModal } from "@utils/modal";
import { ChannelStore, FluxDispatcher, Menu } from "@webpack/common";
import { SetWallpaperModal } from "./modal";
const addWallpaperMenu = (channelId?: string, guildId?: string) => {
const setWallpaper = (url?: string) => {
FluxDispatcher.dispatch({
// @ts-ignore
type: "VC_WALLPAPER_FREE_CHANGE",
channelId,
guildId,
url,
});
};
const initialUrl = channelId ? WallpaperFreeStore.getForChannel(channelId) :
guildId ? WallpaperFreeStore.getForGuild(guildId) : undefined;
return (
<Menu.MenuItem label="WallpaperFree" key="vc-wpfree-menu" id="vc-wpfree-menu">
<Menu.MenuItem
label="Set Wallpaper"
id="vc-wpfree-set-wallpaper"
action={() => openModal(props => <SetWallpaperModal props={props} onSelect={setWallpaper} initialUrl={initialUrl} />)}
/>
<Menu.MenuSeparator />
<Menu.MenuItem
label="Remove Wallpaper"
id="vc-wpfree-remove-wallpaper"
color="danger"
disabled={!initialUrl}
action={() => setWallpaper(void 0)}
/>
</Menu.MenuItem>
);
};
const UserContextPatch: NavContextMenuPatchCallback = (children, args) => {
if (!args.user) return;
const dmChannelId = ChannelStore.getDMFromUserId(args.user.id);
children.push(addWallpaperMenu(dmChannelId));
};
const ChannelContextPatch: NavContextMenuPatchCallback = (children, args) => {
if (!args.channel) return;
children.push(addWallpaperMenu(args.channel.id));
};
const GuildContextPatch: NavContextMenuPatchCallback = (children, args) => {
if (!args.guild) return;
children.push(addWallpaperMenu(void 0, args.guild.id));
};
export { ChannelContextPatch, GuildContextPatch, UserContextPatch };

View file

@ -1,65 +0,0 @@
/*
* Vencord, a Discord client mod
* Copyright (c) 2025 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { BaseText } from "@components/BaseText";
import { ModalContent, ModalHeader, ModalProps, ModalRoot, ModalSize } from "@utils/modal";
import { Button, TextInput, useState } from "@webpack/common";
interface Props {
props: ModalProps;
onSelect: (url: string) => void;
initialUrl: string | undefined;
}
export function SetWallpaperModal({ props, onSelect, initialUrl }: Props) {
const [url, setUrl] = useState(initialUrl ?? "");
return (
<ModalRoot {...props} size={ModalSize.SMALL}>
<ModalHeader>
<BaseText size="lg" style={{ marginBottom: 8 }}>
Set wallpaper
</BaseText>
</ModalHeader>
<ModalContent>
<div style={{ display: "flex", flexDirection: "column", gap: 16 }}>
<BaseText>The image url</BaseText>
<TextInput
value={url}
onChange={u => {
setUrl(u);
}}
autoFocus
/>
{url && (
<img
alt=""
src={url}
style={{
display: "block",
width: "100%",
height: "auto",
objectFit: "cover",
borderRadius: 8
}}
/>
)}
<div style={{ display: "flex", justifyContent: "flex-end", gap: 8 }}>
<Button onClick={props.onClose}>Cancel</Button>
<Button
color={Button.Colors.BRAND}
onClick={() => {
onSelect(url);
props.onClose();
}}
disabled={!url}
>Apply</Button>
</div>
</div>
</ModalContent>
</ModalRoot >
);
}

View file

@ -1,83 +0,0 @@
/*
* Vencord, a Discord client mod
* Copyright (c) 2025 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { BaseText } from "@components/BaseText";
import { WallpaperFreeStore } from "@equicordplugins/wallpaperFree/store";
import { openModal } from "@utils/modal";
import { makeCodeblock } from "@utils/text";
import { Button, FluxDispatcher, Parser } from "@webpack/common";
import { SetWallpaperModal } from "./modal";
export function GlobalDefaultComponent() {
const setGlobal = (url?: string) => {
FluxDispatcher.dispatch({
// @ts-ignore
type: "VC_WALLPAPER_FREE_CHANGE_GLOBAL",
url,
});
};
return (
<>
<Button onClick={() => {
openModal(props => <SetWallpaperModal props={props} onSelect={setGlobal} initialUrl={WallpaperFreeStore.globalDefault} />);
}}>Set a global wallpaper</Button>
<Button
color={Button.Colors.RED}
onClick={() => setGlobal(void 0)}
>Remove global default wallpaper</Button>
<Button
color={Button.Colors.RED}
onClick={() => {
// @ts-ignore
FluxDispatcher.dispatch({ type: "VC_WALLPAPER_FREE_RESET" });
}}
>Reset wallpaper data</Button>
</>
);
}
export function TipsComponent() {
const tipText = `
.vc-wpfree-wp-container {
transform: scaleX(-1); /* flip it horizontally */
filter: blur(4px); /* apply a blur */
opacity: 0.7; /* self-explanatory */
}
/* If you don't like embeds being transparent */
[class*=embedFull__] {
background: var(--background-surface-high) !important;
}
/* the same for codeblocks (or use ShikiCodeblocks) */
.hljs {
background-color: var(--background-base-lowest) !important;
}`;
return (
<div style={{ userSelect: "text" }}>
{!IS_WEB && (
<>
<BaseText>
you can use local files by having them in the vencord theme directory, and using the url <code>vencord:///themes/filename.ext</code>
</BaseText>
<Button onClick={() => VencordNative.themes.openFolder()}>
Open Theme Directory
</Button>
</>
)}
{Parser.parse(makeCodeblock(tipText, "css"))}
<Button onClick={() => VencordNative.quickCss.openEditor()}>
Open QuickCSS
</Button>
</div>
);
}

View file

@ -1,74 +0,0 @@
/*
* Vencord, a Discord client mod
* Copyright (c) 2023 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import "./styles.css";
import { definePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types";
import { Channel } from "@vencord/discord-types";
import { useStateFromStores } from "@webpack/common";
import { ChannelContextPatch, GuildContextPatch, UserContextPatch } from "./components/ctxmenu";
import { GlobalDefaultComponent, TipsComponent } from "./components/util";
import { WallpaperFreeStore } from "./store";
export const settings = definePluginSettings({
globalDefault: {
description: "Set a global default wallpaper for all channels.",
type: OptionType.COMPONENT,
component: GlobalDefaultComponent
},
stylingTips: {
description: "",
type: OptionType.COMPONENT,
component: TipsComponent,
},
});
export default definePlugin({
name: "WallpaperFree",
authors: [Devs.Joona],
description: "Recreation of the old DM wallpaper experiment; Set a background image for any channel, user or server.",
tags: ["Appearance", "Chat", "Customisation"],
patches: [
{
find: ".handleSendMessage,onResize",
group: true,
replacement: [
{
match: /(?<=#{intl::CHANNEL_A11Y_LABEL};).{1,400},(?=keyboardModeEnabled:)/,
replace: "const vcWallpaperFreeUrl=$self.WallpaperState(arguments[0].channel);$&vcWallpaperFreeUrl,"
},
{
match: /}\)]}\)](?=.{1,30}messages-)/,
replace: "$&.toSpliced(0,0,$self.Wallpaper({url:this.props.vcWallpaperFreeUrl}))"
}
]
}
],
settings,
contextMenus: {
"user-context": UserContextPatch,
"channel-context": ChannelContextPatch,
"thread-context": ChannelContextPatch,
"gdm-context": ChannelContextPatch,
"guild-context": GuildContextPatch,
},
Wallpaper({ url }: { url: string; }) {
// no we cant place the hook here
if (!url) return null;
return <div
className="vc-wpfree-wp-container"
style={{
backgroundImage: `url(${url})`,
}}></div>;
},
WallpaperState(channel: Channel) {
return useStateFromStores([WallpaperFreeStore], () => WallpaperFreeStore.getUrl(channel));
},
});

View file

@ -1,82 +0,0 @@
/*
* Vencord, a Discord client mod
* Copyright (c) 2024 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { proxyLazy } from "@utils/lazy";
import { Channel, FluxEmitter, FluxStore } from "@vencord/discord-types";
import { Flux as FluxWP, FluxDispatcher } from "@webpack/common";
interface IFlux {
PersistedStore: typeof FluxStore;
Emitter: FluxEmitter;
}
export const WallpaperFreeStore = proxyLazy(() => {
const wallpaperChannelMap: Map<string, string> = new Map();
const wallpaperGuildMap: Map<string, string> = new Map();
let globalDefault: string | undefined;
class WallpaperFreeStore extends (FluxWP as unknown as IFlux).PersistedStore {
static persistKey = "WallpaperFreeStore";
// @ts-ignore
initialize(previous: { guildMap: Map<string, string>, channelMap: Map<string, string>, globalDefault: string; } | undefined) {
if (!previous)
return;
wallpaperGuildMap.clear();
wallpaperChannelMap.clear();
for (const [channel, url] of previous.channelMap) {
wallpaperChannelMap.set(channel, url);
}
for (const [guild, url] of previous.guildMap) {
wallpaperGuildMap.set(guild, url);
}
globalDefault = previous.globalDefault;
}
getState() {
return { guildMap: Array.from(wallpaperGuildMap), channelMap: Array.from(wallpaperChannelMap), globalDefault };
}
getUrl(channel: Channel) {
return (
wallpaperChannelMap.get(channel.id) ??
wallpaperGuildMap.get(channel.guild_id) ??
globalDefault
);
}
getForChannel(id: string) { return wallpaperChannelMap.get(id); }
getForGuild(id: string) { return wallpaperGuildMap.get(id); }
get globalDefault() { return globalDefault; }
}
const store = new WallpaperFreeStore(FluxDispatcher, {
// @ts-ignore
VC_WALLPAPER_FREE_CHANGE({ guildId, channelId, url }: { guildId: string | undefined, channelId: string | undefined, url: string; }) {
guildId && wallpaperGuildMap.set(guildId, url);
channelId && wallpaperChannelMap.set(channelId, url);
store.emitChange();
},
VC_WALLPAPER_FREE_CHANGE_GLOBAL({ url }: { url: string | undefined; }) {
globalDefault = url;
store.emitChange();
},
VC_WALLPAPER_FREE_RESET() {
wallpaperChannelMap.clear();
wallpaperGuildMap.clear();
globalDefault = void 0;
store.emitChange();
}
});
return store;
});

View file

@ -1,7 +0,0 @@
.vc-wpfree-wp-container {
background-position: 100% 100%;
background-repeat: no-repeat;
background-size: cover;
inset: 0;
position: absolute;
}