RiiConnect24 / RiiTag

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

Minor patches; Rendering -> Redirect Race Solution #40

Closed TheShadowEevee closed 3 years ago

TheShadowEevee commented 3 years ago

This PR contains multiple fixes, listed below. These fixes apply to both of my recent Mii support PRs and fix some issues that were present in RiiTag beforehand as well.

Fixes

  1. Mii Data for Gen1 is now allotted 1000 characters before being determined junk data; See below
  2. Render Races solved; See below
  3. Reddit Silver coin type updated and fixed
  4. Added a warning message when uploading files (Saving changes too quickly would cause the upload to not finish.)
  5. Upgraded Gen1 Rendering API Call to https from http

Render Races - The (hopefully) final solution

For awhile now RiiTag has had a minor issue where the tag wouldn't update fast enough for the page redirect, resulting in the user having to refresh to see the updated tag. This problem became a breaking issue when I implemented CMOC and Gen2 Mii support as they waste a bit more time with web requests, and weren't finishing before the render. Essentially the flow was Redirect -> Render - > Save Mii Data. This of course is completely backwards and caused quite a few issues when editing your Mii, or just editing the tag in general given the redirect happens first. Using promises and a timeout, the order of execution should now be Save Mii Data -> Render -> Redirect.

This solves 2 issues in one, and had minimal impact on the end user (Maybe a few seconds wait on editing, no more than 5).

Mii Data and Upload issues

Gen1 Mii data seems to vary in size, so an artificial limit of 100 characters was enacted, which apparently was too little.

As for uploading issues, uploading a Mii in any format then saving edits would cause an issue where the Mii wouldn't update. Apon inspection it turns out this was simply because the request couldn't finish in time and as a result values would be set wrong and RiiTag would fail the render. The best thing that can be done to solve this was making a message warning users to wait until there was confirmation that the Mii was uploaded.

TheShadowEevee commented 3 years ago

Me writing an essay on a PR that's gonna get like, 10 seconds of viewing time anyway