Merged
Conversation
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Zhu Chenrui <boomzero_zcr@outlook.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Zhu Chenrui <boomzero_zcr@outlook.com>
Contributor
There was a problem hiding this comment.
Pull Request Overview
This pull request improves the version comparison logic for update notifications and bumps the package version to 2.0.0. The changes replace simple string comparison with proper semantic version comparison to ensure accurate update detection.
- Implemented a new
compareVersionsfunction for reliable semantic version comparison - Updated package version from 1.10.0 to 2.0.0 across all relevant files
- Modified admin user list and removed special badge handling for a specific user
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| package.json | Version bump to 2.0.0 |
| XMOJ.user.js | Added compareVersions function, updated version, modified admin list and badge logic |
| Update.json | Added release entry for version 2.0.0 |
| } | ||
| } | ||
| }; | ||
|
|
There was a problem hiding this comment.
The compareVersions function lacks documentation. Consider adding a JSDoc comment explaining the parameters, return value, and behavior when comparing semantic versions.
Suggested change
| /** | |
| * Compares two semantic version strings to determine if an update is needed. | |
| * | |
| * @param {string} currVer - The current version string (e.g., "1.2.3"). | |
| * @param {string} remoteVer - The remote version string to compare against (e.g., "1.2.4"). | |
| * @returns {boolean} Returns true if the remote version is greater than the current version (update needed), false otherwise. | |
| * | |
| * The function compares each segment of the version strings numerically from left to right. | |
| * If the remote version segment is greater than the current, it returns true. | |
| * If the current version segment is greater, it returns false. | |
| * If all segments are equal, it returns false. | |
| * Missing segments are treated as 0. | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR aim to accomplish?:
This pull request updates the version comparison logic in the update notification feature and bumps the package version to 2.0.0. The most important changes are:
Update logic improvements:
compareVersionsfunction to accurately compare semantic version strings instead of using a simple less-than check. This ensures updates are only prompted when a newer version is available.compareVersionsfunction for more reliable update notifications.Release version update:
versionfield inpackage.jsonfrom1.10.0to2.0.0to reflect significant improvements in the update logic.By submitting this pull request, I confirm the following:
git rebase)