feat: 通过 URI 安装插件和导航到特定插件页面的能力#1701
Conversation
There was a problem hiding this comment.
💡 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; |
There was a problem hiding this comment.
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 👍 / 👎.
| while (DownloadTasks.ContainsKey(pluginId)) | ||
| { | ||
| if (DownloadTasks.TryGetValue(pluginId, out var progress)) |
There was a problem hiding this comment.
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 👍 / 👎.
336a013 to
6149128
Compare
6149128 to
be58dfe
Compare
|
@kaokao221 请合并上游更改。 |
HelloWRC
left a comment
There was a problem hiding this comment.
请在后续提交前至少在本地测试一遍。
请注意,如果您继续使用 AI 生成没有审核过的代码并提交 PR,我们可能会临时或永久限制您向本仓库发起 PR 的能力。
| } | ||
| } | ||
|
|
||
| private class InstallPluginDialogContext |
There was a problem hiding this comment.
请将此类移动到单独的文件中,并放置在命名空间 ClassIsland.Views 下。
| 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/" } | ||
| } | ||
| } | ||
| ]; |
There was a problem hiding this comment.
这里的更改纯属 AI 幻觉,会导致编译错误,并且此处的更改对此 PR 没有太大的作用。如无必要,请回滚此更改。
这个 Pull Request 做了什么?
feat: 通过
classisland://app/plugin/install?id={pluginId}直接安装特定插件的能力。feat: 通过
classisland://app/settings/classisland.plugins?pluginId={pluginId}打开特定插件的插件详情页的能力。此外,插件市场的网页预览现已在以下自动部署可用:
感谢支持!
相关 Issue
Fixes #682
检查清单