Merge remote-tracking branch 'upstream/dev' into dev

This commit is contained in:
thororen1234 2026-01-09 15:16:34 -05:00
commit 9ac7dee47c
No known key found for this signature in database
6 changed files with 51 additions and 41 deletions

View file

@ -51,7 +51,7 @@ export interface ProfileBadge {
/**
* Allows dynamically returning multiple badges.
* May call hooks but then you must not use shouldShow
* Must not call hooks
*/
getBadges?(userInfo: BadgeUserArgs): ProfileBadge[];
}

View file

@ -133,16 +133,12 @@ export default definePlugin({
{
find: "#{intl::PROFILE_USER_BADGES}",
replacement: [
{
match: /(?<=\{[^}]*?)badges:\i(?=[^}]*?}=(\i))/,
replace: "_$&=$self.useBadges($1.displayProfile).concat($1.badges)"
},
{
match: /alt:" ","aria-hidden":!0,src:.{0,50}(\i).iconSrc/,
replace: "...$1.props,$&"
},
{
match: /(?<="aria-label":(\i)\.description,.{0,200}?)children:/g,
match: /(?<=forceOpen:.{0,40}?\i\((\i)\.id\).{0,100}?)children:/,
replace: "children:$1.component?$self.renderBadgeComponent({...$1}) :"
},
// handle onClick and onContextMenu
@ -151,6 +147,13 @@ export default definePlugin({
replace: "...$self.getBadgeMouseEventHandlers($1),$&"
}
]
},
{
find: "getLegacyUsername(){",
replacement: {
match: /getBadges\(\)\{.{0,100}?return\[/,
replace: "$&...$self.getBadges(this),"
}
}
],
@ -186,14 +189,13 @@ export default definePlugin({
clearInterval(intervalId);
},
// doesn't use hooks itself, but some plugins might do so in their getBadges function
useBadges(profile: { userId: string; guildId: string; }) {
getBadges(profile: { userId: string; guildId: string; }) {
if (!profile) return [];
try {
return _getBadges(profile);
} catch (e) {
new Logger("BadgeAPI#useBadges").error(e);
new Logger("BadgeAPI#getBadges").error(e);
return [];
}
},

View file

@ -60,11 +60,12 @@ export default definePlugin({
);
},
getSrc(props: { src: string; mediaLayoutType: string; width: number; height: number; contentType: string; mosaicStyleAlt?: boolean; }, freeze?: boolean) {
getSrc(props: { src: string; width: number; height: number; contentType: string; mosaicStyleAlt?: boolean; trigger?: string; }, freeze?: boolean) {
if (!props?.src) return;
try {
const { contentType, height, mediaLayoutType, src, width, mosaicStyleAlt } = props;
const { contentType, height, src, width, mosaicStyleAlt, trigger } = props;
// Embed images do not have a content type set.
// It's difficult to differentiate between images and videos. but mosaicStyleAlt seems exclusive to images
const isImage = contentType?.startsWith("image/") ?? (typeof mosaicStyleAlt === "boolean");
@ -73,9 +74,15 @@ export default definePlugin({
const url = new URL(src);
if (!url.pathname.startsWith("/attachments/")) return;
url.searchParams.set("animated", String(!freeze));
if (freeze) {
url.searchParams.set("animated", "false");
if (!settings.store.originalImagesInChat && mediaLayoutType === "MOSAIC") {
if (url.pathname.endsWith(".gif"))
url.searchParams.set("format", "webp");
}
const isModal = !!trigger;
if (!settings.store.originalImagesInChat && !isModal) {
// make sure the image is not too large
const pixels = width * height;
const limit = 2000 * 1200;

View file

@ -45,21 +45,9 @@ const { useStatusFillColor } = mapMangledModuleLazy(".concat(.5625*", {
useStatusFillColor: filters.byCode(".hex")
});
interface IconFactoryOpts {
viewBox?: string;
width?: number;
height?: number;
}
interface IconProps {
color: string;
tooltip: string;
small?: boolean;
}
function Icon(path: string, opts?: IconFactoryOpts) {
return ({ color, tooltip, small }: IconProps) => (
<Tooltip text={tooltip} >
function Icon(path: string, opts?: { viewBox?: string; width?: number; height?: number; }) {
return ({ color, tooltip, small }: { color: string; tooltip: string; small: boolean; }) => (
<Tooltip text={tooltip}>
{tooltipProps => (
<svg
{...tooltipProps}
@ -84,16 +72,7 @@ const Icons = {
vencord: Icon("M14.8 2.7 9 3.1V47h3.3c1.7 0 6.2.3 10 .7l6.7.6V2l-4.2.2c-2.4.1-6.9.3-10 .5zm1.8 6.4c1 1.7-1.3 3.6-2.7 2.2C12.7 10.1 13.5 8 15 8c.5 0 1.2.5 1.6 1.1zM16 33c0 6-.4 10-1 10s-1-4-1-10 .4-10 1-10 1 4 1 10zm15-8v23.3l3.8-.7c2-.3 4.7-.6 6-.6H43V3h-2.2c-1.3 0-4-.3-6-.6L31 1.7V25z", { viewBox: "0 0 50 50" }),
};
type Platform = keyof typeof Icons;
interface PlatformIconProps {
platform: Platform;
status: string;
small?: boolean;
isProfile?: boolean;
}
const PlatformIcon = ({ platform, status, small }: PlatformIconProps) => {
const PlatformIcon = ({ platform, status, small }) => {
const tooltip = platform === "embedded"
? "Console"
: platform[0].toUpperCase() + platform.slice(1);

View file

@ -21,6 +21,7 @@ const DefaultEngines = {
GitHub: "https://github.com/search?q=",
Reddit: "https://www.reddit.com/search?q=",
Wikipedia: "https://wikipedia.org/w/index.php?search=",
Startpage: "https://www.startpage.com/sp/search?query="
} as const;
const enum ReplacementEngineValue {

View file

@ -4,14 +4,25 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { definePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";
import definePlugin, { OptionType } from "@utils/types";
const settings = definePluginSettings({
experimentalAV1Support: {
type: OptionType.BOOLEAN,
description: "Enable AV1 codec support. May cause issues like infinitely loading streams",
default: false
}
});
export default definePlugin({
name: "WebScreenShareFixes",
authors: [Devs.Kaitlyn],
description: "Removes 2500kbps bitrate cap on chromium and vesktop clients.",
enabledByDefault: true,
settings,
patches: [
{
find: "x-google-max-bitrate",
@ -30,9 +41,19 @@ export default definePlugin({
},
{
match: /\i\?\[(\i\.\i)\.H265,\i\.\i\.H264,\i\.\i\.VP8,\i\.\i\.VP9\]/,
replace: "true?['AV1',$1.H265,$1.VP9,$1.H264,$1.VP8]"
replace: "true?$self.getCodecs($1)"
}
]
}
]
],
getCodecs(Codecs: Record<string, string>) {
const codecs = [Codecs.H265, Codecs.VP9, Codecs.H264, Codecs.VP8];
if (settings.store.experimentalAV1Support) {
codecs.unshift("AV1");
}
return codecs;
}
});