mirror of
https://github.com/eiblog/eiblog.git
synced 2026-02-09 08:02:26 +08:00
chore: rename blog->eiblog
This commit is contained in:
@@ -24,9 +24,9 @@ const (
|
||||
)
|
||||
|
||||
func checkDisqusConfig() error {
|
||||
if config.Conf.BlogApp.Disqus.ShortName != "" &&
|
||||
config.Conf.BlogApp.Disqus.PublicKey != "" &&
|
||||
config.Conf.BlogApp.Disqus.AccessToken != "" {
|
||||
if config.Conf.EiBlogApp.Disqus.ShortName != "" &&
|
||||
config.Conf.EiBlogApp.Disqus.PublicKey != "" &&
|
||||
config.Conf.EiBlogApp.Disqus.AccessToken != "" {
|
||||
return nil
|
||||
}
|
||||
return errors.New("disqus: config incompleted")
|
||||
@@ -49,8 +49,8 @@ func PostsCount(articles map[string]*model.Article) error {
|
||||
}
|
||||
|
||||
vals := url.Values{}
|
||||
vals.Set("api_key", config.Conf.BlogApp.Disqus.PublicKey)
|
||||
vals.Set("forum", config.Conf.BlogApp.Disqus.ShortName)
|
||||
vals.Set("api_key", config.Conf.EiBlogApp.Disqus.PublicKey)
|
||||
vals.Set("forum", config.Conf.EiBlogApp.Disqus.ShortName)
|
||||
// batch get
|
||||
var count, index int
|
||||
for _, article := range articles {
|
||||
@@ -128,8 +128,8 @@ func PostsList(slug, cursor string) (*postsListResp, error) {
|
||||
}
|
||||
|
||||
vals := url.Values{}
|
||||
vals.Set("api_key", config.Conf.BlogApp.Disqus.PublicKey)
|
||||
vals.Set("forum", config.Conf.BlogApp.Disqus.ShortName)
|
||||
vals.Set("api_key", config.Conf.EiBlogApp.Disqus.PublicKey)
|
||||
vals.Set("forum", config.Conf.EiBlogApp.Disqus.ShortName)
|
||||
vals.Set("thread:ident", "post-"+slug)
|
||||
vals.Set("cursor", cursor)
|
||||
vals.Set("limit", "50")
|
||||
@@ -224,8 +224,8 @@ func PostApprove(post string) error {
|
||||
}
|
||||
|
||||
vals := url.Values{}
|
||||
vals.Set("api_key", config.Conf.BlogApp.Disqus.PublicKey)
|
||||
vals.Set("access_token", config.Conf.BlogApp.Disqus.AccessToken)
|
||||
vals.Set("api_key", config.Conf.EiBlogApp.Disqus.PublicKey)
|
||||
vals.Set("access_token", config.Conf.EiBlogApp.Disqus.AccessToken)
|
||||
vals.Set("post", post)
|
||||
|
||||
header := http.Header{"Referer": {"https://disqus.com"}}
|
||||
@@ -263,13 +263,13 @@ func ThreadCreate(article *model.Article, btitle string) error {
|
||||
}
|
||||
|
||||
vals := url.Values{}
|
||||
vals.Set("api_key", config.Conf.BlogApp.Disqus.PublicKey)
|
||||
vals.Set("access_token", config.Conf.BlogApp.Disqus.AccessToken)
|
||||
vals.Set("forum", config.Conf.BlogApp.Disqus.ShortName)
|
||||
vals.Set("api_key", config.Conf.EiBlogApp.Disqus.PublicKey)
|
||||
vals.Set("access_token", config.Conf.EiBlogApp.Disqus.AccessToken)
|
||||
vals.Set("forum", config.Conf.EiBlogApp.Disqus.ShortName)
|
||||
vals.Set("title", article.Title+" | "+btitle)
|
||||
vals.Set("identifier", "post-"+article.Slug)
|
||||
|
||||
urlPath := fmt.Sprintf("https://%s/post/%s.html", config.Conf.BlogApp.Host, article.Slug)
|
||||
urlPath := fmt.Sprintf("https://%s/post/%s.html", config.Conf.EiBlogApp.Host, article.Slug)
|
||||
vals.Set("url", urlPath)
|
||||
|
||||
resp, err := httpPost(apiThreadCreate, vals)
|
||||
|
||||
@@ -16,7 +16,7 @@ import (
|
||||
|
||||
// feedrPingFunc http://<your-hub-name>.superfeedr.com/
|
||||
var feedrPingFunc = func(btitle, slug string) error {
|
||||
feedrHost := config.Conf.BlogApp.FeedRPC.FeedrURL
|
||||
feedrHost := config.Conf.EiBlogApp.FeedRPC.FeedrURL
|
||||
if feedrHost == "" {
|
||||
return nil
|
||||
}
|
||||
@@ -61,15 +61,15 @@ type rpcValue struct {
|
||||
|
||||
// rpcPingFunc ping rpc
|
||||
var rpcPingFunc = func(btitle, slug string) error {
|
||||
if len(config.Conf.BlogApp.FeedRPC.PingRPC) == 0 {
|
||||
if len(config.Conf.EiBlogApp.FeedRPC.PingRPC) == 0 {
|
||||
return nil
|
||||
}
|
||||
param := rpcPingParam{MethodName: "weblogUpdates.extendedPing"}
|
||||
param.Params.Param = [4]rpcValue{
|
||||
0: rpcValue{Value: btitle},
|
||||
1: rpcValue{Value: "https://" + config.Conf.BlogApp.Host},
|
||||
2: rpcValue{Value: fmt.Sprintf("https://%s/post/%s.html", config.Conf.BlogApp.Host, slug)},
|
||||
3: rpcValue{Value: "https://" + config.Conf.BlogApp.Host + "/rss.html"},
|
||||
1: rpcValue{Value: "https://" + config.Conf.EiBlogApp.Host},
|
||||
2: rpcValue{Value: fmt.Sprintf("https://%s/post/%s.html", config.Conf.EiBlogApp.Host, slug)},
|
||||
3: rpcValue{Value: "https://" + config.Conf.EiBlogApp.Host + "/rss.html"},
|
||||
}
|
||||
buf := bytes.Buffer{}
|
||||
buf.WriteString(xml.Header)
|
||||
@@ -80,7 +80,7 @@ var rpcPingFunc = func(btitle, slug string) error {
|
||||
data := buf.Bytes()
|
||||
header := http.Header{}
|
||||
header.Set("Content-Type", "text/xml")
|
||||
for _, addr := range config.Conf.BlogApp.FeedRPC.PingRPC {
|
||||
for _, addr := range config.Conf.EiBlogApp.FeedRPC.PingRPC {
|
||||
resp, err := httpPostHeader(addr, data, header)
|
||||
if err != nil {
|
||||
logrus.Error("rpcPingFunc.httpPostHeader: ", err)
|
||||
|
||||
@@ -15,17 +15,17 @@ import (
|
||||
|
||||
// QiniuUpload 上传文件
|
||||
func QiniuUpload(name string, size int64, data io.Reader) (string, error) {
|
||||
if config.Conf.BlogApp.Qiniu.AccessKey == "" ||
|
||||
config.Conf.BlogApp.Qiniu.SecretKey == "" {
|
||||
if config.Conf.EiBlogApp.Qiniu.AccessKey == "" ||
|
||||
config.Conf.EiBlogApp.Qiniu.SecretKey == "" {
|
||||
return "", errors.New("qiniu config error")
|
||||
}
|
||||
key := completeQiniuKey(name)
|
||||
|
||||
mac := qbox.NewMac(config.Conf.BlogApp.Qiniu.AccessKey,
|
||||
config.Conf.BlogApp.Qiniu.SecretKey)
|
||||
mac := qbox.NewMac(config.Conf.EiBlogApp.Qiniu.AccessKey,
|
||||
config.Conf.EiBlogApp.Qiniu.SecretKey)
|
||||
// 设置上传策略
|
||||
putPolicy := &storage.PutPolicy{
|
||||
Scope: config.Conf.BlogApp.Qiniu.Bucket,
|
||||
Scope: config.Conf.EiBlogApp.Qiniu.Bucket,
|
||||
Expires: 3600,
|
||||
InsertOnly: 1,
|
||||
}
|
||||
@@ -46,7 +46,7 @@ func QiniuUpload(name string, size int64, data io.Reader) (string, error) {
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
url := "https://" + config.Conf.BlogApp.Qiniu.Domain + "/" + key
|
||||
url := "https://" + config.Conf.EiBlogApp.Qiniu.Domain + "/" + key
|
||||
return url, nil
|
||||
}
|
||||
|
||||
@@ -54,8 +54,8 @@ func QiniuUpload(name string, size int64, data io.Reader) (string, error) {
|
||||
func QiniuDelete(name string) error {
|
||||
key := completeQiniuKey(name)
|
||||
|
||||
mac := qbox.NewMac(config.Conf.BlogApp.Qiniu.AccessKey,
|
||||
config.Conf.BlogApp.Qiniu.SecretKey)
|
||||
mac := qbox.NewMac(config.Conf.EiBlogApp.Qiniu.AccessKey,
|
||||
config.Conf.EiBlogApp.Qiniu.SecretKey)
|
||||
// 上传配置
|
||||
cfg := &storage.Config{
|
||||
Zone: &storage.ZoneHuadong,
|
||||
@@ -64,7 +64,7 @@ func QiniuDelete(name string) error {
|
||||
// manager
|
||||
bucketManager := storage.NewBucketManager(mac, cfg)
|
||||
// Delete
|
||||
return bucketManager.Delete(config.Conf.BlogApp.Qiniu.Bucket, key)
|
||||
return bucketManager.Delete(config.Conf.EiBlogApp.Qiniu.Bucket, key)
|
||||
}
|
||||
|
||||
// completeQiniuKey 修复路径
|
||||
|
||||
Reference in New Issue
Block a user