mirror of
https://github.com/Vendicated/Vencord.git
synced 2024-09-20 06:30:35 +00:00
Compare commits
32 commits
2df1461041
...
79f1e38c8a
Author | SHA1 | Date | |
---|---|---|---|
|
79f1e38c8a | ||
|
6cce8a8bc4 | ||
|
1848b16536 | ||
|
c572116b97 | ||
|
e26986f66a | ||
|
8c6104305b | ||
|
50ce282284 | ||
|
2272e1dfaa | ||
|
bcb0c4100f | ||
|
8a0b8b60b5 | ||
|
7eeeceea1c | ||
|
073b561db1 | ||
|
487bb264c8 | ||
|
543d1de570 | ||
|
7cf5fab128 | ||
|
eb2ef2298b | ||
|
f5dffe12c2 | ||
|
240ce8b07f | ||
|
ab7cf5dfa9 | ||
|
3b969e55ef | ||
|
a742cc2b53 | ||
|
f4ca72c6f6 | ||
|
d9e8a86688 | ||
|
253bfa1ea2 | ||
|
5a96c0bb54 | ||
|
915e14ddab | ||
|
a7a461309d | ||
|
3bcbe7e386 | ||
|
89c2cd2108 | ||
|
ffaca84aa5 | ||
|
25b9898c09 | ||
|
833010fa52 |
12 changed files with 375 additions and 25 deletions
|
@ -24,7 +24,7 @@ interface ActivityButton {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Activity {
|
interface Activity {
|
||||||
state: string;
|
state?: string;
|
||||||
details?: string;
|
details?: string;
|
||||||
timestamps?: {
|
timestamps?: {
|
||||||
start?: number;
|
start?: number;
|
||||||
|
@ -52,8 +52,8 @@ const enum ActivityFlag {
|
||||||
|
|
||||||
export interface TrackData {
|
export interface TrackData {
|
||||||
name: string;
|
name: string;
|
||||||
album: string;
|
album?: string;
|
||||||
artist: string;
|
artist?: string;
|
||||||
|
|
||||||
appleMusicLink?: string;
|
appleMusicLink?: string;
|
||||||
songLink?: string;
|
songLink?: string;
|
||||||
|
@ -61,8 +61,8 @@ export interface TrackData {
|
||||||
albumArtwork?: string;
|
albumArtwork?: string;
|
||||||
artistArtwork?: string;
|
artistArtwork?: string;
|
||||||
|
|
||||||
playerPosition: number;
|
playerPosition?: number;
|
||||||
duration: number;
|
duration?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
const enum AssetImageType {
|
const enum AssetImageType {
|
||||||
|
@ -155,8 +155,8 @@ const settings = definePluginSettings({
|
||||||
function customFormat(formatStr: string, data: TrackData) {
|
function customFormat(formatStr: string, data: TrackData) {
|
||||||
return formatStr
|
return formatStr
|
||||||
.replaceAll("{name}", data.name)
|
.replaceAll("{name}", data.name)
|
||||||
.replaceAll("{album}", data.album)
|
.replaceAll("{album}", data.album ?? "")
|
||||||
.replaceAll("{artist}", data.artist);
|
.replaceAll("{artist}", data.artist ?? "");
|
||||||
}
|
}
|
||||||
|
|
||||||
function getImageAsset(type: AssetImageType, data: TrackData) {
|
function getImageAsset(type: AssetImageType, data: TrackData) {
|
||||||
|
@ -212,14 +212,16 @@ export default definePlugin({
|
||||||
|
|
||||||
const assets: ActivityAssets = {};
|
const assets: ActivityAssets = {};
|
||||||
|
|
||||||
|
const isRadio = Number.isNaN(trackData.duration) && (trackData.playerPosition === 0);
|
||||||
|
|
||||||
if (settings.store.largeImageType !== AssetImageType.Disabled) {
|
if (settings.store.largeImageType !== AssetImageType.Disabled) {
|
||||||
assets.large_image = largeImageAsset;
|
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) {
|
if (settings.store.smallImageType !== AssetImageType.Disabled) {
|
||||||
assets.small_image = smallImageAsset;
|
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[] = [];
|
const buttons: ActivityButton[] = [];
|
||||||
|
@ -243,17 +245,17 @@ export default definePlugin({
|
||||||
|
|
||||||
name: customFormat(settings.store.nameString, trackData),
|
name: customFormat(settings.store.nameString, trackData),
|
||||||
details: customFormat(settings.store.detailsString, 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),
|
start: Date.now() - (trackData.playerPosition * 1000),
|
||||||
end: Date.now() - (trackData.playerPosition * 1000) + (trackData.duration * 1000),
|
end: Date.now() - (trackData.playerPosition * 1000) + (trackData.duration * 1000),
|
||||||
} : undefined),
|
} : undefined,
|
||||||
|
|
||||||
assets,
|
assets,
|
||||||
|
|
||||||
buttons: buttons.length ? buttons.map(v => v.label) : undefined,
|
buttons: !isRadio && buttons.length ? buttons.map(v => v.label) : undefined,
|
||||||
metadata: { button_urls: buttons.map(v => v.url) || undefined, },
|
metadata: !isRadio && buttons.length ? { button_urls: buttons.map(v => v.url) } : undefined,
|
||||||
|
|
||||||
type: settings.store.activityType,
|
type: settings.store.activityType,
|
||||||
flags: ActivityFlag.INSTANCE,
|
flags: ActivityFlag.INSTANCE,
|
||||||
|
|
68
src/plugins/betterSettings/PluginsSubmenu.tsx
Normal file
68
src/plugins/betterSettings/PluginsSubmenu.tsx
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
/*
|
||||||
|
* 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 { isObjectEmpty } from "@utils/misc";
|
||||||
|
import { Alerts, i18n, 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={i18n.Messages.SEARCH}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{!!plugins.length && <Menu.MenuSeparator />}
|
||||||
|
|
||||||
|
{plugins.map(p => (
|
||||||
|
<Menu.MenuItem
|
||||||
|
key={p.name}
|
||||||
|
id={p.name}
|
||||||
|
label={p.name}
|
||||||
|
action={() => openPluginModal(p, onRestartNeeded)}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
|
@ -13,6 +13,8 @@ import { waitFor } from "@webpack";
|
||||||
import { ComponentDispatch, FocusLock, i18n, Menu, useEffect, useRef } from "@webpack/common";
|
import { ComponentDispatch, FocusLock, i18n, Menu, useEffect, useRef } from "@webpack/common";
|
||||||
import type { HTMLAttributes, ReactElement } from "react";
|
import type { HTMLAttributes, ReactElement } from "react";
|
||||||
|
|
||||||
|
import PluginsSubmenu from "./PluginsSubmenu";
|
||||||
|
|
||||||
type SettingsEntry = { section: string, label: string; };
|
type SettingsEntry = { section: string, label: string; };
|
||||||
|
|
||||||
const cl = classNameFactory("");
|
const cl = classNameFactory("");
|
||||||
|
@ -118,13 +120,21 @@ export default definePlugin({
|
||||||
},
|
},
|
||||||
{ // Settings cog context menu
|
{ // Settings cog context menu
|
||||||
find: "Messages.USER_SETTINGS_ACTIONS_MENU_LABEL",
|
find: "Messages.USER_SETTINGS_ACTIONS_MENU_LABEL",
|
||||||
replacement: {
|
replacement: [
|
||||||
match: /(EXPERIMENTS:.+?)(\(0,\i.\i\)\(\))(?=\.filter\(\i=>\{let\{section:\i\}=)/,
|
{
|
||||||
replace: "$1$self.wrapMenu($2)"
|
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
|
// 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.
|
// without possibly also catching unrelated errors of children.
|
||||||
//
|
//
|
||||||
|
|
|
@ -126,7 +126,7 @@ export default definePlugin({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
find: '"Handling ping: "',
|
find: '"_handleLocalVideoDisabled: ',
|
||||||
predicate: () => settings.store.disableNoisyLoggers,
|
predicate: () => settings.store.disableNoisyLoggers,
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /new \i\.\i\("RTCConnection\("\.concat.+?\)\)(?=,)/,
|
match: /new \i\.\i\("RTCConnection\("\.concat.+?\)\)(?=,)/,
|
||||||
|
|
14
src/plugins/customFolderIcons/README.md
Normal file
14
src/plugins/customFolderIcons/README.md
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
# CustomFolderIcons
|
||||||
|
|
||||||
|
Allows you to set custom images/svgs as folder icons
|
||||||
|
|
||||||
|
Available as "Change Icon" in the folder context menu
|
||||||
|
|
||||||
|
![the context menu with the "Change Icon" button](https://github.com/sadan4/Vencord/assets/117494111/3dfb843c-6964-4ac3-a0b9-8772569953d3)
|
||||||
|
|
||||||
|
![an image of some example custom folder icons](https://github.com/sadan4/Vencord/assets/117494111/c5324ab1-3b7a-4286-8cb5-41c0ceb2ea44)
|
||||||
|
|
||||||
|
![the modal used to customize the folder icons](https://github.com/sadan4/Vencord/assets/117494111/1426d350-56db-4687-8052-6c1b1ce873a1)
|
||||||
|
|
||||||
|
|
||||||
|
|
124
src/plugins/customFolderIcons/components.tsx
Normal file
124
src/plugins/customFolderIcons/components.tsx
Normal file
|
@ -0,0 +1,124 @@
|
||||||
|
/*
|
||||||
|
* Vencord, a Discord client mod
|
||||||
|
* Copyright (c) 2024 sadan
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { closeModal, ModalContent, ModalHeader, ModalRoot, openModalLazy } from "@utils/modal";
|
||||||
|
import { Button, Menu, Slider, TextInput, useState } from "@webpack/common";
|
||||||
|
|
||||||
|
import settings, { folderIconsData } from "./settings";
|
||||||
|
import { folderProp, int2rgba, setFolderData } from "./util";
|
||||||
|
|
||||||
|
export function ImageModal(folderProps: folderProp) {
|
||||||
|
const [data, setData] = useState(((settings.store.folderIcons ?? {}) as folderIconsData)[folderProps.folderId]?.url ?? "");
|
||||||
|
const [size, setSize] = useState(100);
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<TextInput
|
||||||
|
// this looks like a horrorshow
|
||||||
|
defaultValue={data}
|
||||||
|
onChange={(val, _n) => {
|
||||||
|
setData(val);
|
||||||
|
}}
|
||||||
|
placeholder="https://example.com/image.png"
|
||||||
|
>
|
||||||
|
</TextInput>
|
||||||
|
<RenderPreview folderProps={folderProps} url={data} size={size} />
|
||||||
|
{data && <>
|
||||||
|
<div style={{
|
||||||
|
color: "#FFF"
|
||||||
|
}}>Change the size of the folder icon</div>
|
||||||
|
<Slider
|
||||||
|
initialValue={100}
|
||||||
|
onValueChange={(v: number) => {
|
||||||
|
setSize(v);
|
||||||
|
}}
|
||||||
|
maxValue={200}
|
||||||
|
minValue={25}
|
||||||
|
// [25, 200]
|
||||||
|
markers={Array.apply(0, Array(176)).map((_, i) => i + 25)}
|
||||||
|
stickToMarkers={true}
|
||||||
|
keyboardStep={1}
|
||||||
|
renderMarker={() => null} />
|
||||||
|
</>}
|
||||||
|
<Button onClick={() => {
|
||||||
|
setFolderData(folderProps, {
|
||||||
|
url: data,
|
||||||
|
size: size
|
||||||
|
});
|
||||||
|
closeModal("custom-folder-icon");
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Save
|
||||||
|
</Button>
|
||||||
|
<hr />
|
||||||
|
<Button onClick={() => {
|
||||||
|
// INFO: unset button
|
||||||
|
const folderSettings = settings.store.folderIcons as folderIconsData;
|
||||||
|
if (folderSettings[folderProps.folderId]) {
|
||||||
|
folderSettings[folderProps.folderId] = null;
|
||||||
|
}
|
||||||
|
closeModal("custom-folder-icon");
|
||||||
|
}}>
|
||||||
|
Unset
|
||||||
|
</Button>
|
||||||
|
<hr />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
export function RenderPreview({ folderProps, url, size }: { folderProps: folderProp; url: string; size: number; }) {
|
||||||
|
if (!url) return null;
|
||||||
|
return (
|
||||||
|
<div className="test1234" style={{
|
||||||
|
width: "20vh",
|
||||||
|
height: "20vh",
|
||||||
|
overflow: "hidden",
|
||||||
|
// 16/48
|
||||||
|
borderRadius: "33%",
|
||||||
|
backgroundColor: int2rgba(folderProps.folderColor, 0.4),
|
||||||
|
display: "flex",
|
||||||
|
justifyContent: "center",
|
||||||
|
alignItems: "center"
|
||||||
|
}}>
|
||||||
|
<img src={url} width={`${size}%`} height={`${size}%`} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function makeContextItem(a: folderProp) {
|
||||||
|
return (
|
||||||
|
<Menu.MenuItem
|
||||||
|
id="custom-folder-icons"
|
||||||
|
key="custom-folder-icons"
|
||||||
|
label="Change Icon"
|
||||||
|
action={() => {
|
||||||
|
openModalLazy(async () => {
|
||||||
|
return props => (
|
||||||
|
<ModalRoot {...props}>
|
||||||
|
<ModalHeader >
|
||||||
|
<div style={{
|
||||||
|
color: "white"
|
||||||
|
}}>
|
||||||
|
Set a New Icon.
|
||||||
|
</div>
|
||||||
|
</ModalHeader>
|
||||||
|
<ModalContent>
|
||||||
|
<ImageModal folderId={a.folderId} folderColor={a.folderColor}/>
|
||||||
|
</ModalContent>
|
||||||
|
<div style={{
|
||||||
|
color: "white",
|
||||||
|
margin: "2.5%",
|
||||||
|
marginTop: "1%"
|
||||||
|
}}>
|
||||||
|
You might have to hover the folder after setting in order for it to refresh.
|
||||||
|
</div>
|
||||||
|
</ModalRoot>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
{
|
||||||
|
modalKey: "custom-folder-icon"
|
||||||
|
});
|
||||||
|
}}/>
|
||||||
|
);
|
||||||
|
}
|
60
src/plugins/customFolderIcons/index.tsx
Normal file
60
src/plugins/customFolderIcons/index.tsx
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
/*
|
||||||
|
* Vencord, a Discord client mod
|
||||||
|
* Copyright (c) 2024 sadan
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { Devs } from "@utils/constants";
|
||||||
|
import definePlugin from "@utils/types";
|
||||||
|
|
||||||
|
import { makeContextItem } from "./components";
|
||||||
|
import settings, { folderIconsData } from "./settings";
|
||||||
|
import { folderProp, int2rgba } from "./util";
|
||||||
|
|
||||||
|
export default definePlugin({
|
||||||
|
settings,
|
||||||
|
name: "CustomFolderIcons",
|
||||||
|
description: "Customize folder icons with any png",
|
||||||
|
authors: [
|
||||||
|
Devs.sadan
|
||||||
|
],
|
||||||
|
patches: [
|
||||||
|
{
|
||||||
|
find: ".expandedFolderIconWrapper",
|
||||||
|
replacement: {
|
||||||
|
match: /(return.{0,80}expandedFolderIconWrapper.*,)(\(0,..jsxs\)\(.*]}\))/,
|
||||||
|
replace: "$1$self.shouldReplace(arguments[0])?$self.replace(arguments[0]):$2"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
contextMenus: {
|
||||||
|
"guild-context": (menuItems, props: folderProp) => {
|
||||||
|
if(!("folderId" in props)) return;
|
||||||
|
menuItems.push(makeContextItem(props));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
shouldReplace(props: any): boolean{
|
||||||
|
return !!((settings.store.folderIcons as folderIconsData)?.[props.folderNode.id]?.url);
|
||||||
|
},
|
||||||
|
replace(props: any){
|
||||||
|
const folderSettings = (settings.store.folderIcons as folderIconsData);
|
||||||
|
if(folderSettings && folderSettings[props.folderNode.id]){
|
||||||
|
const data = folderSettings[props.folderNode.id];
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
backgroundColor: int2rgba(props.folderNode.color, +settings.store.solidIcon || .4),
|
||||||
|
display: "flex",
|
||||||
|
justifyContent: "center",
|
||||||
|
alignItems: "center",
|
||||||
|
width: "100%",
|
||||||
|
height: "100%"
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<img src={data!.url} width={`${data!.size ?? 100}%`} height={`${data!.size ?? 100}%`}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
29
src/plugins/customFolderIcons/settings.tsx
Normal file
29
src/plugins/customFolderIcons/settings.tsx
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
/*
|
||||||
|
* Vencord, a Discord client mod
|
||||||
|
* Copyright (c) 2024 sadan
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { definePluginSettings } from "@api/Settings";
|
||||||
|
import { OptionType } from "@utils/types";
|
||||||
|
|
||||||
|
export interface folderIcon{
|
||||||
|
url: string,
|
||||||
|
size: number,
|
||||||
|
}
|
||||||
|
export type folderIconsData = Record<string, folderIcon | null>;
|
||||||
|
|
||||||
|
const settings = definePluginSettings({
|
||||||
|
solidIcon: {
|
||||||
|
type: OptionType.BOOLEAN,
|
||||||
|
default: false,
|
||||||
|
description: "Use a solid background on the background of the image"
|
||||||
|
},
|
||||||
|
folderIcons: {
|
||||||
|
type: OptionType.COMPONENT,
|
||||||
|
hidden: true,
|
||||||
|
description: "folder icon settings",
|
||||||
|
component: () => <></>
|
||||||
|
}
|
||||||
|
});
|
||||||
|
export default settings;
|
29
src/plugins/customFolderIcons/util.tsx
Normal file
29
src/plugins/customFolderIcons/util.tsx
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
/*
|
||||||
|
* Vencord, a Discord client mod
|
||||||
|
* Copyright (c) 2024 sadan
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
import settings, { folderIcon, folderIconsData } from "./settings";
|
||||||
|
|
||||||
|
export async function setFolderData(props: folderProp, newData: folderIcon) {
|
||||||
|
if(!settings.store.folderIcons){
|
||||||
|
settings.store.folderIcons = {};
|
||||||
|
}
|
||||||
|
const folderSettings = (settings.store.folderIcons as folderIconsData);
|
||||||
|
folderSettings[props.folderId] = newData;
|
||||||
|
}
|
||||||
|
export interface folderProp {
|
||||||
|
folderId: string;
|
||||||
|
folderColor: number;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param rgbVal RGB value
|
||||||
|
* @param alpha alpha bewteen zero and 1
|
||||||
|
*/
|
||||||
|
export function int2rgba(rgbVal: number, alpha: number = 1) {
|
||||||
|
const b = rgbVal & 0xFF,
|
||||||
|
g = (rgbVal & 0xFF00) >>> 8,
|
||||||
|
r = (rgbVal & 0xFF0000) >>> 16;
|
||||||
|
return `rgba(${[r, g, b].join(",")},${alpha})`;
|
||||||
|
}
|
|
@ -23,12 +23,13 @@ import { ErrorCard } from "@components/ErrorCard";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import { Margins } from "@utils/margins";
|
import { Margins } from "@utils/margins";
|
||||||
import definePlugin, { OptionType } from "@utils/types";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
import { findByPropsLazy } from "@webpack";
|
import { findByPropsLazy, findLazy } from "@webpack";
|
||||||
import { Forms, React } from "@webpack/common";
|
import { Forms, React } from "@webpack/common";
|
||||||
|
|
||||||
import hideBugReport from "./hideBugReport.css?managed";
|
import hideBugReport from "./hideBugReport.css?managed";
|
||||||
|
|
||||||
const KbdStyles = findByPropsLazy("key", "combo");
|
const KbdStyles = findByPropsLazy("key", "combo");
|
||||||
|
const BugReporterExperiment = findLazy(m => m?.definition?.id === "2024-09_bug_reporter");
|
||||||
|
|
||||||
const settings = definePluginSettings({
|
const settings = definePluginSettings({
|
||||||
toolbarDevMenu: {
|
toolbarDevMenu: {
|
||||||
|
@ -78,8 +79,8 @@ export default definePlugin({
|
||||||
{
|
{
|
||||||
find: "toolbar:function",
|
find: "toolbar:function",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /\i\.isStaff\(\)/,
|
match: /hasBugReporterAccess:(\i)/,
|
||||||
replace: "true"
|
replace: "_hasBugReporterAccess:$1=true"
|
||||||
},
|
},
|
||||||
predicate: () => settings.store.toolbarDevMenu
|
predicate: () => settings.store.toolbarDevMenu
|
||||||
},
|
},
|
||||||
|
@ -91,10 +92,18 @@ export default definePlugin({
|
||||||
match: /\i\.isDM\(\)\|\|\i\.isThread\(\)/,
|
match: /\i\.isDM\(\)\|\|\i\.isThread\(\)/,
|
||||||
replace: "false",
|
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),
|
stop: () => disableStyle(hideBugReport),
|
||||||
|
|
||||||
settingsAboutComponent: () => {
|
settingsAboutComponent: () => {
|
||||||
|
|
|
@ -91,7 +91,7 @@ export default definePlugin({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
find: ".PANEL,isInteractionSource:",
|
find: ".PANEL,interactionType:",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /{profileType:\i\.\i\.PANEL,children:\[/,
|
match: /{profileType:\i\.\i\.PANEL,children:\[/,
|
||||||
replace: "$&$self.BiteSizeReviewsButton({user:arguments[0].user}),"
|
replace: "$&$self.BiteSizeReviewsButton({user:arguments[0].user}),"
|
||||||
|
|
5
src/webpack/common/types/menu.d.ts
vendored
5
src/webpack/common/types/menu.d.ts
vendored
|
@ -72,6 +72,11 @@ export interface Menu {
|
||||||
onChange(value: number): void,
|
onChange(value: number): void,
|
||||||
renderValue?(value: number): string,
|
renderValue?(value: number): string,
|
||||||
}>;
|
}>;
|
||||||
|
MenuSearchControl: RC<{
|
||||||
|
query: string
|
||||||
|
onChange(query: string): void;
|
||||||
|
placeholder?: string;
|
||||||
|
}>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ContextMenuApi {
|
export interface ContextMenuApi {
|
||||||
|
|
Loading…
Reference in a new issue