mirror of
https://github.com/trafficlunar/tomodachi-share.git
synced 2026-06-28 14:44:15 +00:00
feat: tomodachi life data decrypting and fix hair color rendering
This commit is contained in:
parent
fae79e67af
commit
5de6e924f2
4 changed files with 107 additions and 1 deletions
|
|
@ -11,6 +11,7 @@ import { MII_DECRYPTION_KEY } from "@/lib/constants";
|
|||
import { nameSchema, tagsSchema } from "@/lib/schemas";
|
||||
|
||||
import Mii from "@/utils/mii.js/mii";
|
||||
import TomodachiLifeMii from "@/utils/tomodachi-life-mii";
|
||||
|
||||
const uploadsDirectory = path.join(process.cwd(), "public", "uploads");
|
||||
|
||||
|
|
@ -61,6 +62,13 @@ export async function POST(request: Request) {
|
|||
// Convert to Mii class
|
||||
const buffer = Buffer.from(result);
|
||||
const mii = new Mii(buffer);
|
||||
const tomodachiLifeMii = TomodachiLifeMii.fromBytes(qrBytes);
|
||||
|
||||
if (tomodachiLifeMii.hairDyeEnabled) {
|
||||
mii.hairColor = tomodachiLifeMii.studioHairColor;
|
||||
mii.eyebrowColor = tomodachiLifeMii.studioHairColor;
|
||||
mii.facialHairColor = tomodachiLifeMii.studioHairColor;
|
||||
}
|
||||
|
||||
// Create Mii in database
|
||||
const miiRecord = await prisma.mii.create({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue