Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(admin): better validation for uploaded games #162

Merged
merged 7 commits into from
Jan 24, 2025

Conversation

joshzcold
Copy link
Owner

@joshzcold joshzcold commented Jan 19, 2025

Fixes: #5

take the same new game validator and put it on the admin page to validate uploaded games as well

Improve the json parse error to include the actual error on parse

image

take the same new game validator and put it on the admin page to
validate uploaded games as well

Improve the json parse error to include the actual error on parse
@joshzcold joshzcold requested a review from karlromets January 19, 2025 23:47
@joshzcold joshzcold added the enhancement New feature or request label Jan 19, 2025
@joshzcold
Copy link
Owner Author

Fixes: #5

@joshzcold joshzcold self-assigned this Jan 19, 2025
@karlromets
Copy link
Collaborator

The example image looks bad, is the newline not newlining? 😅

Also could you please provide the faulty .json file for testing ?

@joshzcold
Copy link
Owner Author

joshzcold commented Jan 20, 2025

The example image looks bad, is the newline not newlining? 😅

Also could you please provide the faulty .json file for testing ?

Yeah lol it's not doing a new lines job

Here is an example json file that should trigger about 4 errors
game_0.json

@joshzcold
Copy link
Owner Author

@karlromets pushed a fix. Now looks like
image

Copy link
Collaborator

@karlromets karlromets left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, however due to the error timeout being 5s, the game file error disappears after 5 seconds. This is pretty bad user experience e.g. for slow readers.

Issue comes from this function with a timeout:

function setError(e) {
  setErrorVal(e);
  console.error(e);
  setTimeout(() => {
    setErrorVal("");
  }, 5000);
}

@joshzcold
Copy link
Owner Author

Yeah, Ill go ahead and double it

@joshzcold joshzcold requested a review from karlromets January 24, 2025 05:51
@karlromets karlromets merged commit 8875996 into master Jan 24, 2025
@karlromets karlromets deleted the fix/json_validation_game_upload branch January 24, 2025 06:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

error checking on game submit in /admin
2 participants