merge: dev branch

This commit is contained in:
Lewis Crichton 2023-09-27 21:42:29 +01:00
commit eb31ad994e
No known key found for this signature in database
14 changed files with 65 additions and 28 deletions

10
.github/ISSUE_TEMPLATE/blank.yml vendored Normal file
View file

@ -0,0 +1,10 @@
name: Blank Issue
description: Create a blank issue. ALWAYS FIRST USE OUR SUPPORT CHANNEL! ONLY USE THIS FORM IF YOU ARE A CONTRIBUTOR OR WERE TOLD TO DO SO IN THE SUPPORT CHANNEL.
body:
- type: textarea
id: content
attributes:
label: Content
validations:
required: true

View file

@ -1,4 +1,4 @@
blank_issues_enabled: true
blank_issues_enabled: false
contact_links:
- name: Vencord Support Server
url: https://discord.gg/D9uwnFnqmd

View file

@ -236,3 +236,22 @@ export function ReplyIcon(props: IconProps) {
</Icon>
);
}
export function DeleteIcon(props: IconProps) {
return (
<Icon
{...props}
className={classes(props.className, "vc-delete-icon")}
viewBox="0 0 24 24"
>
<path
fill="currentColor"
d="M15 3.999V2H9V3.999H3V5.999H21V3.999H15Z"
/>
<path
fill="currentColor"
d="M5 6.99902V18.999C5 20.101 5.897 20.999 7 20.999H17C18.103 20.999 19 20.101 19 18.999V6.99902H5ZM11 17H9V11H11V17ZM15 17H13V11H15V17Z"
/>
</Icon>
);
}

View file

