Skip to content

feat: 通过 URI 安装插件和导航到特定插件页面的能力#1701

Open
kaokao221 wants to merge 5 commits intoClassIsland:masterfrom
kaokao221:uri-implemention
Open

feat: 通过 URI 安装插件和导航到特定插件页面的能力#1701
kaokao221 wants to merge 5 commits intoClassIsland:masterfrom
kaokao221:uri-implemention

Conversation

@kaokao221
Copy link
Copy Markdown
Contributor

@kaokao221 kaokao221 commented Mar 13, 2026

这个 Pull Request 做了什么?

feat: 通过 classisland://app/plugin/install?id={pluginId} 直接安装特定插件的能力。

feat: 通过 classisland://app/settings/classisland.plugins?pluginId={pluginId} 打开特定插件的插件详情页的能力。

此外,插件市场的网页预览现已在以下自动部署可用:

  • Cloudflare Pages: ccipx.minisvc.com
  • Vercel: vcipx.minisvc.com
  • Github Pages: gcipx.minisvc.com
  • EdgeOne Pages (Glocal no MLC): ecipx.minisvc.com

感谢支持!

相关 Issue

Fixes #682

检查清单

  • 我已经在本地测试过这个 PR,确保欲实现的功能或修复的问题能正常工作。

Copy link
Copy Markdown

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

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: b8268d1909

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".


await Avalonia.Threading.Dispatcher.UIThread.InvokeAsync(() =>
{
downloadComplete = true;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Prevent failed installs from being reported as success

This completion branch unconditionally sets the dialog to "插件已安装" once the task disappears from DownloadTasks, but RequestDownloadPlugin removes that entry in both success and failure paths. When the download fails (for example, network or checksum errors), users will still see a success message and be prompted to restart even though nothing was installed. The success UI should only be shown when the associated DownloadProgress finished without an exception.

Useful? React with 👍 / 👎.

Comment on lines +280 to +282
while (DownloadTasks.ContainsKey(pluginId))
{
if (DownloadTasks.TryGetValue(pluginId, out var progress))
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 Stop polling DownloadTasks off the UI thread

This polling loop reads DownloadTasks from a Task.Run worker thread while RequestDownloadPlugin mutates the same collection on the UI thread. DownloadTasks is an ObservableDictionary backed by a normal Dictionary with no synchronization, so concurrent ContainsKey/TryGetValue with add/remove can intermittently fail at runtime. Keep access on the UI thread or protect it with synchronization to avoid cross-thread collection races during installs.

Useful? React with 👍 / 👎.

@kaokao221 kaokao221 requested review from a team and HelloWRC as code owners March 13, 2026 12:41
@HelloWRC
Copy link
Copy Markdown
Member

@kaokao221 请合并上游更改。

Copy link
Copy Markdown
Member

@HelloWRC HelloWRC left a comment

Choose a reason for hiding this comment

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

请在后续提交前至少在本地测试一遍。

请注意,如果您继续使用 AI 生成没有审核过的代码并提交 PR,我们可能会临时或永久限制您向本仓库发起 PR 的能力。

}
}

private class InstallPluginDialogContext
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

请将此类移动到单独的文件中,并放置在命名空间 ClassIsland.Views 下。

Comment on lines +33 to +49
private static readonly string DefaultPluginIndexKey = "official";

private static readonly List<PluginIndexInfo> FallbackMirrors =
[
new PluginIndexInfo()
{
Id = DefaultPluginIndexKey,
Url = "https://get.classisland.tech/d/ClassIsland-Ningbo-S3/classisland/plugin/index.zip?time={time}",
Name = "官方源",
Description = "官方提供的插件源。",
Mirrors = new Dictionary<string, string>()
{
{ "github", "https://raw.githubusercontent.com/ClassIsland/ClassIsland-Plugins/master/" },
{ "coding", "https://classisland.coding.net/p/classisland/d/ClassIsland-Plugins/git/raw/master/" }
}
}
];
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

这里的更改纯属 AI 幻觉,会导致编译错误,并且此处的更改对此 PR 没有太大的作用。如无必要,请回滚此更改。

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

通过uri直接导航到某一具体插件的详细

2 participants