Skip to content

Commit

Permalink
Merge branch 'dev' into sqaaakoi-stable
Browse files Browse the repository at this point in the history
  • Loading branch information
Sqaaakoi committed May 2, 2024
2 parents 49e02ef + 9be3af3 commit 0727737
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 17 deletions.
6 changes: 2 additions & 4 deletions src/api/Badges.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export interface ProfileBadge {
image?: string;
link?: string;
/** Action to perform when you click the badge */
onClick?(): void;
onClick?(event: React.MouseEvent<HTMLButtonElement, MouseEvent>, props: BadgeUserArgs): void;
/** Should the user display this badge? */
shouldShow?(userInfo: BadgeUserArgs): boolean;
/** Optional props (e.g. style) for the badge, ignored for component badges */
Expand Down Expand Up @@ -87,9 +87,7 @@ export function _getBadges(args: BadgeUserArgs) {

export interface BadgeUserArgs {
user: User;
profile: Profile;
premiumSince: Date;
premiumGuildSince?: Date;
guildId: string;
}

interface ConnectedAccount {
Expand Down
15 changes: 7 additions & 8 deletions src/plugins/_api/badges.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,13 @@ const ContributorBadge: ProfileBadge = {
description: "Vencord Contributor",
image: CONTRIBUTOR_BADGE,
position: BadgePosition.START,
props: {
style: {
borderRadius: "50%",
transform: "scale(0.9)" // The image is a bit too big compared to default badges
}
},
shouldShow: ({ user }) => isPluginDev(user.id),
link: "https://github.com/Vendicated/Vencord"
onClick(_, { user }) {
// circular import shenanigans
const { openContributorModal } = require("@components/PluginSettings/ContributorModal") as typeof import("@components/PluginSettings/ContributorModal");
// setImmediate is needed to run on later tick to workaround limitation in proxyLazy
setImmediate(() => openContributorModal(user));
}
};

let DonorBadges = {} as Record<string, Array<Record<"tooltip" | "badge", string>>>;
Expand Down Expand Up @@ -85,7 +84,7 @@ export default definePlugin({
// conditionally override their onClick with badge.onClick if it exists
{
match: /href:(\i)\.link/,
replace: "...($1.onClick && { onClick: $1.onClick }),$&"
replace: "...($1.onClick && { onClick: vcE => $1.onClick(vcE, arguments[0]) }),$&"
}
]
}
Expand Down
24 changes: 19 additions & 5 deletions src/plugins/_core/noTrack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,31 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

import { definePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";
import definePlugin, { OptionType } from "@utils/types";

const settings = definePluginSettings({
disableAnalytics: {
type: OptionType.BOOLEAN,
description: "Disable Discord's tracking (analytics/'science')",
default: true,
restartNeeded: true
}
});

export default definePlugin({
name: "NoTrack",
description: "Disable Discord's tracking ('science'), metrics and Sentry crash reporting",
description: "Disable Discord's tracking (analytics/'science'), metrics and Sentry crash reporting",
authors: [Devs.Cyn, Devs.Ven, Devs.Nuckyz, Devs.Arrow],
required: true,

settings,

patches: [
{
find: "AnalyticsActionHandlers.handle",
predicate: () => settings.store.disableAnalytics,
replacement: {
match: /^.+$/,
replace: "()=>{}",
Expand All @@ -44,11 +58,11 @@ export default definePlugin({
replacement: [
{
match: /this\._intervalId=/,
replace: "this._intervalId=undefined&&"
replace: "this._intervalId=void 0&&"
},
{
match: /(increment\(\i\){)/,
replace: "$1return;"
match: /(?:increment|distribution)\(\i(?:,\i)?\){/g,
replace: "$&return;"
}
]
},
Expand Down

0 comments on commit 0727737

Please sign in to comment.