Skip to content

修复更新#826

Merged
boomzero merged 10 commits intodevfrom
boomzero/upd
Aug 9, 2025
Merged

修复更新#826
boomzero merged 10 commits intodevfrom
boomzero/upd

Conversation

@boomzero
Copy link
Member

@boomzero boomzero commented Aug 9, 2025

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:

  • Added a new compareVersions function 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.
  • Replaced the previous version comparison in the update check with the new compareVersions function for more reliable update notifications.

Release version update:

  • Updated the version field in package.json from 1.10.0 to 2.0.0 to reflect significant improvements in the update logic.

By submitting this pull request, I confirm the following:

  1. I have read and understood the contributor's guide, as well as this entire template. I understand which branch to base my commits and Pull Requests against.
  2. I have commented on my proposed changes within the code and I have tested my changes.
  3. I am willing to help maintain this change if there are issues with it later.
  4. It is compatible with the GNU General Public License v3.0
  5. I have squashed any insignificant commits. (git rebase)
  6. I have checked that another pull request for this purpose does not exist.
  7. I have considered and confirmed that this submission will be valuable to others.
  8. I accept that this submission may not be used, and the pull request can be closed at the will of the maintainer.
  9. I give this submission freely and claim no ownership to its content.

  • I have read the above and my PR is ready for review. Check this box to confirm

@hendragon-bot hendragon-bot bot added the user-script This issue or pull request is related to the main user script label Aug 9, 2025
@boomzero boomzero changed the title Boomzero/upd 修复更新 Aug 9, 2025
@pull-request-size pull-request-size bot added size/M and removed size/S labels Aug 9, 2025

This comment was marked as outdated.

boomzero and others added 4 commits August 9, 2025 15:16
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Zhu Chenrui <boomzero_zcr@outlook.com>
@boomzero boomzero requested a review from Copilot August 9, 2025 07:19

This comment was marked as outdated.

boomzero and others added 2 commits August 9, 2025 15:20
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Zhu Chenrui <boomzero_zcr@outlook.com>
@boomzero boomzero requested a review from Copilot August 9, 2025 07:21
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 compareVersions function 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

}
}
};

Copy link

Copilot AI Aug 9, 2025

Choose a reason for hiding this comment

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

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.
*/

Copilot uses AI. Check for mistakes.
@boomzero boomzero merged commit eb5b73c into dev Aug 9, 2025
2 checks passed
@boomzero boomzero deleted the boomzero/upd branch August 9, 2025 07:23
@boomzero boomzero linked an issue Aug 9, 2025 that may be closed by this pull request
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M user-script This issue or pull request is related to the main user script

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] 更新炸了

2 participants