;
+}
+
+const settings = definePluginSettings({
+ nitroFirst: {
+ description: "Banner to use if both Nitro and USRBG banners are present",
+ type: OptionType.SELECT,
+ options: [
+ { label: "Nitro banner", value: true, default: true },
+ { label: "USRBG banner", value: false },
+ ]
+ },
+ voiceBackground: {
+ description: "Use USRBG banners as voice chat backgrounds",
+ type: OptionType.BOOLEAN,
+ default: true,
+ restartNeeded: true
+ }
+});
+
+export default definePlugin({
+ name: "FORKED - USRBG",
+ description: "Displays user banners from dorkbutt's USRBG server, allowing anyone to get a banner without Nitro",
+ authors: [Devs.dorkbutt, Devs.AutumnVN, Devs.katlyn, Devs.pylix, Devs.TheKodeToad],
+ settings,
+ patches: [
+ {
+ find: '.banner)==null?"COMPLETE"',
+ replacement: {
+ match: /(?<=void 0:)\i.getPreviewBanner\(\i,\i,\i\)/,
+ replace: "$self.patchBannerUrl(arguments[0])||$&"
+
+ }
+ },
+ {
+ find: "\"data-selenium-video-tile\":",
+ predicate: () => settings.store.voiceBackground,
+ replacement: [
+ {
+ match: /(?<=function\((\i),\i\)\{)(?=let.{20,40},style:)/,
+ replace: "$1.style=$self.getVoiceBackgroundStyles($1);"
+ }
+ ]
+ }
+ ],
+
+ data: null as UsrbgApiReturn | null,
+
+ settingsAboutComponent: () => {
+ return (
+ "Message @dorkbutt about getting your personal banner added!"
+ );
+ },
+
+ getVoiceBackgroundStyles({ className, participantUserId }: any) {
+ if (className.includes("tile_")) {
+ if (this.userHasBackground(participantUserId)) {
+ return {
+ backgroundImage: `url(${this.getImageUrl(participantUserId)})`,
+ backgroundSize: "cover",
+ backgroundPosition: "center",
+ backgroundRepeat: "no-repeat"
+ };
+ }
+ }
+ },
+
+ patchBannerUrl({ displayProfile }: any) {
+ if (displayProfile?.banner && settings.store.nitroFirst) return;
+ if (this.userHasBackground(displayProfile?.userId)) return this.getImageUrl(displayProfile?.userId);
+ },
+
+ userHasBackground(userId: string) {
+ return !!this.data?.users[userId];
+ },
+
+ getImageUrl(userId: string): string | null {
+ if (!this.userHasBackground(userId)) return null;
+
+ // We can assert that data exists because userHasBackground returned true
+ const { endpoint, bucket, prefix, users: { [userId]: etag } } = this.data!;
+ return `${endpoint}/${bucket}/${prefix}${userId}?${etag}`;
+ },
+
+ async start() {
+ const res = await fetch(API_URL);
+ if (res.ok) {
+ this.data = await res.json();
+ }
+ }
+});
diff --git a/src/plugins/other-usrbg/users.json b/src/plugins/other-usrbg/users.json
new file mode 100644
index 00000000..9ac83479
--- /dev/null
+++ b/src/plugins/other-usrbg/users.json
@@ -0,0 +1,6 @@
+{"endpoint":"https://usrbg.dorkbutt.lol","bucket":"usrbg","prefix":"v2/",
+ "users":{
+ "862105885660676146":"db1d",
+ "578012873813524530":"315c"
+ }
+}
diff --git a/src/plugins/showHiddenChannels/index.tsx b/src/plugins/showHiddenChannels/index.tsx
index cd1b19ba..149d422b 100644
--- a/src/plugins/showHiddenChannels/index.tsx
+++ b/src/plugins/showHiddenChannels/index.tsx
@@ -267,7 +267,7 @@ export default definePlugin({
{
find: '"MessageManager"',
replacement: {
- match: /"Skipping fetch because channelId is a static route"\);return}(?=.+?getChannel\((\i)\))/,
+ match: /forceFetch:\i,isPreload:.+?}=\i;(?=.+?getChannel\((\i)\))/,
replace: (m, channelId) => `${m}if($self.isHiddenChannel({channelId:${channelId}}))return;`
}
},
@@ -494,10 +494,11 @@ export default definePlugin({
isHiddenChannel(channel: Channel & { channelId?: string; }, checkConnect = false) {
try {
- if (!channel) return false;
+ if (channel == null || Object.hasOwn(channel, "channelId") && channel.channelId == null) return false;
- if (channel.channelId) channel = ChannelStore.getChannel(channel.channelId);
- if (!channel || channel.isDM() || channel.isGroupDM() || channel.isMultiUserDM()) return false;
+ if (channel.channelId != null) channel = ChannelStore.getChannel(channel.channelId);
+ if (channel == null || channel.isDM() || channel.isGroupDM() || channel.isMultiUserDM()) return false;
+ if (["browse", "customize", "guide"].includes(channel.id)) return false;
return !PermissionStore.can(PermissionsBits.VIEW_CHANNEL, channel) || checkConnect && !PermissionStore.can(PermissionsBits.CONNECT, channel);
} catch (e) {
diff --git a/src/plugins/webContextMenus.web/index.ts b/src/plugins/webContextMenus.web/index.ts
index 45e6fa00..666e51be 100644
--- a/src/plugins/webContextMenus.web/index.ts
+++ b/src/plugins/webContextMenus.web/index.ts
@@ -122,10 +122,16 @@ export default definePlugin({
{
find: "Copy image not supported",
- replacement: {
- match: /(?<=(?:canSaveImage|canCopyImage)\(\i?\)\{.{0,50})!\i\.isPlatformEmbedded/g,
- replace: "false"
- }
+ replacement: [
+ {
+ match: /(?<=(?:canSaveImage|canCopyImage)\(.{0,120}?)!\i\.isPlatformEmbedded/g,
+ replace: "false"
+ },
+ {
+ match: /canCopyImage\(.+?(?=return"function"==typeof \i\.clipboard\.copyImage)/,
+ replace: "$&return true;"
+ }
+ ]
},
// Add back Copy & Save Image
{
@@ -137,7 +143,7 @@ export default definePlugin({
replace: "false"
},
{
- match: /return\s*?\[.{0,50}?(?=\?.{0,100}?id:"copy-image")/,
+ match: /return\s*?\[.{0,50}?(?=\?\(0,\i\.jsxs?.{0,100}?id:"copy-image")/,
replace: "return [true"
},
{
diff --git a/src/plugins/whoReacted/index.tsx b/src/plugins/whoReacted/index.tsx
index aea57fef..f14de9f5 100644
--- a/src/plugins/whoReacted/index.tsx
+++ b/src/plugins/whoReacted/index.tsx
@@ -66,7 +66,7 @@ function fetchReactions(msg: Message, emoji: ReactionEmoji, type: number) {
function getReactionsWithQueue(msg: Message, e: ReactionEmoji, type: number) {
const key = `${msg.id}:${e.name}:${e.id ?? ""}:${type}`;
- const cache = reactions[key] ??= { fetched: false, users: {} };
+ const cache = reactions[key] ??= { fetched: false, users: new Map() };
if (!cache.fetched) {
queue.unshift(() => fetchReactions(msg, e, type));
cache.fetched = true;
@@ -159,7 +159,7 @@ export default definePlugin({
}, [message.id, forceUpdate]);
const reactions = getReactionsWithQueue(message, emoji, type);
- const users = Object.values(reactions).filter(Boolean) as User[];
+ const users = [...reactions.values()].filter(Boolean);
return (
;
+ users: Map;
}
interface RootObject {
diff --git a/src/utils/constants.ts b/src/utils/constants.ts
index 65c73bd8..7bcadb42 100644
--- a/src/utils/constants.ts
+++ b/src/utils/constants.ts
@@ -589,6 +589,10 @@ export const Devs = /* #__PURE__*/ Object.freeze({
name: "samsam",
id: 836452332387565589n,
},
+ Cootshk: {
+ name: "Cootshk",
+ id: 921605971577548820n
+ },
} satisfies Record);
// iife so #__PURE__ works correctly
diff --git a/src/utils/misc.ts b/src/utils/misc.ts
index 7f9f6e59..7028e00b 100644
--- a/src/utils/misc.ts
+++ b/src/utils/misc.ts
@@ -92,6 +92,7 @@ export function identity(value: T): T {
export const isMobile = navigator.userAgent.includes("Mobi");
export const isPluginDev = (id: string) => Object.hasOwn(DevsById, id);
+export const shouldShowContributorBadge = (id: string) => isPluginDev(id) && DevsById[id].badge !== false;
export function pluralise(amount: number, singular: string, plural = singular + "s") {
return amount === 1 ? `${amount} ${singular}` : `${amount} ${plural}`;
diff --git a/src/webpack/common/utils.ts b/src/webpack/common/utils.ts
index 05eb5729..5c54c95a 100644
--- a/src/webpack/common/utils.ts
+++ b/src/webpack/common/utils.ts
@@ -138,7 +138,7 @@ export const UserUtils = {
export const UploadManager = findByPropsLazy("clearAll", "addFile");
export const UploadHandler = {
- promptToUpload: findByCodeLazy("#{intl::ATTACHMENT_TOO_MANY_ERROR_TITLE}") as (files: File[], channel: Channel, draftType: Number) => void
+ promptToUpload: findByCodeLazy("=!0,showLargeMessageDialog:") as (files: File[], channel: Channel, draftType: Number) => void
};
export const ApplicationAssetUtils = mapMangledModuleLazy("getAssetImage: size must === [", {