Skip to content

Add APIs to fetch theme info and settings according to the theme id#1660

Merged
JohnNiang merged 1 commit intohalo-dev:masterfrom
guqing:feature/1659
Feb 18, 2022
Merged

Add APIs to fetch theme info and settings according to the theme id#1660
JohnNiang merged 1 commit intohalo-dev:masterfrom
guqing:feature/1659

Conversation

@guqing
Copy link
Member

@guqing guqing commented Feb 18, 2022

What this PR does?

Add api to fetch theme info and settings according to the themeId

Why we need it?

Close #1659

How to test it?

  1. 拉取该PR运行
  2. 登陆后台设置api key为:12345678
  3. 测试接口

获取主题信息:

➤ curl -g -i -X GET http://127.0.0.1:8090/api/content/themes/caicai_anatole -H "API-Authorization: 12345678" -H "Content-Type: application/json"
HTTP/1.1 200 OK
Date: Fri, 18 Feb 2022 05:08:17 GMT
Access-Control-Allow-Headers: Content-Type,ADMIN-Authorization,API-Authorization
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
Access-Control-Allow-Credentials: true
Access-Control-Max-Age: 3600
Content-Type: application/json
Vary: Accept-Encoding, User-Agent
Transfer-Encoding: chunked

{"status":200,"message":"OK","devMessage":null,"data":{"id":"caicai_anatole","name":"Anatole","website":"https://github.com/halo-dev/halo-theme-anatole","branch":"master","repo":"https://github.com/halo-dev/halo-theme-anatole","updateStrategy":"RELEASE","description":"A other Halo theme","logo":"https://avatars1.githubusercontent.com/u/1811819?s=460&v=4","version":"1.2.0","require":"1.3.0","author":{"name":"Caicai","website":"https://www.caicai.me","avatar":null},"themePath":"/Users/guqing/halo-dev/templates/themes/caicai_anatole","folderName":"caicai_anatole","hasOptions":true,"screenshots":"/themes/caicai_anatole/screenshot.png","postMetaField":null,"sheetMetaField":null,"activated":true}}

获取主题配置:

➤ curl -g -i -X GET http://127.0.0.1:8090/api/content/themes/caicai_anatole/settings -H "API-Authorization: 12345678" -H "Content-Type: application/json"
HTTP/1.1 200 OK
Date: Fri, 18 Feb 2022 05:09:47 GMT
Access-Control-Allow-Headers: Content-Type,ADMIN-Authorization,API-Authorization
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
Access-Control-Allow-Credentials: true
Access-Control-Max-Age: 3600
Content-Type: application/json
Vary: Accept-Encoding, User-Agent
Transfer-Encoding: chunked

{"status":200,"message":"OK","devMessage":null,"data":{"post_title_uppper":true,"scrollbar":"#3798e8","avatar_circle":true,"blog_title_uppper":true,"hitokoto":false,"rss":true,"google_color":"#fff","code_pretty":""}}

@guqing guqing requested review from JohnNiang and ruibaby February 18, 2022 05:10
@ruibaby ruibaby requested a review from wan92hen February 18, 2022 05:11
@JohnNiang JohnNiang changed the title Add a api of according to the themeId Add APIs to fetch theme info and settings according to the theme id Feb 18, 2022
Copy link
Member

@JohnNiang JohnNiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@JohnNiang JohnNiang merged commit 15bde8e into halo-dev:master Feb 18, 2022
@guqing guqing deleted the feature/1659 branch May 24, 2022 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

希望在Content API中提供通过themeId查询主题信息及配置的接口

2 participants