Skip to content

feat: 支持链接拖拽识别并处理 - #7300

Open
zkitefly wants to merge 6 commits into
HMCL-dev:mainfrom
zkitefly:url
Open

zkitefly wants to merge 6 commits into
HMCL-dev:mainfrom
zkitefly:url

Conversation

@zkitefly

Copy link
Copy Markdown
Member

添加了链接识别与处理功能,支持 Modrinth、mcmod 资源链接及可下载文件链接,可直接从链接安装模组、整合包或 version json

Close #7243

_20261115_040625.webm

添加了链接识别与处理功能,支持 Modrinth、mcmod 资源链接及可下载文件链接,可直接从链接安装模组、整合包或游戏实例
@github-actions github-actions Bot added the 500+ label Nov 14, 2026
zkitefly and others added 3 commits November 15, 2026 14:06
Co-authored-by: 辞庐 <109708109+CiiLu@users.noreply.github.com>
Co-authored-by: 辞庐 <109708109+CiiLu@users.noreply.github.com>
Co-authored-by: 辞庐 <109708109+CiiLu@users.noreply.github.com>
@zkitefly

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-15T06:14:14.742522Z 56a13b9 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 56a13b976b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

/// @param target the encoded payload
/// @return the decoded address, or `null` when the payload cannot be decoded
private static @Nullable String decodeMcmodTarget(String target) {
String value = NetworkUtils.decodeURL(target);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve literal plus signs in mcmod redirect payloads

For a valid standard-Base64 mcmod target whose path contains an unescaped +, URLDecoder converts the plus to a space before either Base64 decoder sees it, so the target is rejected. Path segments are not form-encoded; percent-decode the payload without converting literal plus signs.

Useful? React with 👍 / 👎.

return new ProbeResult(url, fileName, false, true, false);

boolean zip = "zip".equals(extension) || mime.contains("zip");
boolean mod = zip || "jar".equals(extension) || "litemod".equals(extension) || mime.contains("java-archive");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Normalize MIME-classified archives to a supported mod extension

When a valid archive has a Content-Type containing zip or java-archive but a non-mod suffix such as .bin, this advertises Install as Mod. installMod preserves that suffix, and ModManager.addMod rejects it by extension; the completion callback catches only IOException, so choosing the advertised action does not install the file.

Useful? React with 👍 / 👎.

Controllers.taskDialog(task.whenComplete(Schedulers.javafx(), (@Nullable Exception exception) -> {
if (exception == null) {
Controllers.getDecorator().startWizard(
new ModpackInstallWizardProvider(repository, temporaryFile),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Delete downloaded modpack files after wizard use

When a detected .zip or .mrpack download succeeds, this hands the system-temporary file to the wizard, but only the failed-download branch deletes it. The wizard leaves its selected source file intact, so completing or canceling repeated link installs leaves each full archive in the OS temporary directory and can consume substantial disk space.

Useful? React with 👍 / 👎.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] 支持拖拽或输入链接识别

2 participants