Plugin

NoMosaic

Removes Discord image mosaic

Media Appearance Chat
index.ts
Download

Source

src/plugins/noMosaic/index.ts
1/*
2 * FiveCord — a Discord client mod
3 * Copyright (c) 2025 FiveCord
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 */
6
7import { definePluginSettings } from "@api/Settings";
8import { Devs } from "@utils/constants";
9import definePlugin, { OptionType } from "@utils/types";
10
11const settings = definePluginSettings({
12 inlineVideo: {
13 description: "Play videos without carousel modal",
14 type: OptionType.BOOLEAN,
15 default: true,
16 restartNeeded: true
17 }
18});
19
20export default definePlugin({
21 name: "NoMosaic",
22 authors: [Devs.AutumnVN],
23 description: "Removes Discord image mosaic",
24 tags: ["Media", "Appearance", "Chat"],
25 searchTerms: ["image", "mosaic", "media"],
26
27 settings,
28
29 patches: [
30 {
31 find: '"PLAINTEXT_PREVIEW":"OTHER"',
32 replacement: {
33 match: /"IMAGE"===\i\|\|"VIDEO"===\i\|\|"CLIP"===\i/,
34 replace: "false"
35 }
36 },
37 {
38 find: "return{visualMediaItems:",
39 replacement: {
40 match: /return{visualMediaItems:.+?props:(\i)(?=.{0,20}?\1\.item\.uniqueId)/,
41 replace: '$&,useFullWidth:["IMAGE","VIDEO","CLIP"].includes($1.item?.type)?false:undefined'
42 }
43 },
44 {
45 find: "renderAttachments(",
46 predicate: () => settings.store.inlineVideo,
47 replacement: {
48 match: /url:(\i)\.url\}\);return /,
49 replace: "$&$1.content_type?.startsWith('image/')&&"
50 }
51 },
52 ]
53});
54