Commit Graph

1868 Commits (9fdc9c1bb7a4d305808080184711833c702918c8)

Author SHA1 Message Date
guqing de493ccb2c
feat: add plugin setting support (#2238)
<!--  Thanks for sending a pull request!  Here are some tips for you:
1. 如果这是你的第一次,请阅读我们的贡献指南:<https://github.com/halo-dev/halo/blob/master/CONTRIBUTING.md>。
1. If this is your first time, please read our contributor guidelines: <https://github.com/halo-dev/halo/blob/master/CONTRIBUTING.md>.
2. 请根据你解决问题的类型为 Pull Request 添加合适的标签。
2. Please label this pull request according to what type of issue you are addressing, especially if this is a release targeted pull request.
3. 请确保你已经添加并运行了适当的测试。
3. Ensure you have added or ran the appropriate tests for your PR.
-->

#### What type of PR is this?
/kind feature
/area core
/milestone 2.0
<!--
添加其中一个类别:
Add one of the following kinds:

/kind bug
/kind cleanup
/kind documentation
/kind feature
/kind improvement

适当添加其中一个或多个类别(可选):
Optionally add one or more of the following kinds if applicable:

/kind api-change
/kind deprecation
/kind failing-test
/kind flake
/kind regression
-->

#### What this PR does / why we need it:
新增插件设置,允许通过 Setting 自定义模型生成表单并收集其值为 ConfigMap
插件可以通过注入 SettingFetcher 来获取值并使用它,例如:
```java
Sns sns = settingFetcher.getGroupForObject("sns", Sns.class);
```
#### Which issue(s) this PR fixes:

<!--
PR 合并时自动关闭 issue。
Automatically closes linked issue when PR is merged.

用法:`Fixes #<issue 号>`,或者 `Fixes (粘贴 issue 完整链接)`
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
-->
Fixes #

#### Special notes for your reviewer:
/cc @halo-dev/sig-halo 
#### 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
None
```
2022-07-12 14:57:08 +00:00
guqing abe29c12bf
feat: add configmap extension (#2232)
* feat: add configmap extension
2022-07-12 15:31:29 +08:00
Ryan Wang c97804780b
refactor: configure the api request to allow credentials and X-XSRF-TOKEN,COOKIE headers (#2227)
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-07-08 09:44:13 +00:00
guqing 3e8f8b8789
feat: add plugin reconciler (#2221)
* feat: add plugin reconciler

* feat: add unit test case
2022-07-08 07:08:13 +00:00
John Niang 3f7cb58370
Add support for custom endpoints (#2223)
* Support to add custom endpoints

Signed-off-by: johnniang <johnniang@fastmail.com>

* Update docs/developer-guide/custom-endpoint.md

Co-authored-by: guqing <38999863+guqing@users.noreply.github.com>

Co-authored-by: Ryan Wang <i@ryanc.cc>
Co-authored-by: guqing <38999863+guqing@users.noreply.github.com>
2022-07-08 04:40:13 +00:00
guqing 73d43cae64
refactor: JSON serialize exception (#2222) 2022-07-07 09:32:14 +00:00
John Niang 2afe19f1b9
Add rolebinding reconciler to reset role names of users (#2217)
* Add rolebinding reconciler to reset role names of users

Signed-off-by: johnniang <johnniang@fastmail.com>

* Add @Bean annotations on roleBindingController

* Fix errors complained by unneccesary catch

Signed-off-by: johnniang <johnniang@fastmail.com>
2022-07-07 03:36:10 +00:00
guqing f62d089237
feat: add role reconciler (#2212)
* feat: add role reconciler

* refactor: get role by name

* refactor: reconcile

* refactor: reconciler

* fix: test
2022-07-06 08:40:12 +00:00
guqing f7945081a5
refactor: plugin custom api generate rules (#2211)
* refactor: plugin custom api generate rules

* refactor: boolean convert

* fix: unit test
2022-07-05 07:00:12 +00:00
John Niang 27435a1aeb
Implement Extension reconciliation mechanism (#2204) 2022-07-04 03:14:24 +00:00
guqing d7cfe4c4a5
refactor: Unstructured loading opportunity for plugin (#2191)
* refactor: Unstructured loading opportunity for plugin

* refactor: gvk
2022-06-27 07:14:10 +00:00
John Niang 61d2169a51
Add additional method to fetch Extension by GVK and name (#2190) 2022-06-26 16:04:09 +00:00
guqing c0758f32d1
refactor: plugin configuration loading to adapt to plugin development mode (#2183)
* refactor: plugin configuration loading to adapt to plugin development mode

* refactor: extension locations

* refactor: plugin labels

* fix: unit test
2022-06-23 09:56:26 +00:00
guqing 273ffaad48
feat: add plugin status manage (#2177)
* feat: add plugin status manage

* feat: add plugin state changed listener

* refactor: plugin status

* refactor: plugin
2022-06-23 03:08:24 +00:00
John Niang c24df6fb05
Refine Swagger document for Extension APIs (#2180) 2022-06-22 04:36:21 +00:00
John Niang ac7a3c86c8
Configure CORS for API endpoints (#2175) 2022-06-21 11:06:20 +00:00
John Niang d556787b3a
Add update and delete handlers for Extensions (#2172) 2022-06-21 11:04:21 +00:00
guqing b9e5ed2f4c
feat: add shared application context for plugin (#2174)
* feat: add shared application context for plugin

* chore: remove todo notes

* fix: router function composite
2022-06-21 07:34:25 +00:00
guqing 7cd1282ad3
feat: add request mapping handler mapping for plugin (#2161)
* feat: add requet mapping handler mapping for plugin

* fix: request info resolve

* fix: test code style

* refactor: plugin api version resolve

* fix: merge conflicts
2022-06-21 03:22:24 +00:00
guqing 89eeccd99c
fix: locale for unit test of json extension converter (#2170) 2022-06-20 15:18:28 +00:00
John Niang f5d629d2bf
Add user support for authentication and authorization (#2163)
* Move role and rolebinding extensions into core package

* Add UserExtensionUserDetailService to find user and update password

* Rename DefaultUserDetailService

* Fix test errors

* Add SuperAdminInitializer to initialize first user

* Add unit tests for DefaultUserDetailService and UserService

* Add test for verifying SuperAdminInitializer

* Fix unstable test due to database reusability

Signed-off-by: johnniang <johnniang@fastmail.com>
2022-06-20 03:26:18 +00:00
John Niang e52db6859f
Add feature to generate APIs for schemes automatically (#2158)
* Add ExtensionEndpointInstaller

* Refactor Schemes with SchemeManager

* Add some unit tests

1. Add ExtensionCompositeRouterFunctionTest
2. Add ExtensionConfigurationTest
3. Refactor Unstructured
4. Fix bad ObjectMapper in Json converter.

* Fix bad scheme registration
2022-06-16 03:10:14 +00:00
guqing fcbf0031a4
feat: plugin supports multiple ways of specifying licenses (#2152)
* feat: plugin supports multiple ways of specifying licenses

* feat: add unit test case for deserialize license
2022-06-15 15:36:12 +00:00
guqing 83d668b0a9
feat: add plugin unstructured resource loader (#2154)
* feat: add plugin unstructured resource loader

* feat: add test unit case
2022-06-14 15:38:12 +00:00
guqing 6bbaa9aeba
feat: add reverse proxy router registry for plugin by reverse proxy rules (#2151)
* feat: add reverse proxy router registry for plugin by reverse proxy rules

* Update src/main/java/run/halo/app/plugin/resources/ReverseProxyRouterFunctionFactory.java

Co-authored-by: John Niang <johnniang@fastmail.com>

* refactor: merge stream operation

* refactor: plugin composite router function

* feat: add unit test case

Co-authored-by: John Niang <johnniang@fastmail.com>
2022-06-14 10:58:21 +00:00
guqing a2f49c60bc
feat: add plugin life cycle management (#2134)
* feat: add plugin life cycle management

* refactor: plugin lifecycle endpoint mapping
2022-06-13 02:36:11 +00:00
John Niang a956758a2f
Overwrite Jackson2Json decoder and encoder (#2145) 2022-06-09 08:04:13 +00:00
John Niang 02a7143fe5
Enable CSRF token in Set-Cookie header (#2144) 2022-06-09 02:30:13 +00:00
guqing b3b13bc820
feat: add yaml descriptor finder for plugin (#2132)
* feat: add yaml plugin descriptor finder

* refactor: json assert

* refactor: plugin descriptor finder

* refactor: yaml plguin finder

* refactor: plugin dependencies
2022-06-07 06:32:12 +00:00
John Niang 1024f71635
Replace webmvc with webflux (#2138)
* Replace webmvc to webflux

Signed-off-by: johnniang <johnniang@fastmail.com>

* Remove jetty dependency

Signed-off-by: johnniang <johnniang@fastmail.com>

* Refactor authentication module

* Refactor authentication module

* Migrate authorization module

* Refactor Login components

* Fix broken imports

* Upgrade springdoc version

* Refine security matcher using pathMatchers utility
2022-06-07 02:20:12 +00:00
guqing 19db04c430
refactor: policy rule constructor to avoid null values (#2131)
* refactor: policy rule constructor to avoid null values

* fix: unit test case
2022-06-02 02:52:10 +00:00
guqing 2c057f4fe1
feat: add plugin implementation (#2128) 2022-05-31 04:06:10 +00:00
guqing f4a943e45a
refactor: rule resolver and role binding lister (#2119) 2022-05-30 09:08:09 +00:00
guqing 9a05942bc4
feat: add yaml unstructured loader (#2122) 2022-05-28 09:44:08 +00:00
guqing 3c856d04af
feat: add personal access token authentication mechanism (#2116)
* feat: add personal access token authentication

* fix: merge conflicts

* refactor: remove base62 codec

* refactor: remove deprecated method

* feat: add base64 test

* chore: add todo for test only methods
2022-05-27 06:26:37 +00:00
John Niang b5d7f194ef
Create unstructured Extension which can store any Extensions (#2111)
* Extract ExtensionOperator and MetadataOperator

* Move groupVersionKind methods up to ExtensionOperator interface

* Add Unstructured Extension for generic Extension

* Refine mapping of GVK and Scheme

* Add two compatible methods
2022-05-26 08:38:10 +00:00
guqing 0f4ae08fd8
feat: add logout handler (#2110)
* feat: add logout handler

* chore: delete unused code

* fix: merge conflicts
2022-05-25 09:58:10 +00:00
guqing c5df6d3dbb
feat: add default role binding lister and role getter (#2108)
* feat: add default role binding lister and role getter

* feat: add initial capacity for role binding list
2022-05-25 07:52:10 +00:00
John Niang 5f9daf4735
Add JSON schema generator and validator (#2093)
Only validate the JSON schema when saving Extension into database.
2022-05-17 16:06:12 +00:00
John Niang 264f9e39cb
Add support for Extension mechanism (#2086)
* Add support for Extension mechanism

1. Add ExtensionStore
2. Add Extension
3. Add Scheme

* Add more unit tests

* Fix checkstyle violations

* Remove unused import
2022-05-17 10:36:13 +00:00
guqing be2c0654a2
chore: add checkstyle rule (#2091)
* feat: add unused imports checkstyle rule

* feat: add java doc style rule

* fix: check style
2022-05-17 06:46:11 +00:00
John Niang 3cf2f9d7e1
Add support for API documentation (#2082) 2022-05-11 08:06:11 +00:00
guqing b4e9b54ffe
refactor: remove authorization filter and replace it with the RequestInfoAuthorizationManager (#2081) 2022-05-11 02:26:11 +00:00
guqing d9bccdb5e1
feat: Add rule resolver and authorization filter (#1904)
* feat: Add request info resolver and evaluation

* feat: Add attributes record

* feat: Add rule resolver and authorization filter

* feat: Add authorization intergation test case

* chore: add todo for only testing class
2022-04-29 06:39:08 +00:00
guqing 9a0dc50653
feat: Add Principal attribute to authorizationBuilder when password authenticate successfully (#1878) 2022-04-22 09:36:11 +00:00
guqing a7b9433120
feat: Add bearer token filter config for authentication (#1876) 2022-04-22 07:36:11 +00:00
guqing 6de85184b1
feat: Add bearer token authentication filter for bearer authentication (#1872) 2022-04-22 06:36:11 +00:00
guqing e8d8ef8f28
feat: Add jwt token and provider for jwt authentication (#1871) 2022-04-22 06:00:12 +00:00
guqing 673c2068d9
feat: Add default bearer token resolver for rfc6750#section-2.1-2.3 (#1869) 2022-04-22 03:04:10 +00:00
guqing 599ab5618b
feat: Add bearer token errors for rfc6750#section-3.1 (#1868) 2022-04-21 08:46:12 +00:00
guqing c999c35a20
feat: Add bearer token and bearer authentication (#1864) 2022-04-21 07:58:12 +00:00
guqing 3f5e83fcae
chore: use providerSettings to create OAuth2TokenEndpointFilter (#1863) 2022-04-20 08:08:10 +00:00
guqing 8ac819ad14
chore: cleanup deprecated class (#1859) 2022-04-20 03:14:10 +00:00
guqing f1ccccb557
refactor: use OAuth2Password grant instead of JwtUsernamePassword authentication (#1857) 2022-04-20 03:02:10 +00:00
guqing ed6aea6245
feat: Add oauth2 refresh token authentication (#1856)
* feat: Add oauth2 refresh token authentication

* feat: Add unit test case
2022-04-19 10:16:14 +00:00
guqing ad562b4917
feat: Add InMemoryOAuth2AuthorizationService for development or testing (#1854) 2022-04-19 08:06:09 +00:00
guqing eee58989fe
feat: Allow configuration for token and refresh token time-to-live (#1853) 2022-04-19 03:16:15 +00:00
guqing 9dd778bdab
feat: Add ProviderContextHolder for token generate (#1852)
* feat: Add auhentication provider and password authentication filter

* refactor: JwtUsernamePasswordAuthenticationFilter and add test case

* chore: delete unused class

* fix: code style

* refactor: web secutity config

* feat: Add ProviderContextHolder for token generate

* chore: optimize imports
2022-04-18 06:58:13 +00:00
guqing 66be1d1ba7
feat: Add UsernamePasswordAuthenticationProvider and filter to authentication client password request (#1846)
* feat: Add auhentication provider and password authentication filter

* refactor: JwtUsernamePasswordAuthenticationFilter and add test case

* chore: delete unused class

* fix: code style

* refactor: web secutity config
2022-04-18 03:40:11 +00:00
guqing 20e6d4d1eb
feat: Add JwtGenerator for authentication (#1843)
* feat: Add JwtGenerator for authentication

* fix: code style

* refactor: change OAuth2TokenType type to record

* refactor: remove explicit declaration of equals and hashcode for records class
2022-04-15 02:47:57 +00:00
guqing 90d61a27e9
feat: add token provider (#1841) 2022-04-13 11:38:34 +00:00
guqing b3c82396ac
feat: Add security config for halo (#1838)
* feat: Add security config for halo

* chore: delete file

* feat: add security config intergration test case

* refactor: use EnableWebSecurity annotation

* refactor: patch prefix

* Update src/test/java/run/halo/app/integration/security/AuthenticationTest.java

Co-authored-by: John Niang <johnniang@fastmail.com>

* refactor: mvc path prefix config

Co-authored-by: John Niang <johnniang@fastmail.com>
2022-04-13 09:08:34 +00:00
guqing e2843adbe7
Create basic project structure for halo 2.0 (#1699)
* feat: Add project structure

* feat: Add config

* feat: Add flyway migrate config for h2 and mysql and postgresql

* fix: checkstyle config

* chore: Upgrade springboot 2.6 to 3.0.0-m1

* feat: Add spring snapshot url for repositories

* refactor: Change jdk11 to jdk17 for github ci config

* refactor: update build.gradle config
2022-03-04 15:04:11 +08:00
Ryan Wang 641264ba5c chore: clean code for next major version
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-03-03 11:34:42 +08:00
guqing 68d263bef3
Add assembler for post and sheet to replace service convert (#1691) 2022-03-03 11:15:56 +08:00
guqing 52b3e4f605
Fix the problem jsonToCacheWrapper crashes when cache value is not JSON format (#1695)
* fix: json to cache wrapper convertor when other exception

* feat: Add test case for level cache
2022-03-02 18:06:54 +08:00
lan-yonghui 4354991a9e
fix: Remove the code that filters empty strings from the properties file
* fix: Remove the code that filters empty strings from the properties file.
* blog birthday default value set "0"
2022-03-02 16:36:20 +08:00
guqing 4d71185066
fix: leak of version number inference when create or update content patch (#1690) 2022-03-02 13:40:19 +08:00
guqing 4f1a3c5f0b
refactor: post and cateogry authentication (#1678) 2022-03-01 13:32:52 +08:00
扶醉 5064837cf8
Fix the problem post and sheet contents are empty in the content API (#1686)
* fix: Post and sheet content is empty in the Content API
2022-02-27 15:47:54 +08:00
Ryan Wang 567ad5ef46
chore: sync default theme repo (#1682)
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-02-25 20:42:47 +08:00
Ryan Wang a94dd8df7b
feat: add api for update photos in batch (#1679)
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-02-25 16:09:30 +08:00
Ryan Wang 5959fdfa2d feat: add api for delete photos in batch
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-02-25 15:55:11 +08:00
Ryan Wang 631b2149d3
release: 1.5.0-alpha.1 (#1671)
Signed-off-by: Ryan Wang <i@ryanc.cc>
2022-02-21 23:45:20 +08:00
guqing d889a08833
Add keep-raw option to decide how to render post (#1668)
* feat: Content add front-end rendering options and refactor post params

* feat: add default value for serverSidemarkdownRender

* refactor: content save api

* fix: generate summary

* refactor: remove useless server-side markdown render code

* refactor: allow the formatContent to be empty

* refactor: Rename serverSideMarkdownRender to keepRaw

* refactor: Rename test case
2022-02-21 22:50:35 +08:00
guqing 923eb17577
Support post content version control (#1617)
* feat: split post content to new table and support content version control

* feat: Improve post version management

* feat: Add post content and version record deletion

* feat: Add isInProcess attribute for post list and detail api

* feat: Add migrate sql script

* fix: Add a sql of allow origin_content to null in posts table

* feat: Assign a value to the source of the post content version record
2022-02-20 20:34:56 +08:00
Ryan Wang 1ee7b58ef1
Add password reset field verification (#1636)
* perf: add password reset field verification

Signed-off-by: Ryan Wang <i@ryanc.cc>

* feat: add unit test case

Co-authored-by: guqing <1484563614@qq.com>
2022-02-20 10:30:42 +08:00
guqing acf6a98d25
Add an API to update categories in batch (#1657)
* feat: Add a api of update categories in batch

* fix: filter condition
2022-02-18 15:50:02 +08:00
guqing 15bde8eef7
Add APIs to fetch theme info and settings according to the theme id (#1660) 2022-02-18 14:08:36 +08:00
lan-yonghui d961a5e8a5
feat: add priority field into category table (#1650)
* feat: 分类增加排序字段

* style: Optimize and change categories sorting codes

* style: delete sql file

* style: update categories priority default value 0

* style: Optimize categories priority default value
2022-02-15 17:50:37 +08:00
John Niang 2249ef1103
Fix the problem where the activated field was not set correctly for a theme property (#1632)
Signed-off-by: John Niang <johnniang@fastmail.com>
2022-01-16 13:30:09 +08:00
Ryan Wang f83389ca4c
chore: sync default theme (#1621) 2022-01-11 11:19:25 +08:00
guqing 9ddd74b74b
Include posts that under the subcategories when getting posts b… (#1567)
* feat: include posts that under the subcategories when getting posts by category

* refactor: list as tree

* fix: can nott query the problem of encrypted category

* refactor: post count under the category

* fix: list all by parent id
2021-12-21 23:35:42 +08:00
Ryan Wang 27664fcb41
fix: huawei obs upload file address is incorrect (#1589) 2021-12-11 11:49:55 +08:00
guqing 514ccdb2a1
Add some APIs for group obtaining theme configurations and setting items (#1582) 2021-12-09 21:27:41 +08:00
Ryan Wang dbf954e20c
release: 1.4.15 (#1573) 2021-12-06 16:24:56 +08:00
guqing 448739cddd
Tag support color options (#1566)
* feat: tag support color options

* refactor: change the color of tag

* feat: add api model property

* refactor: change color field length

* refactor: color field length in tag param
2021-12-06 12:38:06 +08:00
Ryan Wang ab82fadd6e
release: 1.4.14 (#1568) 2021-12-05 20:35:07 +08:00
guqing a802572128
feat: add a batch creation api for photos (#1564)
* feat: add an api of batch creation photos

* feat: add an api verification
2021-12-04 15:58:10 +08:00
guqing 9801bc7a20
Fixed the problem that copying the default theme at halo startup did not use themeId as the theme folder name (#1549)
* fix: 1547

* refactor: replace the string magic value using a static constant
2021-12-03 10:21:55 +08:00
Mingjie Shao b301c8e074
Mark email as not required parameter in BaseComment (#1535)
* Removing email field from the required arguments in comments

* Fixed gravatar and added database migration script

* Adding validation test cases for PostCommentParam

* Added unit test for PostCommentServiceImpl

* Address comments: removing identicon in gravatar, renaming migration script

* Address comment: removing gravata identicon from CommentProperties

* Address comments: Adding more unit tests for comment API

* Address comments: Adding integration tests for comment API
2021-11-24 17:31:57 +08:00
guqing d965b6c3e7
fix: not clear access rights when the password of private posts or categories was changed (#1540)
* fix: 1518

* feat: add test case

* fix: remove unused import clause

* fix: unit test case
2021-11-22 09:10:59 +08:00
guqing 2ed5ef51c5
feat: add api for modifying journal comment content (#1536)
* feat: add api of modify comment content

* fix: remove update comment content api

* fix: remove comment content param
2021-11-18 20:29:21 +08:00
guqing c149d53f7e
feat: support photo likes (#1537)
* feat: support photo likes

* feat: add CacheLock annotation to likes api
2021-11-18 20:28:32 +08:00
guqing e1737145ac
fix: content Search page XSS injection problem (#1534) 2021-11-16 21:42:46 +08:00
guqing 641e03e401
Support querying multi post statuses (#1527)
* feat: post page list supports multiple status queries
2021-11-14 18:48:47 +08:00
guqing 62c84e9215
Fix the problem of updating categories and menus in batch (#1526)
* fix: batch update
2021-11-13 22:48:36 +08:00
stackcn c3536cb8ce
fix: typo (#1516) 2021-11-03 10:36:40 +08:00
扶醉 58d1b3f9c0
Add photo teams api in content api (#1515) 2021-11-02 22:09:31 +08:00
guqing 1d91450505
refactor: the naming method of uploaded attachments (#1500)
* feat: Refactor the naming method of uploaded attachments

* refactor: attachment upload parameter

* refactor: 重构文件名称是否重复的判断方式

* refactor: the usage of file path descriptor

* fix: remove blank line

* feat: add more test case

* fix: file base name in FilePathDescriptor

* Revert "refactor: the usage of file path descriptor"

This reverts commit b46ff3b4
2021-10-29 19:36:37 +08:00