Compare commits
122 commits
Author | SHA1 | Date | |
---|---|---|---|
Ulysia | 1d5709763a | ||
9d4e859a0a | |||
439a4f8eb6 | |||
00f82e96bd | |||
5216bcca1e | |||
e7e298d2e7 | |||
d897dab054 | |||
88e8fa7e90 | |||
f5f59be1b6 | |||
534ab3eb5f | |||
a6ea03bacc | |||
Ulysia | c3bdc71512 | ||
e620431210 | |||
5afc24b41a | |||
7f8e241b9c | |||
553293ceee | |||
0af820c874 | |||
a11ccde40f | |||
58c3032bb2 | |||
4e89352758 | |||
e818905520 | |||
aa1b446c07 | |||
2dce060cf9 | |||
89bb3ee30a | |||
47db61d00e | |||
Ulysia | a592586af7 | ||
Ulysia | 0567320fc6 | ||
416d85dcf0 | |||
013c8d061d | |||
b5f626d1ff | |||
1e01f85217 | |||
91a32e22de | |||
43b3c137ce | |||
18f7b74210 | |||
eab0cf9966 | |||
e7956413e2 | |||
832e874c35 | |||
55146db760 | |||
bc59fc41b3 | |||
1abfb5f0cf | |||
cb2848f186 | |||
c3f2e76b9c | |||
eb63a54fa6 | |||
5881716c57 | |||
d7cbe270e5 | |||
c29362ca89 | |||
fd0fbace2e | |||
409f47bf24 | |||
b0e2f310bc | |||
65069c673c | |||
b1db18c319 | |||
db5fe2a394 | |||
e4318a887a | |||
eaf62d8c1c | |||
22a5b18bfa | |||
1dc2d92493 | |||
492b0cff08 | |||
2d675b4b2e | |||
49b0a38c37 | |||
467157539c | |||
e8242f22c9 | |||
f7587d9b2e | |||
755e869db7 | |||
a015cf96f6 | |||
c7e5295da0 | |||
8afd79dd50 | |||
65c5897dc3 | |||
6cce8a8bc4 | |||
1848b16536 | |||
c572116b97 | |||
e26986f66a | |||
f12335a371 | |||
640d99dcda | |||
bcfef05a8a | |||
f17b92c2fd | |||
292f7d71d3 | |||
9d67421b34 | |||
b822542352 | |||
f27361f017 | |||
a765212cfe | |||
c07d78fa96 | |||
56459bdcad | |||
868b2ea9f0 | |||
9e7f8829f2 | |||
e5a4db6460 | |||
8890c8c6b4 | |||
61d3c08f1f | |||
e6994e1946 | |||
40512d7294 | |||
be02baffaa | |||
99cd423efb | |||
7333f40db6 | |||
244cb26c32 | |||
df8aec8e3c | |||
d10e649b63 | |||
7f784befc2 | |||
30e4e83158 | |||
4c4f2894fb | |||
c51d7b8fb4 | |||
accfc15125 | |||
27e81b20db | |||
d0ad4e6c1d | |||
0c71d6c3fa | |||
74fd85bd3d | |||
968e688c10 | |||
b595a3e33c | |||
e07a4e19e6 | |||
273981deb7 | |||
81eabc7ee2 | |||
d5eaae9d51 | |||
00276cad7c | |||
ee9fbc4d25 | |||
0cea347264 | |||
eb0d91fd8e | |||
07e629d8d4 | |||
e473a57c3d | |||
ad3d936dfd | |||
db2f5c9292 | |||
5bfc608f7d | |||
7d8214fc37 | |||
cdf72cf4be | |||
4b16fbcaa9 |
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -18,7 +18,5 @@ lerna-debug.log*
|
|||
.pnpm-debug.log*
|
||||
*.tsbuildinfo
|
||||
|
||||
src/userplugins
|
||||
|
||||
ExtensionCache/
|
||||
settings/
|
||||
|
|
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
[submodule "src/userplugins/vc-message-logger-enhanced"]
|
||||
path = src/userplugins/vc-message-logger-enhanced
|
||||
url = https://github.com/Syncxv/vc-message-logger-enhanced.git
|
|
@ -5,6 +5,7 @@
|
|||
// @author Vendicated (https://github.com/Vendicated)
|
||||
// @namespace https://github.com/Vendicated/Vencord
|
||||
// @supportURL https://github.com/Vendicated/Vencord
|
||||
// @icon https://raw.githubusercontent.com/Vendicated/Vencord/refs/heads/main/browser/icon.png
|
||||
// @license GPL-3.0
|
||||
// @match *://*.discord.com/*
|
||||
// @grant GM_xmlhttpRequest
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "vencord",
|
||||
"private": "true",
|
||||
"version": "1.9.8",
|
||||
"version": "1.10.6",
|
||||
"description": "The cutest Discord client mod",
|
||||
"homepage": "https://github.com/Vendicated/Vencord#readme",
|
||||
"bugs": {
|
||||
|
@ -35,6 +35,7 @@
|
|||
"testTsc": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@intrnl/xxhash64": "^0.1.2",
|
||||
"@sapphi-red/web-noise-suppressor": "0.3.5",
|
||||
"@vap/core": "0.0.12",
|
||||
"@vap/shiki": "0.10.5",
|
||||
|
@ -70,6 +71,7 @@
|
|||
"stylelint": "^16.8.1",
|
||||
"stylelint-config-standard": "^36.0.1",
|
||||
"ts-patch": "^3.2.1",
|
||||
"ts-pattern": "^5.3.1",
|
||||
"tsx": "^4.16.5",
|
||||
"type-fest": "^4.23.0",
|
||||
"typescript": "^5.5.4",
|
||||
|
|
|
@ -16,6 +16,9 @@ importers:
|
|||
|
||||
.:
|
||||
dependencies:
|
||||
'@intrnl/xxhash64':
|
||||
specifier: ^0.1.2
|
||||
version: 0.1.2
|
||||
'@sapphi-red/web-noise-suppressor':
|
||||
specifier: 0.3.5
|
||||
version: 0.3.5
|
||||
|
@ -116,6 +119,9 @@ importers:
|
|||
ts-patch:
|
||||
specifier: ^3.2.1
|
||||
version: 3.2.1
|
||||
ts-pattern:
|
||||
specifier: ^5.3.1
|
||||
version: 5.3.1
|
||||
tsx:
|
||||
specifier: ^4.16.5
|
||||
version: 4.16.5
|
||||
|
@ -534,6 +540,9 @@ packages:
|
|||
resolution: {integrity: sha512-d2CGZR2o7fS6sWB7DG/3a95bGKQyHMACZ5aW8qGkkqQpUoZV6C0X7Pc7l4ZNMZkfNBf4VWNe9E1jRsf0G146Ew==}
|
||||
engines: {node: '>=18.18'}
|
||||
|
||||
'@intrnl/xxhash64@0.1.2':
|
||||
resolution: {integrity: sha512-1+lx7j99fdph+uy3EnjQyr39KQZ7LP56+aWOr6finJWpgYpvb7XrhFUqDwnEk/wpPC98nCjAT6RulpW3crWjlg==}
|
||||
|
||||
'@jridgewell/gen-mapping@0.3.5':
|
||||
resolution: {integrity: sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==}
|
||||
engines: {node: '>=6.0.0'}
|
||||
|
@ -2524,6 +2533,9 @@ packages:
|
|||
resolution: {integrity: sha512-hlR43v+GUIUy8/ZGFP1DquEqPh7PFKQdDMTAmYt671kCCA6AkDQMoeFaFmZ7ObPLYOmpMgyKUqL1C+coFMf30w==}
|
||||
hasBin: true
|
||||
|
||||
ts-pattern@5.3.1:
|
||||
resolution: {integrity: sha512-1RUMKa8jYQdNfmnK4jyzBK3/PS/tnjcZ1CW0v1vWDeYe5RBklc/nquw03MEoB66hVBm4BnlCfmOqDVxHyT1DpA==}
|
||||
|
||||
tsconfig-paths@3.15.0:
|
||||
resolution: {integrity: sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==}
|
||||
|
||||
|
@ -2933,6 +2945,8 @@ snapshots:
|
|||
|
||||
'@humanwhocodes/retry@0.3.0': {}
|
||||
|
||||
'@intrnl/xxhash64@0.1.2': {}
|
||||
|
||||
'@jridgewell/gen-mapping@0.3.5':
|
||||
dependencies:
|
||||
'@jridgewell/set-array': 1.2.1
|
||||
|
@ -5158,6 +5172,8 @@ snapshots:
|
|||
semver: 7.6.3
|
||||
strip-ansi: 6.0.1
|
||||
|
||||
ts-pattern@5.3.1: {}
|
||||
|
||||
tsconfig-paths@3.15.0:
|
||||
dependencies:
|
||||
'@types/json5': 0.0.29
|
||||
|
|
|
@ -334,5 +334,6 @@ export const commonRendererPlugins = [
|
|||
banImportPlugin(builtinModuleRegex, "Cannot import node inbuilt modules in browser code. You need to use a native.ts file"),
|
||||
banImportPlugin(/^react$/, "Cannot import from react. React and hooks should be imported from @webpack/common"),
|
||||
banImportPlugin(/^electron(\/.*)?$/, "Cannot import electron in browser code. You need to use a native.ts file"),
|
||||
banImportPlugin(/^ts-pattern$/, "Cannot import from ts-pattern. match and P should be imported from @webpack/common"),
|
||||
...commonOpts.plugins
|
||||
];
|
||||
|
|
2
setup-origins.sh
Executable file
2
setup-origins.sh
Executable file
|
@ -0,0 +1,2 @@
|
|||
git remote add upstream https://github.com/Vendicated/Vencord.git
|
||||
git remote set-url --pull upstream DISABLED
|
|
@ -16,6 +16,7 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Logger } from "@utils/Logger";
|
||||
import { makeCodeblock } from "@utils/text";
|
||||
|
||||
import { sendBotMessage } from "./commandHelpers";
|
||||
|
@ -46,10 +47,10 @@ export let RequiredMessageOption: Option = ReqPlaceholder;
|
|||
export const _init = function (cmds: Command[]) {
|
||||
try {
|
||||
BUILT_IN = cmds;
|
||||
OptionalMessageOption = cmds.find(c => c.name === "shrug")!.options![0];
|
||||
RequiredMessageOption = cmds.find(c => c.name === "me")!.options![0];
|
||||
OptionalMessageOption = cmds.find(c => (c.untranslatedName || c.displayName) === "shrug")!.options![0];
|
||||
RequiredMessageOption = cmds.find(c => (c.untranslatedName || c.displayName) === "me")!.options![0];
|
||||
} catch (e) {
|
||||
console.error("Failed to load CommandsApi");
|
||||
new Logger("CommandsAPI").error("Failed to load CommandsApi", e, " - cmds is", cmds);
|
||||
}
|
||||
return cmds;
|
||||
} as never;
|
||||
|
@ -138,6 +139,8 @@ export function registerCommand<C extends Command>(command: C, plugin: string) {
|
|||
throw new Error(`Command '${command.name}' already exists.`);
|
||||
|
||||
command.isVencordCommand = true;
|
||||
command.untranslatedName ??= command.name;
|
||||
command.untranslatedDescription ??= command.description;
|
||||
command.id ??= `-${BUILT_IN.length + 1}`;
|
||||
command.applicationId ??= "-1"; // BUILT_IN;
|
||||
command.type ??= ApplicationCommandType.CHAT_INPUT;
|
||||
|
|
|
@ -93,8 +93,10 @@ export interface Command {
|
|||
isVencordCommand?: boolean;
|
||||
|
||||
name: string;
|
||||
untranslatedName?: string;
|
||||
displayName?: string;
|
||||
description: string;
|
||||
untranslatedDescription?: string;
|
||||
displayDescription?: string;
|
||||
|
||||
options?: Option[];
|
||||
|
|
|
@ -90,19 +90,20 @@ export function removeGlobalContextMenuPatch(patch: GlobalContextMenuPatchCallba
|
|||
* A helper function for finding the children array of a group nested inside a context menu based on the id(s) of its children
|
||||
* @param id The id of the child. If an array is specified, all ids will be tried
|
||||
* @param children The context menu children
|
||||
* @param matchSubstring Whether to check if the id is a substring of the child id
|
||||
*/
|
||||
export function findGroupChildrenByChildId(id: string | string[], children: Array<ReactElement | null>): Array<ReactElement | null> | null {
|
||||
export function findGroupChildrenByChildId(id: string | string[], children: Array<ReactElement | null | undefined>, matchSubstring = false): Array<ReactElement | null | undefined> | null {
|
||||
for (const child of children) {
|
||||
if (child == null) continue;
|
||||
|
||||
if (Array.isArray(child)) {
|
||||
const found = findGroupChildrenByChildId(id, child);
|
||||
const found = findGroupChildrenByChildId(id, child, matchSubstring);
|
||||
if (found !== null) return found;
|
||||
}
|
||||
|
||||
if (
|
||||
(Array.isArray(id) && id.some(id => child.props?.id === id))
|
||||
|| child.props?.id === id
|
||||
(Array.isArray(id) && id.some(id => matchSubstring ? child.props?.id?.includes(id) : child.props?.id === id))
|
||||
|| (matchSubstring ? child.props?.id?.includes(id) : child.props?.id === id)
|
||||
) return children;
|
||||
|
||||
let nextChildren = child.props?.children;
|
||||
|
@ -112,7 +113,7 @@ export function findGroupChildrenByChildId(id: string | string[], children: Arra
|
|||
child.props.children = nextChildren;
|
||||
}
|
||||
|
||||
const found = findGroupChildrenByChildId(id, nextChildren);
|
||||
const found = findGroupChildrenByChildId(id, nextChildren, matchSubstring);
|
||||
if (found !== null) return found;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,9 +18,8 @@
|
|||
|
||||
import "./iconStyles.css";
|
||||
|
||||
import { getTheme, Theme } from "@utils/discord";
|
||||
import { getIntlMessage, getTheme, Theme } from "@utils/discord";
|
||||
import { classes } from "@utils/misc";
|
||||
import { i18n } from "@webpack/common";
|
||||
import type { PropsWithChildren } from "react";
|
||||
|
||||
interface BaseIconProps extends IconProps {
|
||||
|
@ -65,8 +64,7 @@ export function LinkIcon({ height = 24, width = 24, className }: IconProps) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Discord's copy icon, as seen in the user popout right of the username when clicking
|
||||
* your own username in the bottom left user panel
|
||||
* Discord's copy icon, as seen in the user panel popout on the right of the username and in large code blocks
|
||||
*/
|
||||
export function CopyIcon(props: IconProps) {
|
||||
return (
|
||||
|
@ -76,8 +74,9 @@ export function CopyIcon(props: IconProps) {
|
|||
viewBox="0 0 24 24"
|
||||
>
|
||||
<g fill="currentColor">
|
||||
<path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1z" />
|
||||
<path d="M15 5H8c-1.1 0-1.99.9-1.99 2L6 21c0 1.1.89 2 1.99 2H19c1.1 0 2-.9 2-2V11l-6-6zM8 21V7h6v5h5v9H8z" />
|
||||
<path d="M3 16a1 1 0 0 1-1-1v-5a8 8 0 0 1 8-8h5a1 1 0 0 1 1 1v.5a.5.5 0 0 1-.5.5H10a6 6 0 0 0-6 6v5.5a.5.5 0 0 1-.5.5H3Z" />
|
||||
<path d="M6 18a4 4 0 0 0 4 4h8a4 4 0 0 0 4-4v-4h-3a5 5 0 0 1-5-5V6h-4a4 4 0 0 0-4 4v8Z" />
|
||||
<path d="M21.73 12a3 3 0 0 0-.6-.88l-4.25-4.24a3 3 0 0 0-.88-.61V9a3 3 0 0 0 3 3h2.73Z" />
|
||||
</g>
|
||||
</Icon>
|
||||
);
|
||||
|
@ -133,7 +132,7 @@ export function InfoIcon(props: IconProps) {
|
|||
export function OwnerCrownIcon(props: IconProps) {
|
||||
return (
|
||||
<Icon
|
||||
aria-label={i18n.Messages.GUILD_OWNER}
|
||||
aria-label={getIntlMessage("GUILD_OWNER")}
|
||||
{...props}
|
||||
className={classes(props.className, "vc-owner-crown-icon")}
|
||||
role="img"
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Margins } from "@utils/margins";
|
||||
import { wordsFromCamel, wordsToTitle } from "@utils/text";
|
||||
import { OptionType, PluginOptionNumber } from "@utils/types";
|
||||
import { Forms, React, TextInput } from "@webpack/common";
|
||||
|
||||
|
@ -54,7 +56,8 @@ export function SettingNumericComponent({ option, pluginSettings, definedSetting
|
|||
|
||||
return (
|
||||
<Forms.FormSection>
|
||||
<Forms.FormTitle>{option.description}</Forms.FormTitle>
|
||||
<Forms.FormTitle>{wordsToTitle(wordsFromCamel(id))}</Forms.FormTitle>
|
||||
<Forms.FormText className={Margins.bottom20} type="description">{option.description}</Forms.FormText>
|
||||
<TextInput
|
||||
type="number"
|
||||
pattern="-?[0-9]+"
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Margins } from "@utils/margins";
|
||||
import { wordsFromCamel, wordsToTitle } from "@utils/text";
|
||||
import { PluginOptionSelect } from "@utils/types";
|
||||
import { Forms, React, Select } from "@webpack/common";
|
||||
|
||||
|
@ -44,7 +46,8 @@ export function SettingSelectComponent({ option, pluginSettings, definedSettings
|
|||
|
||||
return (
|
||||
<Forms.FormSection>
|
||||
<Forms.FormTitle>{option.description}</Forms.FormTitle>
|
||||
<Forms.FormTitle>{wordsToTitle(wordsFromCamel(id))}</Forms.FormTitle>
|
||||
<Forms.FormText className={Margins.bottom16} type="description">{option.description}</Forms.FormText>
|
||||
<Select
|
||||
isDisabled={option.disabled?.call(definedSettings) ?? false}
|
||||
options={option.options}
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Margins } from "@utils/margins";
|
||||
import { wordsFromCamel, wordsToTitle } from "@utils/text";
|
||||
import { PluginOptionSlider } from "@utils/types";
|
||||
import { Forms, React, Slider } from "@webpack/common";
|
||||
|
||||
|
@ -50,7 +52,8 @@ export function SettingSliderComponent({ option, pluginSettings, definedSettings
|
|||
|
||||
return (
|
||||
<Forms.FormSection>
|
||||
<Forms.FormTitle>{option.description}</Forms.FormTitle>
|
||||
<Forms.FormTitle>{wordsToTitle(wordsFromCamel(id))}</Forms.FormTitle>
|
||||
<Forms.FormText className={Margins.bottom20} type="description">{option.description}</Forms.FormText>
|
||||
<Slider
|
||||
disabled={option.disabled?.call(definedSettings) ?? false}
|
||||
markers={option.markers}
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Margins } from "@utils/margins";
|
||||
import { wordsFromCamel, wordsToTitle } from "@utils/text";
|
||||
import { PluginOptionString } from "@utils/types";
|
||||
import { Forms, React, TextInput } from "@webpack/common";
|
||||
|
||||
|
@ -41,7 +43,8 @@ export function SettingTextComponent({ option, pluginSettings, definedSettings,
|
|||
|
||||
return (
|
||||
<Forms.FormSection>
|
||||
<Forms.FormTitle>{option.description}</Forms.FormTitle>
|
||||
<Forms.FormTitle>{wordsToTitle(wordsFromCamel(id))}</Forms.FormTitle>
|
||||
<Forms.FormText className={Margins.bottom20} type="description">{option.description}</Forms.FormText>
|
||||
<TextInput
|
||||
type="text"
|
||||
value={state}
|
||||
|
|
|
@ -93,7 +93,7 @@ interface PluginCardProps extends React.HTMLProps<HTMLDivElement> {
|
|||
export function PluginCard({ plugin, disabled, onRestartNeeded, onMouseEnter, onMouseLeave, isNew }: PluginCardProps) {
|
||||
const settings = Settings.plugins[plugin.name];
|
||||
|
||||
const isEnabled = () => settings.enabled ?? false;
|
||||
const isEnabled = () => Vencord.Plugins.isPluginEnabled(plugin.name);
|
||||
|
||||
function toggleEnabled() {
|
||||
const wasEnabled = isEnabled();
|
||||
|
@ -292,10 +292,10 @@ export default function PluginSettings() {
|
|||
|
||||
if (!pluginFilter(p)) continue;
|
||||
|
||||
const isRequired = p.required || depMap[p.name]?.some(d => settings.plugins[d].enabled);
|
||||
const isRequired = p.required || p.isDependency || depMap[p.name]?.some(d => settings.plugins[d].enabled);
|
||||
|
||||
if (isRequired) {
|
||||
const tooltipText = p.required
|
||||
const tooltipText = p.required || !depMap[p.name]
|
||||
? "This plugin is required for Vencord to function."
|
||||
: makeDependencyList(depMap[p.name]?.filter(d => settings.plugins[d].enabled));
|
||||
|
||||
|
|
|
@ -382,6 +382,7 @@ function PatchHelper() {
|
|||
<Forms.FormTitle className={Margins.top20}>Code</Forms.FormTitle>
|
||||
<CodeBlock lang="js" content={code} />
|
||||
<Button onClick={() => Clipboard.copy(code)}>Copy to Clipboard</Button>
|
||||
<Button className={Margins.top8} onClick={() => Clipboard.copy("```ts\n" + code + "\n```")}>Copy as Codeblock</Button>
|
||||
</>
|
||||
)}
|
||||
</SettingsTab>
|
||||
|
|
|
@ -77,8 +77,16 @@ function Validators({ themeLinks }: { themeLinks: string[]; }) {
|
|||
<Forms.FormTitle className={Margins.top20} tag="h5">Validator</Forms.FormTitle>
|
||||
<Forms.FormText>This section will tell you whether your themes can successfully be loaded</Forms.FormText>
|
||||
<div>
|
||||
{themeLinks.map(link => (
|
||||
<Card style={{
|
||||
{themeLinks.map(rawLink => {
|
||||
const { label, link } = (() => {
|
||||
const match = /^@(light|dark) (.*)/.exec(rawLink);
|
||||
if (!match) return { label: rawLink, link: rawLink };
|
||||
|
||||
const [, mode, link] = match;
|
||||
return { label: `[${mode} mode only] ${link}`, link };
|
||||
})();
|
||||
|
||||
return <Card style={{
|
||||
padding: ".5em",
|
||||
marginBottom: ".5em",
|
||||
marginTop: ".5em"
|
||||
|
@ -86,11 +94,11 @@ function Validators({ themeLinks }: { themeLinks: string[]; }) {
|
|||
<Forms.FormTitle tag="h5" style={{
|
||||
overflowWrap: "break-word"
|
||||
}}>
|
||||
{link}
|
||||
{label}
|
||||
</Forms.FormTitle>
|
||||
<Validator link={link} />
|
||||
</Card>
|
||||
))}
|
||||
</Card>;
|
||||
})}
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
|
@ -296,6 +304,7 @@ function ThemesTab() {
|
|||
<Card className="vc-settings-card vc-text-selectable">
|
||||
<Forms.FormTitle tag="h5">Paste links to css files here</Forms.FormTitle>
|
||||
<Forms.FormText>One link per line</Forms.FormText>
|
||||
<Forms.FormText>You can prefix lines with @light or @dark to toggle them based on your Discord theme</Forms.FormText>
|
||||
<Forms.FormText>Make sure to use direct links to files (raw or github.io)!</Forms.FormText>
|
||||
</Card>
|
||||
|
||||
|
|
|
@ -31,9 +31,7 @@ export async function loadLazyChunks() {
|
|||
const lazyChunks = factoryCode.matchAll(LazyChunkRegex);
|
||||
const validChunkGroups = new Set<[chunkIds: number[], entryPoint: number]>();
|
||||
|
||||
// Workaround for a chunk that depends on the ChannelMessage component but may be be force loaded before
|
||||
// the chunk containing the component
|
||||
const shouldForceDefer = factoryCode.includes(".Messages.GUILD_FEED_UNFEATURE_BUTTON_TEXT");
|
||||
const shouldForceDefer = false;
|
||||
|
||||
await Promise.all(Array.from(lazyChunks).map(async ([, rawChunkIds, entryPoint]) => {
|
||||
const chunkIds = rawChunkIds ? Array.from(rawChunkIds.matchAll(Webpack.ChunkIdsRegex)).map(m => Number(m[1])) : [];
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
*/
|
||||
|
||||
import { onceDefined } from "@shared/onceDefined";
|
||||
import electron, { app, BrowserWindowConstructorOptions, Menu } from "electron";
|
||||
import electron, { app, BrowserWindowConstructorOptions, Menu, nativeTheme } from "electron";
|
||||
import { dirname, join } from "path";
|
||||
|
||||
import { initIpc } from "./ipcMain";
|
||||
|
@ -100,6 +100,19 @@ if (!IS_VANILLA) {
|
|||
|
||||
super(options);
|
||||
initIpc(this);
|
||||
|
||||
// Workaround for https://github.com/electron/electron/issues/43367. Vesktop also has its own workaround
|
||||
// @TODO: Remove this when the issue is fixed
|
||||
if (IS_DISCORD_DESKTOP) {
|
||||
this.webContents.on("devtools-opened", () => {
|
||||
if (!nativeTheme.shouldUseDarkColors) return;
|
||||
|
||||
nativeTheme.themeSource = "light";
|
||||
setTimeout(() => {
|
||||
nativeTheme.themeSource = "dark";
|
||||
}, 100);
|
||||
});
|
||||
}
|
||||
} else super(options);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
[class*="profileBadges"] {
|
||||
flex: none;
|
||||
}
|
|
@ -16,8 +16,6 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import "./fixBadgeOverflow.css";
|
||||
|
||||
import { _getBadges, BadgePosition, BadgeUserArgs, ProfileBadge } from "@api/Badges";
|
||||
import DonateButton from "@components/DonateButton";
|
||||
import ErrorBoundary from "@components/ErrorBoundary";
|
||||
|
@ -79,7 +77,7 @@ export default definePlugin({
|
|||
replace: "...$1.props,$& $1.image??"
|
||||
},
|
||||
{
|
||||
match: /(?<=text:(\i)\.description,.{0,50})children:/,
|
||||
match: /(?<=text:(\i)\.description,.{0,200})children:/,
|
||||
replace: "children:$1.component ? $self.renderBadgeComponent({ ...$1 }) :"
|
||||
},
|
||||
// conditionally override their onClick with badge.onClick if it exists
|
||||
|
|
24
src/plugins/_api/dynamicImageModalApi.ts
Normal file
24
src/plugins/_api/dynamicImageModalApi.ts
Normal file
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* Vencord, a Discord client mod
|
||||
* Copyright (c) 2024 Vendicated and contributors
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { Devs } from "@utils/constants";
|
||||
import definePlugin from "@utils/types";
|
||||
|
||||
|
||||
export default definePlugin({
|
||||
name: "DynamicImageModalAPI",
|
||||
authors: [Devs.sadan, Devs.Nuckyz],
|
||||
description: "Allows you to omit either width or height when opening an image modal",
|
||||
patches: [
|
||||
{
|
||||
find: "SCALE_DOWN:",
|
||||
replacement: {
|
||||
match: /!\(null==(\i)\|\|0===\i\|\|null==(\i)\|\|0===\i\)/,
|
||||
replace: (_, width, height) => `!((null == ${width} || 0 === ${width}) && (null == ${height} || 0 === ${height}))`
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
|
@ -31,7 +31,7 @@ export default definePlugin({
|
|||
match: /let\{[^}]*lostPermissionTooltipText:\i[^}]*\}=(\i),/,
|
||||
replace: "$&vencordProps=$1,"
|
||||
}, {
|
||||
match: /\.Messages\.GUILD_OWNER(?=.+?decorators:(\i)\(\)).+?\1=?\(\)=>.+?children:\[/,
|
||||
match: /#{intl::GUILD_OWNER}(?=.+?decorators:(\i)\(\)).+?\1=?\(\)=>.+?children:\[/,
|
||||
replace: "$&...(typeof vencordProps=='undefined'?[]:Vencord.Api.MemberListDecorators.__getDecorators(vencordProps)),"
|
||||
}
|
||||
]
|
||||
|
|
|
@ -25,7 +25,7 @@ export default definePlugin({
|
|||
authors: [Devs.Cyn],
|
||||
patches: [
|
||||
{
|
||||
find: ".Messages.REMOVE_ATTACHMENT_BODY",
|
||||
find: "#{intl::REMOVE_ATTACHMENT_BODY}",
|
||||
replacement: {
|
||||
match: /(?<=.container\)?,children:)(\[.+?\])/,
|
||||
replace: "Vencord.Api.MessageAccessories._modifyAccessories($1,this.props)",
|
||||
|
|
|
@ -27,7 +27,7 @@ export default definePlugin({
|
|||
{
|
||||
find: '"Message Username"',
|
||||
replacement: {
|
||||
match: /\.Messages\.GUILD_COMMUNICATION_DISABLED_BOTTOM_SHEET_TITLE.+?}\),\i(?=\])/,
|
||||
match: /#{intl::GUILD_COMMUNICATION_DISABLED_BOTTOM_SHEET_TITLE}.+?}\),\i(?=\])/,
|
||||
replace: "$&,...Vencord.Api.MessageDecorations.__addDecorationsToMessage(arguments[0])"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ export default definePlugin({
|
|||
authors: [Devs.Arjix, Devs.hunt, Devs.Ven],
|
||||
patches: [
|
||||
{
|
||||
find: ".Messages.EDIT_TEXTAREA_HELP",
|
||||
find: "#{intl::EDIT_TEXTAREA_HELP}",
|
||||
replacement: {
|
||||
match: /(?<=,channel:\i\}\)\.then\().+?(?=return \i\.content!==this\.props\.message\.content&&\i\((.+?)\))/,
|
||||
replace: (match, args) => "" +
|
||||
|
|
|
@ -24,9 +24,9 @@ export default definePlugin({
|
|||
description: "API to add buttons to message popovers.",
|
||||
authors: [Devs.KingFish, Devs.Ven, Devs.Nuckyz],
|
||||
patches: [{
|
||||
find: "Messages.MESSAGE_UTILITIES_A11Y_LABEL",
|
||||
find: "#{intl::MESSAGE_UTILITIES_A11Y_LABEL}",
|
||||
replacement: {
|
||||
match: /\.jsx\)\((\i\.\i),\{label:\i\.\i\.Messages\.MESSAGE_ACTION_REPLY.{0,200}?"reply-self".{0,50}?\}\):null(?=,.+?message:(\i))/,
|
||||
match: /\.jsx\)\((\i\.\i),\{label:\i\.\i\.string\(\i\.\i#{intl::MESSAGE_ACTION_REPLY}.{0,200}?"reply-self".{0,50}?\}\):null(?=,.+?message:(\i))/,
|
||||
replace: "$&,Vencord.Api.MessagePopover._buildPopoverElements($1,$2)"
|
||||
}
|
||||
}],
|
||||
|
|
|
@ -25,16 +25,16 @@ export default definePlugin({
|
|||
description: "Api required for plugins that modify the server list",
|
||||
patches: [
|
||||
{
|
||||
find: "Messages.DISCODO_DISABLED",
|
||||
find: "#{intl::DISCODO_DISABLED}",
|
||||
replacement: {
|
||||
match: /(?<=Messages\.DISCODO_DISABLED.+?return)(\(.{0,75}?tutorialContainer.+?}\))(?=}function)/,
|
||||
match: /(?<=#{intl::DISCODO_DISABLED}.+?return)(\(.{0,75}?tutorialContainer.+?}\))(?=}function)/,
|
||||
replace: "[$1].concat(Vencord.Api.ServerList.renderAll(Vencord.Api.ServerList.ServerListRenderPosition.Above))"
|
||||
}
|
||||
},
|
||||
{
|
||||
find: "Messages.SERVERS,children",
|
||||
find: "#{intl::SERVERS}),children",
|
||||
replacement: {
|
||||
match: /(?<=Messages\.SERVERS,children:).+?default:return null\}\}\)/,
|
||||
match: /(?<=#{intl::SERVERS}\),children:)\i\.map\(\i\)/,
|
||||
replace: "Vencord.Api.ServerList.renderAll(Vencord.Api.ServerList.ServerListRenderPosition.In).concat($&)"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ export default definePlugin({
|
|||
},
|
||||
},
|
||||
{
|
||||
find: ".METRICS,",
|
||||
find: ".METRICS",
|
||||
replacement: [
|
||||
{
|
||||
match: /this\._intervalId=/,
|
||||
|
|
|
@ -25,8 +25,9 @@ import ThemesTab from "@components/VencordSettings/ThemesTab";
|
|||
import UpdaterTab from "@components/VencordSettings/UpdaterTab";
|
||||
import VencordTab from "@components/VencordSettings/VencordTab";
|
||||
import { Devs } from "@utils/constants";
|
||||
import { getIntlMessage } from "@utils/discord";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
import { i18n, React } from "@webpack/common";
|
||||
import { React } from "@webpack/common";
|
||||
|
||||
import gitHash from "~git-hash";
|
||||
|
||||
|
@ -57,20 +58,20 @@ export default definePlugin({
|
|||
]
|
||||
},
|
||||
{
|
||||
find: "Messages.ACTIVITY_SETTINGS",
|
||||
find: ".SEARCH_NO_RESULTS&&0===",
|
||||
replacement: [
|
||||
{
|
||||
match: /(?<=section:(.{0,50})\.DIVIDER\}\))([,;])(?=.{0,200}(\i)\.push.{0,100}label:(\i)\.header)/,
|
||||
replace: (_, sectionTypes, commaOrSemi, elements, element) => `${commaOrSemi} $self.addSettings(${elements}, ${element}, ${sectionTypes}) ${commaOrSemi}`
|
||||
},
|
||||
{
|
||||
match: /({(?=.+?function (\i).{0,120}(\i)=\i\.useMemo.{0,30}return \i\.useMemo\(\(\)=>\i\(\3).+?function\(\){return )\2(?=})/,
|
||||
match: /({(?=.+?function (\i).{0,120}(\i)=\i\.useMemo.{0,60}return \i\.useMemo\(\(\)=>\i\(\3).+?function\(\){return )\2(?=})/,
|
||||
replace: (_, rest, settingsHook) => `${rest}$self.wrapSettingsHook(${settingsHook})`
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
find: "Messages.USER_SETTINGS_ACTIONS_MENU_LABEL",
|
||||
find: "#{intl::USER_SETTINGS_ACTIONS_MENU_LABEL}",
|
||||
replacement: {
|
||||
match: /(?<=function\((\i),\i\)\{)(?=let \i=Object.values\(\i.\i\).*?(\i\.\i)\.open\()/,
|
||||
replace: "$2.open($1);return;"
|
||||
|
@ -148,13 +149,18 @@ export default definePlugin({
|
|||
|
||||
if (!header) return;
|
||||
|
||||
try {
|
||||
const names = {
|
||||
top: i18n.Messages.USER_SETTINGS,
|
||||
aboveNitro: i18n.Messages.BILLING_SETTINGS,
|
||||
belowNitro: i18n.Messages.APP_SETTINGS,
|
||||
aboveActivity: i18n.Messages.ACTIVITY_SETTINGS
|
||||
top: getIntlMessage("USER_SETTINGS"),
|
||||
aboveNitro: getIntlMessage("BILLING_SETTINGS"),
|
||||
belowNitro: getIntlMessage("APP_SETTINGS"),
|
||||
aboveActivity: getIntlMessage("ACTIVITY_SETTINGS")
|
||||
};
|
||||
|
||||
return header === names[settingsLocation];
|
||||
} catch {
|
||||
return firstChild === "PREMIUM";
|
||||
}
|
||||
},
|
||||
|
||||
patchedSettings: new WeakSet(),
|
||||
|
@ -197,7 +203,7 @@ export default definePlugin({
|
|||
},
|
||||
|
||||
get electronVersion() {
|
||||
return VencordNative.native.getVersions().electron || window.armcord?.electron || null;
|
||||
return VencordNative.native.getVersions().electron || window.legcord?.electron || null;
|
||||
},
|
||||
|
||||
get chromiumVersion() {
|
||||
|
|
|
@ -77,7 +77,7 @@ async function generateDebugInfoMessage() {
|
|||
const client = (() => {
|
||||
if (IS_DISCORD_DESKTOP) return `Discord Desktop v${DiscordNative.app.getVersion()}`;
|
||||
if (IS_VESKTOP) return `Vesktop v${VesktopNative.app.getVersion()}`;
|
||||
if ("armcord" in window) return `ArmCord v${window.armcord.version}`;
|
||||
if ("legcord" in window) return `Legcord v${window.legcord.version}`;
|
||||
|
||||
// @ts-expect-error
|
||||
const name = typeof unsafeWindow !== "undefined" ? "UserScript" : "Web";
|
||||
|
@ -142,15 +142,15 @@ export default definePlugin({
|
|||
required: true,
|
||||
description: "Helps us provide support to you",
|
||||
authors: [Devs.Ven],
|
||||
dependencies: ["CommandsAPI", "UserSettingsAPI", "MessageAccessoriesAPI"],
|
||||
dependencies: ["UserSettingsAPI", "MessageAccessoriesAPI"],
|
||||
|
||||
settings,
|
||||
|
||||
patches: [{
|
||||
find: ".BEGINNING_DM.format",
|
||||
find: "#{intl::BEGINNING_DM}",
|
||||
replacement: {
|
||||
match: /BEGINNING_DM\.format\(\{.+?\}\),(?=.{0,100}userId:(\i\.getRecipientId\(\)))/,
|
||||
replace: "$& $self.ContributorDmWarningCard({ userId: $1 }),"
|
||||
match: /#{intl::BEGINNING_DM},{.+?}\),(?=.{0,300}(\i)\.isMultiUserDM)/,
|
||||
replace: "$& $self.renderContributorDmWarningCard({ channel: $1 }),"
|
||||
}
|
||||
}],
|
||||
|
||||
|
@ -235,7 +235,8 @@ export default definePlugin({
|
|||
}
|
||||
},
|
||||
|
||||
ContributorDmWarningCard: ErrorBoundary.wrap(({ userId }) => {
|
||||
renderContributorDmWarningCard: ErrorBoundary.wrap(({ channel }) => {
|
||||
const userId = channel.getRecipientId();
|
||||
if (!isPluginDev(userId)) return null;
|
||||
if (RelationshipStore.isFriend(userId) || isPluginDev(UserStore.getCurrentUser()?.id)) return null;
|
||||
|
||||
|
|
7
src/plugins/accountPanelServerProfile/README.md
Normal file
7
src/plugins/accountPanelServerProfile/README.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
# AccountPanelServerProfile
|
||||
|
||||
Right click your account panel in the bottom left to view your profile in the current server
|
||||
|
||||
![](https://github.com/user-attachments/assets/3228497d-488f-479c-93d2-a32ccdb08f0f)
|
||||
|
||||
![](https://github.com/user-attachments/assets/6fc45363-d95f-4810-812f-2f9fb28b41b5)
|
134
src/plugins/accountPanelServerProfile/index.tsx
Normal file
134
src/plugins/accountPanelServerProfile/index.tsx
Normal file
|
@ -0,0 +1,134 @@
|
|||
/*
|
||||
* Vencord, a Discord client mod
|
||||
* Copyright (c) 2024 Vendicated and contributors
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { definePluginSettings } from "@api/Settings";
|
||||
import ErrorBoundary from "@components/ErrorBoundary";
|
||||
import { Devs } from "@utils/constants";
|
||||
import { getCurrentChannel } from "@utils/discord";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
import { findByPropsLazy, findComponentByCodeLazy } from "@webpack";
|
||||
import { ContextMenuApi, Menu, useEffect, useRef } from "@webpack/common";
|
||||
import { User } from "discord-types/general";
|
||||
|
||||
interface UserProfileProps {
|
||||
popoutProps: Record<string, any>;
|
||||
currentUser: User;
|
||||
originalPopout: () => React.ReactNode;
|
||||
}
|
||||
|
||||
const UserProfile = findComponentByCodeLazy("UserProfilePopoutWrapper: user cannot be undefined");
|
||||
const styles = findByPropsLazy("accountProfilePopoutWrapper");
|
||||
|
||||
let openAlternatePopout = false;
|
||||
let accountPanelRef: React.MutableRefObject<Record<PropertyKey, any> | null> = { current: null };
|
||||
|
||||
const AccountPanelContextMenu = ErrorBoundary.wrap(() => {
|
||||
const { prioritizeServerProfile } = settings.use(["prioritizeServerProfile"]);
|
||||
|
||||
return (
|
||||
<Menu.Menu
|
||||
navId="vc-ap-server-profile"
|
||||
onClose={ContextMenuApi.closeContextMenu}
|
||||
>
|
||||
<Menu.MenuItem
|
||||
id="vc-ap-view-alternate-popout"
|
||||
label={prioritizeServerProfile ? "View Account Profile" : "View Server Profile"}
|
||||
disabled={getCurrentChannel()?.getGuildId() == null}
|
||||
action={e => {
|
||||
openAlternatePopout = true;
|
||||
accountPanelRef.current?.props.onMouseDown();
|
||||
accountPanelRef.current?.props.onClick(e);
|
||||
}}
|
||||
/>
|
||||
<Menu.MenuCheckboxItem
|
||||
id="vc-ap-prioritize-server-profile"
|
||||
label="Prioritize Server Profile"
|
||||
checked={prioritizeServerProfile}
|
||||
action={() => settings.store.prioritizeServerProfile = !prioritizeServerProfile}
|
||||
/>
|
||||
</Menu.Menu>
|
||||
);
|
||||
}, { noop: true });
|
||||
|
||||
const settings = definePluginSettings({
|
||||
prioritizeServerProfile: {
|
||||
type: OptionType.BOOLEAN,
|
||||
description: "Prioritize Server Profile when left clicking your account panel",
|
||||
default: false
|
||||
}
|
||||
});
|
||||
|
||||
export default definePlugin({
|
||||
name: "AccountPanelServerProfile",
|
||||
description: "Right click your account panel in the bottom left to view your profile in the current server",
|
||||
authors: [Devs.Nuckyz, Devs.relitrix],
|
||||
settings,
|
||||
|
||||
patches: [
|
||||
{
|
||||
find: "#{intl::ACCOUNT_SPEAKING_WHILE_MUTED}",
|
||||
group: true,
|
||||
replacement: [
|
||||
{
|
||||
match: /(?<=\.SIZE_32\)}\);)/,
|
||||
replace: "$self.useAccountPanelRef();"
|
||||
},
|
||||
{
|
||||
match: /(\.AVATAR,children:.+?renderPopout:(\i)=>){(.+?)}(?=,position)(?<=currentUser:(\i).+?)/,
|
||||
replace: (_, rest, popoutProps, originalPopout, currentUser) => `${rest}$self.UserProfile({popoutProps:${popoutProps},currentUser:${currentUser},originalPopout:()=>{${originalPopout}}})`
|
||||
},
|
||||
{
|
||||
match: /\.AVATAR,children:.+?(?=renderPopout:)/,
|
||||
replace: "$&onRequestClose:$self.onPopoutClose,"
|
||||
},
|
||||
{
|
||||
match: /(?<=.avatarWrapper,)/,
|
||||
replace: "ref:$self.accountPanelRef,onContextMenu:$self.openAccountPanelContextMenu,"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
get accountPanelRef() {
|
||||
return accountPanelRef;
|
||||
},
|
||||
|
||||
useAccountPanelRef() {
|
||||
useEffect(() => () => {
|
||||
accountPanelRef.current = null;
|
||||
}, []);
|
||||
|
||||
return (accountPanelRef = useRef(null));
|
||||
},
|
||||
|
||||
openAccountPanelContextMenu(event: React.UIEvent) {
|
||||
ContextMenuApi.openContextMenu(event, AccountPanelContextMenu);
|
||||
},
|
||||
|
||||
onPopoutClose() {
|
||||
openAlternatePopout = false;
|
||||
},
|
||||
|
||||
UserProfile: ErrorBoundary.wrap(({ popoutProps, currentUser, originalPopout }: UserProfileProps) => {
|
||||
if (
|
||||
(settings.store.prioritizeServerProfile && openAlternatePopout) ||
|
||||
(!settings.store.prioritizeServerProfile && !openAlternatePopout)
|
||||
) {
|
||||
return originalPopout();
|
||||
}
|
||||
|
||||
const currentChannel = getCurrentChannel();
|
||||
if (currentChannel?.getGuildId() == null) {
|
||||
return originalPopout();
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={styles.accountProfilePopoutWrapper}>
|
||||
<UserProfile {...popoutProps} userId={currentUser.id} guildId={currentChannel.getGuildId()} channelId={currentChannel.id} />
|
||||
</div>
|
||||
);
|
||||
}, { noop: true })
|
||||
});
|
|
@ -41,7 +41,7 @@ export default definePlugin({
|
|||
},
|
||||
{
|
||||
// Status emojis
|
||||
find: ".Messages.GUILD_OWNER,",
|
||||
find: "#{intl::GUILD_OWNER}",
|
||||
replacement: {
|
||||
match: /(?<=\.activityEmoji,.+?animate:)\i/,
|
||||
replace: "!0"
|
||||
|
|
3
src/plugins/alwaysExpandRoles/README.md
Normal file
3
src/plugins/alwaysExpandRoles/README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Always Expand Roles
|
||||
|
||||
Always expands the role list in profile popouts
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Vencord, a modification for Discord's desktop app
|
||||
* Copyright (c) 2022 Vendicated and contributors
|
||||
* 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
|
||||
|
@ -16,20 +16,22 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { migratePluginSettings } from "@api/Settings";
|
||||
import { Devs } from "@utils/constants";
|
||||
import definePlugin from "@utils/types";
|
||||
|
||||
migratePluginSettings("AlwaysExpandRoles", "ShowAllRoles");
|
||||
export default definePlugin({
|
||||
name: "TimeBarAllActivities",
|
||||
description: "Adds the Spotify time bar to all activities if they have start and end timestamps",
|
||||
authors: [Devs.fawn],
|
||||
name: "AlwaysExpandRoles",
|
||||
description: "Always expands the role list in profile popouts",
|
||||
authors: [Devs.surgedevs],
|
||||
patches: [
|
||||
{
|
||||
find: "}renderTimeBar(",
|
||||
find: 'action:"EXPAND_ROLES"',
|
||||
replacement: {
|
||||
match: /renderTimeBar\((.{1,3})\){.{0,50}?let/,
|
||||
replace: "renderTimeBar($1){let"
|
||||
match: /(roles:\i(?=.+?(\i)\(!0\)[,;]\i\({action:"EXPAND_ROLES"}\)).+?\[\i,\2\]=\i\.useState\()!1\)/,
|
||||
replace: (_, rest, setExpandedRoles) => `${rest}!0)`
|
||||
}
|
||||
}
|
||||
],
|
||||
]
|
||||
});
|
|
@ -71,7 +71,7 @@ export default definePlugin({
|
|||
description: "Anonymise uploaded file names",
|
||||
patches: [
|
||||
{
|
||||
find: "instantBatchUpload:function",
|
||||
find: "instantBatchUpload:",
|
||||
replacement: {
|
||||
match: /uploadFiles:(\i),/,
|
||||
replace:
|
||||
|
@ -86,9 +86,9 @@ export default definePlugin({
|
|||
}
|
||||
},
|
||||
{
|
||||
find: ".Messages.ATTACHMENT_UTILITIES_SPOILER",
|
||||
find: "#{intl::ATTACHMENT_UTILITIES_SPOILER}",
|
||||
replacement: {
|
||||
match: /(?<=children:\[)(?=.{10,80}tooltip:.{0,100}\i\.\i\.Messages\.ATTACHMENT_UTILITIES_SPOILER)/,
|
||||
match: /(?<=children:\[)(?=.{10,80}tooltip:.{0,100}#{intl::ATTACHMENT_UTILITIES_SPOILER})/,
|
||||
replace: "arguments[0].canEdit!==false?$self.renderIcon(arguments[0]):null,"
|
||||
},
|
||||
},
|
||||
|
|
|
@ -24,7 +24,7 @@ interface ActivityButton {
|
|||
}
|
||||
|
||||
interface Activity {
|
||||
state: string;
|
||||
state?: string;
|
||||
details?: string;
|
||||
timestamps?: {
|
||||
start?: number;
|
||||
|
@ -52,8 +52,8 @@ const enum ActivityFlag {
|
|||
|
||||
export interface TrackData {
|
||||
name: string;
|
||||
album: string;
|
||||
artist: string;
|
||||
album?: string;
|
||||
artist?: string;
|
||||
|
||||
appleMusicLink?: string;
|
||||
songLink?: string;
|
||||
|
@ -61,8 +61,8 @@ export interface TrackData {
|
|||
albumArtwork?: string;
|
||||
artistArtwork?: string;
|
||||
|
||||
playerPosition: number;
|
||||
duration: number;
|
||||
playerPosition?: number;
|
||||
duration?: number;
|
||||
}
|
||||
|
||||
const enum AssetImageType {
|
||||
|
@ -120,7 +120,7 @@ const settings = definePluginSettings({
|
|||
stateString: {
|
||||
type: OptionType.STRING,
|
||||
description: "Activity state format string",
|
||||
default: "{artist}"
|
||||
default: "{artist} · {album}"
|
||||
},
|
||||
largeImageType: {
|
||||
type: OptionType.SELECT,
|
||||
|
@ -155,8 +155,8 @@ const settings = definePluginSettings({
|
|||
function customFormat(formatStr: string, data: TrackData) {
|
||||
return formatStr
|
||||
.replaceAll("{name}", data.name)
|
||||
.replaceAll("{album}", data.album)
|
||||
.replaceAll("{artist}", data.artist);
|
||||
.replaceAll("{album}", data.album ?? "")
|
||||
.replaceAll("{artist}", data.artist ?? "");
|
||||
}
|
||||
|
||||
function getImageAsset(type: AssetImageType, data: TrackData) {
|
||||
|
@ -212,14 +212,16 @@ export default definePlugin({
|
|||
|
||||
const assets: ActivityAssets = {};
|
||||
|
||||
const isRadio = Number.isNaN(trackData.duration) && (trackData.playerPosition === 0);
|
||||
|
||||
if (settings.store.largeImageType !== AssetImageType.Disabled) {
|
||||
assets.large_image = largeImageAsset;
|
||||
assets.large_text = customFormat(settings.store.largeTextString, trackData);
|
||||
if (!isRadio) assets.large_text = customFormat(settings.store.largeTextString, trackData);
|
||||
}
|
||||
|
||||
if (settings.store.smallImageType !== AssetImageType.Disabled) {
|
||||
assets.small_image = smallImageAsset;
|
||||
assets.small_text = customFormat(settings.store.smallTextString, trackData);
|
||||
if (!isRadio) assets.small_text = customFormat(settings.store.smallTextString, trackData);
|
||||
}
|
||||
|
||||
const buttons: ActivityButton[] = [];
|
||||
|
@ -243,17 +245,17 @@ export default definePlugin({
|
|||
|
||||
name: customFormat(settings.store.nameString, trackData),
|
||||
details: customFormat(settings.store.detailsString, trackData),
|
||||
state: customFormat(settings.store.stateString, trackData),
|
||||
state: isRadio ? undefined : customFormat(settings.store.stateString, trackData),
|
||||
|
||||
timestamps: (settings.store.enableTimestamps ? {
|
||||
timestamps: (trackData.playerPosition && trackData.duration && settings.store.enableTimestamps) ? {
|
||||
start: Date.now() - (trackData.playerPosition * 1000),
|
||||
end: Date.now() - (trackData.playerPosition * 1000) + (trackData.duration * 1000),
|
||||
} : undefined),
|
||||
} : undefined,
|
||||
|
||||
assets,
|
||||
|
||||
buttons: buttons.length ? buttons.map(v => v.label) : undefined,
|
||||
metadata: { button_urls: buttons.map(v => v.url) || undefined, },
|
||||
buttons: !isRadio && buttons.length ? buttons.map(v => v.label) : undefined,
|
||||
metadata: !isRadio && buttons.length ? { button_urls: buttons.map(v => v.url) } : undefined,
|
||||
|
||||
type: settings.store.activityType,
|
||||
flags: ActivityFlag.INSTANCE,
|
||||
|
|
|
@ -11,37 +11,11 @@ import type { TrackData } from ".";
|
|||
|
||||
const exec = promisify(execFile);
|
||||
|
||||
// function exec(file: string, args: string[] = []) {
|
||||
// return new Promise<{ code: number | null, stdout: string | null, stderr: string | null; }>((resolve, reject) => {
|
||||
// const process = spawn(file, args, { stdio: [null, "pipe", "pipe"] });
|
||||
|
||||
// let stdout: string | null = null;
|
||||
// process.stdout.on("data", (chunk: string) => { stdout ??= ""; stdout += chunk; });
|
||||
// let stderr: string | null = null;
|
||||
// process.stderr.on("data", (chunk: string) => { stdout ??= ""; stderr += chunk; });
|
||||
|
||||
// process.on("exit", code => { resolve({ code, stdout, stderr }); });
|
||||
// process.on("error", err => reject(err));
|
||||
// });
|
||||
// }
|
||||
|
||||
async function applescript(cmds: string[]) {
|
||||
const { stdout } = await exec("osascript", cmds.map(c => ["-e", c]).flat());
|
||||
return stdout;
|
||||
}
|
||||
|
||||
function makeSearchUrl(type: string, query: string) {
|
||||
const url = new URL("https://tools.applemediaservices.com/api/apple-media/music/US/search.json");
|
||||
url.searchParams.set("types", type);
|
||||
url.searchParams.set("limit", "1");
|
||||
url.searchParams.set("term", query);
|
||||
return url;
|
||||
}
|
||||
|
||||
const requestOptions: RequestInit = {
|
||||
headers: { "user-agent": "Mozilla/5.0 (Windows NT 10.0; rv:125.0) Gecko/20100101 Firefox/125.0" },
|
||||
};
|
||||
|
||||
interface RemoteData {
|
||||
appleMusicLink?: string,
|
||||
songLink?: string,
|
||||
|
@ -51,6 +25,24 @@ interface RemoteData {
|
|||
|
||||
let cachedRemoteData: { id: string, data: RemoteData; } | { id: string, failures: number; } | null = null;
|
||||
|
||||
const APPLE_MUSIC_BUNDLE_REGEX = /<script type="module" crossorigin src="([a-zA-Z0-9.\-/]+)"><\/script>/;
|
||||
const APPLE_MUSIC_TOKEN_REGEX = /\w+="([A-Za-z0-9-_]*\.[A-Za-z0-9-_]*\.[A-Za-z0-9-_]*)",\w+="x-apple-jingle-correlation-key"/;
|
||||
|
||||
let cachedToken: string | undefined = undefined;
|
||||
|
||||
const getToken = async () => {
|
||||
if (cachedToken) return cachedToken;
|
||||
|
||||
const html = await fetch("https://music.apple.com/").then(r => r.text());
|
||||
const bundleUrl = new URL(html.match(APPLE_MUSIC_BUNDLE_REGEX)![1], "https://music.apple.com/");
|
||||
|
||||
const bundle = await fetch(bundleUrl).then(r => r.text());
|
||||
const token = bundle.match(APPLE_MUSIC_TOKEN_REGEX)![1];
|
||||
|
||||
cachedToken = token;
|
||||
return token;
|
||||
};
|
||||
|
||||
async function fetchRemoteData({ id, name, artist, album }: { id: string, name: string, artist: string, album: string; }) {
|
||||
if (id === cachedRemoteData?.id) {
|
||||
if ("data" in cachedRemoteData) return cachedRemoteData.data;
|
||||
|
@ -58,21 +50,39 @@ async function fetchRemoteData({ id, name, artist, album }: { id: string, name:
|
|||
}
|
||||
|
||||
try {
|
||||
const [songData, artistData] = await Promise.all([
|
||||
fetch(makeSearchUrl("songs", artist + " " + album + " " + name), requestOptions).then(r => r.json()),
|
||||
fetch(makeSearchUrl("artists", artist.split(/ *[,&] */)[0]), requestOptions).then(r => r.json())
|
||||
]);
|
||||
const dataUrl = new URL("https://amp-api-edge.music.apple.com/v1/catalog/us/search");
|
||||
dataUrl.searchParams.set("platform", "web");
|
||||
dataUrl.searchParams.set("l", "en-US");
|
||||
dataUrl.searchParams.set("limit", "1");
|
||||
dataUrl.searchParams.set("with", "serverBubbles");
|
||||
dataUrl.searchParams.set("types", "songs");
|
||||
dataUrl.searchParams.set("term", `${name} ${artist} ${album}`);
|
||||
dataUrl.searchParams.set("include[songs]", "artists");
|
||||
|
||||
const appleMusicLink = songData?.songs?.data[0]?.attributes.url;
|
||||
const songLink = songData?.songs?.data[0]?.id ? `https://song.link/i/${songData?.songs?.data[0]?.id}` : undefined;
|
||||
const token = await getToken();
|
||||
|
||||
const albumArtwork = songData?.songs?.data[0]?.attributes.artwork.url.replace("{w}", "512").replace("{h}", "512");
|
||||
const artistArtwork = artistData?.artists?.data[0]?.attributes.artwork.url.replace("{w}", "512").replace("{h}", "512");
|
||||
const songData = await fetch(dataUrl, {
|
||||
headers: {
|
||||
"accept": "*/*",
|
||||
"accept-language": "en-US,en;q=0.9",
|
||||
"authorization": `Bearer ${token}`,
|
||||
"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36",
|
||||
"origin": "https://music.apple.com",
|
||||
},
|
||||
})
|
||||
.then(r => r.json())
|
||||
.then(data => data.results.song.data[0]);
|
||||
|
||||
cachedRemoteData = {
|
||||
id,
|
||||
data: { appleMusicLink, songLink, albumArtwork, artistArtwork }
|
||||
data: {
|
||||
appleMusicLink: songData.attributes.url,
|
||||
songLink: `https://song.link/i/${songData.id}`,
|
||||
albumArtwork: songData.attributes.artwork.url.replace("{w}x{h}", "512x512"),
|
||||
artistArtwork: songData.relationships.artists.data[0].attributes.artwork.url.replace("{w}x{h}", "512x512"),
|
||||
}
|
||||
};
|
||||
|
||||
return cachedRemoteData.data;
|
||||
} catch (e) {
|
||||
console.error("[AppleMusicRichPresence] Failed to fetch remote data:", e);
|
||||
|
|
|
@ -73,8 +73,8 @@ export default definePlugin({
|
|||
},
|
||||
|
||||
async start() {
|
||||
// ArmCord comes with its own arRPC implementation, so this plugin just confuses users
|
||||
if ("armcord" in window) return;
|
||||
// Legcord comes with its own arRPC implementation, so this plugin just confuses users
|
||||
if ("legcord" in window) return;
|
||||
|
||||
if (ws) ws.close();
|
||||
ws = new WebSocket("ws://127.0.0.1:1337"); // try to open WebSocket
|
||||
|
|
|
@ -36,7 +36,7 @@ export default definePlugin({
|
|||
settings,
|
||||
patches: [
|
||||
{
|
||||
find: "BAN_CONFIRM_TITLE.",
|
||||
find: "#{intl::BAN_CONFIRM_TITLE}",
|
||||
replacement: {
|
||||
match: /src:\i\("?\d+"?\)/g,
|
||||
replace: "src:$self.source"
|
||||
|
|
11
src/plugins/betterFolders/README.md
Normal file
11
src/plugins/betterFolders/README.md
Normal file
|
@ -0,0 +1,11 @@
|
|||
# Better Folders
|
||||
|
||||
Better Folders offers a variety of options to improve your folder experience
|
||||
|
||||
Always show the folder icon, regardless of if the folder is open or not
|
||||
|
||||
Only have one folder open at a time
|
||||
|
||||
Open folders in a sidebar:
|
||||
|
||||
![A folder open in a separate sidebar](https://github.com/user-attachments/assets/432d3146-8091-4bae-9c1e-c19046c72947)
|
|
@ -18,9 +18,10 @@
|
|||
|
||||
import { definePluginSettings } from "@api/Settings";
|
||||
import { Devs } from "@utils/constants";
|
||||
import { getIntlMessage } from "@utils/discord";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
import { findByPropsLazy, findLazy, findStoreLazy } from "@webpack";
|
||||
import { FluxDispatcher, i18n, useMemo } from "@webpack/common";
|
||||
import { FluxDispatcher, useMemo } from "@webpack/common";
|
||||
|
||||
import FolderSideBar from "./FolderSideBar";
|
||||
|
||||
|
@ -30,9 +31,9 @@ enum FolderIconDisplay {
|
|||
MoreThanOneFolderExpanded
|
||||
}
|
||||
|
||||
const GuildsTree = findLazy(m => m.prototype?.moveNextTo);
|
||||
const SortedGuildStore = findStoreLazy("SortedGuildStore");
|
||||
export const ExpandedGuildFolderStore = findStoreLazy("ExpandedGuildFolderStore");
|
||||
const SortedGuildStore = findStoreLazy("SortedGuildStore");
|
||||
const GuildsTree = findLazy(m => m.prototype?.moveNextTo);
|
||||
const FolderUtils = findByPropsLazy("move", "toggleGuildFolderExpand");
|
||||
|
||||
let lastGuildId = null as string | null;
|
||||
|
@ -118,22 +119,22 @@ export default definePlugin({
|
|||
// If we are rendering the Better Folders sidebar, we filter out guilds that are not in folders and unexpanded folders
|
||||
{
|
||||
match: /\[(\i)\]=(\(0,\i\.\i\).{0,40}getGuildsTree\(\).+?}\))(?=,)/,
|
||||
replace: (_, originalTreeVar, rest) => `[betterFoldersOriginalTree]=${rest},${originalTreeVar}=$self.getGuildTree(!!arguments[0].isBetterFolders,betterFoldersOriginalTree,arguments[0].betterFoldersExpandedIds)`
|
||||
replace: (_, originalTreeVar, rest) => `[betterFoldersOriginalTree]=${rest},${originalTreeVar}=$self.getGuildTree(!!arguments[0]?.isBetterFolders,betterFoldersOriginalTree,arguments[0]?.betterFoldersExpandedIds)`
|
||||
},
|
||||
// If we are rendering the Better Folders sidebar, we filter out everything but the servers and folders from the GuildsBar Guild List children
|
||||
{
|
||||
match: /lastTargetNode:\i\[\i\.length-1\].+?Fragment.+?\]}\)\]/,
|
||||
replace: "$&.filter($self.makeGuildsBarGuildListFilter(!!arguments[0].isBetterFolders))"
|
||||
replace: "$&.filter($self.makeGuildsBarGuildListFilter(!!arguments[0]?.isBetterFolders))"
|
||||
},
|
||||
// If we are rendering the Better Folders sidebar, we filter out everything but the scroller for the guild list from the GuildsBar Tree children
|
||||
{
|
||||
match: /unreadMentionsIndicatorBottom,.+?}\)\]/,
|
||||
replace: "$&.filter($self.makeGuildsBarTreeFilter(!!arguments[0].isBetterFolders))"
|
||||
replace: "$&.filter($self.makeGuildsBarTreeFilter(!!arguments[0]?.isBetterFolders))"
|
||||
},
|
||||
// Export the isBetterFolders variable to the folders component
|
||||
{
|
||||
match: /(?<=\.Messages\.SERVERS.+?switch\((\i)\.type\){case \i\.\i\.FOLDER:.+?folderNode:\i,)/,
|
||||
replace: 'isBetterFolders:typeof isBetterFolders!=="undefined"?isBetterFolders:false,'
|
||||
match: /switch\(\i\.type\){case \i\.\i\.FOLDER:.+?folderNode:\i,/,
|
||||
replace: '$&isBetterFolders:typeof isBetterFolders!=="undefined"?isBetterFolders:false,'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -167,31 +168,31 @@ export default definePlugin({
|
|||
{
|
||||
predicate: () => settings.store.keepIcons,
|
||||
match: /(?<=let{folderNode:\i,setNodeRef:\i,.+?expanded:(\i),.+?;)(?=let)/,
|
||||
replace: (_, isExpanded) => `${isExpanded}=!!arguments[0].isBetterFolders&&${isExpanded};`
|
||||
replace: (_, isExpanded) => `${isExpanded}=!!arguments[0]?.isBetterFolders&&${isExpanded};`
|
||||
},
|
||||
// Disable expanding and collapsing folders transition in the normal GuildsBar sidebar
|
||||
{
|
||||
predicate: () => !settings.store.keepIcons,
|
||||
match: /(?<=\.Messages\.SERVER_FOLDER_PLACEHOLDER.+?useTransition\)\()/,
|
||||
replace: "!!arguments[0].isBetterFolders&&"
|
||||
match: /(?<=#{intl::SERVER_FOLDER_PLACEHOLDER}.+?useTransition\)\()/,
|
||||
replace: "$self.shouldShowTransition(arguments[0])&&"
|
||||
},
|
||||
// If we are rendering the normal GuildsBar sidebar, we avoid rendering guilds from folders that are expanded
|
||||
{
|
||||
predicate: () => !settings.store.keepIcons,
|
||||
match: /expandedFolderBackground,.+?,(?=\i\(\(\i,\i,\i\)=>{let{key.{0,45}ul)(?<=selected:\i,expanded:(\i),.+?)/,
|
||||
replace: (m, isExpanded) => `${m}!arguments[0].isBetterFolders&&${isExpanded}?null:`
|
||||
replace: (m, isExpanded) => `${m}$self.shouldRenderContents(arguments[0],${isExpanded})?null:`
|
||||
},
|
||||
{
|
||||
// Decide if we should render the expanded folder background if we are rendering the Better Folders sidebar
|
||||
predicate: () => settings.store.showFolderIcon !== FolderIconDisplay.Always,
|
||||
match: /(?<=\.wrapper,children:\[)/,
|
||||
replace: "$self.shouldShowFolderIconAndBackground(!!arguments[0].isBetterFolders,arguments[0].betterFoldersExpandedIds)&&"
|
||||
replace: "$self.shouldShowFolderIconAndBackground(!!arguments[0]?.isBetterFolders,arguments[0]?.betterFoldersExpandedIds)&&"
|
||||
},
|
||||
{
|
||||
// Decide if we should render the expanded folder icon if we are rendering the Better Folders sidebar
|
||||
predicate: () => settings.store.showFolderIcon !== FolderIconDisplay.Always,
|
||||
match: /(?<=\.expandedFolderBackground.+?}\),)(?=\i,)/,
|
||||
replace: "!$self.shouldShowFolderIconAndBackground(!!arguments[0].isBetterFolders,arguments[0].betterFoldersExpandedIds)?null:"
|
||||
replace: "!$self.shouldShowFolderIconAndBackground(!!arguments[0]?.isBetterFolders,arguments[0]?.betterFoldersExpandedIds)?null:"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -200,12 +201,12 @@ export default definePlugin({
|
|||
predicate: () => settings.store.sidebar,
|
||||
replacement: {
|
||||
// Render the Better Folders sidebar
|
||||
match: /(?<=({className:\i\.guilds,themeOverride:\i})\))/,
|
||||
replace: ",$self.FolderSideBar($1)"
|
||||
match: /(container.{0,50}({className:\i\.guilds,themeOverride:\i})\))/,
|
||||
replace: "$1,$self.FolderSideBar({...$2})"
|
||||
}
|
||||
},
|
||||
{
|
||||
find: ".Messages.DISCODO_DISABLED",
|
||||
find: "#{intl::DISCODO_DISABLED}",
|
||||
predicate: () => settings.store.closeAllHomeButton,
|
||||
replacement: {
|
||||
// Close all folders when clicking the home button
|
||||
|
@ -274,12 +275,16 @@ export default definePlugin({
|
|||
},
|
||||
|
||||
makeGuildsBarGuildListFilter(isBetterFolders: boolean) {
|
||||
try {
|
||||
return child => {
|
||||
if (isBetterFolders) {
|
||||
return child?.props?.["aria-label"] === i18n.Messages.SERVERS;
|
||||
return child?.props?.["aria-label"] === getIntlMessage("SERVERS");
|
||||
}
|
||||
return true;
|
||||
};
|
||||
} catch {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
makeGuildsBarTreeFilter(isBetterFolders: boolean) {
|
||||
|
@ -306,7 +311,20 @@ export default definePlugin({
|
|||
}
|
||||
},
|
||||
|
||||
FolderSideBar: guildsBarProps => <FolderSideBar {...guildsBarProps} />,
|
||||
shouldShowTransition(props: any) {
|
||||
// Pending guilds
|
||||
if (props?.folderNode?.id === 1) return true;
|
||||
|
||||
closeFolders
|
||||
return !!props?.isBetterFolders;
|
||||
},
|
||||
|
||||
shouldRenderContents(props: any, isExpanded: boolean) {
|
||||
// Pending guilds
|
||||
if (props?.folderNode?.id === 1) return false;
|
||||
|
||||
return !props?.isBetterFolders && isExpanded;
|
||||
},
|
||||
|
||||
FolderSideBar,
|
||||
closeFolders,
|
||||
});
|
||||
|
|
|
@ -34,9 +34,9 @@ export default definePlugin({
|
|||
},
|
||||
},
|
||||
{
|
||||
find: ".Messages.GIF,",
|
||||
find: "#{intl::GIF}",
|
||||
replacement: {
|
||||
match: /alt:(\i)=(\i\.\i\.Messages\.GIF)(?=,[^}]*\}=(\i))/,
|
||||
match: /alt:(\i)=(\i\.\i\.string\(\i\.\i#{intl::GIF}\))(?=,[^}]*\}=(\i))/,
|
||||
replace:
|
||||
// rename prop so we can always use default value
|
||||
"alt_$$:$1=$self.altify($3)||$2",
|
||||
|
|
|
@ -63,9 +63,9 @@ export default definePlugin({
|
|||
}
|
||||
},
|
||||
{
|
||||
find: "Messages.NOTE_PLACEHOLDER",
|
||||
find: "#{intl::NOTE_PLACEHOLDER}",
|
||||
replacement: {
|
||||
match: /\.NOTE_PLACEHOLDER,/,
|
||||
match: /#{intl::NOTE_PLACEHOLDER}\),/,
|
||||
replace: "$&spellCheck:!$self.noSpellCheck,"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -99,7 +99,11 @@ export default definePlugin({
|
|||
id="vc-view-role-icon"
|
||||
label="View Role Icon"
|
||||
action={() => {
|
||||
openImageModal(`${location.protocol}//${window.GLOBAL_ENV.CDN_HOST}/role-icons/${role.id}/${role.icon}.${settings.store.roleIconFileFormat}`);
|
||||
openImageModal({
|
||||
url: `${location.protocol}//${window.GLOBAL_ENV.CDN_HOST}/role-icons/${role.id}/${role.icon}.${settings.store.roleIconFileFormat}`,
|
||||
height: 128,
|
||||
width: 128
|
||||
});
|
||||
}}
|
||||
icon={ImageIcon}
|
||||
/>
|
||||
|
|
|
@ -47,7 +47,7 @@ export default definePlugin({
|
|||
},
|
||||
|
||||
{
|
||||
find: ".ADD_ROLE_A11Y_LABEL",
|
||||
find: "#{intl::ADD_ROLE_A11Y_LABEL}",
|
||||
all: true,
|
||||
predicate: () => Settings.plugins.BetterRoleDot.copyRoleColorInProfilePopout && !Settings.plugins.BetterRoleDot.bothStyles,
|
||||
noWarn: true,
|
||||
|
|
|
@ -60,7 +60,7 @@ export default definePlugin({
|
|||
|
||||
patches: [
|
||||
{
|
||||
find: "Messages.AUTH_SESSIONS_SESSION_LOG_OUT",
|
||||
find: "#{intl::AUTH_SESSIONS_SESSION_LOG_OUT}",
|
||||
replacement: [
|
||||
// Replace children with a single label with state
|
||||
{
|
||||
|
|
69
src/plugins/betterSettings/PluginsSubmenu.tsx
Normal file
69
src/plugins/betterSettings/PluginsSubmenu.tsx
Normal file
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* Vencord, a Discord client mod
|
||||
* Copyright (c) 2024 Vendicated and contributors
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { openPluginModal } from "@components/PluginSettings/PluginModal";
|
||||
import { getIntlMessage } from "@utils/discord";
|
||||
import { isObjectEmpty } from "@utils/misc";
|
||||
import { Alerts, Menu, useMemo, useState } from "@webpack/common";
|
||||
|
||||
import Plugins from "~plugins";
|
||||
|
||||
function onRestartNeeded() {
|
||||
Alerts.show({
|
||||
title: "Restart required",
|
||||
body: <p>You have changed settings that require a restart.</p>,
|
||||
confirmText: "Restart now",
|
||||
cancelText: "Later!",
|
||||
onConfirm: () => location.reload()
|
||||
});
|
||||
}
|
||||
|
||||
export default function PluginsSubmenu() {
|
||||
const sortedPlugins = useMemo(() => Object.values(Plugins)
|
||||
.sort((a, b) => a.name.localeCompare(b.name)), []);
|
||||
const [query, setQuery] = useState("");
|
||||
|
||||
const search = query.toLowerCase();
|
||||
const include = (p: typeof Plugins[keyof typeof Plugins]) => (
|
||||
Vencord.Plugins.isPluginEnabled(p.name)
|
||||
&& p.options && !isObjectEmpty(p.options)
|
||||
&& (
|
||||
p.name.toLowerCase().includes(search)
|
||||
|| p.description.toLowerCase().includes(search)
|
||||
|| p.tags?.some(t => t.toLowerCase().includes(search))
|
||||
)
|
||||
);
|
||||
|
||||
const plugins = sortedPlugins.filter(include);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Menu.MenuControlItem
|
||||
id="vc-plugins-search"
|
||||
control={(props, ref) => (
|
||||
<Menu.MenuSearchControl
|
||||
{...props}
|
||||
query={query}
|
||||
onChange={setQuery}
|
||||
ref={ref}
|
||||
placeholder={getIntlMessage("SEARCH")}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
|
||||
{!!plugins.length && <Menu.MenuSeparator />}
|
||||
|
||||
{plugins.map(p => (
|
||||
<Menu.MenuItem
|
||||
key={p.name}
|
||||
id={p.name}
|
||||
label={p.name}
|
||||
action={() => openPluginModal(p, onRestartNeeded)}
|
||||
/>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
}
|
|
@ -7,12 +7,15 @@
|
|||
import { definePluginSettings } from "@api/Settings";
|
||||
import { classNameFactory } from "@api/Styles";
|
||||
import { Devs } from "@utils/constants";
|
||||
import { getIntlMessage } from "@utils/discord";
|
||||
import { Logger } from "@utils/Logger";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
import { waitFor } from "@webpack";
|
||||
import { ComponentDispatch, FocusLock, i18n, Menu, useEffect, useRef } from "@webpack/common";
|
||||
import { ComponentDispatch, FocusLock, Menu, useEffect, useRef } from "@webpack/common";
|
||||
import type { HTMLAttributes, ReactElement } from "react";
|
||||
|
||||
import PluginsSubmenu from "./PluginsSubmenu";
|
||||
|
||||
type SettingsEntry = { section: string, label: string; };
|
||||
|
||||
const cl = classNameFactory("");
|
||||
|
@ -109,7 +112,7 @@ export default definePlugin({
|
|||
predicate: () => settings.store.disableFade
|
||||
},
|
||||
{ // Load menu TOC eagerly
|
||||
find: "Messages.USER_SETTINGS_WITH_BUILD_OVERRIDE.format",
|
||||
find: "#{intl::USER_SETTINGS_WITH_BUILD_OVERRIDE}",
|
||||
replacement: {
|
||||
match: /(\i)\(this,"handleOpenSettingsContextMenu",.{0,100}?null!=\i&&.{0,100}?(await Promise\.all[^};]*?\)\)).*?,(?=\1\(this)/,
|
||||
replace: "$&(async ()=>$2)(),"
|
||||
|
@ -117,14 +120,22 @@ export default definePlugin({
|
|||
predicate: () => settings.store.eagerLoad
|
||||
},
|
||||
{ // Settings cog context menu
|
||||
find: "Messages.USER_SETTINGS_ACTIONS_MENU_LABEL",
|
||||
replacement: {
|
||||
find: "#{intl::USER_SETTINGS_ACTIONS_MENU_LABEL}",
|
||||
replacement: [
|
||||
{
|
||||
match: /(EXPERIMENTS:.+?)(\(0,\i.\i\)\(\))(?=\.filter\(\i=>\{let\{section:\i\}=)/,
|
||||
replace: "$1$self.wrapMenu($2)"
|
||||
},
|
||||
{
|
||||
match: /case \i\.\i\.DEVELOPER_OPTIONS:return \i;/,
|
||||
replace: "$&case 'VencordPlugins':return $self.PluginsSubmenu();"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
],
|
||||
|
||||
PluginsSubmenu,
|
||||
|
||||
// This is the very outer layer of the entire ui, so we can't wrap this in an ErrorBoundary
|
||||
// without possibly also catching unrelated errors of children.
|
||||
//
|
||||
|
@ -149,7 +160,7 @@ export default definePlugin({
|
|||
if (item.section === "HEADER") {
|
||||
items.push({ label: item.label, items: [] });
|
||||
} else if (item.section === "DIVIDER") {
|
||||
items.push({ label: i18n.Messages.OTHER_OPTIONS, items: [] });
|
||||
items.push({ label: getIntlMessage("OTHER_OPTIONS"), items: [] });
|
||||
} else {
|
||||
items.at(-1)!.items.push(item);
|
||||
}
|
||||
|
|
|
@ -57,7 +57,11 @@ export const handleViewPreview = async ({ guildId, channelId, ownerId }: Applica
|
|||
const previewUrl = await ApplicationStreamPreviewStore.getPreviewURL(guildId, channelId, ownerId);
|
||||
if (!previewUrl) return;
|
||||
|
||||
openImageModal(previewUrl);
|
||||
openImageModal({
|
||||
url: previewUrl,
|
||||
height: 720,
|
||||
width: 1280
|
||||
});
|
||||
};
|
||||
|
||||
export const addViewStreamContext: NavContextMenuPatchCallback = (children, { userId }: { userId: string | bigint; }) => {
|
||||
|
|
|
@ -45,8 +45,8 @@ export default definePlugin({
|
|||
{
|
||||
find: ".embedWrapper,embed",
|
||||
replacement: [{
|
||||
match: /\.embedWrapper(?=.+?channel_id:(\i)\.id)/g,
|
||||
replace: "$&+($1.nsfw?' vc-nsfw-img':'')"
|
||||
match: /\.container/,
|
||||
replace: "$&+(this.props.channel.nsfw? ' vc-nsfw-img': '')"
|
||||
}]
|
||||
}
|
||||
],
|
||||
|
|
|
@ -155,4 +155,5 @@ export const defaultRules = [
|
|||
"igshid",
|
||||
"igsh",
|
||||
"share_id@reddit.com",
|
||||
"si@soundcloud.com",
|
||||
];
|
||||
|
|
|
@ -12,9 +12,9 @@ import { Margins } from "@utils/margins";
|
|||
import { classes } from "@utils/misc";
|
||||
import definePlugin, { OptionType, StartAt } from "@utils/types";
|
||||
import { findByCodeLazy, findComponentByCodeLazy, findStoreLazy } from "@webpack";
|
||||
import { Button, Forms, useStateFromStores } from "@webpack/common";
|
||||
import { Button, Forms, ThemeStore, useStateFromStores } from "@webpack/common";
|
||||
|
||||
const ColorPicker = findComponentByCodeLazy(".Messages.USER_SETTINGS_PROFILE_COLOR_SELECT_COLOR", ".BACKGROUND_PRIMARY)");
|
||||
const ColorPicker = findComponentByCodeLazy("#{intl::USER_SETTINGS_PROFILE_COLOR_SELECT_COLOR}", ".BACKGROUND_PRIMARY)");
|
||||
|
||||
const colorPresets = [
|
||||
"#1E1514", "#172019", "#13171B", "#1C1C28", "#402D2D",
|
||||
|
@ -36,7 +36,6 @@ function setTheme(theme: string) {
|
|||
saveClientTheme({ theme });
|
||||
}
|
||||
|
||||
const ThemeStore = findStoreLazy("ThemeStore");
|
||||
const NitroThemeStore = findStoreLazy("ClientThemesBackgroundStore");
|
||||
|
||||
function ThemeSettings() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# ConsoleJanitor
|
||||
|
||||
Disables annoying console messages/errors. This plugin mainly removes errors/warnings that happen all the time and noisy/spammy logging messages.
|
||||
Disables annoying console messages/errors. This plugin mainly removes errors/warnings that happen all the time and Discord logger messages.
|
||||
|
||||
Some of the disabled messages include the "notosans-400-normalitalic" error and MessageActionCreators, Routing/Utils loggers.
|
||||
One of the disabled messages is the "Window state not initialized" warning, for example.
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import { definePluginSettings } from "@api/Settings";
|
||||
import { Devs } from "@utils/constants";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
import definePlugin, { OptionType, StartAt } from "@utils/types";
|
||||
|
||||
const Noop = () => { };
|
||||
const NoopLogger = {
|
||||
|
@ -22,10 +22,12 @@ const NoopLogger = {
|
|||
fileOnly: Noop
|
||||
};
|
||||
|
||||
const logAllow = new Set();
|
||||
|
||||
const settings = definePluginSettings({
|
||||
disableNoisyLoggers: {
|
||||
disableLoggers: {
|
||||
type: OptionType.BOOLEAN,
|
||||
description: "Disable noisy loggers like the MessageActionCreators",
|
||||
description: "Disables Discords loggers",
|
||||
default: false,
|
||||
restartNeeded: true
|
||||
},
|
||||
|
@ -34,18 +36,43 @@ const settings = definePluginSettings({
|
|||
description: "Disable the Spotify logger, which leaks account information and access token",
|
||||
default: true,
|
||||
restartNeeded: true
|
||||
},
|
||||
whitelistedLoggers: {
|
||||
type: OptionType.STRING,
|
||||
description: "Semi colon separated list of loggers to allow even if others are hidden",
|
||||
default: "GatewaySocket; Routing/Utils",
|
||||
onChange(newVal: string) {
|
||||
logAllow.clear();
|
||||
newVal.split(";").map(x => x.trim()).forEach(logAllow.add.bind(logAllow));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
export default definePlugin({
|
||||
name: "ConsoleJanitor",
|
||||
description: "Disables annoying console messages/errors",
|
||||
authors: [Devs.Nuckyz],
|
||||
authors: [Devs.Nuckyz, Devs.sadan],
|
||||
settings,
|
||||
|
||||
startAt: StartAt.Init,
|
||||
start() {
|
||||
logAllow.clear();
|
||||
this.settings.store.whitelistedLoggers?.split(";").map(x => x.trim()).forEach(logAllow.add.bind(logAllow));
|
||||
},
|
||||
|
||||
NoopLogger: () => NoopLogger,
|
||||
shouldLog(logger: string) {
|
||||
return logAllow.has(logger);
|
||||
},
|
||||
|
||||
patches: [
|
||||
{
|
||||
find: 'react-spring: The "interpolate" function',
|
||||
replacement: {
|
||||
match: /,console.warn\('react-spring: The "interpolate" function is deprecated in v10 \(use "to" instead\)'\)/,
|
||||
replace: ""
|
||||
}
|
||||
},
|
||||
{
|
||||
find: 'console.warn("Window state not initialized"',
|
||||
replacement: {
|
||||
|
@ -60,13 +87,6 @@ export default definePlugin({
|
|||
replace: ""
|
||||
}
|
||||
},
|
||||
{
|
||||
find: "notosans-400-normalitalic",
|
||||
replacement: {
|
||||
match: /,"notosans-.+?"/g,
|
||||
replace: ""
|
||||
}
|
||||
},
|
||||
{
|
||||
find: 'console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");',
|
||||
all: true,
|
||||
|
@ -110,34 +130,13 @@ export default definePlugin({
|
|||
replace: ""
|
||||
}
|
||||
},
|
||||
...[
|
||||
'("MessageActionCreators")', '("ChannelMessages")',
|
||||
'("Routing/Utils")', '("RTCControlSocket")',
|
||||
'("ConnectionEventFramerateReducer")', '("RTCLatencyTestManager")',
|
||||
'("OverlayBridgeStore")', '("RPCServer:WSS")', '("RPCServer:IPC")'
|
||||
].map(logger => ({
|
||||
find: logger,
|
||||
predicate: () => settings.store.disableNoisyLoggers,
|
||||
all: true,
|
||||
replacement: {
|
||||
match: new RegExp(String.raw`new \i\.\i${logger.replace(/([()])/g, "\\$1")}`),
|
||||
replace: `$self.NoopLogger${logger}`
|
||||
}
|
||||
})),
|
||||
// Patches discords generic logger function
|
||||
{
|
||||
find: '"Experimental codecs: "',
|
||||
predicate: () => settings.store.disableNoisyLoggers,
|
||||
find: "Σ:",
|
||||
predicate: () => settings.store.disableLoggers,
|
||||
replacement: {
|
||||
match: /new \i\.\i\("Connection\("\.concat\(\i,"\)"\)\)/,
|
||||
replace: "$self.NoopLogger()"
|
||||
}
|
||||
},
|
||||
{
|
||||
find: '"Handling ping: "',
|
||||
predicate: () => settings.store.disableNoisyLoggers,
|
||||
replacement: {
|
||||
match: /new \i\.\i\("RTCConnection\("\.concat.+?\)\)(?=,)/,
|
||||
replace: "$self.NoopLogger()"
|
||||
match: /(?<=&&)(?=console)/,
|
||||
replace: "$self.shouldLog(arguments[0])&&"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -148,5 +147,5 @@ export default definePlugin({
|
|||
replace: "$self.NoopLogger()"
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
});
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
import { Devs } from "@utils/constants";
|
||||
import { getCurrentChannel, getCurrentGuild } from "@utils/discord";
|
||||
import { runtimeHashMessageKey } from "@utils/intlHash";
|
||||
import { SYM_LAZY_CACHED, SYM_LAZY_GET } from "@utils/lazy";
|
||||
import { relaunch } from "@utils/native";
|
||||
import { canonicalizeMatch, canonicalizeReplace, canonicalizeReplacement } from "@utils/patches";
|
||||
|
@ -104,6 +105,7 @@ function makeShortcuts() {
|
|||
canonicalizeMatch,
|
||||
canonicalizeReplace,
|
||||
canonicalizeReplacement,
|
||||
runtimeHashMessageKey,
|
||||
fakeRender: (component: ComponentType, props: any) => {
|
||||
const prevWin = fakeRenderWin?.deref();
|
||||
const win = prevWin?.closed === false
|
||||
|
|
5
src/plugins/copyFileContents/README.md
Normal file
5
src/plugins/copyFileContents/README.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
# CopyFileContents
|
||||
|
||||
Adds a button to text file attachments to copy their contents.
|
||||
|
||||
![](https://github.com/user-attachments/assets/b1a0f6f4-106f-4953-94d9-4c5ef5810bca)
|
60
src/plugins/copyFileContents/index.tsx
Normal file
60
src/plugins/copyFileContents/index.tsx
Normal file
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* Vencord, a Discord client mod
|
||||
* Copyright (c) 2024 Vendicated and contributors
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import "./style.css";
|
||||
|
||||
import ErrorBoundary from "@components/ErrorBoundary";
|
||||
import { CopyIcon, NoEntrySignIcon } from "@components/Icons";
|
||||
import { Devs } from "@utils/constants";
|
||||
import { copyWithToast } from "@utils/misc";
|
||||
import definePlugin from "@utils/types";
|
||||
import { Tooltip, useState } from "@webpack/common";
|
||||
|
||||
const CheckMarkIcon = () => {
|
||||
return <svg width="24" height="24" viewBox="0 0 24 24">
|
||||
<path fill="currentColor" d="M21.7 5.3a1 1 0 0 1 0 1.4l-12 12a1 1 0 0 1-1.4 0l-6-6a1 1 0 1 1 1.4-1.4L9 16.58l11.3-11.3a1 1 0 0 1 1.4 0Z"></path>
|
||||
</svg>;
|
||||
};
|
||||
|
||||
export default definePlugin({
|
||||
name: "CopyFileContents",
|
||||
description: "Adds a button to text file attachments to copy their contents",
|
||||
authors: [Devs.Obsidian, Devs.Nuckyz],
|
||||
patches: [
|
||||
{
|
||||
find: "#{intl::PREVIEW_BYTES_LEFT}",
|
||||
replacement: {
|
||||
match: /\.footerGap.+?url:\i,fileName:\i,fileSize:\i}\),(?<=fileContents:(\i),bytesLeft:(\i).+?)/g,
|
||||
replace: "$&$self.addCopyButton({fileContents:$1,bytesLeft:$2}),"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
addCopyButton: ErrorBoundary.wrap(({ fileContents, bytesLeft }: { fileContents: string, bytesLeft: number; }) => {
|
||||
const [recentlyCopied, setRecentlyCopied] = useState(false);
|
||||
|
||||
return (
|
||||
<Tooltip text={recentlyCopied ? "Copied!" : bytesLeft > 0 ? "File too large to copy" : "Copy File Contents"}>
|
||||
{tooltipProps => (
|
||||
<div
|
||||
{...tooltipProps}
|
||||
className="vc-cfc-button"
|
||||
role="button"
|
||||
onClick={() => {
|
||||
if (!recentlyCopied && bytesLeft <= 0) {
|
||||
copyWithToast(fileContents);
|
||||
setRecentlyCopied(true);
|
||||
setTimeout(() => setRecentlyCopied(false), 2000);
|
||||
}
|
||||
}}
|
||||
>
|
||||
{recentlyCopied ? <CheckMarkIcon /> : bytesLeft > 0 ? <NoEntrySignIcon color="var(--channel-icon)" /> : <CopyIcon />}
|
||||
</div>
|
||||
)}
|
||||
</Tooltip>
|
||||
);
|
||||
}, { noop: true }),
|
||||
});
|
9
src/plugins/copyFileContents/style.css
Normal file
9
src/plugins/copyFileContents/style.css
Normal file
|
@ -0,0 +1,9 @@
|
|||
.vc-cfc-button {
|
||||
color: var(--interactive-normal);
|
||||
cursor: pointer;
|
||||
padding-left: 4px;
|
||||
}
|
||||
|
||||
.vc-cfc-button:hover {
|
||||
color: var(--interactive-hover);
|
||||
}
|
|
@ -67,7 +67,7 @@ export default definePlugin({
|
|||
|
||||
patches: [
|
||||
{
|
||||
find: ".Messages.ERRORS_UNEXPECTED_CRASH",
|
||||
find: "#{intl::ERRORS_UNEXPECTED_CRASH}",
|
||||
replacement: {
|
||||
match: /this\.setState\((.+?)\)/,
|
||||
replace: "$self.handleCrash(this,$1);"
|
||||
|
@ -175,7 +175,7 @@ export default definePlugin({
|
|||
}
|
||||
if (settings.store.attemptToNavigateToHome) {
|
||||
try {
|
||||
NavigationRouter.transitionTo("/channels/@me");
|
||||
NavigationRouter.transitionToGuild("@me");
|
||||
} catch (err) {
|
||||
CrashHandlerLogger.debug("Failed to navigate to home", err);
|
||||
}
|
||||
|
|
|
@ -26,12 +26,11 @@ import { Margins } from "@utils/margins";
|
|||
import { classes } from "@utils/misc";
|
||||
import { useAwaiter } from "@utils/react";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
import { findByCodeLazy, findByPropsLazy, findComponentByCodeLazy } from "@webpack";
|
||||
import { findByCodeLazy, findComponentByCodeLazy } from "@webpack";
|
||||
import { ApplicationAssetUtils, Button, FluxDispatcher, Forms, GuildStore, React, SelectedChannelStore, SelectedGuildStore, UserStore } from "@webpack/common";
|
||||
|
||||
const useProfileThemeStyle = findByCodeLazy("profileThemeStyle:", "--profile-gradient-primary-color");
|
||||
const ActivityComponent = findComponentByCodeLazy("onOpenGameProfile");
|
||||
const ActivityClassName = findByPropsLazy("activity", "buttonColor");
|
||||
|
||||
const ShowCurrentGame = getUserSettingLazy<boolean>("status", "showCurrentGame")!;
|
||||
|
||||
|
@ -436,8 +435,8 @@ export default definePlugin({
|
|||
|
||||
<Forms.FormDivider className={Margins.top8} />
|
||||
|
||||
<div style={{ width: "284px", ...profileThemeStyle }}>
|
||||
{activity[0] && <ActivityComponent activity={activity[0]} className={ActivityClassName.activity} channelId={SelectedChannelStore.getChannelId()}
|
||||
<div style={{ width: "284px", ...profileThemeStyle, padding: 8, marginTop: 8, borderRadius: 8, background: "var(--bg-mod-faint)" }}>
|
||||
{activity[0] && <ActivityComponent activity={activity[0]} channelId={SelectedChannelStore.getChannelId()}
|
||||
guild={GuildStore.getGuild(SelectedGuildStore.getLastSelectedGuildId())}
|
||||
application={{ id: settings.store.appID }}
|
||||
user={UserStore.getCurrentUser()} />}
|
||||
|
|
|
@ -37,8 +37,8 @@ export default definePlugin({
|
|||
find: 'type:"IDLE",idle:',
|
||||
replacement: [
|
||||
{
|
||||
match: /(?<=Date\.now\(\)-\i>)\i\.\i/,
|
||||
replace: "$self.getIdleTimeout()"
|
||||
match: /(?<=Date\.now\(\)-\i>)\i\.\i\|\|/,
|
||||
replace: "$self.getIdleTimeout()||"
|
||||
},
|
||||
{
|
||||
match: /Math\.min\((\i\.\i\.getSetting\(\)\*\i\.\i\.\i\.SECOND),\i\.\i\)/,
|
||||
|
|
|
@ -46,7 +46,7 @@ const embedUrlRe = /https:\/\/www\.youtube\.com\/embed\/([a-zA-Z0-9_-]{11})/;
|
|||
async function embedDidMount(this: Component<Props>) {
|
||||
try {
|
||||
const { embed } = this.props;
|
||||
const { replaceElements } = settings.store;
|
||||
const { replaceElements, dearrowByDefault } = settings.store;
|
||||
|
||||
if (!embed || embed.dearrow || embed.provider?.name !== "YouTube" || !embed.video?.url) return;
|
||||
|
||||
|
@ -63,18 +63,22 @@ async function embedDidMount(this: Component<Props>) {
|
|||
|
||||
if (!hasTitle && !hasThumb) return;
|
||||
|
||||
|
||||
embed.dearrow = {
|
||||
enabled: true
|
||||
enabled: dearrowByDefault
|
||||
};
|
||||
|
||||
if (hasTitle && replaceElements !== ReplaceElements.ReplaceThumbnailsOnly) {
|
||||
embed.dearrow.oldTitle = embed.rawTitle;
|
||||
embed.rawTitle = titles[0].title.replace(/(^|\s)>(\S)/g, "$1$2");
|
||||
}
|
||||
const replacementTitle = titles[0].title.replace(/(^|\s)>(\S)/g, "$1$2");
|
||||
|
||||
embed.dearrow.oldTitle = dearrowByDefault ? embed.rawTitle : replacementTitle;
|
||||
if (dearrowByDefault) embed.rawTitle = replacementTitle;
|
||||
}
|
||||
if (hasThumb && replaceElements !== ReplaceElements.ReplaceTitlesOnly) {
|
||||
embed.dearrow.oldThumb = embed.thumbnail.proxyURL;
|
||||
embed.thumbnail.proxyURL = `https://dearrow-thumb.ajay.app/api/v1/getThumbnail?videoID=${videoId}&time=${thumbnails[0].timestamp}`;
|
||||
const replacementProxyURL = `https://dearrow-thumb.ajay.app/api/v1/getThumbnail?videoID=${videoId}&time=${thumbnails[0].timestamp}`;
|
||||
|
||||
embed.dearrow.oldThumb = dearrowByDefault ? embed.thumbnail.proxyURL : replacementProxyURL;
|
||||
if (dearrowByDefault) embed.thumbnail.proxyURL = replacementProxyURL;
|
||||
}
|
||||
|
||||
this.forceUpdate();
|
||||
|
@ -96,6 +100,7 @@ function DearrowButton({ component }: { component: Component<Props>; }) {
|
|||
className={"vc-dearrow-toggle-" + (embed.dearrow.enabled ? "on" : "off")}
|
||||
onClick={() => {
|
||||
const { enabled, oldThumb, oldTitle } = embed.dearrow;
|
||||
settings.store.dearrowByDefault = !enabled;
|
||||
embed.dearrow.enabled = !enabled;
|
||||
if (oldTitle) {
|
||||
embed.dearrow.oldTitle = embed.rawTitle;
|
||||
|
@ -153,6 +158,12 @@ const settings = definePluginSettings({
|
|||
{ label: "Titles", value: ReplaceElements.ReplaceTitlesOnly },
|
||||
{ label: "Thumbnails", value: ReplaceElements.ReplaceThumbnailsOnly },
|
||||
],
|
||||
},
|
||||
dearrowByDefault: {
|
||||
description: "Dearrow videos automatically",
|
||||
type: OptionType.BOOLEAN,
|
||||
default: true,
|
||||
restartNeeded: false
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ export default definePlugin({
|
|||
{
|
||||
find: "DefaultCustomizationSections",
|
||||
replacement: {
|
||||
match: /(?<=USER_SETTINGS_AVATAR_DECORATION},"decoration"\),)/,
|
||||
match: /(?<=#{intl::USER_SETTINGS_AVATAR_DECORATION}\)},"decoration"\),)/,
|
||||
replace: "$self.DecorSection(),"
|
||||
}
|
||||
},
|
||||
|
@ -54,7 +54,7 @@ export default definePlugin({
|
|||
replace: "$self.DecorationGridItem=$&"
|
||||
},
|
||||
{
|
||||
match: /(?<==)\i=>{let{user:\i,avatarDecoration.{300,600}decorationGridItemChurned/,
|
||||
match: /(?<==)\i=>{let{user:\i,avatarDecoration/,
|
||||
replace: "$self.DecorationGridDecoration=$&"
|
||||
},
|
||||
// Remove NEW label from decor avatar decorations
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
*/
|
||||
|
||||
import { PlusIcon } from "@components/Icons";
|
||||
import { i18n, Text } from "@webpack/common";
|
||||
import { getIntlMessage } from "@utils/discord";
|
||||
import { Text } from "@webpack/common";
|
||||
import { HTMLProps } from "react";
|
||||
|
||||
import { DecorationGridItem } from ".";
|
||||
|
@ -24,7 +25,7 @@ export default function DecorationGridCreate(props: DecorationGridCreateProps) {
|
|||
variant="text-xs/normal"
|
||||
color="header-primary"
|
||||
>
|
||||
{i18n.Messages.CREATE}
|
||||
{getIntlMessage("CREATE")}
|
||||
</Text>
|
||||
</DecorationGridItem >;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
*/
|
||||
|
||||
import { NoEntrySignIcon } from "@components/Icons";
|
||||
import { i18n, Text } from "@webpack/common";
|
||||
import { getIntlMessage } from "@utils/discord";
|
||||
import { Text } from "@webpack/common";
|
||||
import { HTMLProps } from "react";
|
||||
|
||||
import { DecorationGridItem } from ".";
|
||||
|
@ -24,7 +25,7 @@ export default function DecorationGridNone(props: DecorationGridNoneProps) {
|
|||
variant="text-xs/normal"
|
||||
color="header-primary"
|
||||
>
|
||||
{i18n.Messages.NONE}
|
||||
{getIntlMessage("NONE")}
|
||||
</Text>
|
||||
</DecorationGridItem >;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ export default definePlugin({
|
|||
authors: [Devs.Nuckyz],
|
||||
patches: [
|
||||
{
|
||||
find: ".Messages.BOT_CALL_IDLE_DISCONNECT",
|
||||
find: "#{intl::BOT_CALL_IDLE_DISCONNECT_2}",
|
||||
replacement: {
|
||||
match: /,?(?=\i\(this,"idleTimeout",new \i\.\i\))/,
|
||||
replace: ";return;"
|
||||
|
|
|
@ -23,12 +23,13 @@ import { ErrorCard } from "@components/ErrorCard";
|
|||
import { Devs } from "@utils/constants";
|
||||
import { Margins } from "@utils/margins";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
import { findByPropsLazy } from "@webpack";
|
||||
import { findByPropsLazy, findLazy } from "@webpack";
|
||||
import { Forms, React } from "@webpack/common";
|
||||
|
||||
import hideBugReport from "./hideBugReport.css?managed";
|
||||
|
||||
const KbdStyles = findByPropsLazy("key", "combo");
|
||||
const BugReporterExperiment = findLazy(m => m?.definition?.id === "2024-09_bug_reporter");
|
||||
|
||||
const settings = definePluginSettings({
|
||||
toolbarDevMenu: {
|
||||
|
@ -78,8 +79,8 @@ export default definePlugin({
|
|||
{
|
||||
find: "toolbar:function",
|
||||
replacement: {
|
||||
match: /\i\.isStaff\(\)/,
|
||||
replace: "true"
|
||||
match: /hasBugReporterAccess:(\i)/,
|
||||
replace: "_hasBugReporterAccess:$1=true"
|
||||
},
|
||||
predicate: () => settings.store.toolbarDevMenu
|
||||
},
|
||||
|
@ -91,10 +92,18 @@ export default definePlugin({
|
|||
match: /\i\.isDM\(\)\|\|\i\.isThread\(\)/,
|
||||
replace: "false",
|
||||
}
|
||||
},
|
||||
// enable option to always record clips even if you are not streaming
|
||||
{
|
||||
find: "isDecoupledGameClippingEnabled(){",
|
||||
replacement: {
|
||||
match: /\i\.isStaff\(\)/,
|
||||
replace: "true"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
start: () => enableStyle(hideBugReport),
|
||||
start: () => !BugReporterExperiment.getCurrentConfig().hasBugReporterAccess && enableStyle(hideBugReport),
|
||||
stop: () => disableStyle(hideBugReport),
|
||||
|
||||
settingsAboutComponent: () => {
|
||||
|
|
|
@ -22,7 +22,7 @@ import { Devs } from "@utils/constants";
|
|||
import { ApngBlendOp, ApngDisposeOp, importApngJs } from "@utils/dependencies";
|
||||
import { getCurrentGuild } from "@utils/discord";
|
||||
import { Logger } from "@utils/Logger";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
import definePlugin, { OptionType, Patch } from "@utils/types";
|
||||
import { findByCodeLazy, findByPropsLazy, findStoreLazy, proxyLazyWebpack } from "@webpack";
|
||||
import { Alerts, ChannelStore, DraftType, EmojiStore, FluxDispatcher, Forms, GuildMemberStore, IconUtils, lodash, Parser, PermissionsBits, PermissionStore, UploadHandler, UserSettingsActionCreators, UserStore } from "@webpack/common";
|
||||
import type { Emoji } from "@webpack/types";
|
||||
|
@ -194,6 +194,26 @@ const hasExternalStickerPerms = (channelId: string) => hasPermission(channelId,
|
|||
const hasEmbedPerms = (channelId: string) => hasPermission(channelId, PermissionsBits.EMBED_LINKS);
|
||||
const hasAttachmentPerms = (channelId: string) => hasPermission(channelId, PermissionsBits.ATTACH_FILES);
|
||||
|
||||
function makeBypassPatches(): Omit<Patch, "plugin"> {
|
||||
const mapping: Array<{ func: string, predicate?: () => boolean; }> = [
|
||||
{ func: "canUseCustomStickersEverywhere", predicate: () => settings.store.enableStickerBypass },
|
||||
{ func: "canUseHighVideoUploadQuality", predicate: () => settings.store.enableStreamQualityBypass },
|
||||
{ func: "canStreamQuality", predicate: () => settings.store.enableStreamQualityBypass },
|
||||
{ func: "canUseClientThemes" },
|
||||
{ func: "canUseCustomNotificationSounds" },
|
||||
{ func: "canUsePremiumAppIcons" }
|
||||
];
|
||||
|
||||
return {
|
||||
find: "canUseCustomStickersEverywhere:",
|
||||
replacement: mapping.map(({ func, predicate }) => ({
|
||||
match: new RegExp(String.raw`(?<=${func}:function\(\i(?:,\i)?\){)`),
|
||||
replace: "return true;",
|
||||
predicate
|
||||
}))
|
||||
};
|
||||
}
|
||||
|
||||
export default definePlugin({
|
||||
name: "FakeNitro",
|
||||
authors: [Devs.Arjix, Devs.D3SOX, Devs.Ven, Devs.fawn, Devs.captain, Devs.Nuckyz, Devs.AutumnVN],
|
||||
|
@ -203,6 +223,17 @@ export default definePlugin({
|
|||
settings,
|
||||
|
||||
patches: [
|
||||
// General bypass patches
|
||||
makeBypassPatches(),
|
||||
// Patch the emoji picker in voice calls to not be bypassed by fake nitro
|
||||
{
|
||||
find: "emojiItemDisabled]",
|
||||
predicate: () => settings.store.enableEmojiBypass,
|
||||
replacement: {
|
||||
match: /CHAT/,
|
||||
replace: "STATUS"
|
||||
}
|
||||
},
|
||||
{
|
||||
find: ".PREMIUM_LOCKED;",
|
||||
group: true,
|
||||
|
@ -243,15 +274,6 @@ export default definePlugin({
|
|||
replace: (_, rest1, rest2) => `${rest1},fakeNitroOriginal){if(!fakeNitroOriginal)return false;${rest2}`
|
||||
}
|
||||
},
|
||||
// Allow stickers to be sent everywhere
|
||||
{
|
||||
find: "canUseCustomStickersEverywhere:function",
|
||||
predicate: () => settings.store.enableStickerBypass,
|
||||
replacement: {
|
||||
match: /canUseCustomStickersEverywhere:function\(\i\){/,
|
||||
replace: "$&return true;"
|
||||
},
|
||||
},
|
||||
// Make stickers always available
|
||||
{
|
||||
find: '"SENDABLE"',
|
||||
|
@ -261,37 +283,15 @@ export default definePlugin({
|
|||
replace: "true?"
|
||||
}
|
||||
},
|
||||
// Allow streaming with high quality
|
||||
{
|
||||
find: "canUseHighVideoUploadQuality:function",
|
||||
predicate: () => settings.store.enableStreamQualityBypass,
|
||||
replacement: [
|
||||
"canUseHighVideoUploadQuality",
|
||||
"canStreamQuality",
|
||||
].map(func => {
|
||||
return {
|
||||
match: new RegExp(`${func}:function\\(\\i(?:,\\i)?\\){`, "g"),
|
||||
replace: "$&return true;"
|
||||
};
|
||||
})
|
||||
},
|
||||
// Remove boost requirements to stream with high quality
|
||||
{
|
||||
find: "STREAM_FPS_OPTION.format",
|
||||
find: "#{intl::STREAM_FPS_OPTION}",
|
||||
predicate: () => settings.store.enableStreamQualityBypass,
|
||||
replacement: {
|
||||
match: /guildPremiumTier:\i\.\i\.TIER_\d,?/g,
|
||||
replace: ""
|
||||
}
|
||||
},
|
||||
// Allow client themes to be changeable
|
||||
{
|
||||
find: "canUseClientThemes:function",
|
||||
replacement: {
|
||||
match: /canUseClientThemes:function\(\i\){/,
|
||||
replace: "$&return true;"
|
||||
}
|
||||
},
|
||||
{
|
||||
find: '"UserSettingsProtoStore"',
|
||||
replacement: [
|
||||
|
@ -350,13 +350,13 @@ export default definePlugin({
|
|||
{
|
||||
// Filter attachments to remove fake nitro stickers or emojis
|
||||
predicate: () => settings.store.transformStickers,
|
||||
match: /renderAttachments\(\i\){let{attachments:(\i).+?;/,
|
||||
match: /renderAttachments\(\i\){.+?{attachments:(\i).+?;/,
|
||||
replace: (m, attachments) => `${m}${attachments}=$self.filterAttachments(${attachments});`
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
find: ".Messages.STICKER_POPOUT_UNJOINED_PRIVATE_GUILD_DESCRIPTION.format",
|
||||
find: "#{intl::STICKER_POPOUT_UNJOINED_PRIVATE_GUILD_DESCRIPTION}",
|
||||
predicate: () => settings.store.transformStickers,
|
||||
replacement: [
|
||||
{
|
||||
|
@ -381,7 +381,7 @@ export default definePlugin({
|
|||
}
|
||||
},
|
||||
{
|
||||
find: ".Messages.EMOJI_POPOUT_UNJOINED_DISCOVERABLE_GUILD_DESCRIPTION",
|
||||
find: "#{intl::EMOJI_POPOUT_UNJOINED_DISCOVERABLE_GUILD_DESCRIPTION}",
|
||||
predicate: () => settings.store.transformEmojis,
|
||||
replacement: {
|
||||
// Add the fake nitro emoji notice
|
||||
|
@ -389,14 +389,6 @@ export default definePlugin({
|
|||
replace: (_, reactNode, props) => `$self.addFakeNotice(${FakeNoticeType.Emoji},${reactNode},!!${props}?.fakeNitroNode?.fake)`
|
||||
}
|
||||
},
|
||||
// Allow using custom app icons
|
||||
{
|
||||
find: "canUsePremiumAppIcons:function",
|
||||
replacement: {
|
||||
match: /canUsePremiumAppIcons:function\(\i\){/,
|
||||
replace: "$&return true;"
|
||||
}
|
||||
},
|
||||
// Separate patch for allowing using custom app icons
|
||||
{
|
||||
find: /\.getCurrentDesktopIcon.{0,25}\.isPremium/,
|
||||
|
@ -412,14 +404,6 @@ export default definePlugin({
|
|||
match: /(?<=type:"(?:SOUNDBOARD_SOUNDS_RECEIVED|GUILD_SOUNDBOARD_SOUND_CREATE|GUILD_SOUNDBOARD_SOUND_UPDATE|GUILD_SOUNDBOARD_SOUNDS_UPDATE)".+?available:)\i\.available/g,
|
||||
replace: "true"
|
||||
}
|
||||
},
|
||||
// Allow using custom notification sounds
|
||||
{
|
||||
find: "canUseCustomNotificationSounds:function",
|
||||
replacement: {
|
||||
match: /canUseCustomNotificationSounds:function\(\i\){/,
|
||||
replace: "$&return true;"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
|
|
|
@ -108,10 +108,10 @@ interface ProfileModalProps {
|
|||
isTryItOutFlow: boolean;
|
||||
}
|
||||
|
||||
const ColorPicker = findComponentByCodeLazy<ColorPickerProps>(".Messages.USER_SETTINGS_PROFILE_COLOR_SELECT_COLOR", ".BACKGROUND_PRIMARY)");
|
||||
const ColorPicker = findComponentByCodeLazy<ColorPickerProps>("#{intl::USER_SETTINGS_PROFILE_COLOR_SELECT_COLOR}", ".BACKGROUND_PRIMARY)");
|
||||
const ProfileModal = findComponentByCodeLazy<ProfileModalProps>("isTryItOutFlow:", "pendingThemeColors:", "pendingAvatarDecoration:", "EDIT_PROFILE_BANNER");
|
||||
|
||||
const requireColorPicker = extractAndLoadChunksLazy(["USER_SETTINGS_PROFILE_COLOR_DEFAULT_BUTTON.format"], /createPromise:\(\)=>\i\.\i(\("?.+?"?\)).then\(\i\.bind\(\i,"?(.+?)"?\)\)/);
|
||||
const requireColorPicker = extractAndLoadChunksLazy(["#{intl::USER_SETTINGS_PROFILE_COLOR_DEFAULT_BUTTON}"], /createPromise:\(\)=>\i\.\i(\("?.+?"?\)).then\(\i\.bind\(\i,"?(.+?)"?\)\)/);
|
||||
|
||||
export default definePlugin({
|
||||
name: "FakeProfileThemes",
|
||||
|
@ -126,9 +126,9 @@ export default definePlugin({
|
|||
}
|
||||
},
|
||||
{
|
||||
find: ".USER_SETTINGS_RESET_PROFILE_THEME",
|
||||
find: "#{intl::USER_SETTINGS_RESET_PROFILE_THEME}",
|
||||
replacement: {
|
||||
match: /RESET_PROFILE_THEME}\)(?<=color:(\i),.{0,500}?color:(\i),.{0,500}?)/,
|
||||
match: /#{intl::USER_SETTINGS_RESET_PROFILE_THEME}\)}\)(?<=color:(\i),.{0,500}?color:(\i),.{0,500}?)/,
|
||||
replace: "$&,$self.addCopy3y3Button({primary:$1,accent:$2})"
|
||||
}
|
||||
}
|
||||
|
|
3
src/plugins/fixImagesQuality/README.md
Normal file
3
src/plugins/fixImagesQuality/README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Fix Images Quality
|
||||
|
||||
Prevents images from being loaded as webp, which can cause quality loss
|
|
@ -8,16 +8,15 @@ import { Devs } from "@utils/constants";
|
|||
import definePlugin from "@utils/types";
|
||||
|
||||
export default definePlugin({
|
||||
name: "NoDefaultHangStatus",
|
||||
description: "Disable the default hang status when joining voice channels",
|
||||
authors: [Devs.D3SOX],
|
||||
|
||||
name: "FixImagesQuality",
|
||||
description: "Prevents images from being loaded as webp, which can cause quality loss",
|
||||
authors: [Devs.Nuckyz],
|
||||
patches: [
|
||||
{
|
||||
find: ".CHILLING)",
|
||||
find: "getFormatQuality(){",
|
||||
replacement: {
|
||||
match: /{enableHangStatus:(\i),/,
|
||||
replace: "{_enableHangStatus:$1=false,"
|
||||
match: /(?<=null;return )\i\.\i&&\(\i\|\|!\i\.isAnimated.+?:(?=\i&&\(\i="png"\))/,
|
||||
replace: ""
|
||||
}
|
||||
}
|
||||
]
|
|
@ -27,7 +27,7 @@ export default definePlugin({
|
|||
authors: [Devs.D3SOX, Devs.Nickyux],
|
||||
patches: [
|
||||
{
|
||||
find: ".Messages.GUILD_OWNER,",
|
||||
find: "#{intl::GUILD_OWNER}",
|
||||
replacement: {
|
||||
match: /,isOwner:(\i),/,
|
||||
replace: ",_isOwner:$1=$self.isGuildOwner(e),"
|
||||
|
|
|
@ -27,7 +27,6 @@ export default definePlugin({
|
|||
name: "FriendInvites",
|
||||
description: "Create and manage friend invite links via slash commands (/create friend invite, /view friend invites, /revoke friend invites).",
|
||||
authors: [Devs.afn, Devs.Dziurwa],
|
||||
dependencies: ["CommandsAPI"],
|
||||
commands: [
|
||||
{
|
||||
name: "create friend invite",
|
||||
|
|
|
@ -7,16 +7,15 @@
|
|||
import ErrorBoundary from "@components/ErrorBoundary";
|
||||
import { Devs } from "@utils/constants";
|
||||
import { getCurrentChannel } from "@utils/discord";
|
||||
import { Logger } from "@utils/Logger";
|
||||
import definePlugin from "@utils/types";
|
||||
import { findByCodeLazy, findByPropsLazy, findLazy } from "@webpack";
|
||||
import { Heading, RelationshipStore, Text } from "@webpack/common";
|
||||
import { findByCodeLazy, findByPropsLazy, findComponentByCodeLazy } from "@webpack";
|
||||
import { RelationshipStore, Text } from "@webpack/common";
|
||||
|
||||
const containerWrapper = findByPropsLazy("memberSinceWrapper");
|
||||
const container = findByPropsLazy("memberSince");
|
||||
const getCreatedAtDate = findByCodeLazy('month:"short",day:"numeric"');
|
||||
const locale = findByPropsLazy("getLocale");
|
||||
const section = findLazy((m: any) => m.section !== void 0 && m.heading !== void 0 && Object.values(m).length === 2);
|
||||
const Section = findComponentByCodeLazy('"auto":"smooth"', ".section");
|
||||
|
||||
export default definePlugin({
|
||||
name: "FriendsSince",
|
||||
|
@ -27,43 +26,28 @@ export default definePlugin({
|
|||
{
|
||||
find: ".PANEL}),nicknameIcons",
|
||||
replacement: {
|
||||
match: /USER_PROFILE_MEMBER_SINCE,.{0,100}userId:(\i\.id)}\)}\)/,
|
||||
replace: "$&,$self.friendsSinceNew({userId:$1,isSidebar:true})"
|
||||
match: /#{intl::USER_PROFILE_MEMBER_SINCE}\),.{0,100}userId:(\i\.id)}\)}\)/,
|
||||
replace: "$&,$self.FriendsSinceComponent({userId:$1,isSidebar:true})"
|
||||
}
|
||||
},
|
||||
// User Profile Modal
|
||||
{
|
||||
find: "action:\"PRESS_APP_CONNECTION\"",
|
||||
replacement: {
|
||||
match: /USER_PROFILE_MEMBER_SINCE,.{0,100}userId:(\i\.id),.{0,100}}\)}\),/,
|
||||
replace: "$&,$self.friendsSinceNew({userId:$1,isSidebar:false}),"
|
||||
match: /#{intl::USER_PROFILE_MEMBER_SINCE}\),.{0,100}userId:(\i\.id),.{0,100}}\)}\),/,
|
||||
replace: "$&,$self.FriendsSinceComponent({userId:$1,isSidebar:false}),"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
getFriendSince(userId: string) {
|
||||
try {
|
||||
if (!RelationshipStore.isFriend(userId)) return null;
|
||||
|
||||
return RelationshipStore.getSince(userId);
|
||||
} catch (err) {
|
||||
new Logger("FriendsSince").error(err);
|
||||
return null;
|
||||
}
|
||||
},
|
||||
|
||||
friendsSinceNew: ErrorBoundary.wrap(({ userId, isSidebar }: { userId: string; isSidebar: boolean; }) => {
|
||||
FriendsSinceComponent: ErrorBoundary.wrap(({ userId, isSidebar }: { userId: string; isSidebar: boolean; }) => {
|
||||
if (!RelationshipStore.isFriend(userId)) return null;
|
||||
|
||||
const friendsSince = RelationshipStore.getSince(userId);
|
||||
if (!friendsSince) return null;
|
||||
|
||||
return (
|
||||
<section className={section.section}>
|
||||
<Heading variant="text-xs/semibold" style={isSidebar ? {} : { color: "var(--header-secondary)" }}>
|
||||
Friends Since
|
||||
</Heading>
|
||||
|
||||
<Section heading="Friends Since">
|
||||
{
|
||||
isSidebar ? (
|
||||
<Text variant="text-sm/normal">
|
||||
|
@ -91,8 +75,7 @@ export default definePlugin({
|
|||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
</section>
|
||||
</Section>
|
||||
);
|
||||
}, { noop: true }),
|
||||
});
|
||||
|
|
5
src/plugins/fullSearchContext/README.md
Normal file
5
src/plugins/fullSearchContext/README.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
# FullSearchContext
|
||||
|
||||
Makes the message context menu in message search results have all options you'd expect.
|
||||
|
||||
![](https://github.com/user-attachments/assets/472d1327-3935-44c7-b7c4-0978b5348550)
|
112
src/plugins/fullSearchContext/index.tsx
Normal file
112
src/plugins/fullSearchContext/index.tsx
Normal file
|
@ -0,0 +1,112 @@
|
|||
/*
|
||||
* 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 { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/ContextMenu";
|
||||
import { migratePluginSettings } from "@api/Settings";
|
||||
import { Devs } from "@utils/constants";
|
||||
import { getIntlMessage } from "@utils/discord";
|
||||
import { NoopComponent } from "@utils/react";
|
||||
import definePlugin from "@utils/types";
|
||||
import { filters, findByPropsLazy, waitFor } from "@webpack";
|
||||
import { ChannelStore, ContextMenuApi, UserStore } from "@webpack/common";
|
||||
import { Message } from "discord-types/general";
|
||||
|
||||
const { useMessageMenu } = findByPropsLazy("useMessageMenu");
|
||||
|
||||
interface CopyIdMenuItemProps {
|
||||
id: string;
|
||||
label: string;
|
||||
}
|
||||
|
||||
let CopyIdMenuItem: (props: CopyIdMenuItemProps) => React.ReactElement | null = NoopComponent;
|
||||
waitFor(filters.componentByCode('"devmode-copy-id-".concat'), m => CopyIdMenuItem = m);
|
||||
|
||||
function MessageMenu({ message, channel, onHeightUpdate }) {
|
||||
const canReport = message.author &&
|
||||
!(message.author.id === UserStore.getCurrentUser().id || message.author.system);
|
||||
|
||||
return useMessageMenu({
|
||||
navId: "message-actions",
|
||||
ariaLabel: getIntlMessage("MESSAGE_UTILITIES_A11Y_LABEL"),
|
||||
|
||||
message,
|
||||
channel,
|
||||
canReport,
|
||||
onHeightUpdate,
|
||||
onClose: () => ContextMenuApi.closeContextMenu(),
|
||||
|
||||
textSelection: "",
|
||||
favoriteableType: null,
|
||||
favoriteableId: null,
|
||||
favoriteableName: null,
|
||||
itemHref: void 0,
|
||||
itemSrc: void 0,
|
||||
itemSafeSrc: void 0,
|
||||
itemTextContent: void 0,
|
||||
|
||||
isFullSearchContextMenu: true
|
||||
});
|
||||
}
|
||||
|
||||
interface MessageActionsProps {
|
||||
message: Message;
|
||||
isFullSearchContextMenu?: boolean;
|
||||
}
|
||||
|
||||
const contextMenuPatch: NavContextMenuPatchCallback = (children, props: MessageActionsProps) => {
|
||||
if (props?.isFullSearchContextMenu == null) return;
|
||||
|
||||
const group = findGroupChildrenByChildId("devmode-copy-id", children, true);
|
||||
group?.push(
|
||||
CopyIdMenuItem({ id: props.message.author.id, label: getIntlMessage("COPY_ID_AUTHOR") })
|
||||
);
|
||||
};
|
||||
|
||||
migratePluginSettings("FullSearchContext", "SearchReply");
|
||||
export default definePlugin({
|
||||
name: "FullSearchContext",
|
||||
description: "Makes the message context menu in message search results have all options you'd expect",
|
||||
authors: [Devs.Ven, Devs.Aria],
|
||||
|
||||
patches: [{
|
||||
find: "onClick:this.handleMessageClick,",
|
||||
replacement: {
|
||||
match: /this(?=\.handleContextMenu\(\i,\i\))/,
|
||||
replace: "$self"
|
||||
}
|
||||
}],
|
||||
|
||||
handleContextMenu(event: React.MouseEvent, message: Message) {
|
||||
const channel = ChannelStore.getChannel(message.channel_id);
|
||||
if (!channel) return;
|
||||
|
||||
event.stopPropagation();
|
||||
|
||||
ContextMenuApi.openContextMenu(event, contextMenuProps =>
|
||||
<MessageMenu
|
||||
message={message}
|
||||
channel={channel}
|
||||
onHeightUpdate={contextMenuProps.onHeightUpdate}
|
||||
/>
|
||||
);
|
||||
},
|
||||
|
||||
contextMenus: {
|
||||
"message-actions": contextMenuPatch
|
||||
}
|
||||
});
|
|
@ -92,7 +92,7 @@ export default definePlugin({
|
|||
|
||||
patches: [
|
||||
{
|
||||
find: ".Messages.ACCOUNT_SPEAKING_WHILE_MUTED",
|
||||
find: "#{intl::ACCOUNT_SPEAKING_WHILE_MUTED}",
|
||||
replacement: {
|
||||
match: /this\.renderNameZone\(\).+?children:\[/,
|
||||
replace: "$&$self.GameActivityToggleButton(),"
|
||||
|
|
|
@ -166,7 +166,7 @@ export default definePlugin({
|
|||
|
||||
patches: [
|
||||
{
|
||||
find: "Messages.WELCOME_CTA_LABEL",
|
||||
find: "#{intl::WELCOME_CTA_LABEL}",
|
||||
replacement: {
|
||||
match: /innerClassName:\i\.welcomeCTAButton,(?<={channel:\i,message:\i}=(\i).{0,400}?)/,
|
||||
replace: "$&onContextMenu:(vcEvent)=>$self.pickSticker(vcEvent, $1),"
|
||||
|
|
13
src/plugins/ignoreActivities/README.md
Normal file
13
src/plugins/ignoreActivities/README.md
Normal file
|
@ -0,0 +1,13 @@
|
|||
# IgnoreActivities
|
||||
|
||||
Ignore activities from showing up on your status ONLY. You can configure which ones are specifically ignored from the Registered Games and Activities tabs, or use the general settings.
|
||||
|
||||
![](https://github.com/user-attachments/assets/f0c19060-0ecf-4f1c-8165-a5aa40143c82)
|
||||
|
||||
![](https://github.com/user-attachments/assets/73c3fa7a-5b90-41ee-a4d6-91fa76458b74)
|
||||
|
||||
![](https://github.com/user-attachments/assets/1ab3fe73-3911-48d1-8a08-e976af614b41)
|
||||
|
||||
The activity stays showing as a detected game even if ignored, differently from the stock Toggle Detection button from Discord:
|
||||
|
||||
![](https://github.com/user-attachments/assets/08ea60c3-3a31-42de-ae4c-7535fbf1b45a)
|
|
@ -26,6 +26,11 @@ interface IgnoredActivity {
|
|||
type: ActivitiesTypes;
|
||||
}
|
||||
|
||||
const enum FilterMode {
|
||||
Whitelist,
|
||||
Blacklist
|
||||
}
|
||||
|
||||
const RunningGameStore = findStoreLazy("RunningGameStore");
|
||||
|
||||
const ShowCurrentGame = getUserSettingLazy("status", "showCurrentGame")!;
|
||||
|
@ -70,14 +75,17 @@ function handleActivityToggle(e: React.MouseEvent<HTMLButtonElement, MouseEvent>
|
|||
if (ignoredActivityIndex === -1) settings.store.ignoredActivities = getIgnoredActivities().concat(activity);
|
||||
else settings.store.ignoredActivities = getIgnoredActivities().filter((_, index) => index !== ignoredActivityIndex);
|
||||
|
||||
// Trigger activities recalculation
|
||||
recalculateActivities();
|
||||
}
|
||||
|
||||
function recalculateActivities() {
|
||||
ShowCurrentGame.updateSetting(old => old);
|
||||
}
|
||||
|
||||
function ImportCustomRPCComponent() {
|
||||
return (
|
||||
<Flex flexDirection="column">
|
||||
<Forms.FormText type={Forms.FormText.Types.DESCRIPTION}>Import the application id of the CustomRPC plugin to the allowed list</Forms.FormText>
|
||||
<Forms.FormText type={Forms.FormText.Types.DESCRIPTION}>Import the application id of the CustomRPC plugin to the filter list</Forms.FormText>
|
||||
<div>
|
||||
<Button
|
||||
onClick={() => {
|
||||
|
@ -86,7 +94,7 @@ function ImportCustomRPCComponent() {
|
|||
return showToast("CustomRPC application ID is not set.", Toasts.Type.FAILURE);
|
||||
}
|
||||
|
||||
const isAlreadyAdded = allowedIdsPushID?.(id);
|
||||
const isAlreadyAdded = idsListPushID?.(id);
|
||||
if (isAlreadyAdded) {
|
||||
showToast("CustomRPC application ID is already added.", Toasts.Type.FAILURE);
|
||||
}
|
||||
|
@ -99,39 +107,39 @@ function ImportCustomRPCComponent() {
|
|||
);
|
||||
}
|
||||
|
||||
let allowedIdsPushID: ((id: string) => boolean) | null = null;
|
||||
let idsListPushID: ((id: string) => boolean) | null = null;
|
||||
|
||||
function AllowedIdsComponent(props: { setValue: (value: string) => void; }) {
|
||||
const [allowedIds, setAllowedIds] = useState<string>(settings.store.allowedIds ?? "");
|
||||
function IdsListComponent(props: { setValue: (value: string) => void; }) {
|
||||
const [idsList, setIdsList] = useState<string>(settings.store.idsList ?? "");
|
||||
|
||||
allowedIdsPushID = (id: string) => {
|
||||
const currentIds = new Set(allowedIds.split(",").map(id => id.trim()).filter(Boolean));
|
||||
idsListPushID = (id: string) => {
|
||||
const currentIds = new Set(idsList.split(",").map(id => id.trim()).filter(Boolean));
|
||||
|
||||
const isAlreadyAdded = currentIds.has(id) || (currentIds.add(id), false);
|
||||
|
||||
const ids = Array.from(currentIds).join(", ");
|
||||
setAllowedIds(ids);
|
||||
setIdsList(ids);
|
||||
props.setValue(ids);
|
||||
|
||||
return isAlreadyAdded;
|
||||
};
|
||||
|
||||
useEffect(() => () => {
|
||||
allowedIdsPushID = null;
|
||||
idsListPushID = null;
|
||||
}, []);
|
||||
|
||||
function handleChange(newValue: string) {
|
||||
setAllowedIds(newValue);
|
||||
setIdsList(newValue);
|
||||
props.setValue(newValue);
|
||||
}
|
||||
|
||||
return (
|
||||
<Forms.FormSection>
|
||||
<Forms.FormTitle tag="h3">Allowed List</Forms.FormTitle>
|
||||
<Forms.FormText className={Margins.bottom8} type={Forms.FormText.Types.DESCRIPTION}>Comma separated list of activity IDs to allow (Useful for allowing RPC activities and CustomRPC)</Forms.FormText>
|
||||
<Forms.FormTitle tag="h3">Filter List</Forms.FormTitle>
|
||||
<Forms.FormText className={Margins.bottom8} type={Forms.FormText.Types.DESCRIPTION}>Comma separated list of activity IDs to filter (Useful for filtering specific RPC activities and CustomRPC</Forms.FormText>
|
||||
<TextInput
|
||||
type="text"
|
||||
value={allowedIds}
|
||||
value={idsList}
|
||||
onChange={handleChange}
|
||||
placeholder="235834946571337729, 343383572805058560"
|
||||
/>
|
||||
|
@ -145,40 +153,62 @@ const settings = definePluginSettings({
|
|||
description: "",
|
||||
component: () => <ImportCustomRPCComponent />
|
||||
},
|
||||
allowedIds: {
|
||||
listMode: {
|
||||
type: OptionType.SELECT,
|
||||
description: "Change the mode of the filter list",
|
||||
options: [
|
||||
{
|
||||
label: "Whitelist",
|
||||
value: FilterMode.Whitelist,
|
||||
default: true
|
||||
},
|
||||
{
|
||||
label: "Blacklist",
|
||||
value: FilterMode.Blacklist,
|
||||
}
|
||||
],
|
||||
onChange: recalculateActivities
|
||||
},
|
||||
idsList: {
|
||||
type: OptionType.COMPONENT,
|
||||
description: "",
|
||||
default: "",
|
||||
onChange(newValue: string) {
|
||||
const ids = new Set(newValue.split(",").map(id => id.trim()).filter(Boolean));
|
||||
settings.store.allowedIds = Array.from(ids).join(", ");
|
||||
settings.store.idsList = Array.from(ids).join(", ");
|
||||
recalculateActivities();
|
||||
},
|
||||
component: props => <AllowedIdsComponent setValue={props.setValue} />
|
||||
component: props => <IdsListComponent setValue={props.setValue} />
|
||||
},
|
||||
ignorePlaying: {
|
||||
type: OptionType.BOOLEAN,
|
||||
description: "Ignore all playing activities (These are usually game and RPC activities)",
|
||||
default: false
|
||||
default: false,
|
||||
onChange: recalculateActivities
|
||||
},
|
||||
ignoreStreaming: {
|
||||
type: OptionType.BOOLEAN,
|
||||
description: "Ignore all streaming activities",
|
||||
default: false
|
||||
default: false,
|
||||
onChange: recalculateActivities
|
||||
},
|
||||
ignoreListening: {
|
||||
type: OptionType.BOOLEAN,
|
||||
description: "Ignore all listening activities (These are usually spotify activities)",
|
||||
default: false
|
||||
default: false,
|
||||
onChange: recalculateActivities
|
||||
},
|
||||
ignoreWatching: {
|
||||
type: OptionType.BOOLEAN,
|
||||
description: "Ignore all watching activities",
|
||||
default: false
|
||||
default: false,
|
||||
onChange: recalculateActivities
|
||||
},
|
||||
ignoreCompeting: {
|
||||
type: OptionType.BOOLEAN,
|
||||
description: "Ignore all competing activities (These are normally special game activities)",
|
||||
default: false
|
||||
default: false,
|
||||
onChange: recalculateActivities
|
||||
}
|
||||
}).withPrivateSettings<{
|
||||
ignoredActivities: IgnoredActivity[];
|
||||
|
@ -189,8 +219,8 @@ function getIgnoredActivities() {
|
|||
}
|
||||
|
||||
function isActivityTypeIgnored(type: number, id?: string) {
|
||||
if (id && settings.store.allowedIds.includes(id)) {
|
||||
return false;
|
||||
if (id && settings.store.idsList.includes(id)) {
|
||||
return settings.store.listMode === FilterMode.Blacklist;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
|
@ -206,15 +236,15 @@ function isActivityTypeIgnored(type: number, id?: string) {
|
|||
|
||||
export default definePlugin({
|
||||
name: "IgnoreActivities",
|
||||
authors: [Devs.Nuckyz],
|
||||
description: "Ignore activities from showing up on your status ONLY. You can configure which ones are specifically ignored from the Registered Games and Activities tabs, or use the general settings below.",
|
||||
authors: [Devs.Nuckyz, Devs.Kylie],
|
||||
description: "Ignore activities from showing up on your status ONLY. You can configure which ones are specifically ignored from the Registered Games and Activities tabs, or use the general settings below",
|
||||
dependencies: ["UserSettingsAPI"],
|
||||
|
||||
settings,
|
||||
|
||||
patches: [
|
||||
{
|
||||
find: '="LocalActivityStore",',
|
||||
find: '"LocalActivityStore"',
|
||||
replacement: [
|
||||
{
|
||||
match: /HANG_STATUS.+?(?=!\i\(\)\(\i,\i\)&&)(?<=(\i)\.push.+?)/,
|
||||
|
@ -223,19 +253,20 @@ export default definePlugin({
|
|||
]
|
||||
},
|
||||
{
|
||||
find: '="ActivityTrackingStore",',
|
||||
find: '"ActivityTrackingStore"',
|
||||
replacement: {
|
||||
match: /getVisibleRunningGames\(\).+?;(?=for)(?<=(\i)=\i\.\i\.getVisibleRunningGames.+?)/,
|
||||
replace: (m, runningGames) => `${m}${runningGames}=${runningGames}.filter(({id,name})=>$self.isActivityNotIgnored({type:0,application_id:id,name}));`
|
||||
}
|
||||
},
|
||||
{
|
||||
find: ".Messages.SETTINGS_GAMES_TOGGLE_OVERLAY",
|
||||
find: "#{intl::SETTINGS_GAMES_TOGGLE_OVERLAY}",
|
||||
replacement: {
|
||||
match: /\.Messages\.SETTINGS_GAMES_TOGGLE_OVERLAY.+?}\(\),(?<={overlay:\i,.+?=(\i),.+?)(?=!(\i))/,
|
||||
match: /#{intl::SETTINGS_GAMES_TOGGLE_OVERLAY}.+?}\(\),(?<={overlay:\i,.+?=(\i),.+?)(?=!(\i))/,
|
||||
replace: (m, props, nowPlaying) => `${m}$self.renderToggleGameActivityButton(${props},${nowPlaying}),`
|
||||
}
|
||||
},
|
||||
// Discord has 2 different components for activities. Currently, the last is the one being used
|
||||
{
|
||||
find: ".activityTitleText,variant",
|
||||
replacement: {
|
||||
|
@ -244,15 +275,21 @@ export default definePlugin({
|
|||
},
|
||||
},
|
||||
{
|
||||
find: ".activityCardDetails,children",
|
||||
find: ".promotedLabelWrapperNonBanner,children",
|
||||
replacement: {
|
||||
match: /\.activityCardDetails.+?children:(\i\.application)\.name.*?}\),/,
|
||||
match: /\.appDetailsHeaderContainer.+?children:\i.*?}\),(?<=application:(\i).+?)/,
|
||||
replace: (m, props) => `${m}$self.renderToggleActivityButton(${props}),`
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
async start() {
|
||||
// Migrate allowedIds
|
||||
if (Settings.plugins.IgnoreActivities.allowedIds) {
|
||||
settings.store.idsList = Settings.plugins.IgnoreActivities.allowedIds;
|
||||
delete Settings.plugins.IgnoreActivities.allowedIds; // Remove allowedIds
|
||||
}
|
||||
|
||||
const oldIgnoredActivitiesData = await DataStore.get<Map<IgnoredActivity["id"], IgnoredActivity>>("IgnoreActivities_ignoredActivities");
|
||||
|
||||
if (oldIgnoredActivitiesData != null) {
|
||||
|
@ -279,7 +316,7 @@ export default definePlugin({
|
|||
if (isActivityTypeIgnored(props.type, props.application_id)) return false;
|
||||
|
||||
if (props.application_id != null) {
|
||||
return !getIgnoredActivities().some(activity => activity.id === props.application_id) || settings.store.allowedIds.includes(props.application_id);
|
||||
return !getIgnoredActivities().some(activity => activity.id === props.application_id) || (settings.store.listMode === FilterMode.Whitelist && settings.store.idsList.includes(props.application_id));
|
||||
} else {
|
||||
const exePath = RunningGameStore.getRunningGames().find(game => game.name === props.name)?.exePath;
|
||||
if (exePath) {
|
||||
|
|
|
@ -156,14 +156,10 @@ export default definePlugin({
|
|||
|
||||
patches: [
|
||||
{
|
||||
find: "Messages.OPEN_IN_BROWSER",
|
||||
find: ".contain,SCALE_DOWN:",
|
||||
replacement: {
|
||||
// there are 2 image thingies. one for carosuel and one for the single image.
|
||||
// so thats why i added global flag.
|
||||
// also idk if this patch is good, should it be more specific?
|
||||
// https://regex101.com/r/xfvNvV/1
|
||||
match: /return.{1,200}\.wrapper.{1,200}src:\i,/g,
|
||||
replace: `$&id: '${ELEMENT_ID}',`
|
||||
match: /\.slide,\i\),/g,
|
||||
replace: `$&id:"${ELEMENT_ID}",`
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -183,15 +179,13 @@ export default definePlugin({
|
|||
{
|
||||
match: /componentWillUnmount\(\){/,
|
||||
replace: "$&$self.unMountMagnifier();"
|
||||
},
|
||||
|
||||
{
|
||||
match: /componentDidUpdate\(\i\){/,
|
||||
replace: "$&$self.updateMagnifier(this);"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
find: ".carouselModal",
|
||||
replacement: {
|
||||
match: /(?<=\.carouselModal.{0,100}onClick:)\i,/,
|
||||
replace: "()=>{},"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
|
@ -226,6 +220,11 @@ export default definePlugin({
|
|||
}
|
||||
},
|
||||
|
||||
updateMagnifier(instance) {
|
||||
this.unMountMagnifier();
|
||||
this.renderMagnifier(instance);
|
||||
},
|
||||
|
||||
unMountMagnifier() {
|
||||
this.root?.unmount();
|
||||
this.currentMagnifierElement = null;
|
||||
|
|
|
@ -23,12 +23,3 @@
|
|||
|
||||
/* https://googlechrome.github.io/samples/image-rendering-pixelated/index.html */
|
||||
}
|
||||
|
||||
/* make the carousel take up less space so we can click the backdrop and exit out of it */
|
||||
[class*="modalCarouselWrapper_"] {
|
||||
top: 0 !important;
|
||||
}
|
||||
|
||||
[class*="carouselModal_"] {
|
||||
height: 0 !important;
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ export default definePlugin({
|
|||
patches: [
|
||||
// Counts header
|
||||
{
|
||||
find: ".FRIENDS_ALL_HEADER",
|
||||
find: "#{intl::FRIENDS_ALL_HEADER}",
|
||||
replacement: {
|
||||
match: /toString\(\)\}\);case (\i\.\i)\.BLOCKED/,
|
||||
replace: 'toString()});case $1.IMPLICIT:return "Implicit — "+arguments[1];case $1.BLOCKED'
|
||||
|
@ -48,9 +48,9 @@ export default definePlugin({
|
|||
},
|
||||
// Sections header
|
||||
{
|
||||
find: ".FRIENDS_SECTION_ONLINE",
|
||||
find: "#{intl::FRIENDS_SECTION_ONLINE}",
|
||||
replacement: {
|
||||
match: /(\(0,\i\.jsx\)\(\i\.TabBar\.Item,\{id:\i\.\i)\.BLOCKED,className:([^\s]+?)\.item,children:\i\.\i\.Messages\.BLOCKED\}\)/,
|
||||
match: /(\(0,\i\.jsx\)\(\i\.TabBar\.Item,\{id:\i\.\i)\.BLOCKED,className:([^\s]+?)\.item,children:\i\.\i\.string\(\i\.\i#{intl::BLOCKED}\)\}\)/,
|
||||
replace: "$1.IMPLICIT,className:$2.item,children:\"Implicit\"}),$&"
|
||||
},
|
||||
},
|
||||
|
@ -117,7 +117,7 @@ export default definePlugin({
|
|||
|
||||
wrapSort(comparator: Function, row: any) {
|
||||
return row.type === 5
|
||||
? -UserAffinitiesStore.getUserAffinity(row.user.id)?.affinity ?? 0
|
||||
? -(UserAffinitiesStore.getUserAffinity(row.user.id)?.affinity ?? 0)
|
||||
: comparator(row);
|
||||
},
|
||||
|
||||
|
|
|
@ -66,14 +66,14 @@ export function addPatch(newPatch: Omit<Patch, "plugin">, pluginName: string) {
|
|||
patch.replacement = [patch.replacement];
|
||||
}
|
||||
|
||||
patch.replacement = patch.replacement.filter(({ predicate }) => !predicate || predicate());
|
||||
|
||||
if (IS_REPORTER) {
|
||||
patch.replacement.forEach(r => {
|
||||
delete r.predicate;
|
||||
});
|
||||
}
|
||||
|
||||
patch.replacement = patch.replacement.filter(({ predicate }) => !predicate || predicate());
|
||||
|
||||
patches.push(patch);
|
||||
}
|
||||
|
||||
|
@ -105,6 +105,11 @@ for (const p of pluginsValues) if (isPluginEnabled(p.name)) {
|
|||
settings[d].enabled = true;
|
||||
dep.isDependency = true;
|
||||
});
|
||||
|
||||
if (p.commands?.length) {
|
||||
Plugins.CommandsAPI.isDependency = true;
|
||||
settings.CommandsAPI.enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
for (const p of pluginsValues) {
|
||||
|
|
|
@ -111,7 +111,7 @@ export default definePlugin({
|
|||
patches: [
|
||||
{
|
||||
// Indicator
|
||||
find: ".Messages.MESSAGE_EDITED,",
|
||||
find: "#{intl::MESSAGE_EDITED}",
|
||||
replacement: {
|
||||
match: /let\{className:\i,message:\i[^}]*\}=(\i)/,
|
||||
replace: "try {$1 && $self.INV_REGEX.test($1.message.content) ? $1.content.push($self.indicator()) : null } catch {};$&"
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
import * as DataStore from "@api/DataStore";
|
||||
import { Devs } from "@utils/constants";
|
||||
import definePlugin from "@utils/types";
|
||||
import { ChannelStore, NavigationRouter, SelectedChannelStore, SelectedGuildStore } from "@webpack/common";
|
||||
import { ChannelRouter, ChannelStore, NavigationRouter, SelectedChannelStore, SelectedGuildStore } from "@webpack/common";
|
||||
|
||||
export interface LogoutEvent {
|
||||
type: "LOGOUT";
|
||||
|
@ -40,16 +40,21 @@ interface PreviousChannel {
|
|||
let isSwitchingAccount = false;
|
||||
let previousCache: PreviousChannel | undefined;
|
||||
|
||||
function attemptToNavigateToChannel(guildId: string | null, channelId: string) {
|
||||
if (!ChannelStore.hasChannel(channelId)) return;
|
||||
NavigationRouter.transitionTo(`/channels/${guildId ?? "@me"}/${channelId}`);
|
||||
}
|
||||
|
||||
export default definePlugin({
|
||||
name: "KeepCurrentChannel",
|
||||
description: "Attempt to navigate to the channel you were in before switching accounts or loading Discord.",
|
||||
authors: [Devs.Nuckyz],
|
||||
|
||||
patches: [
|
||||
{
|
||||
find: '"Switching accounts"',
|
||||
replacement: {
|
||||
match: /goHomeAfterSwitching:\i/,
|
||||
replace: "goHomeAfterSwitching:!1"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
flux: {
|
||||
LOGOUT(e: LogoutEvent) {
|
||||
({ isSwitchingAccount } = e);
|
||||
|
@ -59,8 +64,13 @@ export default definePlugin({
|
|||
if (!isSwitchingAccount) return;
|
||||
isSwitchingAccount = false;
|
||||
|
||||
if (previousCache?.channelId)
|
||||
attemptToNavigateToChannel(previousCache.guildId, previousCache.channelId);
|
||||
if (previousCache?.channelId) {
|
||||
if (ChannelStore.hasChannel(previousCache.channelId)) {
|
||||
ChannelRouter.transitionToChannel(previousCache.channelId);
|
||||
} else {
|
||||
NavigationRouter.transitionToGuild("@me");
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
async CHANNEL_SELECT({ guildId, channelId }: ChannelSelectEvent) {
|
||||
|
@ -84,7 +94,7 @@ export default definePlugin({
|
|||
|
||||
await DataStore.set("KeepCurrentChannel_previousData", previousCache);
|
||||
} else if (previousCache.channelId) {
|
||||
attemptToNavigateToChannel(previousCache.guildId, previousCache.channelId);
|
||||
ChannelRouter.transitionToChannel(previousCache.channelId);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -62,7 +62,7 @@ export default definePlugin({
|
|||
|
||||
patches: [
|
||||
{
|
||||
find: ".LOADING_DID_YOU_KNOW",
|
||||
find: "#{intl::LOADING_DID_YOU_KNOW}",
|
||||
replacement: [
|
||||
{
|
||||
match: /"_loadingText".+?(?=(\i)\[.{0,10}\.random)/,
|
||||
|
|
|
@ -14,7 +14,7 @@ import { OnlineMemberCountStore } from "./OnlineMemberCountStore";
|
|||
export function MemberCount({ isTooltip, tooltipGuildId }: { isTooltip?: true; tooltipGuildId?: string; }) {
|
||||
const currentChannel = useStateFromStores([SelectedChannelStore], () => getCurrentChannel());
|
||||
|
||||
const guildId = isTooltip ? tooltipGuildId! : currentChannel.guild_id;
|
||||
const guildId = isTooltip ? tooltipGuildId! : currentChannel?.guild_id;
|
||||
|
||||
const totalCount = useStateFromStores(
|
||||
[GuildMemberCountStore],
|
||||
|
@ -33,7 +33,7 @@ export function MemberCount({ isTooltip, tooltipGuildId }: { isTooltip?: true; t
|
|||
|
||||
const threadGroups = useStateFromStores(
|
||||
[ThreadMemberListStore],
|
||||
() => ThreadMemberListStore.getMemberListSections(currentChannel.id)
|
||||
() => ThreadMemberListStore.getMemberListSections(currentChannel?.id)
|
||||
);
|
||||
|
||||
if (!isTooltip && (groups.length >= 1 || groups[0].id !== "unknown")) {
|
||||
|
|
|
@ -15,8 +15,8 @@ export const OnlineMemberCountStore = proxyLazy(() => {
|
|||
const onlineMemberMap = new Map<string, number>();
|
||||
|
||||
class OnlineMemberCountStore extends Flux.Store {
|
||||
getCount(guildId: string) {
|
||||
return onlineMemberMap.get(guildId);
|
||||
getCount(guildId?: string) {
|
||||
return onlineMemberMap.get(guildId!);
|
||||
}
|
||||
|
||||
async _ensureCount(guildId: string) {
|
||||
|
@ -25,8 +25,8 @@ export const OnlineMemberCountStore = proxyLazy(() => {
|
|||
await PrivateChannelsStore.preload(guildId, GuildChannelStore.getDefaultChannel(guildId).id);
|
||||
}
|
||||
|
||||
ensureCount(guildId: string) {
|
||||
if (onlineMemberMap.has(guildId)) return;
|
||||
ensureCount(guildId?: string) {
|
||||
if (!guildId || onlineMemberMap.has(guildId)) return;
|
||||
|
||||
preloadQueue.push(() =>
|
||||
this._ensureCount(guildId)
|
||||
|
|
|
@ -28,12 +28,12 @@ import { FluxStore } from "@webpack/types";
|
|||
|
||||
import { MemberCount } from "./MemberCount";
|
||||
|
||||
export const GuildMemberCountStore = findStoreLazy("GuildMemberCountStore") as FluxStore & { getMemberCount(guildId: string): number | null; };
|
||||
export const GuildMemberCountStore = findStoreLazy("GuildMemberCountStore") as FluxStore & { getMemberCount(guildId?: string): number | null; };
|
||||
export const ChannelMemberStore = findStoreLazy("ChannelMemberStore") as FluxStore & {
|
||||
getProps(guildId: string, channelId: string): { groups: { count: number; id: string; }[]; };
|
||||
getProps(guildId?: string, channelId?: string): { groups: { count: number; id: string; }[]; };
|
||||
};
|
||||
export const ThreadMemberListStore = findStoreLazy("ThreadMemberListStore") as FluxStore & {
|
||||
getMemberListSections(channelId: string): { [sectionId: string]: { sectionId: string; userIds: string[]; }; };
|
||||
getMemberListSections(channelId?: string): { [sectionId: string]: { sectionId: string; userIds: string[]; }; };
|
||||
};
|
||||
|
||||
|
||||
|
@ -74,7 +74,7 @@ export default definePlugin({
|
|||
{
|
||||
find: ".invitesDisabledTooltip",
|
||||
replacement: {
|
||||
match: /\.VIEW_AS_ROLES_MENTIONS_WARNING.{0,100}(?=])/,
|
||||
match: /#{intl::VIEW_AS_ROLES_MENTIONS_WARNING}.{0,100}(?=])/,
|
||||
replace: "$&,$self.renderTooltip(arguments[0].guild)"
|
||||
},
|
||||
predicate: () => settings.store.toolTip
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# MentionAvatars
|
||||
|
||||
Shows user avatars inside mentions
|
||||
Shows user avatars and role icons inside mentions
|
||||
|
||||
![](https://github.com/user-attachments/assets/fc76ea47-5e19-4063-a592-c57785a75cc7)
|
||||
![](https://github.com/user-attachments/assets/76c4c3d9-7cde-42db-ba84-903cbb40c163)
|
||||
|
|
|
@ -10,21 +10,42 @@ import { definePluginSettings } from "@api/Settings";
|
|||
import ErrorBoundary from "@components/ErrorBoundary";
|
||||
import { Devs } from "@utils/constants";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
import { SelectedGuildStore, useState } from "@webpack/common";
|
||||
import { GuildStore, SelectedGuildStore, useState } from "@webpack/common";
|
||||
import { User } from "discord-types/general";
|
||||
|
||||
const settings = definePluginSettings({
|
||||
showAtSymbol: {
|
||||
type: OptionType.BOOLEAN,
|
||||
description: "Whether the the @ symbol should be displayed",
|
||||
description: "Whether the the @ symbol should be displayed on user mentions",
|
||||
default: true
|
||||
}
|
||||
});
|
||||
|
||||
function DefaultRoleIcon() {
|
||||
return (
|
||||
<svg
|
||||
className="vc-mentionAvatars-icon vc-mentionAvatars-role-icon"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 24 24"
|
||||
fill="currentColor"
|
||||
>
|
||||
<path
|
||||
d="M14 8.00598C14 10.211 12.206 12.006 10 12.006C7.795 12.006 6 10.211 6 8.00598C6 5.80098 7.794 4.00598 10 4.00598C12.206 4.00598 14 5.80098 14 8.00598ZM2 19.006C2 15.473 5.29 13.006 10 13.006C14.711 13.006 18 15.473 18 19.006V20.006H2V19.006Z"
|
||||
/>
|
||||
<path
|
||||
d="M20.0001 20.006H22.0001V19.006C22.0001 16.4433 20.2697 14.4415 17.5213 13.5352C19.0621 14.9127 20.0001 16.8059 20.0001 19.006V20.006Z"
|
||||
/>
|
||||
<path
|
||||
d="M14.8834 11.9077C16.6657 11.5044 18.0001 9.9077 18.0001 8.00598C18.0001 5.96916 16.4693 4.28218 14.4971 4.0367C15.4322 5.09511 16.0001 6.48524 16.0001 8.00598C16.0001 9.44888 15.4889 10.7742 14.6378 11.8102C14.7203 11.8418 14.8022 11.8743 14.8834 11.9077Z"
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
export default definePlugin({
|
||||
name: "MentionAvatars",
|
||||
description: "Shows user avatars inside mentions",
|
||||
authors: [Devs.Ven],
|
||||
description: "Shows user avatars and role icons inside mentions",
|
||||
authors: [Devs.Ven, Devs.SerStars],
|
||||
|
||||
patches: [{
|
||||
find: ".USER_MENTION)",
|
||||
|
@ -32,6 +53,13 @@ export default definePlugin({
|
|||
match: /children:"@"\.concat\((null!=\i\?\i:\i)\)(?<=\.useName\((\i)\).+?)/,
|
||||
replace: "children:$self.renderUsername({username:$1,user:$2})"
|
||||
}
|
||||
},
|
||||
{
|
||||
find: ".ROLE_MENTION)",
|
||||
replacement: {
|
||||
match: /children:\[\i&&.{0,50}\.RoleDot.{0,300},\i(?=\])/,
|
||||
replace: "$&,$self.renderRoleIcon(arguments[0])"
|
||||
}
|
||||
}],
|
||||
|
||||
settings,
|
||||
|
@ -47,12 +75,31 @@ export default definePlugin({
|
|||
onMouseEnter={() => setIsHovering(true)}
|
||||
onMouseLeave={() => setIsHovering(false)}
|
||||
>
|
||||
<img src={user.getAvatarURL(SelectedGuildStore.getGuildId(), 16, isHovering)} className="vc-mentionAvatars-avatar" />
|
||||
<img
|
||||
src={user.getAvatarURL(SelectedGuildStore.getGuildId(), 16, isHovering)}
|
||||
className="vc-mentionAvatars-icon"
|
||||
style={{ borderRadius: "50%" }}
|
||||
/>
|
||||
{getUsernameString(username)}
|
||||
</span>
|
||||
);
|
||||
}, { noop: true })
|
||||
}, { noop: true }),
|
||||
|
||||
renderRoleIcon: ErrorBoundary.wrap(({ roleId, guildId }: { roleId: string, guildId: string; }) => {
|
||||
// Discord uses Role Mentions for uncached users because .... idk
|
||||
if (!roleId) return null;
|
||||
|
||||
const role = GuildStore.getRole(guildId, roleId);
|
||||
|
||||
if (!role?.icon) return <DefaultRoleIcon />;
|
||||
|
||||
return (
|
||||
<img
|
||||
className="vc-mentionAvatars-icon vc-mentionAvatars-role-icon"
|
||||
src={`${location.protocol}//${window.GLOBAL_ENV.CDN_HOST}/role-icons/${roleId}/${role.icon}.webp?size=24&quality=lossless`}
|
||||
/>
|
||||
);
|
||||
}),
|
||||
});
|
||||
|
||||
function getUsernameString(username: string) {
|
||||
|
|
|
@ -1,8 +1,16 @@
|
|||
.vc-mentionAvatars-avatar {
|
||||
.vc-mentionAvatars-icon {
|
||||
vertical-align: middle;
|
||||
width: 1em !important; /* insane discord sets width: 100% in channel topic */
|
||||
height: 1em;
|
||||
margin: 0 4px 0.2rem 2px;
|
||||
border-radius: 50%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.vc-mentionAvatars-role-icon {
|
||||
margin: 0 2px 0.2rem 4px;
|
||||
}
|
||||
|
||||
/** don't display inside the ServerInfo modal owner mention */
|
||||
.vc-gp-owner .vc-mentionAvatars-icon {
|
||||
display: none;
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ export default definePlugin({
|
|||
if (msg.deleted === true) return;
|
||||
|
||||
if (isMe) {
|
||||
if (!settings.store.enableDoubleClickToEdit || EditStore.isEditing(channel.id, msg.id)) return;
|
||||
if (!settings.store.enableDoubleClickToEdit || EditStore.isEditing(channel.id, msg.id) || msg.state !== "SENT") return;
|
||||
|
||||
MessageActions.startEditMessage(channel.id, msg.id, msg.content);
|
||||
event.preventDefault();
|
||||
|
|
|
@ -24,12 +24,12 @@ import { Settings } from "@api/Settings";
|
|||
import { disableStyle, enableStyle } from "@api/Styles";
|
||||
import ErrorBoundary from "@components/ErrorBoundary";
|
||||
import { Devs } from "@utils/constants";
|
||||
import { proxyLazy } from "@utils/lazy";
|
||||
import { getIntlMessage } from "@utils/discord";
|
||||
import { Logger } from "@utils/Logger";
|
||||
import { classes } from "@utils/misc";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
import { findByCodeLazy, findByPropsLazy } from "@webpack";
|
||||
import { ChannelStore, FluxDispatcher, i18n, Menu, MessageStore, Parser, SelectedChannelStore, Timestamp, UserStore, useStateFromStores } from "@webpack/common";
|
||||
import { ChannelStore, FluxDispatcher, Menu, MessageStore, Parser, SelectedChannelStore, Timestamp, UserStore, useStateFromStores } from "@webpack/common";
|
||||
import { Message } from "discord-types/general";
|
||||
|
||||
import overlayStyle from "./deleteStyleOverlay.css?managed";
|
||||
|
@ -178,7 +178,7 @@ export default definePlugin({
|
|||
isEdited={true}
|
||||
isInline={false}
|
||||
>
|
||||
<span className={styles.edited}>{" "}({i18n.Messages.MESSAGE_EDITED})</span>
|
||||
<span className={styles.edited}>{" "}({getIntlMessage("MESSAGE_EDITED")})</span>
|
||||
</Timestamp>
|
||||
</div>
|
||||
))}
|
||||
|
@ -312,9 +312,35 @@ export default definePlugin({
|
|||
);
|
||||
},
|
||||
|
||||
Messages: proxyLazy(() => ({
|
||||
DELETED_MESSAGE_COUNT: getMessage("{count, plural, =0 {No deleted messages} one {{count} deleted message} other {{count} deleted messages}}")
|
||||
})),
|
||||
Messages: {
|
||||
// DELETED_MESSAGE_COUNT: getMessage("{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: [
|
||||
{
|
||||
|
@ -445,7 +471,7 @@ export default definePlugin({
|
|||
|
||||
{
|
||||
// Message content renderer
|
||||
find: "Messages.MESSAGE_EDITED,\")\"",
|
||||
find: "#{intl::MESSAGE_EDITED}",
|
||||
replacement: [
|
||||
{
|
||||
// Render editHistory in the deepest div for message content
|
||||
|
@ -497,7 +523,7 @@ export default definePlugin({
|
|||
},
|
||||
{
|
||||
// Message group rendering
|
||||
find: "Messages.NEW_MESSAGES_ESTIMATED_WITH_DATE",
|
||||
find: "#{intl::NEW_MESSAGES_ESTIMATED_WITH_DATE}",
|
||||
replacement: [
|
||||
{
|
||||
match: /(\i).type===\i\.\i\.MESSAGE_GROUP_BLOCKED\|\|/,
|
||||
|
|
|
@ -82,7 +82,6 @@ export default definePlugin({
|
|||
default: true
|
||||
}
|
||||
},
|
||||
dependencies: ["CommandsAPI"],
|
||||
|
||||
async start() {
|
||||
for (const tag of await getTags()) createTagCommand(tag);
|
||||
|
|
|
@ -33,7 +33,6 @@ export default definePlugin({
|
|||
name: "MoreCommands",
|
||||
description: "echo, lenny, mock",
|
||||
authors: [Devs.Arjix, Devs.echo, Devs.Samu],
|
||||
dependencies: ["CommandsAPI"],
|
||||
commands: [
|
||||
{
|
||||
name: "echo",
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue