Commit Graph

4419 Commits (58679b28117b1d6271dbb8ab995d24061d4ae5ec)

Author SHA1 Message Date
Ryan Wang 97f0d99538 feat: add support for displaying and installing uninstalled themes (halo-dev/console#648)
#### What type of PR is this?

/kind feature
/milestone 2.0

#### What this PR does / why we need it:

支持显示和安装**未安装**的主题,以方便主题开发的时候,创建主题资源。适配 https://github.com/halo-dev/halo/pull/2586

#### Which issue(s) this PR fixes:

Fixes https://github.com/halo-dev/halo/issues/2554

#### Screenshots:

<img width="1663" alt="image" src="https://user-images.githubusercontent.com/21301288/196148567-f43b1bf3-e745-4c1a-950d-65899c1ae73c.png">

#### Special notes for your reviewer:

/cc @halo-dev/sig-halo-console 

测试方式:

1. 需要 `pnpm install`
2. Halo 需要切换到 https://github.com/halo-dev/halo/pull/2586 PR 的分支。
3. 在本地的 `~/halo-dev/themes` 创建新的主题,需要包含 `themes.yaml`,或者将现有的主题直接下载到 `~/halo-dev/themes`
4. 检查后台主题管理的主题列表中是否显示了未安装的主题,以及测试是否可以安装成功。

#### Does this PR introduce a user-facing change?

```release-note
支持显示和安装未安装的主题,以方便主题开发的时候,创建主题资源。
```
2022-10-18 10:12:11 +00:00
John Niang 638ceac5a3
Bump version of SpringDoc to 2.0.0-M7 (#2593)
#### What type of PR is this?

/kind improvement
/area core
/milestone 2.0

#### What this PR does / why we need it:

See https://github.com/springdoc/springdoc-openapi/releases/tag/v2.0.0-M7 for more.

![image](https://user-images.githubusercontent.com/16865714/196356805-ce028139-4e5f-48d7-ba63-d29cefb17683.png)


#### Does this PR introduce a user-facing change?

```release-note
None
```
2022-10-18 10:12:11 +00:00
guqing 9d67ce60cc
refactor: theme list data conversion (#2592)
#### What type of PR is this?
/kind bug
/area core
/milestone 2.0

#### What this PR does / why we need it:
修复主题列表数据类型转换问题
#### Which issue(s) this PR fixes:

Fixes #

#### Special notes for your reviewer:
how to test it?
访问如下 API 不报错即可
```
curl http://localhost:8090/apis/api.console.halo.run/v1alpha1/themes?uninstalled=false
```

/cc @halo-dev/sig-halo 
#### Does this PR introduce a user-facing change?

```release-note
None
```
2022-10-18 06:34:09 +00:00
John Niang 299634b756
Enable generating metadata name using generateName (#2563)
#### What type of PR is this?

/kind feature
/area core
/milestone 2.0

#### What this PR does / why we need it:

See https://github.com/halo-dev/halo/issues/2309 for more.

#### Which issue(s) this PR fixes:

Fixes https://github.com/halo-dev/halo/issues/2309

#### Special notes for your reviewer:

#### Does this PR introduce a user-facing change?

```release-note
新增 generateName 字段用于自动生成自定义模型名称
```
2022-10-18 06:24:10 +00:00
guqing 58e98f0fc8
feat: add an API to list uninstalled themes (#2586)
#### What type of PR is this?
/kind feature
/milestone 2.0
/area core
/kind api-change

#### What this PR does / why we need it:
新增 API 用于查询未安装的主题

#### Which issue(s) this PR fixes:

Fixes #2554

#### Special notes for your reviewer:
how to test it?
1. 安装几个主题
2. 直接解压几个主题到 work dir 的 themes 目录
3. 使用以下 endpoint 查询未安装的主题,期望获得所有未安装主题的 themes.yaml 信息
```
/apis/api.console.halo.run/v1alpha1/themes?uninstalled=true
```

/cc @halo-dev/sig-halo 
#### Does this PR introduce a user-facing change?

```release-note
支持扫描主题目录下未安装的主题
```
2022-10-18 04:30:09 +00:00
guqing 3d79484591
feat: head tag supports extension for template (#2574)
#### What type of PR is this?
/kind feature
/milestone 2.0
/area core

#### What this PR does / why we need it:
允许插件通过实现 TemplateHeadProcessor 接口来修改主题模板的 head 标签

#### Which issue(s) this PR fixes:
how to test it?
1. 克隆 https://github.com/halo-sigs/plugin-umami
2. build 一个 jar 包作为插件使用
3. 配置 plugin-umami 后能在主题页的 head 标签看到一个用于 umami 统计的 script 标签

Fixes #

#### Special notes for your reviewer:
/cc @halo-dev/sig-halo 
#### Does this PR introduce a user-facing change?

```release-note
None
```
2022-10-18 04:18:09 +00:00
guqing 3973768a7a
refactor: get default menu (#2587)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.0

#### What this PR does / why we need it:
优化主题端菜单项查询

#### Which issue(s) this PR fixes:

Fixes #2564

#### Special notes for your reviewer:
how to test it?
使用 menuFinder.getDefault() 方法测试多级菜单项的排序及新增

/cc @halo-dev/sig-halo 
#### Does this PR introduce a user-facing change?

```release-note
修复主题端菜单查询数据错误问题
```
2022-10-18 04:14:13 +00:00
Ryan Wang a0512e43bc feat: add some formkit custom input for the system core extensions (halo-dev/console#643)
#### What type of PR is this?

/kind feature
/milestone 2.0

#### What this PR does / why we need it:

Ref https://github.com/halo-dev/halo/issues/2526#issuecomment-1273094868

FormKit 文档:https://formkit.com/advanced/custom-inputs

通过扩展 FormKit 的自定义 Input,提供系统常用资源的选择组件。

目前提供如下类型:

- menuCheckbox
- menuRadio
- menuItemSelect
- postSelect
- categorySelect
- tagSelect
- singlePageSelect
- categoryCheckbox
- tagCheckbox

FormKit 组件的使用方式:

```vue
<FormKit
        placeholder="请选择文章"
        label="文章"
        type="postSelect"
        validation="required"
/>
```

FormKit Schema 的使用方式:

```yaml
- $formkit: menuRadio
    name: menus
    label: 底部菜单组
```

#### Which issue(s) this PR fixes:

Fixes https://github.com/halo-dev/halo/issues/2526

#### Screenshots:

<!--
如果此 PR 有 UI 的改动,最好截图说明这个 PR 的改动。
If there are UI changes to this PR, it is best to take a screenshot to illustrate the changes to this PR.
eg.
Before:
![screenshot-before](https://user-images.githubusercontent.com/screenshot.png)
After:
![screenshot-after](https://user-images.githubusercontent.com/screenshot.png)
-->

#### Special notes for your reviewer:

/cc @halo-dev/sig-halo-console 

测试方式:

1. 检查后台文章设置弹框的选择分类和标签功能是否正常。
2. 检查后台添加菜单项的功能是否正常。
3. 使用主题或者插件定义 settings.yaml,使用上述任意 input 类型,检查得到的效果和值是否正常。

#### Does this PR introduce a user-facing change?

```release-note
通过扩展 FormKit 的自定义 Input,提供系统常用资源的选择组件。
```
2022-10-18 03:32:09 +00:00
Ryan Wang aa2aa26981 feat: add operation exception toasts for loading plugin resources and login (halo-dev/console#645)
#### What type of PR is this?

/kind feature
/milestone 2.0

#### What this PR does / why we need it:

为登录操作和加载插件资源添加异常提示。

#### Which issue(s) this PR fixes:

Fixes https://github.com/halo-dev/halo/issues/2534

#### Screenshots:

<img width="650" alt="image" src="https://user-images.githubusercontent.com/21301288/196105634-ece58153-d9e0-450d-8068-8cda1bed8bcc.png">

<img width="634" alt="image" src="https://user-images.githubusercontent.com/21301288/196105704-e3a59808-8a33-456d-b668-13e891512353.png">

#### Special notes for your reviewer:

目前还没有处理全局的接口请求异常,需要后端修改异常返回结构。

/cc @halo-dev/sig-halo-console 

#### Does this PR introduce a user-facing change?

<!--
如果当前 Pull Request 的修改不会造成用户侧的任何变更,在 `release-note` 代码块儿中填写 `NONE`。
否则请填写用户侧能够理解的 Release Note。如果当前 Pull Request 包含破坏性更新(Break Change),
Release Note 需要以 `action required` 开头。
If no, just write "NONE" in the release-note block below.
If yes, a release note is required:
Enter your extended release note in the block below. If the PR requires additional action from users switching to the new release, include the string "action required".
-->

```release-note
为登录操作和加载插件资源添加异常提示。
```
2022-10-18 03:30:10 +00:00
guqing a3448adee2
feat: add favicon head processor (#2582)
#### What type of PR is this?
/kind feature
/area core
/milestone 2.0

#### What this PR does / why we need it:
模板渲染自动填充 Favicon 到 head 标签
#### Which issue(s) this PR fixes:

Fixes #2581

#### Special notes for your reviewer:
how to test it?
在 console 系统设置 -> 基础设置 填写 Favicon 后,到主题端能到看它

/cc @halo-dev/sig-halo 
#### Does this PR introduce a user-facing change?

```release-note
支持设置 Favicon
```
2022-10-18 02:22:09 +00:00
Ryan Wang 4ec5c506af refactor: api of dialog component (halo-dev/console#646)
#### What type of PR is this?

/kind api-change
/kind improvement
/milestone 2.0

#### What this PR does / why we need it:

重构 Dialog 组件使用 API 的调用方式,改为与 Toast 组件一致。https://github.com/halo-dev/console/pull/644

同样的,使用此方式调用 Dialog 组件不限制在 Vue 组件。

#### Special notes for your reviewer:

/cc @halo-dev/sig-halo-console 

需要测试后台各个操作的会话框是否正常。

#### Does this PR introduce a user-facing change?

```release-note
重构 Dialog 组件使用 API 的调用方式。
```
2022-10-18 01:58:09 +00:00
Ryan Wang 8648705ab6 perf: refine the fallback of the avatar component (halo-dev/console#649)
#### What type of PR is this?

/kind improvement
/milestone 2.0

#### What this PR does / why we need it:

优化 Avatar 组件在图片加载失败的状态,以及添加加载状态的动画。目前的策略为,如果图片加载异常,那么会取 `alt` 属性生成占位样式。如果没有设置 `alt`,会显示失败的图标。

#### Screenshots:

<img width="421" alt="image" src="https://user-images.githubusercontent.com/21301288/196194978-229cf58d-19e1-4492-b77a-8b1a6b41e3a0.png">

#### Special notes for your reviewer:

/cc @halo-dev/sig-halo-console 

测试方式:

1. 需要 `pnpm build:packages`
2. 测试修改个人资料的头像,观测不同效果。
3. 访问 https://halo-admin-ui-git-fork-ruibaby-perf-avatar-fallback-halo-dev.vercel.app/story/src-components-avatar-avatar-story-vue?variantId=_default 测试不同参数的效果。

#### Does this PR introduce a user-facing change?

```release-note
优化 Avatar 组件在图片加载失败的状态
```
2022-10-17 16:45:38 +00:00
Ryan Wang 64ad054baa chore: bump @halo-dev/api-client for attachment custom endpoint (halo-dev/console#647)
#### What type of PR is this?

/kind improvement
/milestone 2.0

#### What this PR does / why we need it:

升级 `@halo-dev/api-client` 版本以适配 Attachment 资源的自定义 Endpoint。

#### Special notes for your reviewer:

/cc @halo-dev/sig-halo-console 

测试方式:

1. 需要 `pnpm install`。
2. 测试附件列表和上传的功能。

#### Does this PR introduce a user-facing change?

```release-note
None
```
2022-10-17 14:53:39 +00:00
John Niang 2527eb42e2
Disable CSRF token check for RESTful APIs (#2580)
#### What type of PR is this?

/kind bug
/area core
/milestone 2.0
/kind api-change

#### What this PR does / why we need it:

1. Disable CSRF token check for RESTful APIs but login and logout APIs.
2. Enable CORS check for login and logout APIs

#### Which issue(s) this PR fixes:

Fixes https://github.com/halo-dev/halo/issues/2571

#### How to test?

1. Install a valid theme and create a sample post
2. View the post at theme end
3. Check the response of counter API

#### Does this PR introduce a user-facing change?

```release-note
禁用对 RESTful API 的 CSRF 检查
```
2022-10-17 08:03:38 +00:00
guqing 2505c7fe4a
refactor: register method for reverse proxy registry (#2567)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.0

#### What this PR does / why we need it:
对反向代理规则注册增加重复注册检查

场景:
ReverseProxyRouterFunctionRegistry 中有一个 pluginIdReverseProxyMap 记录了 插件名称和插件的 ReverseProxy 名称对应关系
当重复 fake-plugin -> test-reverse-proxy 时,pluginIdReverseProxyMap 的 value 不会去重,因此需要增加重复注册检查
#### Which issue(s) this PR fixes:

Fixes #

#### Special notes for your reviewer:
how to test it?
本 PR 不需要测试,已经对上述场景添加了单元测试

/cc @halo-dev/sig-halo 
#### Does this PR introduce a user-facing change?

```release-note
None
```
2022-10-17 06:19:38 +00:00
Ryan Wang 450de0b6cd feat: add toast component (halo-dev/console#644)
#### What type of PR is this?

/kind feature
/milestone 2.0

#### What this PR does / why we need it:

添加 Toast 组件。

特性:

1. 支持相同消息合并。
2. 支持鼠标悬停。

使用方式:

```vue
import { Toast } from '@halo-dev/components'

Toast.success("Hello", { //props })
Toast.info("Hello", { //props })
Toast.warning("Hello", { //props })
Toast.error("Hello", { //props })
```

props:

```ts
export interface ToastProps {
  type?: Type;
  content?: string;
  duration?: number;
  closable?: boolean;
  frozenOnHover?: boolean;
  count?: 0;
  onClose?: () => void;
}
```

Toast 方法不仅可以在 Vue 单组件中使用,理论上在任何地方均可使用。

#### Which issue(s) this PR fixes:

Fixes https://github.com/halo-dev/halo/issues/2534

#### Screenshots:

<img width="752" alt="image" src="https://user-images.githubusercontent.com/21301288/196099183-09e64daf-0077-4373-9603-5d4349dfce3d.png">

#### Special notes for your reviewer:

/cc @halo-dev/sig-halo-console 

测试方式:

https://halo-admin-ui-git-fork-ruibaby-feat-toast-component-halo-dev.vercel.app/story/src-components-toast-toast-story-vue?variantId=_default

测试功能是否正常。

#### Does this PR introduce a user-facing change?

```release-note
添加 Toast 组件
```
2022-10-17 06:09:38 +00:00
guqing 6cce2202a1
refactor: plugin js bundle file loading and routing rules (#2556)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.0
/kind api-change
#### What this PR does / why we need it:
重构插件 JsBundle 文件加载方式及路由规则

- 将插件静态资源的访问路由规则从 /assets/{plugin-name}/** 改为 /plugins/{plugin-name}/assets/** 与主题静态资源规则结构一致
- 默认在 Halo 中提供 /plugins/{plugin-name}/assets/console/** 路由以确保插件都能加载到最基础的 JsBundle 文件
#### Which issue(s) this PR fixes:

Fixes #2555

#### Special notes for your reviewer:
how to test it?
1. 安装并启用一个插件能访问到 `/plugins/{plugin-name}/assets/console/main.js` 和 `/plugins/{plugin-name}/assets/console/style.css` 即为功能正确
2. 在插件的 extensions 目录创建一个 reverse proxy 的自定义模型 yaml 资源,并使用此插件,插件反向代理规则能正确访问到文件即为功能正确

/cc @halo-dev/sig-halo 
#### Does this PR introduce a user-facing change?

```release-note
重构插件 JsBundle 文件加载方式及路由规则
```
2022-10-17 04:19:37 +00:00
guqing 08fe1858cf
feat: add upvote and downvote tracker (#2566)
#### What type of PR is this?
/kind feature
/area core
/milestone 2.0
/kind api-change

#### What this PR does / why we need it:
新增文章和评论等资源的点赞和踩 API

#### Which issue(s) this PR fixes:

Fixes #2565

#### Special notes for your reviewer:
how to test it?
1.  创建并发布一篇文章 替换下面的 `your-post-name` 然后执行它
```curl
curl --location --request POST 'http://localhost:8090/apis/api.halo.run/v1alpha1/trackers/upvote' \
--header 'Content-Type: application/json' \
--data-raw '{
    "group": "content.halo.run",
    "plural": "posts",
    "name": your-post-name
}
```
2. 请求成功并得到 response 为点赞数
3. 踩的 API 为 `http://localhost:8090/apis/api.halo.run/v1alpha1/trackers/downvote` 请求体与步骤1相同的测试方法
4. 重启 Halo 后 Counter 数据应该依然存在并且正确

/cc @halo-dev/sig-halo 
#### Does this PR introduce a user-facing change?

```release-note
新增文章和评论等资源的点赞和踩 API
```
2022-10-15 04:53:34 +00:00
Simple-Stark ef35205277 fix: `build:packages` script not running on Windows (halo-dev/console#642)
#### What type of PR is this?

/kind documentation

#### What this PR does / why we need it:

修复在 Windows 平台下无法正常运行 `build:packages` 等脚本的问题。

#### Which issue(s) this PR fixes:

Fixes https://github.com/halo-dev/halo/issues/2568

#### Does this PR introduce a user-facing change?

```release-note
NONE
```
2022-10-14 05:50:17 +00:00
John Niang d089ec63b4 Add Makefile for convenient operations (halo-dev/console#641)
#### What type of PR is this?

/kind feature
/area console

#### What this PR does / why we need it:

```bash
╰─❯ make help 
all                  lint and test code
install              install dependencies
build                build console
lint                 lint code
test                 run tests
help                 print this help
```

#### Does this PR introduce a user-facing change?

```release-note
None
```
2022-10-13 10:00:16 +00:00
John Niang 83b40b6dad
Update README.md due to 2.0.0-alpha.2 released (#2546)
#### What type of PR is this?

/kind documentation

#### What this PR does / why we need it:

The README.md is out of date due to [2.0.0-alpha.2](https://github.com/halo-dev/halo/releases/tag/v2.0.0-alpha.2) released.

#### Does this PR introduce a user-facing change?

```release-note
None
```
2022-10-12 09:10:16 +00:00
Ryan Wang 823acdaaae
docs: remove changelog documentation (#2540)
#### What type of PR is this?

/kind documentation

#### What this PR does / why we need it:

目前 Halo 处于多版本同时并存发行的现状,所以在各个分支(main、release-1.5、release-1.6)维护 CHANGELOG.md 会变得比较麻烦。所以考虑移除掉仓库内的 CHANGELOG.md 文件,后续以 [releases](https://github.com/halo-dev/halo/releases) 页面提供。

Ref https://github.com/halo-dev/halo/issues/2538

#### Which issue(s) this PR fixes:

Fixes https://github.com/halo-dev/halo/issues/2538

#### Special notes for your reviewer:

/cc @halo-dev/sig-halo 

#### Does this PR introduce a user-facing change?

```release-note
None
```
2022-10-12 08:20:15 +00:00
John Niang cc221d31c7
Continue extension updation if modification conflict occurs (#2536)
#### What type of PR is this?

/kind bug
/area core
/milestone 2.0

#### What this PR does / why we need it:

When we initialize default extensions at Halo startup, updation of one extension is very likely to be failed due to modification conflict. Then, remaining extensions won't be updated anymore.

Therefore, this PR resolve this problem by retrying updation with 3 times with interval 100ms and continue extension updation if modification conflict occurs.

#### How to test

1. Fully initialize system(e.g.: Clear `~/halo-next` before starting Halo)
2. Update Role `authenticated` as you wish via Extension API
3. Restart Halo and check it again
4. Retry multiple times

#### Does this PR introduce a user-facing change?

```release-note
修复系统默认数据无法正常更新的问题
```
2022-10-12 04:26:15 +00:00
Ryan Wang 5b12cf8ce4 refactor: set the root path of the development environment to /console (halo-dev/console#638)
#### What type of PR is this?

/kind improvement
/milestone 2.0

#### What this PR does / why we need it:

将开发环境的访问根路径改为 `/console`,即 `http://localhost:3000/console`,方便后续 Halo 对此地址进行反向代理,保证同源。

#### Special notes for your reviewer:

/cc @halo-dev/sig-halo-console 

测试方式:启动之后访问 <http://localhost:3000/console>,检查控制台是否有资源加载异常。

#### Does this PR introduce a user-facing change?

```release-note
None
```
2022-10-11 15:32:14 +00:00
John Niang dbaa087936
Support proxying console in server side (#2535)
#### What type of PR is this?

/kind feature
/area core
/milestone 2.0

#### What this PR does / why we need it:

Support proxying console in server side. We just need to configure the properties as following:

```yaml
halo:
  console:
    proxy:
      endpoint: http://localhost:3000/
      enabled: true
```

Before starting Halo server, please start the console first at port 3000 by checkouting https://github.com/halo-dev/console/pull/638.

Now we can have a try to access console via <http://localhost:8090/console/>.

Please note that this feature should be only for development environment instead of production environment.

#### Todos

- [ ] Proxy WebSocket for hmr of Vite

#### Which issue(s) this PR fixes:

Fixes https://github.com/halo-dev/halo/issues/2530

#### Does this PR introduce a user-facing change?

```release-note
None
```
2022-10-11 15:30:14 +00:00
Ryan Wang 64aa137bab refactor: logic of user login (halo-dev/console#636)
#### What type of PR is this?

/kind improvement
/milestone 2.0

#### What this PR does / why we need it:

优化用户登录的逻辑。 适配:https://github.com/halo-dev/halo/pull/2528

#### Which issue(s) this PR fixes:

Fixes https://github.com/halo-dev/halo/issues/2506

#### Special notes for your reviewer:

#### Does this PR introduce a user-facing change?

```release-note
优化用户登录的逻辑
```
2022-10-11 09:00:14 +00:00
John Niang af8860ffb6
Refine logic of form login and logout (#2528)
#### What type of PR is this?

/kind improvement
/kind api-change
/area core
/milestone 2.0

#### What this PR does / why we need it:

Please see b092b390b7/docs/authentication/README.md

#### Which issue(s) this PR fixes:

Fixes https://github.com/halo-dev/halo/issues/2506

#### Special notes for your reviewer:

#### Does this PR introduce a user-facing change?

```release-note
优化系统登录和登出逻辑
```
2022-10-11 08:04:14 +00:00
Ryan Wang db39c3a1d7 perf: remove unused imports
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-10-11 15:35:49 +08:00
Ryan Wang 2ac0c525de feat: add support for selecting parent menu item when creating menu item
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-10-11 15:33:51 +08:00
Ryan Wang 2a12feccf1 perf: remove incorrect help text from menu form
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-10-11 14:26:37 +08:00
Ryan Wang fb6c3755ed
docs: provides Halo 2.0 online demo environment (#2527)
#### What type of PR is this?

/kind documentation
/milestone 2.0

#### What this PR does / why we need it:

更新 README,提供 Halo 2.0 的演示环境信息。

#### Special notes for your reviewer:

/cc @halo-dev/sig-halo 

#### Does this PR introduce a user-facing change?

```release-note
None
```
2022-10-11 01:38:13 +00:00
Ryan Wang e8806cf8eb feat: add deleting plugin setting and configMap support
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-10-10 17:04:32 +08:00
Ryan Wang 7980639e91 perf: optimize reset theme settings config
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-10-10 16:55:25 +08:00
guqing 36e8ae1a15
refactor: system role templates (#2524)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.0

#### What this PR does / why we need it:
优化系统角色模板配置
- 认证用户仅具有名为 system-states 的 ConfigMap 查看权限而非所有 ConfigMap查看权限
- 主题和插件的管理权限目前需要单独勾选 ConfigMap 和 Setting 的权限才可以看到表单和值
#### Which issue(s) this PR fixes:

Fixes #2523

#### Special notes for your reviewer:
/cc @halo-dev/sig-halo 
#### Does this PR introduce a user-facing change?

```release-note
None
```
2022-10-10 08:04:10 +00:00
Ryan Wang 7d17e6e60e chore: bump dependencies
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-10-10 15:50:18 +08:00
Ryan Wang f761c64035 perf: refine ui permissions adapter
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-10-10 15:29:05 +08:00
Ryan Wang d2fbb8b98f chore: add pull request template and remove auto assign config file (halo-dev/console#635)
#### What type of PR is this?

/kind documentation

#### What this PR does / why we need it:

添加 PR 模板和删除 auto assign 的配置文件。 Ref https://github.com/halo-dev/console/pull/569

#### Special notes for your reviewer:

/cc @halo-dev/sig-halo-console 

#### Does this PR introduce a user-facing change?

```release-note
None
```
2022-10-09 06:58:29 +00:00
Ryan Wang ff3c562ff2 refactor: rename admin to console (halo-dev/console#634)
#### What type of PR is this?

/kind improvement
/milestone 2.0

#### What this PR does / why we need it:

Ref https://github.com/halo-dev/halo/pull/2521 我们已经将 halo-admin 的命名改为了 console,所以相关命名需要同步修改。

#### Which issue(s) this PR fixes:

Fixes https://github.com/halo-dev/halo/issues/2519

#### Special notes for your reviewer:

/cc @halo-dev/sig-halo-console 

测试方式:

1. 需要 `pnpm install && pnpm build:packages`
2. 测试后台功能是否正常。

PS:将在此 PR 合并之后发布 `@halo-dev/console-shared` 包到 npm。

#### Does this PR introduce a user-facing change?

```release-note
None
```
2022-10-09 06:56:33 +00:00
Ryan Wang 3f2e30efca chore: bump dependencies
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-10-09 13:59:35 +08:00
guqing 04300308fe
refactor: the way of router function register for reverse proxy (#2522)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.0

#### What this PR does / why we need it:
重构插件反向代理注册方式
#### Which issue(s) this PR fixes:

Fixes #2520

#### Special notes for your reviewer:
How to test:
1. clone 项目 https://github.com/halo-sigs/plugin-comment-widget 后 build 一个 jar
2. 将该 jar 作为一个插件安装到系统并启用它
3. 访问插件提供的反向代理资源
    ```
    curl --location --request GET 'http://localhost:8090/assets/PluginCommentWidget/static/comment-widget.iife.js'
    ```
    期望得到结果
4. 停用插件,重复 Step 3,期望得到 404
5. 重复数次 Step 3-4 均与期望相同即可 
#### Does this PR introduce a user-facing change?

```release-note
None
```
2022-10-09 03:42:30 +00:00
guqing a4609f68d1
fix: the exception of plugin context has been closed when plugin restart (#2518)
#### What type of PR is this?
/kind bug
/area core
/milestone 2.0

#### What this PR does / why we need it:
BasePlugin 持有了一个当前插件的 PluginApplicationContext 当插件停止后重新启用会获取到旧的 PluginApplicationContext,之前之所以这样写的目的只是插件的这个 BasePlugin 不支持依赖注入,目前已经支持所以不在这样解决问题

日志:

```
Caused by: java.lang.IllegalStateException: run.halo.app.plugin.PluginApplicationContext@6baf2671 has been closed already
	at org.springframework.context.support.AbstractApplicationContext.assertBeanFactoryActive(AbstractApplicationContext.java:1125) ~[spring-context-6.0.0-M5.jar:6.0.0-M5]
	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1158) ~[spring-context-6.0.0-M5.jar:6.0.0-M5]
	at run.halo.app.plugin.SpringExtensionFactory.create(SpringExtensionFactory.java:102) ~[classes/:2.0.0-alpha.1]
	at org.pf4j.ExtensionWrapper.getExtension(ExtensionWrapper.java:37) ~[pf4j-3.7.0.jar:3.7.0]
	at org.pf4j.AbstractPluginManager.getExtensions(AbstractPluginManager.java:971) ~[pf4j-3.7.0.jar:3.7.0]
	at run.halo.app.plugin.HaloPluginManager.getExtensions(HaloPluginManager.java:118) ~[classes/:2.0.0-alpha.1]
	at run.halo.app.plugin.ExtensionComponentsFinder.getExtensions(ExtensionComponentsFinder.java:36) ~[classes/:2.0.0-alpha.1]
	at run.halo.app.theme.dialect.CommentElementTagProcessor.doProcess(CommentElementTagProcessor.java:49) ~[classes/:2.0.0-alpha.1]
	at org.thymeleaf.processor.element.AbstractElementTagProcessor.process(AbstractElementTagProcessor.java:95) ~[thymeleaf-3.1.0.M2.jar:3.1.0.M2]
	at org.thymeleaf.util.ProcessorConfigurationUtils$ElementTagProcessorWrapper.process(ProcessorConfigurationUtils.java:633) ~[thymeleaf-3.1.0.M2.jar:3.1.0.M2]
	at org.thymeleaf.engine.ProcessorTemplateHandler.handleStandaloneElement(ProcessorTemplateHandler.java:918) ~[thymeleaf-3.1.0.M2.jar:3.1.0.M2]
	at org.thymeleaf.engine.StandaloneElementTag.beHandled(StandaloneElementTag.java:228) ~[thymeleaf-3.1.0.M2.jar:3.1.0.M2]
	at org.thymeleaf.engine.Model.process(Model.java:282) ~[thymeleaf-3.1.0.M2.jar:3.1.0.M2]
	at org.thymeleaf.engine.ProcessorTemplateHandler.handleStandaloneElement(ProcessorTemplateHandler.java:1204) ~[thymeleaf-3.1.0.M2.jar:3.1.0.M2]
	at org.thymeleaf.engine.StandaloneElementTag.beHandled(StandaloneElementTag.java:228) ~[thymeleaf-3.1.0.M2.jar:3.1.0.M2]
	at org.thymeleaf.engine.Model.process(Model.java:282) ~[thymeleaf-3.1.0.M2.jar:3.1.0.M2]
	at org.thymeleaf.engine.ProcessorTemplateHandler.handleOpenElement(ProcessorTemplateHandler.java:1587) ~[thymeleaf-3.1.0.M2.jar:3.1.0.M2]
	at org.thymeleaf.engine.OpenElementTag.beHandled(OpenElementTag.java:205) ~[thymeleaf-3.1.0.M2.jar:3.1.0.M2]
	at org.thymeleaf.engine.TemplateModel.process(TemplateModel.java:136) ~[thymeleaf-3.1.0.M2.jar:3.1.0.M2]
	at org.thymeleaf.engine.TemplateManager.parseAndProcess(TemplateManager.java:592) ~[thymeleaf-3.1.0.M2.jar:3.1.0.M2]
	at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1103) ~[thymeleaf-3.1.0.M2.jar:3.1.0.M2]
	at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1077) ~[thymeleaf-3.1.0.M2.jar:3.1.0.M2]
	at run.halo.app.theme.engine.SpringWebFluxTemplateEngine.lambda$createFullStream$0(SpringWebFluxTemplateEngine.java:202) ~[classes/:2.0.0-alpha.1]
	at reactor.core.publisher.MonoCreate.subscribe(MonoCreate.java:58) ~[reactor-core-3.5.0-M4.jar:3.5.0-M4]
	at reactor.core.publisher.Mono.subscribe(Mono.java:4321) ~[reactor-core-3.5.0-M4.jar:3.5.0-M4]
	at reactor.core.publisher.MonoSubscribeOn$SubscribeOnSubscriber.run(MonoSubscribeOn.java:126) ~[reactor-core-3.5.0-M4.jar:3.5.0-M4]
	at reactor.core.scheduler.WorkerTask.call(WorkerTask.java:84) ~[reactor-core-3.5.0-M4.jar:3.5.0-M4]
	at reactor.core.scheduler.WorkerTask.call(WorkerTask.java:37) ~[reactor-core-3.5.0-M4.jar:3.5.0-M4]
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source) ~[na:na]
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) ~[na:na]
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) ~[na:na]
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) ~[na:na]
	at java.base/java.lang.Thread.run(Unknown Source) ~[na:na]
```

#### Which issue(s) this PR fixes:

Fixes #

#### Special notes for your reviewer:
how to test:
1. 安装一个插件
2. 启用它再停止它,如此反复,没有抛出异常即可

/cc @halo-dev/sig-halo 
#### Does this PR introduce a user-facing change?

```release-note
None
```
2022-10-09 03:36:30 +00:00
Ryan Wang 18a3fc51a5
chore: rename the default location of the plugin's bundle resources to `console` (#2521)
#### What type of PR is this?

/kind api-change
/kind improvement
/milestone 2.0

#### What this PR does / why we need it:

Ref #2519 ,我们已经将 halo-admin 的命名改为了 console,所以相关命名需要同步修改。

#### Which issue(s) this PR fixes:

Fixes #2519 

#### Special notes for your reviewer:

/hold 

等待插件的 PR。

测试方式:

1. 使用 plugin-links 插件的 https://github.com/halo-sigs/plugin-links/pull/3 PR 进行测试,需要 Clone 到本地。
2. 使用 `./graldew build` 的命令编译插件,得到 `build/libs/plugin-link-*.jar`。
3. Halo 的插件运行模式改为 deployment 模式。
4. 启动 Halo 之后,安装第二步得到的插件。
5. 检查浏览器控制台是否正常加载了 `/assets/PluginLinks/console/main.js` 和 `/assets/PluginLinks/admin/style.css`

#### Does this PR introduce a user-facing change?

```release-note
None
```
2022-10-09 03:30:30 +00:00
John Niang 543bdc45b5
Support running Halo with MySQL and MariaDB database (#2512)
#### What type of PR is this?

/kind feature
/area core
/milestone 2.0

#### What this PR does / why we need it:

Add MySQL script to support running Halo with MySQL database due to https://github.com/jasync-sql/jasync-sql/issues/311 has been resolved.

#### Which issue(s) this PR fixes:

Fixes https://github.com/halo-dev/halo/issues/2464

#### Special notes for reviewers

Steps to test:

1. Start up MySQL. e.g.:

    ```yaml
    version: '3.1'
    
    services:
    
      db:
        image: mysql
        # NOTE: use of "mysql_native_password" is not recommended: https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password
        # (this is just an example, not intended to be a production configuration)
        command: --default-authentication-plugin=mysql_native_password
        restart: always
        environment:
          MYSQL_ROOT_PASSWORD: openmysql
        ports:
          - 3306:3306
    
      adminer:
        image: adminer
        restart: always
        ports:
          - 8080:8080
    ```
    
    ```bash
    docker-compose -f mysql.yaml up
    ```

2. Start Halo with `mysql` profile. e.g.:

    ```bash
    ./gradlew bootRun --args="--spring.profiles.active=mysql"
    ```

3. Validate the functionality of Halo

#### Does this PR introduce a user-facing change?

```release-note
None
```
2022-10-09 02:32:30 +00:00
guqing 9725d63056
fix: tracker counter api does not need authentication for theme (#2517)
#### What type of PR is this?
/kind bug
/area core
/milestone 2.0

#### What this PR does / why we need it:
修复主题端内容页访问量统计接口角色规则动词配置错误问题
#### Which issue(s) this PR fixes:

Fixes #2507

#### Special notes for your reviewer:
/cc @halo-dev/sig-halo 
#### Does this PR introduce a user-facing change?

```release-note
None
```
2022-10-08 09:06:28 +00:00
John Niang b23ed2efcc
Bump version of Spring Boot & SpringDoc (#2511)
#### What type of PR is this?

/kind improvement
/area core
/milestone 2.0

#### What this PR does / why we need it:

1. Upgrade Spring Boot to 3.0.0-M5. See https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.0.0-M5-Release-Notes for more.
2. Upgrade SpringDoc to 2.0.0-M6. The version is compatible to Spring Boot 3.0.0-M5. See https://github.com/springdoc/springdoc-openapi/issues/1865 for more.

#### Special notes for your reviewer:

Please check the API documentation endpoint: <http://localhost:8090/swagger-ui.html>.

#### Does this PR introduce a user-facing change?

```release-note
None
```
2022-10-08 02:04:27 +00:00
John Niang e23193cd73
Add Pull Request template for default branch (#2513)
#### What type of PR is this?

/kind documentation

#### What this PR does / why we need it:

See https://github.com/halo-dev/halo/pull/2078 for more.

#### Does this PR introduce a user-facing change?

```release-note
None
```
2022-10-06 11:00:25 +00:00
Ryan Wang a89d51e63f
docs: remove readme documentation about running with jar (#2501)
#### What type of PR is this?

/kind documentation
/milestone 2.0

#### What this PR does / why we need it:

因为目前暂时没有提供 JAR 包,所以移除 README 有关使用 JAR 包运行的文档。


#### Special notes for your reviewer:

/cc @halo-dev/sig-halo 

#### Does this PR introduce a user-facing change?

```release-note
None
```
2022-10-04 16:22:24 +00:00
John Niang cd2dc99898
Change condition of docker push (#2499) 2022-09-30 19:04:24 +08:00
Ryan Wang c46788c451 fix: ui permissions (halo-dev/console#633) 2022-09-30 19:03:38 +08:00
Ryan Wang d12ca4c14c docs: update readme for Halo 2.0 (halo-dev/console#630)
#### What type of PR is this?

/kind documentation
/milestone 2.0

#### What this PR does / why we need it:

更新 README

#### Special notes for your reviewer:

/cc @halo-dev/sig-halo-console 

#### Does this PR introduce a user-facing change?


```release-note
None
```
2022-09-30 09:58:18 +00:00