2023-10-13 04:10:36 +02:00
|
|
|
/*
|
|
|
|
* Vencord, a Discord client mod
|
|
|
|
* Copyright (c) 2023 Vendicated and contributors
|
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
*/
|
|
|
|
|
2023-11-03 01:57:39 +01:00
|
|
|
import { definePluginSettings } from "@api/Settings";
|
2023-10-13 04:10:36 +02:00
|
|
|
import { Devs } from "@utils/constants";
|
2023-11-03 01:57:39 +01:00
|
|
|
import definePlugin, { OptionType } from "@utils/types";
|
2023-10-13 04:10:36 +02:00
|
|
|
|
2023-11-03 01:57:39 +01:00
|
|
|
const settings = definePluginSettings({
|
|
|
|
inlineVideo: {
|
|
|
|
description: "Play videos without carousel modal",
|
|
|
|
type: OptionType.BOOLEAN,
|
|
|
|
default: true,
|
|
|
|
restartNeeded: true
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2023-10-13 04:10:36 +02:00
|
|
|
export default definePlugin({
|
|
|
|
name: "NoMosaic",
|
|
|
|
authors: [Devs.AutumnVN],
|
|
|
|
description: "Removes Discord new image mosaic",
|
|
|
|
tags: ["image", "mosaic", "media"],
|
2023-11-03 01:57:39 +01:00
|
|
|
|
|
|
|
settings,
|
|
|
|
|
2023-10-25 14:47:08 +02:00
|
|
|
patches: [
|
|
|
|
{
|
2024-06-19 04:36:21 +02:00
|
|
|
find: '=>"IMAGE"===',
|
2024-04-16 22:10:15 +02:00
|
|
|
replacement: {
|
|
|
|
match: /=>"IMAGE"===\i\|\|"VIDEO"===\i;/,
|
|
|
|
replace: "=>false;"
|
|
|
|
}
|
2023-11-03 01:57:39 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
find: "renderAttachments(",
|
|
|
|
predicate: () => settings.store.inlineVideo,
|
|
|
|
replacement: {
|
|
|
|
match: /url:(\i)\.url\}\);return /,
|
|
|
|
replace: "$&$1.content_type?.startsWith('image/')&&"
|
|
|
|
}
|
2023-10-25 14:47:08 +02:00
|
|
|
},
|
2024-04-16 22:10:15 +02:00
|
|
|
]
|
2023-10-13 04:10:36 +02:00
|
|
|
});
|