RiiConnect24 / RiiTag

RiiTag is a customizable gamertag for the Wii.
https://tag.rc24.xyz/
GNU Affero General Public License v3.0
14 stars 7 forks source link

Support for CMOC Mii Entry Numbers #36

Closed TheShadowEevee closed 3 years ago

TheShadowEevee commented 3 years ago

Implements and closes #20

Main Changes:

This PR adds a field (Now the default over uploading a .mii file) in /edit allowing users to insert an entry number for a mii currently in CMOC. This number is parsed through src/rendermiifromentryno.js changing it into a hex value renderable by the main mii renderer. There are regex functions within this file as well, in order to ensure that the number is valid.

Minor Changes: (Not the main focus, but are still included)

  1. Renames config.example.json → config.json.example, adds connect-datadog to package.json (Closes #35)
  2. Move line 150 of app.js to line 163 (Tag Re-Rendering now happens before redirect; no need to refresh to see changes)

Closing

The previous issue has been fixed and removed from this PR description; and with the RegEx parsing ran on the Entry Number, I believe this new code conforms to the basic validation standards listed in #33. I did change the default Mii type to Entry Number vs. .Mii File Upload, I can revert this if it is decided that .Mii file uploads would be used more than the Entry Number entry.

TheShadowEevee commented 3 years ago

It was recommended to me to use node-fetch vs request; This would require another dependency though, so while I can remake the .Mii Data requesting function with node-fetch instead, I want to avoid doing that without some confirmation that another dependency is fine. node-fetch should be able to create a buffer directly, meaning the work done to translate the requested data to hex for the renderer should be a little less.

I'm OK with either personally.

larsenv commented 3 years ago

Thanks!

It would be really nice if you could add 3DS/WiiU/Miitomo Mii support. I don't care much for the Switch format since there's not many ways to extract it yet, but that would be cool too. I was wanting to do that, but didn't get around to it.

You can look at https://github.com/RiiConnect24/mii2studio to see how we do it, or mess with https://pf2m.com/tools/mii/

TheShadowEevee commented 3 years ago

I'll see what I can do; looking at the code for mii2studio it looks like the way Miis are decoded for 3DS/WiiU/ect. is fundamentally different from a CMOC number and wouldn't fulfill #20's request so I'll start work on this in a new branch. Given the branch naming scheme in my fork, progress on this will be committed to the branch testing-36 to correspond to this PR.

If this PR is still open if/when I complete this I'll merge it into the master branch of my fork for this PR, otherwise I can open a new PR if this one has been closed or merged.

bennyman123abc commented 3 years ago

Can it be proven this doesn't introduce any new bugs?

If so, or you've tested it and say it's fine, then I'll pull this request through. Thank you for your work on this project!

TheShadowEevee commented 3 years ago

Shoot, I forgot to comment here after I found this...

There is a bug with guest Mii selection I discovered while working on Gen2 Mii support. I'll commit the fix I made now. I changed the menu design a bit on the testing-36 branch which will be part of the commit as I fix this, which changes how guest Mii's are selected. I've attached an image of what it looks like now.

I've tested everything thoroughly both on the site and with manual post requests and will test site functionality again before committing the fixes. It will take me a bit to apply the fix as I have to separate it from the unfinished Gen2 Mii work, but it shouldn't take more than an hour.

Updated Guest Dropdown Image

Sorry about this

TheShadowEevee commented 3 years ago

Alright, I did some quick testing to ensure the bug was fixed and no new bugs were introduced in 43882f8. Most of the focus was on other parts of the code as the new code was already tested in the testing branch but I did make sure that the new code worked after being plugged into master. Other than that bug I just committed the fix for nothing else has come up in my local testing before or after this commit.

This PR should be bug-free and ready to go.