Merge branch 'dev'

This commit is contained in:
thororen1234 2024-11-05 23:39:42 -05:00
commit 8e38702989
7 changed files with 115 additions and 15 deletions

View file

@ -10,7 +10,7 @@ You can join our [discord server](https://discord.gg/5Xh2W87egW) for commits, ch
### Extra included plugins ### Extra included plugins
<details> <details>
<summary>146 additional plugins</summary> <summary>147 additional plugins</summary>
### All Platforms ### All Platforms
- AllCallTimers by MaxHerbold & D3SOX - AllCallTimers by MaxHerbold & D3SOX
@ -158,7 +158,7 @@ You can join our [discord server](https://discord.gg/5Xh2W87egW) for commits, ch
- None At This Time - None At This Time
### Vesktop & Equibop Only ### Vesktop & Equibop Only
- None At This Time - ScreenRecorder by AutumnVN
### Discord Desktop Only ### Discord Desktop Only
- MediaDownloader by Colorman - MediaDownloader by Colorman

View file

@ -187,6 +187,7 @@ await Promise.all([
sourcemap, sourcemap,
plugins: [ plugins: [
globPlugins("vencordDesktop"), globPlugins("vencordDesktop"),
globPlugins("equicordDesktop"),
...commonOpts.plugins ...commonOpts.plugins
], ],
define: { define: {
@ -239,6 +240,7 @@ await Promise.all([
sourcemap, sourcemap,
plugins: [ plugins: [
globPlugins("equicordDesktop"), globPlugins("equicordDesktop"),
globPlugins("vencordDesktop"),
...commonOpts.plugins ...commonOpts.plugins
], ],
define: { define: {

View file

@ -197,8 +197,8 @@ function ExcludedPluginsList({ search }: { search: string; }) {
const ExcludedReasons: Record<"web" | "discordDesktop" | "vencordDesktop" | "equicordDesktop" | "desktop" | "dev", string> = { const ExcludedReasons: Record<"web" | "discordDesktop" | "vencordDesktop" | "equicordDesktop" | "desktop" | "dev", string> = {
desktop: "Discord Desktop app or Vesktop", desktop: "Discord Desktop app or Vesktop",
discordDesktop: "Discord Desktop app", discordDesktop: "Discord Desktop app",
vencordDesktop: "Vesktop app", vencordDesktop: "Vesktop app & Equibop app",
equicordDesktop: "Equibop app", equicordDesktop: "Vesktop app & Equibop app",
web: "Vesktop & Equibop apps as well as the Web version of Discord", web: "Vesktop & Equibop apps as well as the Web version of Discord",
dev: "Developer version of Equicord" dev: "Developer version of Equicord"
}; };

View file

@ -0,0 +1,69 @@
/*
* Vencord, a Discord client mod
* Copyright (c) 2023 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { addContextMenuPatch, removeContextMenuPatch } from "@api/ContextMenu";
import { ScreenshareIcon } from "@components/Icons";
import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";
import { findByPropsLazy } from "@webpack";
import { Menu, UploadHandler } from "@webpack/common";
const OptionClasses = findByPropsLazy("optionName", "optionIcon", "optionLabel");
let recoder: MediaRecorder;
export default definePlugin({
name: "ScreenRecorder",
description: "epic screen recorder lol",
authors: [Devs.AutumnVN],
contextMenus: {
"channel-attach": startRecording
}
});
function startRecording(children) {
children.push(
<Menu.MenuItem
id="start-recording"
label={
<div className={OptionClasses.optionLabel}>
<ScreenshareIcon className={OptionClasses.optionIcon} height={24} width={24} />
<div className={OptionClasses.optionName}>Start Recording</div>
</div>
}
action={async () => {
const stream = await navigator.mediaDevices.getDisplayMedia({ audio: true, video: { frameRate: { ideal: 60 } } });
recoder = new MediaRecorder(stream);
recoder.start();
removeContextMenuPatch("channel-attach", startRecording);
addContextMenuPatch("channel-attach", stopRecording);
}}
/>
);
}
function stopRecording(children, props) {
children.push(
<Menu.MenuItem
id="stop-recording"
label={
<div className={OptionClasses.optionLabel}>
<ScreenshareIcon className={OptionClasses.optionIcon} height={24} width={24} />
<div className={OptionClasses.optionName}>Stop Recording</div>
</div>
}
action={() => {
recoder.addEventListener("dataavailable", e => {
const file = new File([e.data], "watch if cute.webm", { type: "video/webm" });
UploadHandler.promptToUpload([file], props.channel, 0);
});
recoder.stop();
removeContextMenuPatch("channel-attach", stopRecording);
addContextMenuPatch("channel-attach", startRecording);
}}
/>
);
}

View file

@ -16,7 +16,6 @@ import { disableStyle, enableStyle } from "@api/Styles";
import ErrorBoundary from "@components/ErrorBoundary"; import ErrorBoundary from "@components/ErrorBoundary";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import { getIntlMessage } from "@utils/discord"; import { getIntlMessage } from "@utils/discord";
import { proxyLazy } from "@utils/lazy";
import { Logger } from "@utils/Logger"; import { Logger } from "@utils/Logger";
import { classes } from "@utils/misc"; import { classes } from "@utils/misc";
import definePlugin, { OptionType } from "@utils/types"; import definePlugin, { OptionType } from "@utils/types";
@ -349,11 +348,35 @@ export default definePlugin({
); );
}, },
Messages: proxyLazy(() => ({ Messages: {
DELETED_MESSAGE_COUNT: getMessage( // DELETED_MESSAGE_COUNT: getMessage("{count, plural, =0 {No deleted messages} one {{count} deleted message} other {{count} deleted messages}}")
"{count, plural, =0 {No deleted messages} one {{count} deleted message} other {{count} deleted messages}}", // TODO: find a better way to generate intl messages
), DELETED_MESSAGE_COUNT: () => ({
})), ast: [[
6,
"count",
{
"=0": ["No deleted messages"],
one: [
[
1,
"count"
],
" deleted message"
],
other: [
[
1,
"count"
],
" deleted messages"
]
},
0,
"cardinal"
]]
})
},
patches: [ patches: [
{ {

View file

@ -301,6 +301,7 @@ export default definePlugin({
const [tagName, variant] = passedTagName.split("-"); const [tagName, variant] = passedTagName.split("-");
if (!passedTagName) return getIntlMessage("APP_TAG"); if (!passedTagName) return getIntlMessage("APP_TAG");
const tag = tags.find(({ name }) => tagName === name); const tag = tags.find(({ name }) => tagName === name);
if (!tag && Settings.plugins.NoAppsAllowed.enabled) return "BOT";
if (!tag) return getIntlMessage("APP_TAG"); if (!tag) return getIntlMessage("APP_TAG");
if (variant === "BOT" && tagName !== "WEBHOOK" && this.settings.store.dontShowForBots) return getIntlMessage("APP_TAG"); if (variant === "BOT" && tagName !== "WEBHOOK" && this.settings.store.dontShowForBots) return getIntlMessage("APP_TAG");

View file

@ -18,18 +18,18 @@
import { Settings } from "@api/Settings"; import { Settings } from "@api/Settings";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import { runtimeHashMessageKey } from "@utils/intlHash";
import { Logger } from "@utils/Logger"; import { Logger } from "@utils/Logger";
import definePlugin, { OptionType } from "@utils/types"; import definePlugin, { OptionType } from "@utils/types";
import { findByPropsLazy } from "@webpack"; import { findByPropsLazy } from "@webpack";
import { MessageStore } from "@webpack/common"; import { i18n, MessageStore } from "@webpack/common";
import { Message } from "discord-types/general"; import { Message } from "discord-types/general";
const RelationshipStore = findByPropsLazy("getRelationships", "isBlocked"); const RelationshipStore = findByPropsLazy("getRelationships", "isBlocked");
interface MessageDeleteProps { interface MessageDeleteProps {
collapsedReason: { // i18n message i18n.t["+FcYMz"] if deleted, with args
message: string; collapsedReason: () => any
};
} }
export default definePlugin({ export default definePlugin({
@ -102,6 +102,11 @@ export default definePlugin({
}, },
shouldHide(props: MessageDeleteProps) { shouldHide(props: MessageDeleteProps) {
return !props?.collapsedReason?.message.includes("deleted"); try {
return props.collapsedReason() === i18n.t[runtimeHashMessageKey("BLOCKED_MESSAGE_COUNT")]();
} catch (e) {
console.error(e);
}
return false;
} }
}); });