Merge branch 'dev' into feat/translation
This commit is contained in:
commit
969cf241a7
24 changed files with 418 additions and 220 deletions
2
.github/workflows/codeberg-mirror.yml
vendored
2
.github/workflows/codeberg-mirror.yml
vendored
|
@ -18,5 +18,5 @@ jobs:
|
|||
fetch-depth: 0
|
||||
- uses: pixta-dev/repository-mirroring-action@674e65a7d483ca28dafaacba0d07351bdcc8bd75 # v1.1.1
|
||||
with:
|
||||
target_repo_url: "git@codeberg.org:Ven/cord.git"
|
||||
target_repo_url: "git@codeberg.org:Vee/cord.git"
|
||||
ssh_private_key: ${{ secrets.CODEBERG_SSH_PRIVATE_KEY }}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Vencord
|
||||
|
||||
[![Codeberg Mirror](https://img.shields.io/static/v1?style=for-the-badge&label=Codeberg%20Mirror&message=codeberg.org/Ven/cord&color=2185D0&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABmJLR0QA/wD/AP+gvaeTAAAKbUlEQVR4nNVae3AV5RX/nW/3Pva+b24e5HHzIICQKGoiYiW8NFBFgohaa6ctglpbFSujSGurzUinohWsOij/gGX6R2fqOK0d1FYTEZXaTrWCBbEikJCEyCvkeXNvkrunf+zdkJDkPnex/c3cmd29+53v/M6e73znnF2Cydj4Tntldzi6qrN/qKqzf2jy6b7BnL4B1dI7oMp9AyoRAIdVsNMqhlxWMZjtspzyK/Jhr036OMsm//bh2vzPzNSPzBD6xFutd7R0Dq758ky4orkjYuc05RCAkixbeEq2/UCJ1/LczxcX/c5IPfU5DMHmxpbCpu7o1k/b+xc1n43YjJI7EqV+W2RmvuPt0oDjB2vn5bQbITNjAzzdeKK8qTO0bU9T77zucNQUjzofHrvENWWu3aUBZfW6+ZOOZiIrbYXrmUXo9daX3v6i667O/iGRiRLpwqtIvKDc+0efJ3hb/UIaSkdGWgZ4sqGt9r2m3lc/P9HvSWe80ZiRp3TPL/UsX1+bvyvVsSkb4NE3WjbuPNj5SM8Fcv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XFLXOKXW9r59fWuDA44sKv1byAOBzyCkTH+kdS2f4MLPgXJI0p9T17vrFxcf181GVxEUB+0qfIqt+RcKWFSWGNR4ygd4RTpW4HiCJgFWzstmnSPA7ZLU827pypPwxDB/687GXl1X6Vs6bbGz/LRN80hZCT+yLFZ0cgHED4egACeiXm89GsP9EePuzy4rvGil7jAGYmQDsBjDHUBYZ4GhHBMfORigd4rpnyIS9u6d4rqgnGrUtjCmmSYuOqwB0GcwjbWh9xviurpNnxnDA1IspMPe6bOL755MHJvhKjIgOA7jbJD4pw22Thj+kSIW47h2KRaydVezeP57sCdspRPQqgGeNJJIuBAE+ReJUiOv32mXaXjPZs21C2QnmXgdghyEsMoRfkVMiDgCywF/by9z3xJMb1wCxeHAPgDczZpAh/Iq+HSYmDjCsstgThmf5t4ii8eQm7CgS0SCA5QBezoRApnBaBSyCEhIHCLJEb4ZUd+2SqZSwzE+qpUpEQ9CC4qb01M8cRIQsh8zxiKsMtsn08nvlnrpkyAPj5AGJwMw3AtgGwJ/q2ExxvHsQB74KxfKBMblAyGmTHq4pc4/5GjQeUm6qE9FrAK4E8H6ie41GlkN/jTk6F5Ak2ueUpNmpkgfSMAAAENERAAsB3AHgZDoy0oFdFnBYpXPEBfU4beLRD6Z4qmumug+kIzPjaoeZfQDWAHgAQFam8hLh4MkwWjsHemyS2OF08IYrCjynzZ4zKTCzi5nXMvOnzBw16bevIxR95JOj7DNKb1PqXWa+HMDtAGoBXII0lxq0N2OfAmgA8Hsi2muMhudgesHPzNkA5gKoADADwFRoS8UHQO+x9wLoBNAB4AsAnwM4AOADIjLVxf8L9kdXUOE0IskAAAAASUVORK5CYII=)](https://codeberg.org/Ven/cord)
|
||||
[![Codeberg Mirror](https://img.shields.io/static/v1?style=for-the-badge&label=Codeberg%20Mirror&message=codeberg.org/Vee/cord&color=2185D0&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABmJLR0QA/wD/AP+gvaeTAAAKbUl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J/q2ExxvHsQB74KxfKBMblAyGmTHq4pc4/5GjQeUm6qE9FrAK4E8H6ie41GlkN/jTk6F5Ak2ueUpNmpkgfSMAAAENERAAsB3AHgZDoy0oFdFnBYpXPEBfU4beLRD6Z4qmumug+kIzPjaoeZfQDWAHgAQFam8hLh4MkwWjsHemyS2OF08IYrCjynzZ4zKTCzi5nXMvOnzBw16bevIxR95JOj7DNKb1PqXWa+HMDtAGoBXII0lxq0N2OfAmgA8Hsi2muMhudgesHPzNkA5gKoADADwFRoS8UHQO+x9wLoBNAB4AsAnwM4AOADIjLVxf8L9kdXUOE0IskAAAAASUVORK5CYII=)](https://codeberg.org/Vee/cord)
|
||||
|
||||
The cutest Discord client mod
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "vencord",
|
||||
"private": "true",
|
||||
"version": "1.6.5",
|
||||
"version": "1.6.6",
|
||||
"description": "The cutest Discord client mod",
|
||||
"homepage": "https://github.com/Vendicated/Vencord#readme",
|
||||
"bugs": {
|
||||
|
|
|
@ -44,7 +44,7 @@ async function syncSettings() {
|
|||
// pre-check for local shared settings
|
||||
if (
|
||||
Settings.cloud.authenticated &&
|
||||
await dsGet("Vencord_cloudSecret") === null // this has been enabled due to local settings share or some other bug
|
||||
!await dsGet("Vencord_cloudSecret") // this has been enabled due to local settings share or some other bug
|
||||
) {
|
||||
// show a notification letting them know and tell them how to fix it
|
||||
showNotification({
|
||||
|
|
|
@ -81,9 +81,12 @@ function HashLink({ repo, hash, disabled = false }: { repo: string, hash: string
|
|||
|
||||
function Changes({ updates, repo, repoPending }: CommonProps & { updates: typeof changes; }) {
|
||||
return (
|
||||
<Card style={{ padding: ".5em" }}>
|
||||
<Card style={{ padding: "0 0.5em" }}>
|
||||
{updates.map(({ hash, author, message }) => (
|
||||
<div>
|
||||
<div style={{
|
||||
marginTop: "0.5em",
|
||||
marginBottom: "0.5em"
|
||||
}}>
|
||||
<code><HashLink {...{ repo, hash }} disabled={repoPending} /></code>
|
||||
<span style={{
|
||||
marginLeft: "0.5em",
|
||||
|
@ -113,7 +116,7 @@ function Updatable(props: CommonProps) {
|
|||
</>
|
||||
) : (
|
||||
<Forms.FormText className={Margins.bottom8}>
|
||||
{isOutdated ? `There are ${updates.length} Updates` : "Up to Date!"}
|
||||
{isOutdated ? (updates.length === 1 ? "There is 1 Update" : `There are ${updates.length} Updates`) : "Up to Date!"}
|
||||
</Forms.FormText>
|
||||
)}
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ export const streamContextPatch: NavContextMenuPatchCallback = (children, { stre
|
|||
};
|
||||
|
||||
export const userContextPatch: NavContextMenuPatchCallback = (children, { user }: UserContextProps) => {
|
||||
return addViewStreamContext(children, { userId: user.id });
|
||||
if (user) return addViewStreamContext(children, { userId: user.id });
|
||||
};
|
||||
|
||||
export default definePlugin({
|
||||
|
|
|
@ -30,6 +30,8 @@ interface UserContextProps {
|
|||
}
|
||||
|
||||
const UserContextMenuPatch: NavContextMenuPatchCallback = (children, { user }: UserContextProps) => () => {
|
||||
if (!user) return;
|
||||
|
||||
children.push(
|
||||
<Menu.MenuItem
|
||||
id="vc-copy-user-url"
|
||||
|
|
|
@ -6,21 +6,17 @@
|
|||
|
||||
import "./ui/styles.css";
|
||||
|
||||
import { definePluginSettings } from "@api/Settings";
|
||||
import ErrorBoundary from "@components/ErrorBoundary";
|
||||
import { Link } from "@components/Link";
|
||||
import { Devs } from "@utils/constants";
|
||||
import { Margins } from "@utils/margins";
|
||||
import { classes } from "@utils/misc";
|
||||
import { closeAllModals } from "@utils/modal";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
import definePlugin from "@utils/types";
|
||||
import { findByPropsLazy } from "@webpack";
|
||||
import { FluxDispatcher, Forms, UserStore } from "@webpack/common";
|
||||
import { UserStore } from "@webpack/common";
|
||||
|
||||
import { CDN_URL, RAW_SKU_ID, SKU_ID } from "./lib/constants";
|
||||
import { useAuthorizationStore } from "./lib/stores/AuthorizationStore";
|
||||
import { useCurrentUserDecorationsStore } from "./lib/stores/CurrentUserDecorationsStore";
|
||||
import { useUserDecorAvatarDecoration, useUsersDecorationsStore } from "./lib/stores/UsersDecorationsStore";
|
||||
import { settings } from "./settings";
|
||||
import { setDecorationGridDecoration, setDecorationGridItem } from "./ui/components";
|
||||
import DecorSection from "./ui/components/DecorSection";
|
||||
|
||||
|
@ -30,27 +26,6 @@ export interface AvatarDecoration {
|
|||
skuId: string;
|
||||
}
|
||||
|
||||
const settings = definePluginSettings({
|
||||
changeDecoration: {
|
||||
type: OptionType.COMPONENT,
|
||||
description: "Change your avatar decoration",
|
||||
component() {
|
||||
return <div>
|
||||
<DecorSection hideTitle hideDivider noMargin />
|
||||
<Forms.FormText type="description" className={classes(Margins.top8, Margins.bottom8)}>
|
||||
You can also access Decor decorations from the <Link
|
||||
href="/settings/profile-customization"
|
||||
onClick={e => {
|
||||
e.preventDefault();
|
||||
closeAllModals();
|
||||
FluxDispatcher.dispatch({ type: "USER_SETTINGS_MODAL_SET_SECTION", section: "Profile Customization" });
|
||||
}}
|
||||
>Profiles</Link> page.
|
||||
</Forms.FormText>
|
||||
</div>;
|
||||
}
|
||||
}
|
||||
});
|
||||
export default definePlugin({
|
||||
name: "Decor",
|
||||
description: "Create and use your own custom avatar decorations, or pick your favorite from the presets.",
|
||||
|
|
47
src/plugins/decor/settings.tsx
Normal file
47
src/plugins/decor/settings.tsx
Normal file
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* Vencord, a Discord client mod
|
||||
* Copyright (c) 2023 Vendicated and contributors
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { definePluginSettings } from "@api/Settings";
|
||||
import { Link } from "@components/Link";
|
||||
import { Margins } from "@utils/margins";
|
||||
import { classes } from "@utils/misc";
|
||||
import { closeAllModals } from "@utils/modal";
|
||||
import { OptionType } from "@utils/types";
|
||||
import { FluxDispatcher, Forms } from "@webpack/common";
|
||||
|
||||
import DecorSection from "./ui/components/DecorSection";
|
||||
|
||||
export const settings = definePluginSettings({
|
||||
changeDecoration: {
|
||||
type: OptionType.COMPONENT,
|
||||
description: "Change your avatar decoration",
|
||||
component() {
|
||||
if (!Vencord.Plugins.plugins.Decor.started) return <Forms.FormText>
|
||||
Enable Decor and restart your client to change your avatar decoration.
|
||||
</Forms.FormText>;
|
||||
|
||||
return <div>
|
||||
<DecorSection hideTitle hideDivider noMargin />
|
||||
<Forms.FormText type="description" className={classes(Margins.top8, Margins.bottom8)}>
|
||||
You can also access Decor decorations from the <Link
|
||||
href="/settings/profile-customization"
|
||||
onClick={e => {
|
||||
e.preventDefault();
|
||||
closeAllModals();
|
||||
FluxDispatcher.dispatch({ type: "USER_SETTINGS_MODAL_SET_SECTION", section: "Profile Customization" });
|
||||
}}
|
||||
>Profiles</Link> page.
|
||||
</Forms.FormText>
|
||||
</div>;
|
||||
}
|
||||
},
|
||||
agreedToGuidelines: {
|
||||
type: OptionType.BOOLEAN,
|
||||
description: "Agreed to guidelines",
|
||||
hidden: true,
|
||||
default: false
|
||||
}
|
||||
});
|
|
@ -19,7 +19,7 @@ export let DecorationGridItem: DecorationGridItemComponent;
|
|||
export const setDecorationGridItem = v => DecorationGridItem = v;
|
||||
|
||||
export const AvatarDecorationModalPreview = LazyComponentWebpack(() => {
|
||||
const component = findComponentByCode("AvatarDecorationModalPreview");
|
||||
const component = findComponentByCode(".shopPreviewBanner");
|
||||
return React.memo(component);
|
||||
});
|
||||
|
||||
|
|
|
@ -5,9 +5,10 @@
|
|||
*/
|
||||
|
||||
import { classNameFactory } from "@api/Styles";
|
||||
import { extractAndLoadChunksLazy } from "@webpack";
|
||||
import { extractAndLoadChunksLazy, findByPropsLazy } from "@webpack";
|
||||
|
||||
export const cl = classNameFactory("vc-decor-");
|
||||
export const DecorationModalStyles = findByPropsLazy("modalFooterShopButton");
|
||||
|
||||
export const requireAvatarDecorationModal = extractAndLoadChunksLazy(["openAvatarDecorationModal:"]);
|
||||
export const requireCreateStickerModal = extractAndLoadChunksLazy(["stickerInspected]:"]);
|
||||
|
|
|
@ -4,12 +4,13 @@
|
|||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import ErrorBoundary from "@components/ErrorBoundary";
|
||||
import { Flex } from "@components/Flex";
|
||||
import { openInviteModal } from "@utils/discord";
|
||||
import { Margins } from "@utils/margins";
|
||||
import { classes } from "@utils/misc";
|
||||
import { closeAllModals, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalRoot, ModalSize, openModal } from "@utils/modal";
|
||||
import { findByPropsLazy, findComponentByCodeLazy } from "@webpack";
|
||||
import { closeAllModals, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, ModalSize, openModal } from "@utils/modal";
|
||||
import { findComponentByCodeLazy } from "@webpack";
|
||||
import { Alerts, Button, FluxDispatcher, Forms, GuildStore, NavigationRouter, Parser, Text, Tooltip, useEffect, UserStore, UserUtils, useState } from "@webpack/common";
|
||||
import { User } from "discord-types/general";
|
||||
|
||||
|
@ -18,16 +19,17 @@ import { GUILD_ID, INVITE_KEY } from "../../lib/constants";
|
|||
import { useAuthorizationStore } from "../../lib/stores/AuthorizationStore";
|
||||
import { useCurrentUserDecorationsStore } from "../../lib/stores/CurrentUserDecorationsStore";
|
||||
import { decorationToAvatarDecoration } from "../../lib/utils/decoration";
|
||||
import { cl, requireAvatarDecorationModal } from "../";
|
||||
import { settings } from "../../settings";
|
||||
import { cl, DecorationModalStyles, requireAvatarDecorationModal } from "../";
|
||||
import { AvatarDecorationModalPreview } from "../components";
|
||||
import DecorationGridCreate from "../components/DecorationGridCreate";
|
||||
import DecorationGridNone from "../components/DecorationGridNone";
|
||||
import DecorDecorationGridDecoration from "../components/DecorDecorationGridDecoration";
|
||||
import SectionedGridList from "../components/SectionedGridList";
|
||||
import { openCreateDecorationModal } from "./CreateDecorationModal";
|
||||
import { openGuidelinesModal } from "./GuidelinesModal";
|
||||
|
||||
const UserSummaryItem = findComponentByCodeLazy("defaultRenderUser", "showDefaultAvatarsForNullUsers");
|
||||
const DecorationModalStyles = findByPropsLazy("modalFooterShopButton");
|
||||
|
||||
function usePresets() {
|
||||
const [presets, setPresets] = useState<Preset[]>([]);
|
||||
|
@ -83,7 +85,7 @@ function SectionHeader({ section }: { section: Section; }) {
|
|||
</div>;
|
||||
}
|
||||
|
||||
export default function ChangeDecorationModal(props: any) {
|
||||
function ChangeDecorationModal(props: ModalProps) {
|
||||
// undefined = not trying, null = none, Decoration = selected
|
||||
const [tryingDecoration, setTryingDecoration] = useState<Decoration | null | undefined>(undefined);
|
||||
const isTryingDecoration = typeof tryingDecoration !== "undefined";
|
||||
|
@ -116,6 +118,7 @@ export default function ChangeDecorationModal(props: any) {
|
|||
const data = [
|
||||
{
|
||||
title: "Your Decorations",
|
||||
subtitle: "You can delete your own decorations by right clicking on them.",
|
||||
sectionKey: "ownDecorations",
|
||||
items: ["none", ...ownDecorations, "create"]
|
||||
},
|
||||
|
@ -148,6 +151,7 @@ export default function ChangeDecorationModal(props: any) {
|
|||
className={cl("change-decoration-modal-content")}
|
||||
scrollbarType="none"
|
||||
>
|
||||
<ErrorBoundary>
|
||||
<SectionedGridList
|
||||
renderItem={item => {
|
||||
if (typeof item === "string") {
|
||||
|
@ -163,7 +167,7 @@ export default function ChangeDecorationModal(props: any) {
|
|||
{tooltipProps => <DecorationGridCreate
|
||||
className={cl("change-decoration-modal-decoration")}
|
||||
{...tooltipProps}
|
||||
onSelect={!hasDecorationPendingReview ? openCreateDecorationModal : () => { }}
|
||||
onSelect={!hasDecorationPendingReview ? (settings.store.agreedToGuidelines ? openCreateDecorationModal : openGuidelinesModal) : () => { }}
|
||||
/>}
|
||||
</Tooltip>;
|
||||
}
|
||||
|
@ -202,6 +206,7 @@ export default function ChangeDecorationModal(props: any) {
|
|||
}
|
||||
{activeDecorationHasAuthor && <Text key={`createdBy-${activeSelectedDecoration.authorId}`}>Created by {Parser.parse(`<@${activeSelectedDecoration.authorId}>`)}</Text>}
|
||||
</div>
|
||||
</ErrorBoundary>
|
||||
</ModalContent>
|
||||
<ModalFooter className={classes(cl("change-decoration-modal-footer", cl("modal-footer")))}>
|
||||
<div className={cl("change-decoration-modal-footer-btn-container")}>
|
||||
|
|
|
@ -4,23 +4,23 @@
|
|||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import ErrorBoundary from "@components/ErrorBoundary";
|
||||
import { Link } from "@components/Link";
|
||||
import { openInviteModal } from "@utils/discord";
|
||||
import { Margins } from "@utils/margins";
|
||||
import { closeAllModals, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalRoot, ModalSize, openModal } from "@utils/modal";
|
||||
import { closeAllModals, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, ModalSize, openModal } from "@utils/modal";
|
||||
import { findByPropsLazy, findComponentByCodeLazy } from "@webpack";
|
||||
import { Button, FluxDispatcher, Forms, GuildStore, NavigationRouter, Text, TextInput, useEffect, useMemo, UserStore, useState } from "@webpack/common";
|
||||
|
||||
import { GUILD_ID, INVITE_KEY, RAW_SKU_ID } from "../../lib/constants";
|
||||
import { useCurrentUserDecorationsStore } from "../../lib/stores/CurrentUserDecorationsStore";
|
||||
import { cl, requireAvatarDecorationModal, requireCreateStickerModal } from "../";
|
||||
import { cl, DecorationModalStyles, requireAvatarDecorationModal, requireCreateStickerModal } from "../";
|
||||
import { AvatarDecorationModalPreview } from "../components";
|
||||
|
||||
|
||||
const DecorationModalStyles = findByPropsLazy("modalFooterShopButton");
|
||||
|
||||
const FileUpload = findComponentByCodeLazy("fileUploadInput,");
|
||||
|
||||
const { default: HelpMessage, HelpMessageTypes } = findByPropsLazy("HelpMessageTypes");
|
||||
|
||||
function useObjectURL(object: Blob | MediaSource | null) {
|
||||
const [url, setUrl] = useState<string | null>(null);
|
||||
|
||||
|
@ -39,7 +39,7 @@ function useObjectURL(object: Blob | MediaSource | null) {
|
|||
return url;
|
||||
}
|
||||
|
||||
export default function CreateDecorationModal(props) {
|
||||
function CreateDecorationModal(props: ModalProps) {
|
||||
const [name, setName] = useState("");
|
||||
const [file, setFile] = useState<File | null>(null);
|
||||
const [submitting, setSubmitting] = useState(false);
|
||||
|
@ -75,6 +75,14 @@ export default function CreateDecorationModal(props) {
|
|||
className={cl("create-decoration-modal-content")}
|
||||
scrollbarType="none"
|
||||
>
|
||||
<ErrorBoundary>
|
||||
<HelpMessage messageType={HelpMessageTypes.WARNING}>
|
||||
Make sure your decoration does not violate <Link
|
||||
href="https://github.com/decor-discord/.github/blob/main/GUIDELINES.md"
|
||||
>
|
||||
the guidelines
|
||||
</Link> before submitting it.
|
||||
</HelpMessage>
|
||||
<div className={cl("create-decoration-modal-form-preview-container")}>
|
||||
<div className={cl("create-decoration-modal-form")}>
|
||||
{error !== null && <Text color="text-danger" variant="text-xs/normal">{error.message}</Text>}
|
||||
|
@ -109,11 +117,6 @@ export default function CreateDecorationModal(props) {
|
|||
</div>
|
||||
</div>
|
||||
<Forms.FormText type="description" className={Margins.bottom16}>
|
||||
Make sure your decoration does not violate <Link
|
||||
href="https://github.com/decor-discord/.github/blob/main/GUIDELINES.md"
|
||||
>
|
||||
the guidelines
|
||||
</Link> before creating your decoration.
|
||||
<br />You can receive updates on your decoration's review by joining <Link
|
||||
href={`https://discord.gg/${INVITE_KEY}`}
|
||||
onClick={async e => {
|
||||
|
@ -134,6 +137,7 @@ export default function CreateDecorationModal(props) {
|
|||
Decor's Discord server
|
||||
</Link>.
|
||||
</Forms.FormText>
|
||||
</ErrorBoundary>
|
||||
</ModalContent>
|
||||
<ModalFooter className={cl("modal-footer")}>
|
||||
<Button
|
||||
|
@ -145,7 +149,7 @@ export default function CreateDecorationModal(props) {
|
|||
disabled={!file || !name}
|
||||
submitting={submitting}
|
||||
>
|
||||
Create
|
||||
Submit for Review
|
||||
</Button>
|
||||
<Button
|
||||
onClick={props.onClose}
|
||||
|
|
65
src/plugins/decor/ui/modals/GuidelinesModal.tsx
Normal file
65
src/plugins/decor/ui/modals/GuidelinesModal.tsx
Normal file
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
* Vencord, a Discord client mod
|
||||
* Copyright (c) 2023 Vendicated and contributors
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { Link } from "@components/Link";
|
||||
import { ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, ModalSize, openModal } from "@utils/modal";
|
||||
import { Button, Forms, Text } from "@webpack/common";
|
||||
|
||||
import { settings } from "../../settings";
|
||||
import { cl, DecorationModalStyles, requireAvatarDecorationModal } from "../";
|
||||
import { openCreateDecorationModal } from "./CreateDecorationModal";
|
||||
|
||||
function GuidelinesModal(props: ModalProps) {
|
||||
return <ModalRoot
|
||||
{...props}
|
||||
size={ModalSize.SMALL}
|
||||
className={DecorationModalStyles.modal}
|
||||
>
|
||||
<ModalHeader separator={false} className={cl("modal-header")}>
|
||||
<Text
|
||||
color="header-primary"
|
||||
variant="heading-lg/semibold"
|
||||
tag="h1"
|
||||
style={{ flexGrow: 1 }}
|
||||
>
|
||||
Hold on
|
||||
</Text>
|
||||
<ModalCloseButton onClick={props.onClose} />
|
||||
</ModalHeader>
|
||||
<ModalContent
|
||||
scrollbarType="none"
|
||||
>
|
||||
<Forms.FormText>
|
||||
By submitting a decoration, you agree to <Link
|
||||
href="https://github.com/decor-discord/.github/blob/main/GUIDELINES.md"
|
||||
>
|
||||
the guidelines
|
||||
</Link>. Not reading these guidelines may get your account suspended from creating more decorations in the future.
|
||||
</Forms.FormText>
|
||||
</ModalContent>
|
||||
<ModalFooter className={cl("modal-footer")}>
|
||||
<Button
|
||||
onClick={() => {
|
||||
settings.store.agreedToGuidelines = true;
|
||||
props.onClose();
|
||||
openCreateDecorationModal();
|
||||
}}
|
||||
>
|
||||
Continue
|
||||
</Button>
|
||||
<Button
|
||||
onClick={props.onClose}
|
||||
color={Button.Colors.PRIMARY}
|
||||
look={Button.Looks.LINK}
|
||||
>
|
||||
Go Back
|
||||
</Button>
|
||||
</ModalFooter>
|
||||
</ModalRoot>;
|
||||
}
|
||||
|
||||
export const openGuidelinesModal = () =>
|
||||
requireAvatarDecorationModal().then(() => openModal(props => <GuidelinesModal {...props} />));
|
|
@ -8,7 +8,7 @@
|
|||
display: flex;
|
||||
border-radius: 5px 5px 0 0;
|
||||
padding: 0 16px;
|
||||
gap: 4px
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.vc-decor-change-decoration-modal-preview {
|
||||
|
@ -72,7 +72,7 @@
|
|||
.vc-decor-sectioned-grid-list-grid {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.vc-decor-section-remove-margin {
|
||||
|
|
35
src/plugins/fixCodeblockGap/index.ts
Normal file
35
src/plugins/fixCodeblockGap/index.ts
Normal file
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Vencord, a modification for Discord's desktop app
|
||||
* Copyright (c) 2023 Vendicated and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Devs } from "@utils/constants";
|
||||
import definePlugin from "@utils/types";
|
||||
|
||||
export default definePlugin({
|
||||
name: "FixCodeblockGap",
|
||||
description: "Removes the gap between codeblocks and text below it",
|
||||
authors: [Devs.Grzesiek11],
|
||||
patches: [
|
||||
{
|
||||
find: ".default.Messages.DELETED_ROLE_PLACEHOLDER",
|
||||
replacement: {
|
||||
match: String.raw`/^${"```"}(?:([a-z0-9_+\-.#]+?)\n)?\n*([^\n][^]*?)\n*${"```"}`,
|
||||
replace: "$&\\n?",
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
|
@ -36,17 +36,8 @@ function search(src: string, engine: string) {
|
|||
open(engine + encodeURIComponent(src), "_blank");
|
||||
}
|
||||
|
||||
const imageContextMenuPatch: NavContextMenuPatchCallback = (children, props) => () => {
|
||||
if (!props) return;
|
||||
const { reverseImageSearchType, itemHref, itemSrc } = props;
|
||||
|
||||
if (!reverseImageSearchType || reverseImageSearchType !== "img") return;
|
||||
|
||||
const src = itemHref ?? itemSrc;
|
||||
|
||||
const group = findGroupChildrenByChildId("copy-link", children);
|
||||
if (group) {
|
||||
group.push((
|
||||
function makeSearchItem(src: string) {
|
||||
return (
|
||||
<Menu.MenuItem
|
||||
label="Search Image"
|
||||
key="search-image"
|
||||
|
@ -90,8 +81,23 @@ const imageContextMenuPatch: NavContextMenuPatchCallback = (children, props) =>
|
|||
action={() => Object.values(Engines).forEach(e => search(src, e))}
|
||||
/>
|
||||
</Menu.MenuItem>
|
||||
));
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
const messageContextMenuPatch: NavContextMenuPatchCallback = (children, props) => () => {
|
||||
if (props?.reverseImageSearchType !== "img") return;
|
||||
|
||||
const src = props.itemHref ?? props.itemSrc;
|
||||
|
||||
const group = findGroupChildrenByChildId("copy-link", children);
|
||||
group?.push(makeSearchItem(src));
|
||||
};
|
||||
|
||||
const imageContextMenuPatch: NavContextMenuPatchCallback = (children, props) => () => {
|
||||
if (!props?.src) return;
|
||||
|
||||
const group = findGroupChildrenByChildId("copy-native-link", children) ?? children;
|
||||
group.push(makeSearchItem(props.src));
|
||||
};
|
||||
|
||||
export default definePlugin({
|
||||
|
@ -111,10 +117,12 @@ export default definePlugin({
|
|||
],
|
||||
|
||||
start() {
|
||||
addContextMenuPatch("message", imageContextMenuPatch);
|
||||
addContextMenuPatch("message", messageContextMenuPatch);
|
||||
addContextMenuPatch("image-context", imageContextMenuPatch);
|
||||
},
|
||||
|
||||
stop() {
|
||||
removeContextMenuPatch("message", imageContextMenuPatch);
|
||||
removeContextMenuPatch("message", messageContextMenuPatch);
|
||||
removeContextMenuPatch("image-context", imageContextMenuPatch);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -19,14 +19,23 @@
|
|||
import "./styles.css";
|
||||
|
||||
import { addPreSendListener, removePreSendListener } from "@api/MessageEvents";
|
||||
import { definePluginSettings } from "@api/Settings";
|
||||
import { classNameFactory } from "@api/Styles";
|
||||
import { Devs } from "@utils/constants";
|
||||
import { getTheme, insertTextIntoChatInputBox, Theme } from "@utils/discord";
|
||||
import { Margins } from "@utils/margins";
|
||||
import { closeModal, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, openModal } from "@utils/modal";
|
||||
import definePlugin from "@utils/types";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
import { Button, ButtonLooks, ButtonWrapperClasses, Forms, Parser, Select, Tooltip, useMemo, useState } from "@webpack/common";
|
||||
|
||||
const settings = definePluginSettings({
|
||||
replaceMessageContents: {
|
||||
description: "Replace timestamps in message contents",
|
||||
type: OptionType.BOOLEAN,
|
||||
default: true,
|
||||
},
|
||||
});
|
||||
|
||||
function parseTime(time: string) {
|
||||
const cleanTime = time.slice(1, -1).replace(/(\d)(AM|PM)$/i, "$1 $2");
|
||||
|
||||
|
@ -116,9 +125,11 @@ function PickerModal({ rootProps, close }: { rootProps: ModalProps, close(): voi
|
|||
export default definePlugin({
|
||||
name: "SendTimestamps",
|
||||
description: "Send timestamps easily via chat box button & text shortcuts. Read the extended description!",
|
||||
authors: [Devs.Ven, Devs.Tyler],
|
||||
authors: [Devs.Ven, Devs.Tyler, Devs.Grzesiek11],
|
||||
dependencies: ["MessageEventsAPI"],
|
||||
|
||||
settings: settings,
|
||||
|
||||
patches: [
|
||||
{
|
||||
find: "ChannelTextAreaButtons",
|
||||
|
@ -131,7 +142,9 @@ export default definePlugin({
|
|||
|
||||
start() {
|
||||
this.listener = addPreSendListener((_, msg) => {
|
||||
if (settings.store.replaceMessageContents) {
|
||||
msg.content = msg.content.replace(/`\d{1,2}:\d{2} ?(?:AM|PM)?`/gi, parseTime);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
@ -213,7 +213,7 @@ function applyRules(content: string): string {
|
|||
|
||||
if (stringRules) {
|
||||
for (const rule of stringRules) {
|
||||
if (!rule.find || !rule.replace) continue;
|
||||
if (!rule.find) continue;
|
||||
if (rule.onlyIfIncludes && !content.includes(rule.onlyIfIncludes)) continue;
|
||||
|
||||
content = ` ${content} `.replaceAll(rule.find, rule.replace.replaceAll("\\n", "\n")).replace(/^\s|\s$/g, "");
|
||||
|
@ -222,7 +222,7 @@ function applyRules(content: string): string {
|
|||
|
||||
if (regexRules) {
|
||||
for (const rule of regexRules) {
|
||||
if (!rule.find || !rule.replace) continue;
|
||||
if (!rule.find) continue;
|
||||
if (rule.onlyIfIncludes && !content.includes(rule.onlyIfIncludes)) continue;
|
||||
|
||||
try {
|
||||
|
|
13
src/plugins/urbanDictionary/README.md
Normal file
13
src/plugins/urbanDictionary/README.md
Normal file
|
@ -0,0 +1,13 @@
|
|||
# Urban Dictionary
|
||||
|
||||
Use /urban slash command to search for a definition for a word on [Urban Dictionary](https://www.urbandictionary.com/).
|
||||
|
||||
## Preview
|
||||
|
||||
![preview](https://i.imgur.com/1zwzj38.png)
|
||||
|
||||
## Usage
|
||||
|
||||
- Enable this plugin
|
||||
- Set plugin settings as desired
|
||||
- Type /urban and start getting definitions right into your Discord client.
|
|
@ -18,14 +18,24 @@
|
|||
|
||||
import { ApplicationCommandOptionType, sendBotMessage } from "@api/Commands";
|
||||
import { ApplicationCommandInputType } from "@api/Commands/types";
|
||||
import { definePluginSettings } from "@api/Settings";
|
||||
import { Devs } from "@utils/constants";
|
||||
import definePlugin from "@utils/types";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
|
||||
const settings = definePluginSettings({
|
||||
resultsAmount: {
|
||||
type: OptionType.NUMBER,
|
||||
description: "The amount of results you want to get (more gives better results, but is slower)",
|
||||
default: 10
|
||||
}
|
||||
});
|
||||
|
||||
export default definePlugin({
|
||||
name: "UrbanDictionary",
|
||||
description: "Search for a word on Urban Dictionary via /urban slash command",
|
||||
authors: [Devs.jewdev],
|
||||
dependencies: ["CommandsAPI"],
|
||||
settings,
|
||||
commands: [
|
||||
{
|
||||
name: "urban",
|
||||
|
@ -41,12 +51,16 @@ export default definePlugin({
|
|||
],
|
||||
execute: async (args, ctx) => {
|
||||
try {
|
||||
const query = encodeURIComponent(args[0].value);
|
||||
const { list: [definition] } = await (await fetch(`https://api.urbandictionary.com/v0/define?term=${query}`)).json();
|
||||
const query: string = encodeURIComponent(args[0].value);
|
||||
const { list } = await fetch(`https://api.urbandictionary.com/v0/define?term=${query}&per_page=${settings.store.resultsAmount}`).then(response => response.json());
|
||||
|
||||
if (!definition)
|
||||
if (!list.length)
|
||||
return void sendBotMessage(ctx.channel.id, { content: "No results found." });
|
||||
|
||||
const definition = list.reduce((prev, curr) => {
|
||||
return prev.thumbs_up > curr.thumbs_up ? prev : curr;
|
||||
});
|
||||
|
||||
const linkify = (text: string) => text
|
||||
.replaceAll("\r\n", "\n")
|
||||
.replace(/([*>_`~\\])/gsi, "\\$1")
|
||||
|
|
|
@ -33,7 +33,7 @@ function VencordPopout(onClose: () => void) {
|
|||
const pluginEntries = [] as ReactNode[];
|
||||
|
||||
for (const plugin of Object.values(Vencord.Plugins.plugins)) {
|
||||
if (plugin.toolboxActions) {
|
||||
if (plugin.toolboxActions && Vencord.Plugins.isPluginEnabled(plugin.name)) {
|
||||
pluginEntries.push(
|
||||
<Menu.MenuGroup
|
||||
label={plugin.name}
|
||||
|
|
|
@ -169,6 +169,15 @@ export default definePlugin({
|
|||
match: /let\{text:\i=""/,
|
||||
replace: "return [null,null];$&"
|
||||
}
|
||||
},
|
||||
|
||||
// Add back "Show My Camera" context menu
|
||||
{
|
||||
find: '.default("MediaEngineWebRTC");',
|
||||
replacement: {
|
||||
match: /supports\(\i\)\{switch\(\i\)\{case (\i).Features/,
|
||||
replace: "$&.DISABLE_VIDEO:return true;case $1.Features"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
|
|
|
@ -399,6 +399,10 @@ export const Devs = /* #__PURE__*/ Object.freeze({
|
|||
name: "maisy",
|
||||
id: 257109471589957632n,
|
||||
},
|
||||
Grzesiek11: {
|
||||
name: "Grzesiek11",
|
||||
id: 368475654662127616n,
|
||||
},
|
||||
} satisfies Record<string, Dev>);
|
||||
|
||||
// iife so #__PURE__ works correctly
|
||||
|
|
Loading…
Reference in a new issue