Skip to content

sync: dev to extern-contrib - #1014

Merged
PythonSmall-Q merged 43 commits into
extern-contribfrom
dev
Aug 22, 2026
Merged

sync: dev to extern-contrib#1014
PythonSmall-Q merged 43 commits into
extern-contribfrom
dev

Conversation

@github-actions

@github-actions github-actions Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

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

Summary by Sourcery

Improve submission data transfer and rendering while adding support for efficient numeric inputs.

New Features:

  • Add high-speed numeric input encoding with configurable line-break preservation for generated submission data tools.
  • Support decoding and displaying both legacy and new compressed submission payload formats.

Bug Fixes:

  • Handle submissions without resubmit links, including PID 0 entries, without breaking submission list rendering.
  • Avoid errors when the optional submission data container is absent.

Enhancements:

  • Replace unsafe link markup generation with DOM-based construction and improve generated input-data handling.

Chores:

  • Bump the userscript and package versions to 3.6.3 and update the release feed.

Summary by cubic

Fixes results-table rendering by only showing the “重交” link when it exists and adds a faster, more robust ApplyData pipeline. Old: always injected the resubmit link and encoded payloads via thrown errors; New: safe DOM-built links, gzip+Base93 by default with optional NSC3 number-stream mode and UI controls, payload emitted to stderr with abort-triggered RE, and ApplyData controls render even without the server container. Bumps version to 3.6.3 and updates the feed.

  • Verify PID 0 rows show only the source link and no layout errors.
  • Check ApplyData UI: “获取数据” plus “高速数值模式” and “保留换行” toggles with live descriptions; default uses gzip+Base93, NSC3 can be enabled, and “保留换行” defaults to on.
  • Confirm decoding supports Base93 + gzip and NSC3 (v1/v3), ExtractData parses [payload] lines, and failure states revert to “获取数据失败”.
  • Ensure ApplyData renders when #apply_data is missing (attached near results) and only binds the toggle listener when the element exists.
  • Check version alignment: userscript and package.json at 3.6.3; Update.json includes 3.6.2 and 3.6.3 prerelease entries and notes.

Written for commit 18acd49. Summary will update on new commits.

Review in cubic

@sourcery-ai

sourcery-ai Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Bumps the script/package version to 3.6.2 and hardens the DOM manipulation logic for reset/resubmit links in the submissions table to handle cases where a resubmit link is missing, while also adding an Update.json entry.

File-Level Changes

Change Details Files
Harden DOM manipulation for solution source and resubmit links when ResetType utility is enabled, safely handling missing resubmit links and rebuilding the cell content via created elements instead of innerHTML.
  • Replace direct innerHTML assignment with explicit creation of an anchor element for the solution source link and use replaceChildren to update the source cell.
  • Capture the existing resubmit link node defensively using optional chaining and null-coalescing to allow for cases where it does not exist.
  • Conditionally recreate and append a new resubmit anchor only when a resubmit link is present, ensuring submissions with PID 0 do not break the script.
  • Preserve the subsequent DOM manipulations (removing sibling cells, stripping class attributes, and normalizing size text) after the safer rebuild of the cell.
XMOJ.user.js
Increment project/script version to 3.6.2 and update metadata.
  • Update the UserScript @Version header from 3.6.1 to 3.6.2 to reflect the new release.
  • Bump the package.json version field from 3.6.1 to 3.6.2 to stay in sync with the script version.
  • Add or update an entry in Update.json to record this release (content not shown in diff).
XMOJ.user.js
package.json
Update.json

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 21, 2026

Copy link
Copy Markdown

Deploying xmoj-script-dev-channel with  Cloudflare Pages  Cloudflare Pages

Latest commit: 18acd49
Status: ✅  Deploy successful!
Preview URL: https://5e65362f.xmoj-script-dev-channel.pages.dev

View logs

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

Fixed security issues:

  • Cross-site scripting (XSS) via untrusted HTML/JS injection in web rendering sinks (link)

  • The logic still relies heavily on childNodes[n] indexing, which is brittle to DOM structure changes; consider selecting the needed cells/links via more explicit selectors (e.g., querySelector or children with clear indices) to make the code more robust and self-documenting.

  • When checking for the presence of resubmitLink, using early returns or small helper functions (e.g., createSourceCellWithLinks) could simplify main() and make this block easier to read and reuse.

Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The logic still relies heavily on `childNodes[n]` indexing, which is brittle to DOM structure changes; consider selecting the needed cells/links via more explicit selectors (e.g., `querySelector` or `children` with clear indices) to make the code more robust and self-documenting.
- When checking for the presence of `resubmitLink`, using early returns or small helper functions (e.g., `createSourceCellWithLinks`) could simplify `main()` and make this block easier to read and reuse.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@hendragon-bot hendragon-bot Bot added the user-script This issue or pull request is related to the main user script label Aug 22, 2026
@PythonSmall-Q
PythonSmall-Q merged commit b58504b into extern-contrib Aug 22, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XL 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.

2 participants