This commit is contained in:
2025-07-27 14:15:06 +03:00
8 changed files with 422 additions and 34 deletions

View File

@@ -3,10 +3,8 @@
import { useRobuxBalance } from "@/hooks/roblox/useRobuxBalance";
import { RobuxIcon } from "../roblox/RobloxIcons";
import React, { useState } from "react";
import { Separator } from "../ui/separator";
import { Bell, SettingsIcon, ShirtIcon } from "lucide-react";
import { ShirtIcon } from "lucide-react";
import { StupidHoverThing } from "../util/MiscStuff";
import { toast } from "sonner";
import { OutfitSelector } from "./OutfitQuickChooser";
import { proxyFetch } from "@/lib/utils";
import { loadThumbnails } from "@/lib/thumbnailLoader";
@@ -16,14 +14,21 @@ import { useBestFriends } from "@/hooks/roblox/useBestFriends";
import { useCurrentAccount } from "@/hooks/roblox/useCurrentAccount";
import { useFriendsPresence } from "@/hooks/roblox/usePresence";
/**
requires csrf token cuz u cant use noblox.js on the web
either go to https://roblox.com/my/avataar or the app to change ur fit
*/
async function updateOutfit(outfit: { id: number }, acc: { id: number }) {
try {
const J = (await (
// ocbwoy3 stupid idiot for using v3 api
const details = (await (
await proxyFetch(
`https://avatar.roblox.com/v1/outfits/${outfit.id}/details`
)
).json()) as {
id: number;
name: string;
bodyColors: Record<string, string>;
scale: Record<string, number>;
};
const detailsV3 = (await (
await proxyFetch(
`https://avatar.roblox.com/v3/outfits/${outfit.id}/details`
)
@@ -31,16 +36,50 @@ async function updateOutfit(outfit: { id: number }, acc: { id: number }) {
id: number;
name: string;
assets: any[];
bodyColors: Record<string, string>;
scale: Record<string, number>;
playerAvatarType: "R6" | "R15";
};
await proxyFetch(
`https://avatar.roblox.com/v1/avatar/set-body-colors`,
{
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(details.bodyColors)
}
);
await proxyFetch(`https://avatar.roblox.com/v1/avatar/set-scales`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(details.scale)
});
// u cant set avatar item scaling/rotation cuz roblox can't make good web apis
await proxyFetch(
`https://avatar.roblox.com/v1/avatar/set-wearing-assets`,
{
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
assetIds: J.assets.map((a) => a.id).filter((a) => !!a)
assetIds: detailsV3.assets.map((a) => a.id).filter(Boolean)
})
}
);
await proxyFetch(
`https://avatar.roblox.com/v1/avatar/set-player-avatar-type`,
{
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
playerAvatarType: detailsV3.playerAvatarType
})
}
);
loadThumbnails([
{
type: "AvatarHeadShot",
@@ -48,8 +87,10 @@ async function updateOutfit(outfit: { id: number }, acc: { id: number }) {
format: "webp",
size: "720x720"
}
]).catch((a) => {});
} catch {}
]).catch(() => {});
} catch (err) {
console.error(err);
}
}
export const QuickTopUI = React.memo(function () {
@@ -85,12 +126,18 @@ export const QuickTopUI = React.memo(function () {
</StupidHoverThing>
<StupidHoverThing
text={!robux ? "Loading..." : `You have ${robux} Robux`}
text={
!robux
? "You might probably have some Robux..."
: `You have ${robux.toLocaleString()} Robux`
}
>
<div className="rounded-full bg-crust/50 flex items-center p-2">
<RobuxIcon className="w-6 h-6" />
{robux ? (
<p className="pl-1">{robux.toLocaleString()}</p>
<p className="pl-1">
{robux ? robux.toLocaleString() : "???"}
</p>
) : (
<></>
)}
@@ -109,6 +156,7 @@ export const QuickTopUILogoPart = React.memo(function () {
</Link>
<Link href="/test" className="mt-2">
<p>{"ocbwoy3-chan's roblox"}</p>
<p className="mt-2 text-surface2 font-mono line-clamp-1">{process.env.NODE_ENV} {process.env.NEXT_PUBLIC_CWD} {process.env.NEXT_PUBLIC_ARGV0}</p>
</Link>
</div>
);