sync: dev to extern-contrib

Merged
GI
2mo ago
+1871-999

sync-branches: New code has just landed in dev, so let's bring extern-contrib up to speed!

Summary by Sourcery

Synchronize the external-contrib branch with dev by improving captcha recovery and making ended-contest fallback submissions reliable.

New Features:

  • Automatically refresh unreadable captcha images up to five times when auto-solving is enabled.

Bug Fixes:

  • Improve submissions for ended contests by retrying cooldown responses, reporting server errors, and refreshing the captcha after captcha failures.
  • Prevent stale captcha answers from being entered while a replacement image is loading.

Enhancements:

  • Centralize ended-contest fallback submission handling and user-facing submission status reporting.

Build:

  • Bump the userscript and package versions to 3.7.0.

Chores:

  • Update release metadata in Update.json for the synchronized versions.

Summary by cubic

Syncs extern-contrib with dev, bumping XMOJ.user.js and package.json to 3.7.1. Brings the captcha auto-refresh, reliable ended-contest fallback submissions, and compatibility with the new /web/contest/ app.

New Features

  • The /web/contest/ app now gets the same theme, top navbar, problem switcher, and other enhancements as the legacy pages; old contest URLs redirect to the matching /web pages.
  • Adds unit tests and a Playwright-based harness that runs the script against the live site, wired into a Test CI workflow.

Bug Fixes

  • Fallback submissions after a contest ends wait out 请勿重复提交 cooldowns (3 seconds apart, up to 5 attempts) instead of being silently dropped; other failures surface the server's message, and captcha errors refresh the captcha and stop retrying.
  • Pages with missing DOM elements (403/404, multi-subtask test reports) no longer throw TypeErrors; user-info and AC-rate features skip invalid states instead of submitting empty data.
  • Reduces load-time flashing and navbar layout shift, and fixes the empty scores on status.php.