mirror of
https://github.com/eiblog/eiblog.git
synced 2026-02-12 09:22:27 +08:00
chore: bump go version: v1.23.0
This commit is contained in:
@@ -6,7 +6,7 @@ import (
|
||||
"github.com/gin-contrib/sessions"
|
||||
"github.com/gin-contrib/sessions/cookie"
|
||||
"github.com/gin-gonic/gin"
|
||||
uuid "github.com/satori/go.uuid"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
// SessionOpts 设置选项
|
||||
@@ -40,7 +40,7 @@ func UserMiddleware() gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
cookie, err := c.Cookie("u")
|
||||
if err != nil || cookie == "" {
|
||||
u1 := uuid.NewV4().String()
|
||||
u1 := uuid.New().String()
|
||||
c.SetCookie("u", u1, 86400*730, "/", "", true, true)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
|
||||
"github.com/eiblog/eiblog/pkg/config"
|
||||
"github.com/eiblog/eiblog/pkg/model"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// disqus api
|
||||
@@ -179,6 +180,10 @@ type PostCreateResp struct {
|
||||
|
||||
// PostCreate 评论文章
|
||||
func (cli *DisqusClient) PostCreate(pc *PostComment) (*PostCreateResp, error) {
|
||||
if cli == nil {
|
||||
return nil, errors.New("disqus client is nil, please init")
|
||||
}
|
||||
|
||||
vals := url.Values{}
|
||||
vals.Set("api_key", disqusAPIKey)
|
||||
vals.Set("message", pc.Message)
|
||||
@@ -226,6 +231,11 @@ type approvedResp struct {
|
||||
|
||||
// PostApprove 批准评论
|
||||
func (cli *DisqusClient) PostApprove(post string) error {
|
||||
if cli == nil {
|
||||
logrus.Warnf("disqus client is nil, please init")
|
||||
return nil
|
||||
}
|
||||
|
||||
vals := url.Values{}
|
||||
vals.Set("api_key", disqusAPIKey)
|
||||
vals.Set("access_token", cli.Conf.AccessToken)
|
||||
@@ -266,6 +276,10 @@ type threadCreateResp struct {
|
||||
|
||||
// ThreadCreate 创建thread
|
||||
func (cli *DisqusClient) ThreadCreate(article *model.Article, btitle string) error {
|
||||
if cli == nil {
|
||||
return errors.New("disqus client is nil, please init")
|
||||
}
|
||||
|
||||
vals := url.Values{}
|
||||
vals.Set("api_key", disqusAPIKey)
|
||||
vals.Set("access_token", cli.Conf.AccessToken)
|
||||
@@ -315,6 +329,10 @@ type threadDetailsResp struct {
|
||||
|
||||
// ThreadDetails thread详细
|
||||
func (cli *DisqusClient) ThreadDetails(article *model.Article) error {
|
||||
if cli == nil {
|
||||
return errors.New("disqus client is nil, please init")
|
||||
}
|
||||
|
||||
vals := url.Values{}
|
||||
vals.Set("api_key", disqusAPIKey)
|
||||
vals.Set("access_token", cli.Conf.AccessToken)
|
||||
|
||||
Reference in New Issue
Block a user