Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

USRBG: support new simplified profile #2501

Merged
merged 2 commits into from
May 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions src/plugins/usrbg/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ import style from "./index.css?managed";
const API_URL = "https://usrbg.is-hardly.online/users";

interface UsrbgApiReturn {
endpoint: string
bucket: string
prefix: string
users: Record<string, string>
endpoint: string;
bucket: string;
prefix: string;
users: Record<string, string>;
}

const settings = definePluginSettings({
Expand Down Expand Up @@ -73,6 +73,19 @@ export default definePlugin({
}
]
},
{
find: /overrideBannerSrc:\i,profileType:/,
replacement: [
{
match: /(\i)\.premiumType/,
replace: "$self.premiumHook($1)||$&"
},
{
match: /(?<=function \i\((\i)\)\{)(?=var.{30,50},overrideBannerSrc:)/,
replace: "$1.overrideBannerSrc=$self.useBannerHook($1);"
}
]
},
{
find: "\"data-selenium-video-tile\":",
predicate: () => settings.store.voiceBackground,
Expand Down Expand Up @@ -123,7 +136,7 @@ export default definePlugin({
return !!this.data?.users[userId];
},

getImageUrl(userId: string): string|null {
getImageUrl(userId: string): string | null {
if (!this.userHasBackground(userId)) return null;

// We can assert that data exists because userHasBackground returned true
Expand Down