Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 支持远程插件 #180

Merged
merged 5 commits into from
Sep 18, 2024
Merged

feat: 支持远程插件 #180

merged 5 commits into from
Sep 18, 2024

Conversation

devhaozi
Copy link
Collaborator

@devhaozi devhaozi commented Sep 18, 2024

Summary by CodeRabbit

版本更新说明

  • 新功能

    • 引入了应用管理功能,包括安装、卸载、更新和列出应用程序。
    • 新增了缓存机制,提高数据检索和存储效率。
    • 支持通过新的 /app 路由管理应用程序。
  • 改进

    • 将插件管理重构为应用管理,简化了注册和路由处理。
    • 增强了国际化和本地化支持,特别是针对中国用户的日期和时间处理。
  • 修复

    • 改善了设置的错误处理逻辑,确保无记录时不会抛出错误。

Copy link

coderabbitai bot commented Sep 18, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

此次更改涉及将系统的插件管理架构转变为应用程序管理架构。主要的修改包括将多个文件中的 Plugin 类型重命名为 App,并更新相关的注册、存储和路由逻辑。新的缓存机制和数据库迁移逻辑也被引入,以支持新的应用程序管理功能。此外,HTTP 路由和服务逻辑也进行了相应的调整,以反映这一变化。

Changes

文件路径 更改摘要
internal/apps/fail2ban/init.go, internal/apps/openresty/init.go Plugin 类型注册更改为 App 类型,并简化了注册属性,新增路由功能。
internal/biz/app.go PluginPluginRepo 重命名为 AppAppRepo,更新了方法签名和返回类型。
internal/biz/cache.go 新增缓存机制,定义 Cache 结构和 CacheRepo 接口。
internal/bootstrap/conf.go 引入 carbon 库进行日期和时间管理,设置默认配置。
internal/data/app.go 定义 appRepo 结构,提供应用程序管理功能,包括安装、卸载和更新应用程序的方法。
internal/data/cache.go 实现缓存存储功能,定义 cacheRepo 结构及其方法。
internal/data/plugin.go 删除 pluginRepo 结构及其相关方法。
internal/data/setting.go 增强设置的错误处理逻辑,改进 GetSet 方法。
internal/migration/v1.go 修改数据库迁移逻辑,将 Plugin 实体替换为 App 实体,新增缓存结构的迁移。
internal/route/http.go 移除与插件相关的路由,添加与应用程序相关的新路由,修改404错误处理逻辑。
internal/service/app.go PluginService 重命名为 AppService,更新服务方法以处理应用程序。
internal/service/info.go pluginRepo 替换为 appRepo,更新多个方法以使用新的应用程序管理逻辑。
pkg/api/api.go 修改 NewAPI 函数,新增 panelVersion 参数并更新相关逻辑。
pkg/api/api_test.go 更新 API 测试,新增测试用例并调整 API 实例化逻辑。
pkg/api/app.go 修改 App 结构,新增字段并更新方法以支持应用程序的版本管理和安装流程。
pkg/api/rewrite.go 新增 Rewrite 结构和 RewritesByType 方法以管理重写规则。
pkg/api/version.go 重命名函数以增强清晰度,并更新 API 交互逻辑。
pkg/apploader/apploader.go 更新注册、获取和列出功能以支持新的 App 类型,移除插件相关的逻辑。
pkg/str/string.go 修改 FirstElement 函数以支持泛型并返回指针类型。
pkg/types/app.go 新增 App 结构以表示应用程序的元数据,包含路由功能。
pkg/types/plugin.go 删除 Plugin 结构,移除插件相关的元数据管理功能。

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant AppService
    participant AppRepo
    participant CacheRepo

    User->>AppService: 请求应用程序列表
    AppService->>CacheRepo: 获取缓存的应用程序
    CacheRepo-->>AppService: 返回应用程序列表
    AppService-->>User: 返回应用程序列表

    User->>AppService: 安装应用程序
    AppService->>AppRepo: 检查应用程序是否已安装
    AppRepo-->>AppService: 返回安装状态
    AppService->>AppRepo: 执行安装逻辑
    AppRepo-->>AppService: 返回安装结果
    AppService-->>User: 返回安装结果
Loading

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    -- I pushed a fix in commit <commit_id>, please review it.
    -- Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    -- @coderabbitai generate unit testing code for this file.
    -- @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    -- @coderabbitai generate interesting stats about this repository and render them as a table.
    -- @coderabbitai read src/utils.ts and generate unit testing code.
    -- @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    -- @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Tip

Early access features: enabled

We are currently testing the following features in early access:

  • OpenAI o1 for code reviews: OpenAI's new o1 model is being tested for code reviews. This model has advanced reasoning capabilities and can provide more nuanced feedback on your code.

Note:

  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.

@devhaozi devhaozi merged commit dded5e2 into main Sep 18, 2024
9 checks passed
@devhaozi devhaozi deleted the app branch September 18, 2024 17:17
devhaozi added a commit that referenced this pull request Oct 28, 2024
* feat: api基本完成

* feat: 阶段性提交

* feat: 初步支持远程插件

* feat: 支持远程插件

* fix: tests
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.

1 participant