• @guqing guqing pushed to refactor/3230 in guqing/halo

    Below is the list of commits:

    • refactor: initialization interface (f7d50c0)
    0 0
  • @guqing guqing pushed to refactor/3230 in guqing/halo

    Below is the list of commits:

    • Upgrade to SpringDoc 2.2.0 for OpenAPI 3.1 support (#4384) (20df302)
    • fix: resolve the issue of ineffective duplicate key validation in AnnotationsForm (#4369) (3ec4091)
    • Move Backup extension into api module (#4392) (b9b663e)
    • Merge branch 'main' into refactor/3230 (97c5e7b)
    0 0
  • @guqing guqing pushed to refactor/3230 in guqing/halo

    Below is the list of commits:

    • refactor: initialization state (f1778c2)
    0 0
  • @guqing guqing commented on issue #4306 in halo-dev/halo

    image image
    初始化接口调用之后,/actuator/globalinfo 接口的 initialized 字段没有更新,并且可以继续调用初始化的接口。重启之后也没有更新状态。

    Done

    0 0
  • @guqing guqing pushed to refactor/3230 in guqing/halo

    Below is the list of commits:

    • fix: update with initialize state (1d5c956)
    0 0
  • @guqing guqing opened issue #4386 in halo-dev/halo

    Your current Halo version

    2.8.0

    Describe this feature

    背景

    目前插件的资源管理的做法是:通过在插件启动前扫描插件 resources/extensions 目录下的 YAMl 文件,将其解析为 Unstructured 对象并在插件启动前将其创建到 Halo 中,然后在停止插件前将其删除。
    但有些资源比如 Setting 需要在插件安装时就创建好,一直生存到插件卸载时才删除,插件更新和卸载时没有有效的办法管理这些资源,只能通过代码处理,这样会导致插件的代码变得复杂,而且也不符合插件的设计初衷,当有新类型的资源出现时可能无法正确的完成资源生命周期的处理需要变更代码。

    目标

    设计一种插件资源管理的方案,使得 Halo 可以在安装、更新和卸载插件时更好的管理插件 extensions 资源。

    • 支持在插件安装时自动扫描并管理插件 extensions 资源。
    • 在插件启动时能精准获取到插件 extensions 资源,避免重复的文件遍历匹配以解决每次插件启动都需要遍历 YAML 文件并读取为 Unstructured 才能找到某种资源类型的问题。
    • 支持在插件更新时自动更新插件 extensions 资源。
    • 支持灵活的管理插件 extensions 资源的生命周期,如 Setting 需要在插件卸载时删除,ReverseProxy 需要在插件停止时删除等。
    • 支持在插件状态变更时,由 Operator 统一维护插件资源的状态,如插件启动时创建资源,插件停止时删除资源,插件更新时更新资源等。

    方案

    提供一个新的自定义模型用来记录插件对应的 extensions 资源文件:

    apiVersion: plugin.halo.run/v1alpha1
    kind: PluginResource
    metadata:
      name: myplugin-resources
    spec:
      name: My Plugin
      version: 1.0.0
      resources:
        - name: mysetting
          kind: Setting
          apiVersion: v1alpha1
          file: settings.yaml
          lifecycle:
            create: OnInstall
            delete: OnUninstall
        - name: myrole
          kind: Role
          apiVersion: v1alpha1
          file: roletemplates.yaml
          lifecycle:
            create: OnStart
            delete: OnStop
        - name: myproxy
          kind: ReverseProxy
          apiVersion: plugin.halo.run/v1alpha1
          file: services/reverseproxy.yaml
          lifecycle:
            create: OnStart
            delete: OnStop

    过程如下:

    • 当插件安装时,Operator 检测到插件安装事件,自动扫描插件 resources/extensions 目录并创建 PluginResource 资源对象。
    • 当插件启动时,Operator 检测到插件启动事件,通过获取插件对应的 PluginResource 资源对象,得到 resources 属性,匹配 lifecycle.create 符合 OnStart 的资源,将其创建到 Halo 中。
    • 当插件停止时,Operator 检测到插件停止事件,通过获取插件对应的 PluginResource 资源对象,得到 resources 属性,匹配 lifecycle.delete 符合 OnStop 的资源,将其删除。
    • 当插件更新时,Opeartor 检测到插件更新事件,重新扫描插件 resources/extensions 目录并更新 PluginResource 资源对象,同时读取资源文件将 lifecycle.create 符合 OnStart 且插件为启动状态的资源和lifecycle.create 符合 OnInstall 的资源更新到 Halo 中,并将不存在的资源删除。
    • 当插件卸载时,Operator 检测到插件卸载事件,通过获取插件对应的 PluginResource 资源对象,得到 resources 属性,匹配 lifecycle.delete 符合 OnUninstall 的资源,将其删除。

    Additional information

    /kind improvement
    /area core
    /milestone 2.9.x

    0 0
  • @guqing guqing opened pull request #4385 in halo-dev/halo

    What type of PR is this?

    /kind bug
    /area core
    /milestone 2.9.x

    What this PR does / why we need it:

    修复评论启用状态的主题模板变量名作用域不正确的问题

    评论组件标签处理器只会在处理到 <halo:comment/> 自定义标签时被执行,而 haloCommentEnabled 状态是评论标签之前使用的那么此时值还没有被评论标签处理器填充所以取不到正确的值,目前的做法是在模板开始解析时填充 haloCommentEnabled 变量到 context,但这样存在的问题时无法判断页面是否使用了评论自定义标签即每个页面都会有这个变量,不过目前没有更好的办法去解决这样的问题。

    Which issue(s) this PR fixes:

    Fixes #4378

    Does this PR introduce a user-facing change?

    修复评论启用状态的主题模板变量名作用域不正确的问题
    
    0 0
  • @guqing guqing created branch refactor/4378 in guqing/halo

    guqing/halo

    一款优秀的开源博客发布应用。

    0 0
  • @guqing guqing created a review on pull request #4384 in halo-dev/halo

    /approve

    0 0
  • @guqing guqing pushed to refactor/3230 in guqing/halo

    Below is the list of commits:

    • refactor: improve the system initialization process (0b01ecc)
    0 0