mirror of
https://github.com/eiblog/eiblog.git
synced 2026-02-04 13:52:26 +08:00
chore: optimize variable naming
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -19,3 +19,4 @@ backend
|
|||||||
# vendor/
|
# vendor/
|
||||||
bin
|
bin
|
||||||
assets/*.*
|
assets/*.*
|
||||||
|
db.sqlite
|
||||||
|
|||||||
14
CHANGELOG.md
14
CHANGELOG.md
@@ -2,20 +2,6 @@
|
|||||||
|
|
||||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||||
|
|
||||||
### [2.1.18](https://github.com/eiblog/eiblog/compare/v2.1.17...v2.1.18) (2023-01-05)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* 1. template read panic ([f6d8656](https://github.com/eiblog/eiblog/commit/f6d8656c83591584581383643d109611d7ed2caa))
|
|
||||||
|
|
||||||
### [2.1.17](https://github.com/eiblog/eiblog/compare/v2.1.16...v2.1.17) (2023-01-04)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **disqus:** failed to commit disqus comments ([a9e8e39](https://github.com/eiblog/eiblog/commit/a9e8e39d342488ec46175997f3df9ab109f2fecf))
|
|
||||||
|
|
||||||
### [2.1.16](https://github.com/eiblog/eiblog/compare/v2.1.15...v2.1.16) (2022-11-20)
|
### [2.1.16](https://github.com/eiblog/eiblog/compare/v2.1.15...v2.1.16) (2022-11-20)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ func handleAdminProfile(c *gin.Context) {
|
|||||||
renderHTMLAdminLayout(c, "admin-profile", params)
|
renderHTMLAdminLayout(c, "admin-profile", params)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// T tag struct
|
||||||
type T struct {
|
type T struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Tags string `json:"tags"`
|
Tags string `json:"tags"`
|
||||||
|
|||||||
@@ -222,7 +222,7 @@ func handleDisqusList(c *gin.Context) {
|
|||||||
ID: v.ID,
|
ID: v.ID,
|
||||||
Name: v.Author.Name,
|
Name: v.Author.Name,
|
||||||
Parent: v.Parent,
|
Parent: v.Parent,
|
||||||
Url: v.Author.ProfileUrl,
|
URL: v.Author.ProfileURL,
|
||||||
Avatar: v.Author.Avatar.Cache,
|
Avatar: v.Author.Avatar.Cache,
|
||||||
CreatedAtStr: tools.ConvertStr(v.CreatedAt),
|
CreatedAtStr: tools.ConvertStr(v.CreatedAt),
|
||||||
Message: v.Message,
|
Message: v.Message,
|
||||||
@@ -261,7 +261,7 @@ type commentsDetail struct {
|
|||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Parent int `json:"parent"`
|
Parent int `json:"parent"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Url string `json:"url"`
|
URL string `json:"url"`
|
||||||
Avatar string `json:"avatar"`
|
Avatar string `json:"avatar"`
|
||||||
CreatedAtStr string `json:"createdAtStr"`
|
CreatedAtStr string `json:"createdAtStr"`
|
||||||
Message string `json:"message"`
|
Message string `json:"message"`
|
||||||
@@ -292,7 +292,7 @@ func handleDisqusCreate(c *gin.Context) {
|
|||||||
AuthorEmail: email,
|
AuthorEmail: email,
|
||||||
AuthorName: name,
|
AuthorName: name,
|
||||||
Identifier: identifier,
|
Identifier: identifier,
|
||||||
IpAddress: c.ClientIP(),
|
IPAddress: c.ClientIP(),
|
||||||
}
|
}
|
||||||
postDetail, err := internal.PostCreate(&comment)
|
postDetail, err := internal.PostCreate(&comment)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -312,7 +312,7 @@ func handleDisqusCreate(c *gin.Context) {
|
|||||||
ID: postDetail.Response.ID,
|
ID: postDetail.Response.ID,
|
||||||
Name: name,
|
Name: name,
|
||||||
Parent: postDetail.Response.Parent,
|
Parent: postDetail.Response.Parent,
|
||||||
Url: postDetail.Response.Author.ProfileUrl,
|
URL: postDetail.Response.Author.ProfileURL,
|
||||||
Avatar: postDetail.Response.Author.Avatar.Cache,
|
Avatar: postDetail.Response.Author.Avatar.Cache,
|
||||||
CreatedAtStr: tools.ConvertStr(postDetail.Response.CreatedAt),
|
CreatedAtStr: tools.ConvertStr(postDetail.Response.CreatedAt),
|
||||||
Message: postDetail.Response.Message,
|
Message: postDetail.Response.Message,
|
||||||
|
|||||||
@@ -95,8 +95,8 @@ func PostsCount(articles map[string]*model.Article) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// postsListResp 获取评论列表
|
// PostsListResp 获取评论列表
|
||||||
type postsListResp struct {
|
type PostsListResp struct {
|
||||||
Cursor struct {
|
Cursor struct {
|
||||||
HasNext bool
|
HasNext bool
|
||||||
Next string
|
Next string
|
||||||
@@ -113,7 +113,7 @@ type postDetail struct {
|
|||||||
IsDeleted bool
|
IsDeleted bool
|
||||||
Author struct {
|
Author struct {
|
||||||
Name string
|
Name string
|
||||||
ProfileUrl string
|
ProfileURL string
|
||||||
Avatar struct {
|
Avatar struct {
|
||||||
Cache string
|
Cache string
|
||||||
}
|
}
|
||||||
@@ -122,7 +122,7 @@ type postDetail struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// PostsList 评论列表
|
// PostsList 评论列表
|
||||||
func PostsList(slug, cursor string) (*postsListResp, error) {
|
func PostsList(slug, cursor string) (*PostsListResp, error) {
|
||||||
if err := checkDisqusConfig(); err != nil {
|
if err := checkDisqusConfig(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -148,7 +148,7 @@ func PostsList(slug, cursor string) (*postsListResp, error) {
|
|||||||
return nil, errors.New(string(b))
|
return nil, errors.New(string(b))
|
||||||
}
|
}
|
||||||
|
|
||||||
result := &postsListResp{}
|
result := &PostsListResp{}
|
||||||
err = json.Unmarshal(b, result)
|
err = json.Unmarshal(b, result)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -163,18 +163,19 @@ type PostComment struct {
|
|||||||
Thread string
|
Thread string
|
||||||
AuthorEmail string
|
AuthorEmail string
|
||||||
AuthorName string
|
AuthorName string
|
||||||
IpAddress string
|
IPAddress string
|
||||||
Identifier string
|
Identifier string
|
||||||
UserAgent string
|
UserAgent string
|
||||||
}
|
}
|
||||||
|
|
||||||
type postCreateResp struct {
|
// PostCreateResp create comments resp
|
||||||
|
type PostCreateResp struct {
|
||||||
Code int
|
Code int
|
||||||
Response postDetail
|
Response postDetail
|
||||||
}
|
}
|
||||||
|
|
||||||
// PostCreate 评论文章
|
// PostCreate 评论文章
|
||||||
func PostCreate(pc *PostComment) (*postCreateResp, error) {
|
func PostCreate(pc *PostComment) (*PostCreateResp, error) {
|
||||||
if err := checkDisqusConfig(); err != nil {
|
if err := checkDisqusConfig(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -201,7 +202,7 @@ func PostCreate(pc *PostComment) (*postCreateResp, error) {
|
|||||||
if resp.StatusCode != http.StatusOK {
|
if resp.StatusCode != http.StatusOK {
|
||||||
return nil, errors.New(string(b))
|
return nil, errors.New(string(b))
|
||||||
}
|
}
|
||||||
result := &postCreateResp{}
|
result := &PostCreateResp{}
|
||||||
err = json.Unmarshal(b, result)
|
err = json.Unmarshal(b, result)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
Reference in New Issue
Block a user