@ -238,7 +238,7 @@ export default function PluginModal({ plugin, onRestartNeeded, onClose, transiti
<Button
onClick={onClose}
size={Button.Sizes.SMALL}
color={Button.Colors.WHITE}
color={Button.Colors.PRIMARY}
look={Button.Looks.LINK}
>
Cancel

View file

@ -22,7 +22,7 @@ import { Settings, useSettings } from "@api/Settings";
import { classNameFactory } from "@api/Styles";
import { ErrorCard } from "@components/ErrorCard";
import { Flex } from "@components/Flex";
import { CogWheel } from "@components/Icons";
import { CogWheel, DeleteIcon } from "@components/Icons";
import { Link } from "@components/Link";
import { AddonCard } from "@components/VencordSettings/AddonCard";
import { SettingsTab, wrapTab } from "@components/VencordSettings/shared";
@ -49,10 +49,7 @@ type FileInput = ComponentType<{
filters?: { name?: string; extensions: string[]; }[];
}>;
const InviteActions = findByPropsLazy("resolveInvite");
const TrashIcon = findByCodeLazy("M5 6.99902V18.999C5 20.101 5.897 20.999");
const FileInput: FileInput = findByCodeLazy("activateUploadDialogue=");
const TextAreaProps = findLazy(m => typeof m.textarea === "string");
@ -142,7 +139,7 @@ function UserCSSThemeCard({ theme, enabled, onChange, onDelete }: UserCSSCardPro
)}
{IS_WEB && (
<div style={{ cursor: "pointer", color: "var(--status-danger" }} onClick={onDelete}>
<TrashIcon />
<DeleteIcon />
</div>
)}
</>
@ -169,7 +166,7 @@ function OtherThemeCard({ theme, enabled, onChange, onDelete }: OtherThemeCardPr
infoButton={
IS_WEB && (
<div style={{ cursor: "pointer", color: "var(--status-danger" }} onClick={onDelete}>
<TrashIcon />
<DeleteIcon />
</div>
)
}

View file

@ -71,7 +71,7 @@ export default definePlugin({
if (!isDeletePressed) {
if (event.detail < 2) return;
if (settings.store.requireModifier && !event.ctrlKey && !event.shiftKey) return;
if (!PermissionStore.can(PermissionsBits.SEND_MESSAGES, channel)) return;
if (channel.guild_id && !PermissionStore.can(PermissionsBits.SEND_MESSAGES, channel)) return;
if (isMe) {
if (!settings.store.enableDoubleClickToEdit || EditStore.isEditing(channel.id, msg.id)) return;

View file

@ -126,7 +126,7 @@ function MenuItem(guildId: string, id?: string, type?: MenuItemParentType) {
function makeContextMenuPatch(childId: string | string[], type?: MenuItemParentType): NavContextMenuPatchCallback {
return (children, props) => () => {
if (!props) return children;
if (!props || (type === MenuItemParentType.User && !props.user) || (type === MenuItemParentType.Guild && !props.guild)) return children;
const group = findGroupChildrenByChildId(childId, children);

View file

@ -172,7 +172,8 @@ function shouldMention(message) {
// handle next/prev reply
function nextReply(isUp: boolean) {
if (!PermissionStore.can(PermissionsBits.SEND_MESSAGES, ChannelStore.getChannel(SelectedChannelStore.getChannelId()))) return;
const currChannel = ChannelStore.getChannel(SelectedChannelStore.getChannelId());
if (currChannel.guild_id && !PermissionStore.can(PermissionsBits.SEND_MESSAGES, currChannel)) return;
const message = getNextMessage(isUp, true);
if (!message)
@ -196,7 +197,8 @@ function nextReply(isUp: boolean) {
// handle next/prev edit
function nextEdit(isUp: boolean) {
if (!PermissionStore.can(PermissionsBits.SEND_MESSAGES, ChannelStore.getChannel(SelectedChannelStore.getChannelId()))) return;
const currChannel = ChannelStore.getChannel(SelectedChannelStore.getChannelId());
if (currChannel.guild_id && !PermissionStore.can(PermissionsBits.SEND_MESSAGES, currChannel)) return;
const message = getNextMessage(isUp, false);
if (!message)

View file

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { DeleteIcon } from "@components/Icons";
import { classes } from "@utils/misc";
import { findByPropsLazy } from "@webpack";
import { Tooltip } from "@webpack/common";
@ -31,10 +32,7 @@ export function DeleteButton({ onClick }: { onClick(): void; }) {
className={classes(iconClasses.button, iconClasses.dangerous)}
onClick={onClick}
>
<svg width="16" height="16" viewBox="0 0 20 20">
<path fill="currentColor" d="M15 3.999V2H9V3.999H3V5.999H21V3.999H15Z" />
<path fill="currentColor" d="M5 6.99902V18.999C5 20.101 5.897 20.999 7 20.999H17C18.103 20.999 19 20.101 19 18.999V6.99902H5ZM11 17H9V11H11V17ZM15 17H13V11H15V17Z" />
</svg>
<DeleteIcon width="20" height="20" />
</div>
)}
</Tooltip>
@ -50,8 +48,11 @@ export function ReportButton({ onClick }: { onClick(): void; }) {
className={iconClasses.button}
onClick={onClick}
>
<svg width="16" height="16" viewBox="0 0 20 20">
<path fill="currentColor" d="M20,6.002H14V3.002C14,2.45 13.553,2.002 13,2.002H4C3.447,2.002 3,2.45 3,3.002V22.002H5V14.002H10.586L8.293,16.295C8.007,16.581 7.922,17.011 8.076,17.385C8.23,17.759 8.596,18.002 9,18.002H20C20.553,18.002 21,17.554 21,17.002V7.002C21,6.45 20.553,6.002 20,6.002Z" />
<svg width="20" height="20" viewBox="0 0 24 24">
<path
fill="currentColor"
d="M20,6.002H14V3.002C14,2.45 13.553,2.002 13,2.002H4C3.447,2.002 3,2.45 3,3.002V22.002H5V14.002H10.586L8.293,16.295C8.007,16.581 7.922,17.011 8.076,17.385C8.23,17.759 8.596,18.002 9,18.002H20C20.553,18.002 21,17.554 21,17.002V7.002C21,6.45 20.553,6.002 20,6.002Z"
/>
</svg>
</div>
)}

View file

@ -32,7 +32,7 @@ const messageContextMenuPatch: NavContextMenuPatchCallback = (children, { messag
if (SelectedChannelStore.getChannelId() !== message.channel_id) return;
const channel = ChannelStore.getChannel(message?.channel_id);
if (!channel) return;
if (!PermissionStore.can(PermissionsBits.SEND_MESSAGES, channel)) return;
if (channel.guild_id && !PermissionStore.can(PermissionsBits.SEND_MESSAGES, channel)) return;
// dms and group chats
const dmGroup = findGroupChildrenByChildId("pin", children);

View file

@ -20,6 +20,7 @@ import { DataStore } from "@api/index";
import { addPreSendListener, removePreSendListener } from "@api/MessageEvents";
import { definePluginSettings } from "@api/Settings";
import { Flex } from "@components/Flex";
import { DeleteIcon } from "@components/Icons";
import { Devs } from "@utils/constants";
import { Logger } from "@utils/Logger";
import { useForceUpdater } from "@utils/react";
@ -173,6 +174,7 @@ function TextReplace({ title, rulesArray, rulesKey, update }: TextReplaceProps)
onClick={() => onClickRemove(index)}
style={{
background: "none",
color: "var(--status-danger)",
...(index === rulesArray.length - 1
? {
visibility: "hidden",
@ -182,11 +184,7 @@ function TextReplace({ title, rulesArray, rulesKey, update }: TextReplaceProps)
)
}}
>
<svg width="24" height="24" viewBox="0 0 24 24">
<title>Delete Rule</title>
<path fill="var(--status-danger)" d="M15 3.999V2H9V3.999H3V5.999H21V3.999H15Z" />
<path fill="var(--status-danger)" d="M5 6.99902V18.999C5 20.101 5.897 20.999 7 20.999H17C18.103 20.999 19 20.101 19 18.999V6.99902H5ZM11 17H9V11H11V17ZM15 17H13V11H15V17Z" />
</svg>
<DeleteIcon />
</Button>
</Flex>
{isRegexRules && renderFindError(rule.find)}

View file

@ -83,6 +83,7 @@ function openImage(url: string) {
}
const UserContext: NavContextMenuPatchCallback = (children, { user, guildId }: UserContextProps) => () => {
if (!user) return;
const memberAvatar = GuildMemberStore.getMember(guildId!, user.id)?.avatar || null;
children.splice(-1, 0, (

View file

@ -119,7 +119,7 @@ const settings = definePluginSettings({
function MakeContextCallback(name: string) {
const callback: NavContextMenuPatchCallback = (children, props) => () => {
if (name === "Guild" && !props.guild) return;
if ((name === "Guild" && !props.guild) || (name === "User" && !props.user)) return;
const lastChild = children.at(-1);
if (lastChild?.key === "developer-actions") {
const p = lastChild.props;

View file

@ -218,10 +218,19 @@ export default definePlugin({
},
async paste() {
const text = await navigator.clipboard.readText();
const clip = (await navigator.clipboard.read())[0];
if (!clip) return;
const data = new DataTransfer();
data.setData("text/plain", text);
for (const type of clip.types) {
if (type === "image/png") {
const file = new File([await clip.getType(type)], "unknown.png", { type });
data.items.add(file);
} else if (type === "text/plain") {
const blob = await clip.getType(type);
data.setData(type, await blob.text());
}
}
document.dispatchEvent(
new ClipboardEvent("paste", {