Commit Graph

4342 Commits (e6f31759a0d6a375323b723140b8b992fac9124c)

Author SHA1 Message Date
Ryan Wang e6f31759a0
feat: allow switching editors while editing a post (#4180)
#### What type of PR is this?

/area console
/kind feature
/milestone 2.8.x

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

支持在编辑文章时切换编辑器,不再限制仅新建时允许切换。但需要注意的是,目前只支持同类型的编辑器切换(rawType)。

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

Fixes #4176 

#### Special notes for your reviewer:

测试方式:

1. 安装多个编辑器插件,可以在 https://github.com/halo-sigs/awesome-halo 中查找。
2. 测试在新建文章时是否能够正常切换编辑器。
3. 测试在修改文章时能够正常切换同类型的编辑器。

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

```release-note
Console 端编辑文章时允许同类型的编辑器切换。
```
2023-07-18 08:16:02 +00:00
Ryan Wang 5a0e202847
chore: add sponsorship entry and sponsor image (#4233)
#### What type of PR is this?

/kind improvement

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

添加[爱发电](https://afdian.net/a/halo-dev)的赞助入口,以及在 README 上添加 Sponsors 图像,此图像会在 https://github.com/halo-sigs/sponsor-images 仓库中自动更新。

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

```release-note
None
```
2023-07-16 16:14:19 +00:00
Ryan Wang ad9b0dfb21
fix: system settings and plugin settings panels cannot be displayed (#4222)
#### What type of PR is this?

/area console
/kind bug
/milestone 2.8.x

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

修复系统设置面板和插件设置面板无法正常显示的问题,此问题由 https://github.com/halo-dev/halo/pull/4102 中升级了 `@vueuse/router` 导致。

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

Fixes #4221 

#### Special notes for your reviewer:

需要测试:

1. 测试系统设置能否正常工作。
2. 测试插件的设置能否正常工作。

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

```release-note
None
```
2023-07-16 15:34:17 +00:00
Ryan Wang b1a6fe3446
feat: register the AnnotationsForm component globally (#4212)
#### What type of PR is this?

/area console
/kind feature
/milestone 2.8.x

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

全局注册 AnnotationsForm 组件,以暴露给插件使用,让插件可以实现为模型设置 annotations 数据的功能。

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

Fixes #4183 

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

```release-note
Console 端全局注册 AnnotationsForm 组件,以暴露给插件使用
```
2023-07-14 04:18:10 +00:00
Ryan Wang efcf526f1b
refactor: logic of attachment data filtering (#4194)
#### What type of PR is this?

/area console
/kind improvement
/milestone 2.8.x

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

重构附件数据管理的筛选条件逻辑以及 UI。

<img width="1645" alt="image" src="https://github.com/halo-dev/halo/assets/21301288/6b13045e-ab6b-4306-a1bb-f19d97115191">


Ref https://github.com/halo-dev/halo/pull/4182
Ref https://github.com/halo-dev/halo/issues/4181

#### Special notes for your reviewer:

需要测试:

1. 测试附件的筛选条件包括关键词筛选功能是否正常。

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

```release-note
重构 Console 端附件数据列表的筛选项 UI 和逻辑。
```
2023-07-13 03:31:17 +00:00
Ryan Wang 6bba5073fa
refactor: simplify the logic of the system settings tab (#4196)
#### What type of PR is this?

/area console
/kind improvement
/milestone 2.8.x

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

简化系统设置页面,选项卡的状态管理逻辑,放弃动态路由的模式,改为使用路由查询参数代替。

原由:https://github.com/halo-dev/halo/pull/4041#issuecomment-1622921084

#### Special notes for your reviewer:

需要测试:

1. 测试系统设置页面能否正常工作即可。

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

```release-note
重构 Console 端系统设置页面的路由结构
```
2023-07-12 06:19:15 +00:00
Ryan Wang bb0a5f114a
feat: record the post query conditions in the route query parameters (#4102)
#### What type of PR is this?

/area console
/kind feature
/milestone 2.8.x

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

在文章数据管理列表页面路由中记录查询条件,包括分页信息、筛选信息等。可以保证在刷新页面或者从文章编辑页面返回时保留之前的查询状态。

<img width="1758" alt="image" src="https://github.com/halo-dev/halo/assets/21301288/270948d6-d585-4b36-ad3a-93064cf47548">

TODO:

- [x] 记录筛选条件,因为路由参数只能使用基本类型,但是原来的筛选条件的变量都是完整对象。

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

Fixes #4098 

#### Special notes for your reviewer:

需要测试:

1. 文章管理列表的所有筛选项是否可以正常工作。
2. 尝试设置部分筛选,然后刷新页面,观察筛选条件是否正常保留。

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

```release-note
Console 端的文章管理列表支持在地址栏记录筛选条件。
```
2023-07-12 06:17:20 +00:00
Ryan Wang 197096305b
refactor: logic of comment data filtering (#4195)
#### What type of PR is this?

/area console
/kind improvement
/milestone 2.8.x

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

重构评论数据管理的筛选条件逻辑以及 UI。

<img width="1650" alt="image" src="https://github.com/halo-dev/halo/assets/21301288/d89769bb-b8af-427e-a1ec-6ac8674131d3">

Ref https://github.com/halo-dev/halo/pull/4182
Ref https://github.com/halo-dev/halo/issues/4181

#### Special notes for your reviewer:

需要测试:

1. 测试评论的筛选条件包括关键词筛选功能是否正常。

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

```release-note
重构 Console 端评论数据列表的筛选项 UI 和逻辑。
```
2023-07-12 01:53:12 +00:00
Ryan Wang 119f352145
refactor: logic of post and singlepage data filtering (#4193)
#### What type of PR is this?

/area console
/kind improvement
/milestone 2.8.x

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

重构文章和页面数据管理的筛选条件逻辑以及 UI。

<img width="1646" alt="image" src="https://github.com/halo-dev/halo/assets/21301288/154c5588-91c0-448d-aa39-d75e90bce6ca">


Ref https://github.com/halo-dev/halo/pull/4182
Ref https://github.com/halo-dev/halo/issues/4181

#### Special notes for your reviewer:

需要测试:

1. 测试文章的筛选条件包括关键词筛选功能是否正常。
2. 测试页面的筛选条件包括关键词筛选功能是否正常。

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

```release-note
重构 Console 端文章数据列表的筛选项 UI 和逻辑。
```
2023-07-11 07:15:10 +00:00
Ryan Wang f622b1787c
refactor: data list filter components (#4182)
#### What type of PR is this?

/area console
/kind improvement
/milestone 2.8.x

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

重构 Console 端数据列表的筛选项 UI,并提供全局的筛选列表组件和搜索输入框组件。

> 在此 PR 同时重构了插件列表和用户列表用于验证,其他页面后续提 PR 修改。

<img width="1657" alt="image" src="https://github.com/halo-dev/halo/assets/21301288/ffa42184-46e6-4cb0-b39f-bd7b18869697">

重构之后可以获得:

1. 更好的代码组织。
2. 更好的使用体验。
3. UI 更加容易适配移动端。

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

Fixes #4181 

#### Special notes for your reviewer:

需要测试:

1. 测试插件管理和用户管理的数据列表筛选和关键词搜索功能是否正常。

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

```release-note
重构 Console 端数据列表的筛选项 UI,并提供全局的筛选列表组件和搜索输入框组件。
```
2023-07-07 08:23:06 +00:00
Ryan Wang c0aae3a63c
feat: make plugin tabs extensible (#4041)
#### What type of PR is this?

/area console
/kind feature
/milestone 2.7.x

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

插件自身的详情页面中的 Tabs 选项卡支持拓展,允许开发者自行为插件编写设置界面、一些不常用的操作页面等。

示例:

<img width="1358" alt="image" src="https://github.com/halo-dev/halo/assets/21301288/1e414e4e-688d-47de-907f-5f2a0afa9350">

扩展方式:

参考文档:https://github.com/ruibaby/halo/blob/feat/plugin-tabs-extend/console/docs/extension-points/plugin-self-tabs.md

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

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

#### Special notes for your reviewer:

需要测试:

1. 测试任意插件的详情页面是否能够正常使用。
2. 测试任意插件的设置表单能否正常使用。
3. 可以尝试根据文档为某个插件添加自定义的选项卡,测试是否能够正常工作。

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

```release-note
Console 端插件详情选项卡支持通过插件扩展。
```
2023-07-07 04:38:11 +00:00
John Niang bf2b92e77c
Prepare for next release 2.8.0 (#4168)
#### What type of PR is this?

/kind cleanup
/area core

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

- Update README
- Bump version to 2.8.0-SNAPSHOT

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

```release-note
None
```
2023-06-30 07:44:13 +00:00
Ryan Wang dcafee7e1f
chore: release 2.7.0 (#4158)
#### What this PR does / why we need it:

修改版本号,准备发布 2.7.0。

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

```release-note
None
```
2023-06-30 03:16:12 +00:00
guqing 529740a238
fix: creating a draft cannot be displayed in the post list (#4155)
#### What this PR does / why we need it:
此改动为还原 AbstractContentService 的 getContent 逻辑

当将 AbstractContentService 的 getContent 的查询改为 client.get 时会影响到文章 reconciler 的调用导致出错后一直requeue 所以无法完成文章逻辑处理。
<img width="633" alt="image" src="https://github.com/halo-dev/halo/assets/38999863/93743cac-f3db-4ff7-837c-bd42dfcf1280">
reconciler 这里获取 releaseSnapshot 时可能文章还是草稿,所以会导致调用 getContent 时多一次查询,所以最好是后续判断一下,当然这里已经在 getContent 判断了

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

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

```release-note
None
```
2023-06-30 03:04:16 +00:00
Ryan Wang 668018e6a0
chore: update preset plugins (#4159)
#### What type of PR is this?

/area plugin
/area core
/milestone 2.7.x

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

Update preset plugins version

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

```release-note
None
```
2023-06-30 03:00:12 +00:00
John Niang 4685bf4052
Add role template for managing cache (#4153)
#### What type of PR is this?

/kind feature
/area core
/milestone 2.7.x

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

Add role template for managing cache. Anyone with role `role-template-manage-cache` can see the `Refresh Page Cache` button.

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

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

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

```release-note
None
```
2023-06-29 07:48:12 +00:00
guqing 9a0c52fb2a
feat: support obtaining the raw external URL configuration (#4150)
#### What type of PR is this?
/kind feature
/area core
/milestone 2.7.x

#### What this PR does / why we need it:
支持通过 ExternalUrlSupplier 获取 externalUrl 配置

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

Fixes #4149

#### Does this PR introduce a user-facing change?
```release-note
支持通过 ExternalUrlSupplier 获取 externalUrl 配置
```
2023-06-29 07:04:12 +00:00
John Niang 0d387eddf3
Enable configuration caching with separate names (#4151)
#### What type of PR is this?

/kind feature
/area core
/milestone 2.7.x

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

Refactor configuration properties to configure caching with separate names, so that we can enable / disable cache with name.

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

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

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

```release-note
None
```
2023-06-29 07:02:11 +00:00
Ryan Wang baba8b9d24
chore: bump @halo-dev/richtext-editor version to alpha 24 (#4146) 2023-06-29 00:10:58 +08:00
guqing 55cb21ccaa
feat: support for obtaining the newest comments on theme-side (#4104)
#### What type of PR is this?
/kind feature
/milestone 2.7.x
/area core
/area theme

#### What this PR does / why we need it:
主题端支持获取最新评论

可能存在的问题:
主题端如果想展示评论所属的具体的主体比如 Moment 可能不好展示

how to test it?
通过 list 方法获取评论看排序和数据是否正确
```html
<p th:each="result : ${commentFinder.list(null,1,10)}">
  <span th:text="${result.spec.raw}"></span>
  -> <span th:text="${#temporals.format(result.spec.creationTime, 'yyyy-MM-dd HH:mm:ss')}"></span>
  -> <span th:text="${result.spec.subjectRef}"></span>
</p>
```
#### Which issue(s) this PR fixes:
Fixes #4088

#### Does this PR introduce a user-facing change?
```release-note
主题端支持获取最新评论
```
2023-06-28 15:48:11 +00:00
John Niang 00dd95ca6d
Add rate limiter for signing up (#4128)
#### What type of PR is this?

/kind feature
/area core
/milestone 2.7.x

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

Add rate limiter for signing up. We only allow 3 registrations within 1 hour by default, despite registration failure.

#### Special notes for your reviewer:

1. Start Halo and console.
2. Try to enable registration for public users.
3. Browse <http://localhost:8090/console/login?type=signup>
4. Input duplicate username for 4 times and see the result.
5. Or input valid username for 4 times and see the result.

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

```release-note
限制注册接口的请求速率
```
2023-06-28 15:42:11 +00:00
guqing cabcd98ef4
feat: add content extension points for post and single page on theme-side (#4080)
#### What type of PR is this?
/kind feature
/milestone 2.7.x
/area core

#### What this PR does / why we need it:
为主题端的文章和自定义页面内容添加扩展点
插件可以通过实现扩展点来干预文章和自定义页面的内容显示,如修改内容的 html 结构,改变特定样式等

使用方式参考:[docs/extension-points/content.md](9b2b9f1837)

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

Fixes #4003

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

```release-note
为主题端的文章和自定义页面内容添加扩展点
```
2023-06-28 15:30:11 +00:00
guqing 972ebed03a
refactor: content page meta tags now override global injected (#4069)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.7.x

#### What this PR does / why we need it:
修复文章页 HTML Meta 标签重复问题

see #4049 for more details.

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

Fixes #4049

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

```release-note
修复文章页 Meta Description 标签重复问题
```
2023-06-28 14:54:12 +00:00
Ryan Wang 8db4cec91e
feat: add support for inserting external media resources to the default editor (#4126)
#### What type of PR is this?

/kind feature
/area console
/area editor
/milestone 2.7.x

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

默认编辑器支持直接插入图片、视频、音频,提供除了附件库的媒体插入入口。

<img width="1011" alt="image" src="https://github.com/halo-dev/halo/assets/21301288/4c9be243-882f-4d21-9fa8-ce3033744746">

通过链接插入图片需要 https://github.com/halo-sigs/richtext-editor/pull/17 的支持。

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

Fixes https://github.com/halo-dev/halo/issues/3882
Fixes https://github.com/halo-dev/halo/issues/3994

#### Special notes for your reviewer:

测试编辑器通过链接插入图片、视频、音频的功能是否正常。

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

```release-note
默认编辑器支持不通过附件库直接插入图片、视频、音频。
```
2023-06-28 09:54:11 +00:00
John Niang 4aec1ba8f6
Check X-Real-IP header when obtaining client IP (#4139)
#### What type of PR is this?

/kind bug
/area core
/milestone 2.7.x

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

In some special situations, Halo can not obtain client IP address from request headers and socket address is unresolved, so that `java.lang.NullPointerException: Cannot invoke "java.net.InetAddress.getHostAddress()" because the return value of "java.net.InetSocketAddress.getAddress()" is null` will happen.

This PR will resolve the problem by checking `X-Real-IP` header and checking if remote address is unresolved.

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

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

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

```release-note
None
```
2023-06-28 09:50:11 +00:00
John Niang 25103b9ff8
Upgrade Spring Boot to 3.1.1 (#4136)
#### What type of PR is this?

/kind cleanup
/area core
/milestone 2.7.x

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

Upgrade Spring Boot to 3.1.1. See https://github.com/spring-projects/spring-boot/releases/tag/v3.1.1 for more.

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

```release-note
升级 Spring Boot 至 3.1.1
```
2023-06-28 08:08:11 +00:00
John Niang ff33608fed
Apply rate limiter for replying a comment (#4135)
#### What type of PR is this?

/kind feature
/area core
/milestone 2.7.x

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

Apply rate limiter for replying a comment as well. This feature is supplement of <https://github.com/halo-dev/halo/pull/4084>.

#### Special notes for your reviewer:

Try to reply any comments 11 times within 1 minute.

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

```release-note
对评论回复添加频率限制
```
2023-06-28 07:38:11 +00:00
Ryan Wang 02e7068ee0
refactor: simplify request exception handling (#4129)
#### What type of PR is this?

/kind improvement
/area console
/milestone 2.7.x

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

简化请求异常提示的逻辑。

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

```release-note
None
```
2023-06-28 06:44:12 +00:00
John Niang d0526ec592
Add support for caching template rendering result (#4091)
#### What type of PR is this?

/kind feature
/area core

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

This PR adds dependency [spring-boot-starter-cache](https://docs.spring.io/spring-boot/docs/current/reference/html/io.html#io.caching) as cache framework and [caffeine](https://github.com/ben-manes/caffeine/wiki) as cache implementation to cache template rendering result.

By default, we disable the cache feature. If you want to enable it, please try to configure properties like this:

```yaml
halo:
  cache:
    disabled: false
```

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

Fixes #2827 

#### Special notes for your reviewer:

1. Start Halo
2. Browse any page twice
3. See the difference in request times

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

```release-note
支持模板渲染结果缓存
```
2023-06-26 14:38:00 +00:00
guqing 2791d2f0e5
refactor: uinify some properties of plugins and themes (#4061)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.7.x
/kind api-change

#### What this PR does / why we need it:
统一主题和插件描述文件的部分字段
1. 统一网站字段为 homepage,将主题的 website 标记为过时并兼容为 homepage
2. 主题添加 license 字段
3. 插件添加 repo

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

#### Does this PR introduce a user-facing change?
```release-note
统一主题和插件描述文件的部分字段
```
2023-06-26 14:33:58 +00:00
guqing ff7ab4e4f1
refactor: support for custom api group in plugin controllers (#4065)
#### What type of PR is this?
/kind improvement
/area core
/milestone 2.7.x

#### What this PR does / why we need it:
插件的 Controllers 支持自定义 API Group
如:
```java
@RestController
@ApiVersion("fake.halo.run/v1")
@RequestMapping("/fake")
public class DemoController {
}
```
则生成路由为 `/apis/fake.halo.run/v1/fake`
如果没有 group 默认兼容以前的为 `/apis/api.plugin.halo.run/{version}/plugins/{pluginName}/**`
```java
@RestController
@ApiVersion("v1alpha1")
@RequestMapping("/fake")
public class DemoController {
}
```

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

#### Does this PR introduce a user-facing change?
```release-note
插件的 Controllers 支持自定义 API Group
```
2023-06-26 14:01:57 +00:00
Ryan Wang e13beb4cd1
feat: add redirect support for social auth provider (#4063)
#### What type of PR is this?

/area console
/kind feature
/milestone 2.7.x

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

三方登录时支持传入 `login_redirect_uri` 参数,以让三方登录提供方支持适配登录后重定向到具体页面的功能。

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

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

#### Special notes for your reviewer:

测试方式:

1. 可以使用 https://github.com/halo-sigs/plugin-oauth2/pull/33 进行测试。
2. 手动在登录页面构造如 https://127.0.0.1:8090/console/login?redirect_uri=/ 的地址,观察使用三方登录之后是否会跳转到指定页面。

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

```release-note
Console 端三方登录支持重定向参数。
```
2023-06-26 13:35:58 +00:00
Ryan Wang c39691d6fe
feat: make default editor extensible (#4090)
#### What type of PR is this?

/area console
/kind feature
/milestone 2.7.x

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

默认编辑器支持扩展,包括输入类型、工具栏、Slash Command 等。

Ref https://github.com/halo-sigs/richtext-editor/pull/16

## 定义方式

```ts
import ExtensionFoo from "./tiptap/extension-foo.ts"

export default definePlugin({
  extensionPoints: {
    "default:editor:extension:create": () => {
      return [ExtensionFoo];
    },
  },
});
```

其中,`ExtensionFoo` 是一个 Tiptap Extension,可以参考 [Tiptap 文档](https://tiptap.dev/) 和 [https://github.com/halo-sigs/richtext-editor/blob/main/docs/extension.md](https://github.com/halo-sigs/richtext-editor/blob/main/docs/extension.md)。

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

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

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

```release-note
Console 端的默认编辑器支持被扩展
```
2023-06-26 13:33:59 +00:00
guqing 532d7e0632
refactor: register plugin application context after context refreshed (#4092)
#### What type of PR is this?
/kind improvement
/area core
/area plugin

#### What this PR does / why we need it:
插件的 ApplicationContext 刷新之后在注册到 Registry 中

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

```release-note
None
```
2023-06-26 13:31:59 +00:00
Ryan Wang 34d0f9369b
refactor: add legacy option for useClipboard hook to solve compatibility issues (#4114)
#### What type of PR is this?

/kind improvement
/area console
/milestone 2.7.x

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

Console 端部分使用了复制功能的页面,所使用的 useClipboard hook 添加 legacy 参数以解决部分浏览器的兼容问题。

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

Fixes #4113 

#### Special notes for your reviewer:

1. 使用路由地址(192.168.x.x)访问 Halo。
2. 测试附件详情弹框的链接复制和概览页面中的复制功能是否正常。

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

```release-note
优化 Console 端部分页面复制功能的兼容性问题。
```
2023-06-26 13:28:08 +00:00
Ryan Wang 27ef8d3bab
fix: dropdown options cannot be clicked in some mobile devices (#4116)
#### What type of PR is this?

/area console
/kind improvement
/milestone 2.7.x

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

修复在部分移动端浏览器(比如 iOS Safari)中,下拉框组件(VDropdown)的选项点击无效的问题,即没有触发 click 事件。此问题的原因可能是因为我们用的 floating-vue 组件提供的 `v-close-popper` 指令的兼容问题,最小复现:https://stackblitz.com/edit/vitejs-vite-ncpzhj?file=src%2FApp.vue

此 PR 改写了关闭下拉框的方式,不再使用 v-close-popper 指令,而且对其他使用此组件的地方没有破坏性更新。

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

Fixes https://github.com/halo-dev/halo/issues/3689
Ref https://github.com/halo-dev/halo/issues/2699

#### Special notes for your reviewer:

如果有条件可以在移动端测试一下,尤其是 iOS Safari,目前在桌面端 Chrome 的设备模拟中测试正常。

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

```release-note
修复 Console 端的下拉框组件选项在移动端无法正常点击的问题。
```
2023-06-26 13:21:57 +00:00
John Niang aaa3548c97
Fix the problem that the username does not exist when the username does not exist (#4070)
#### What type of PR is this?

/kind bug
/area core

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

Catch UserNotFoundException instead of ExtensionNotFoundException to map correctly to BadCredentialsException.

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

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

#### Special notes for your reviewer:

1. Start Halo
2. Login with an username which does not exist
3. Check the response

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

```release-note
修复登录时出现用户名不存在的问题。
```
2023-06-26 12:21:57 +00:00
John Niang ecc617c709
Remap RequestNotPermittedException with RateLimitExceededException (#4119) 2023-06-26 16:12:54 +08:00
Ryan Wang 8c05a6d30e
feat: make comment subject ref provider extensible (#4039)
#### What type of PR is this?

/area console
/kind feature

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

让评论来源的显示支持通过插件扩展,目前如 [瞬间](https://github.com/halo-sigs/plugin-moments) 这类的插件如果使用了评论模块,那么在评论管理是无法显示具体来源的:

<img width="627" alt="image" src="https://github.com/halo-dev/halo/assets/21301288/0df354dc-ed42-4217-abbd-5bce67329e0d">

此 PR 为 Console 端提供了拓展方法,使用方式如下:

```ts
import { definePlugin } from "@halo-dev/console-shared";
import type { CommentSubjectRefResult } from "@halo-dev/console-shared";
import type { Extension } from "@halo-dev/api-client";
import type { Moment } from "./types";

export default definePlugin({
  components: {},
  extensionPoints: {
    "comment:subject-ref:create": () => {
      return [
        {
          kind: "Moment",
          group: "moment.halo.run",
          resolve: (subject: Extension): CommentSubjectRefResult => {
            const moment = subject as Moment;
            return {
              label: "瞬间",
              title: determineMomentTitle(moment),
              externalUrl: `/moments/${moment.metadata.name}`,
              route: {
                name: "Moments",
              },
            };
          },
        },
      ];
    },
  },
});

```

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

Fixes #3554 

#### Special notes for your reviewer:

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

```release-note
Console 端的评论来源显示支持通过插件扩展
```
2023-06-26 04:20:18 +00:00
Ryan Wang ac47942a04
feat: add permission settings to dashboard widgets (#4112)
#### What type of PR is this?

/kind improvement
/area console
/milestone 2.7.x

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

为仪表板内置的小组件添加权限设置,解决部分没有权限的用户访问仪表盘提示异常的问题。

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

Fixes #4111 

#### Special notes for your reviewer:

测试方式:

1. 创建一个访客角色的用户。
2. 访问仪表盘,观察是否有异常提示,以及是否出现没有权限的小组件。

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

```release-note
Console 端仪表盘的内置小组件添加权限设置。
```
2023-06-26 04:12:16 +00:00
Ryan Wang 96225e4040
chore: improve the console project infrastructure (#4105)
#### What type of PR is this?

/area console
/kind improvement
/milestone 2.7.x

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

维护 Console 端的开发基础设施。

- 升级 TypeScript 以及 Vue 对于 TS 支持的相关包。
- 优化 packages 下所有包的配置,解决构建时生成 d.ts 文件的异常。
- 解决 TS 异常。

#### Special notes for your reviewer:

尝试执行:

1. pnpm build:packages
2. pnpm typecheck

观察是否正常即可。

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

```release-note
维护 Console 端的开发基础设施。
```
2023-06-26 03:54:17 +00:00
d28f6075c1
feat: add rate limiter for comment endpoint (#4084)
#### What type of PR is this?

/kind feature
/kind core

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

This PR limited comment creation at a rate of 10 per minute.

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

#### Special notes for your reviewer:
1. Start Halo.
2. Create 11 new comments
3. Check the response.

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

```release-note
增加发表评论频率限制功能
```
2023-06-26 03:30:25 +00:00
Ryan Wang f37085f5a6
perf: improve the text length style of the comment subject ref title (#4115)
#### What type of PR is this?

/area console
/kind improvement
/milestone 2.7.x

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

Fix style issue of the comment subject ref title.

before:

<img width="1386" alt="image" src="https://github.com/halo-dev/halo/assets/21301288/d6c845d4-039b-42bb-855a-01c9ddf113ee">

after:

<img width="1390" alt="image" src="https://github.com/halo-dev/halo/assets/21301288/0f53f3fb-ab59-4b12-9352-49623b121347">


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

Fixes #4068 

#### Special notes for your reviewer:

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

```release-note
None
```
2023-06-25 06:34:17 +00:00
Ryan Wang 1b6d081750
feat: add mouse hover style to the default type of button (#4108)
#### What type of PR is this?

/area console
/kind improvement
/milestone 2.7.x

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

为默认类型的按钮添加鼠标悬浮的样式。

<img width="333" alt="image" src="https://github.com/halo-dev/halo/assets/21301288/922dd681-a2f1-4875-adef-9d1c5a075467">

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

Fixes #4067 

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

```release-note
Console 端默认类型的按钮添加鼠标悬浮的样式。
```
2023-06-25 06:28:14 +00:00
Ryan Wang e658097b99
fix: modal height issue in ios devices (#4106)
#### What type of PR is this?

/area console
/kind improvement
/milestone 2.7.x

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

优化 VModal 组件在 iOS 设备上底部和顶部被遮挡的问题,解决方案来自于:https://github.com/Faisal-Manzer/postcss-viewport-height-correction

| before                                                       | After                                                        |
| ------------------------------------------------------------ | ------------------------------------------------------------ |
| ![IMG_0319](https://github.com/halo-dev/halo/assets/21301288/71d15e51-5cf9-402e-b6ce-fff4e1014f72) | ![IMG_0315](https://github.com/halo-dev/halo/assets/21301288/6c3b4b75-2029-4b32-8dcc-eead3e479ab1) |
| ![IMG_0318](https://github.com/halo-dev/halo/assets/21301288/b4f586b4-34e1-48ea-97ed-7f1f70184346) | ![IMG_0316](https://github.com/halo-dev/halo/assets/21301288/7dee64bb-2328-44ef-a9f6-534ea4c005fe) |

<!--fuck apple, fuck safari-->

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

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


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

```release-note
优化 Console 端弹框组件(VModal)在 iOS 设备的高度问题。
```
2023-06-25 02:06:14 +00:00
Ryan Wang f6a6b25dd6
chore: bump formkit version to 0.17.3 (#4103)
#### What type of PR is this?

/area console
/kind improvement
/milestone 2.7.x

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

升级 FormKit 的版本至 0.17.3

- https://formkit.com/changelog
- https://github.com/formkit/formkit/releases/tag/0.17.0
- https://github.com/formkit/formkit/releases/tag/0.17.3

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

Fixes #3951 

#### Special notes for your reviewer:

测试 Console 端各个表单功能是否正常即可。

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

```release-note
升级 Console 端 FormKit 的依赖版本至 0.17.3
```
2023-06-21 08:28:13 +00:00
John Niang 5e9e87582e
Refactor setting of problem detail type (#4099)
#### What type of PR is this?

/kind improvement
/area core

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

Define a global map to mapping exception to problem detail type.

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

```release-note
None
```
2023-06-21 04:40:12 +00:00
John Niang 12a426c9ae
Exclude WebSocket request when serving console index (#4096)
#### What type of PR is this?

/kind bug
/area core

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

This PR excludes WebSocket request when serving console index and remove request predicate accept in ConsoleProxyFilter.

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

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

#### Special notes for your reviewer:

1. Start Console with dev environment
2. Start Halo with dev profile
3. Try to browse <http://localhost:8090/console> and check the log

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

```release-note
修复开发环境下访问 Console 出现错误的问题
```
2023-06-21 03:42:12 +00:00
John Niang a19f342b47
Fix the problem of logging in successfully even if request not permitted (#4101)
#### What type of PR is this?

/kind bug
/area core

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

This is a bug introduced from https://github.com/halo-dev/halo/pull/4062. I have overridden onAuthenticationSuccess to create rate limiter in advance instead of invoking `securityContextRepository#save` before.

See https://github.com/halo-dev/halo/pull/4099#issuecomment-1598074131 for more.

#### Special notes for your reviewer:

1. Try to log in with incorrect password three times
2. Log in with correct password and check if the response headers contain `Set-Cookie`

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

```release-note
None
```
2023-06-21 03:26:12 +00:00
Ryan Wang 2fd9cbde33
feat: add support for selecting the parent category when creating a new category (#4056)
#### What type of PR is this?

/area console
/kind feature
/milestone 2.7.x

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

支持在创建分类的时候选择上级分类。

<img width="805" alt="image" src="https://github.com/halo-dev/halo/assets/21301288/02912f70-4de4-4b8e-bbbe-f973fbd3e684">

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

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

#### Special notes for your reviewer:

测试方式:

1. 测试新建的时候指定上级分类的功能是否正常。
2. 点击某个分类的操作按钮,选择添加子分类的菜单项,检查在新建分类的表单中上级分类是否选中了此分类。

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

```release-note
Console 端的文章分类支持在新建时指定上级分类。
```
2023-06-19 02:54:11 +00:00