fix: voice and personality issues

This commit is contained in:
trafficlunar 2026-04-05 21:45:57 +01:00
parent d11f32eefb
commit 949e86111a
4 changed files with 4 additions and 5 deletions

View file

@ -43,7 +43,7 @@ export async function PATCH(request: NextRequest, { params }: { params: Promise<
if (!session) return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
Sentry.setUser({ id: session.user?.id, name: session.user?.name });
const rateLimit = new RateLimit(request, 2); // no grouped pathname; edit each mii 2 times a minute
const rateLimit = new RateLimit(request, 6); // no grouped pathname; edit each mii 2 times a minute
const check = await rateLimit.handle();
if (check) return check;

View file

@ -27,10 +27,10 @@ export default function VoiceViewer({ data, onChange, onClickTone }: Props) {
min={0}
max={50}
step={1}
value={data[label as keyof typeof data] ?? 25}
value={data[label.toLowerCase() as keyof typeof data] ?? 25}
disabled={!onChange}
onChange={(e) => {
if (onChange) onChange(e, label);
if (onChange) onChange(e, label.toLowerCase());
}}
/>
<div className="absolute h-4 w-1.5 rounded bg-orange-400 z-0"></div>

View file

@ -223,7 +223,6 @@ export default function HeadTab({ instructions }: Props) {
instructions.current.personality = updated;
return updated;
});
instructions.current.personality = personality;
}}
/>
</div>

View file

@ -7,7 +7,7 @@ export function minifyInstructions(instructions: Partial<SwitchMiiInstructions>)
for (const key in object) {
const value = object[key as keyof SwitchMiiInstructions];
if (!value || (DEFAULT_ZERO_FIELDS.has(key) && value === 0)) {
if (value === null || value === undefined || (DEFAULT_ZERO_FIELDS.has(key) && value === 0)) {
delete object[key as keyof SwitchMiiInstructions];
continue;
}