mirror of
https://github.com/eiblog/eiblog.git
synced 2026-02-04 13:52:26 +08:00
chore: rename blog->eiblog
This commit is contained in:
6
Makefile
6
Makefile
@@ -10,9 +10,9 @@ _app:
|
|||||||
|
|
||||||
# below you should write
|
# below you should write
|
||||||
|
|
||||||
# run blog app
|
# run eiblog app
|
||||||
blog:
|
eiblog:
|
||||||
@scripts/run_app.sh blog
|
@scripts/run_app.sh eiblog
|
||||||
|
|
||||||
# run backup app
|
# run backup app
|
||||||
backup:
|
backup:
|
||||||
|
|||||||
@@ -6,11 +6,11 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/eiblog/eiblog/pkg/config"
|
"github.com/eiblog/eiblog/pkg/config"
|
||||||
"github.com/eiblog/eiblog/pkg/core/blog"
|
"github.com/eiblog/eiblog/pkg/core/eiblog"
|
||||||
"github.com/eiblog/eiblog/pkg/core/blog/admin"
|
"github.com/eiblog/eiblog/pkg/core/eiblog/admin"
|
||||||
"github.com/eiblog/eiblog/pkg/core/blog/file"
|
"github.com/eiblog/eiblog/pkg/core/eiblog/file"
|
||||||
"github.com/eiblog/eiblog/pkg/core/blog/page"
|
"github.com/eiblog/eiblog/pkg/core/eiblog/page"
|
||||||
"github.com/eiblog/eiblog/pkg/core/blog/swag"
|
"github.com/eiblog/eiblog/pkg/core/eiblog/swag"
|
||||||
"github.com/eiblog/eiblog/pkg/mid"
|
"github.com/eiblog/eiblog/pkg/mid"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
@@ -26,7 +26,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func runHTTPServer(endRun chan bool) {
|
func runHTTPServer(endRun chan bool) {
|
||||||
if !config.Conf.BlogApp.EnableHTTP {
|
if !config.Conf.EiBlogApp.EnableHTTP {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,14 +57,14 @@ func runHTTPServer(endRun chan bool) {
|
|||||||
admin.RegisterRoutes(e)
|
admin.RegisterRoutes(e)
|
||||||
|
|
||||||
// admin router
|
// admin router
|
||||||
group := e.Group("/admin", blog.AuthFilter)
|
group := e.Group("/admin", eiblog.AuthFilter)
|
||||||
{
|
{
|
||||||
page.RegisterRoutesAuthz(group)
|
page.RegisterRoutesAuthz(group)
|
||||||
admin.RegisterRoutesAuthz(group)
|
admin.RegisterRoutesAuthz(group)
|
||||||
}
|
}
|
||||||
|
|
||||||
// start
|
// start
|
||||||
address := fmt.Sprintf(":%d", config.Conf.BlogApp.HTTPPort)
|
address := fmt.Sprintf(":%d", config.Conf.EiBlogApp.HTTPPort)
|
||||||
go e.Run(address)
|
go e.Run(address)
|
||||||
fmt.Println("HTTP server running on: " + address)
|
fmt.Println("HTTP server running on: " + address)
|
||||||
}
|
}
|
||||||
@@ -3,9 +3,9 @@ database:
|
|||||||
driver: mongodb
|
driver: mongodb
|
||||||
source: mongodb://localhost:27017
|
source: mongodb://localhost:27017
|
||||||
eshost: http://localhost:9200
|
eshost: http://localhost:9200
|
||||||
blogapp:
|
eiblogapp:
|
||||||
mode:
|
mode:
|
||||||
name: cmd-blog
|
name: cmd-eiblog
|
||||||
enablehttp: true
|
enablehttp: true
|
||||||
httpport: 9000
|
httpport: 9000
|
||||||
host: example.com
|
host: example.com
|
||||||
|
|||||||
16
pkg/cache/cache.go
vendored
16
pkg/cache/cache.go
vendored
@@ -35,7 +35,7 @@ func init() {
|
|||||||
// init timezone
|
// init timezone
|
||||||
var err error
|
var err error
|
||||||
tools.TimeLocation, err = time.LoadLocation(
|
tools.TimeLocation, err = time.LoadLocation(
|
||||||
config.Conf.BlogApp.General.Timezone)
|
config.Conf.EiBlogApp.General.Timezone)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
@@ -106,7 +106,7 @@ func (c *Cache) RepArticle(oldArticle, newArticle *model.Article) {
|
|||||||
|
|
||||||
c.ArticlesMap[newArticle.Slug] = newArticle
|
c.ArticlesMap[newArticle.Slug] = newArticle
|
||||||
render.GenerateExcerptMarkdown(newArticle)
|
render.GenerateExcerptMarkdown(newArticle)
|
||||||
if newArticle.ID < config.Conf.BlogApp.General.StartID {
|
if newArticle.ID < config.Conf.EiBlogApp.General.StartID {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if oldArticle != nil { // 移除旧文章
|
if oldArticle != nil { // 移除旧文章
|
||||||
@@ -179,7 +179,7 @@ func (c *Cache) PageArticleFE(page int, pageSize int) (prev,
|
|||||||
|
|
||||||
var l int
|
var l int
|
||||||
for l = len(c.Articles); l > 0; l-- {
|
for l = len(c.Articles); l > 0; l-- {
|
||||||
if c.Articles[l-1].ID >= config.Conf.BlogApp.General.StartID {
|
if c.Articles[l-1].ID >= config.Conf.EiBlogApp.General.StartID {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -293,11 +293,11 @@ func (c *Cache) recalcLinkedList(article *model.Article, del bool) {
|
|||||||
// 添加操作
|
// 添加操作
|
||||||
_, idx := c.FindArticleByID(article.ID)
|
_, idx := c.FindArticleByID(article.ID)
|
||||||
if idx == 0 && c.Articles[idx+1].ID >=
|
if idx == 0 && c.Articles[idx+1].ID >=
|
||||||
config.Conf.BlogApp.General.StartID {
|
config.Conf.EiBlogApp.General.StartID {
|
||||||
article.Next = c.Articles[idx+1]
|
article.Next = c.Articles[idx+1]
|
||||||
c.Articles[idx+1].Prev = article
|
c.Articles[idx+1].Prev = article
|
||||||
} else if idx > 0 && c.Articles[idx-1].ID >=
|
} else if idx > 0 && c.Articles[idx-1].ID >=
|
||||||
config.Conf.BlogApp.General.StartID {
|
config.Conf.EiBlogApp.General.StartID {
|
||||||
article.Prev = c.Articles[idx-1]
|
article.Prev = c.Articles[idx-1]
|
||||||
if c.Articles[idx-1].Next != nil {
|
if c.Articles[idx-1].Next != nil {
|
||||||
article.Next = c.Articles[idx-1].Next
|
article.Next = c.Articles[idx-1].Next
|
||||||
@@ -395,7 +395,7 @@ func (c *Cache) redelArticle(article *model.Article) {
|
|||||||
|
|
||||||
// loadOrInit 读取数据或初始化
|
// loadOrInit 读取数据或初始化
|
||||||
func (c *Cache) loadOrInit() error {
|
func (c *Cache) loadOrInit() error {
|
||||||
blogapp := config.Conf.BlogApp
|
blogapp := config.Conf.EiBlogApp
|
||||||
// blogger
|
// blogger
|
||||||
blogger := &model.Blogger{
|
blogger := &model.Blogger{
|
||||||
BlogName: strings.Title(blogapp.Account.Username),
|
BlogName: strings.Title(blogapp.Account.Username),
|
||||||
@@ -552,7 +552,7 @@ func (c *Cache) regeneratePages() {
|
|||||||
|
|
||||||
// timerClean 定时清理文章
|
// timerClean 定时清理文章
|
||||||
func (c *Cache) timerClean() {
|
func (c *Cache) timerClean() {
|
||||||
dur := time.Duration(config.Conf.BlogApp.General.Clean)
|
dur := time.Duration(config.Conf.EiBlogApp.General.Clean)
|
||||||
ticker := time.NewTicker(dur * time.Hour)
|
ticker := time.NewTicker(dur * time.Hour)
|
||||||
|
|
||||||
for range ticker.C {
|
for range ticker.C {
|
||||||
@@ -565,7 +565,7 @@ func (c *Cache) timerClean() {
|
|||||||
|
|
||||||
// timerDisqus disqus定时操作
|
// timerDisqus disqus定时操作
|
||||||
func (c *Cache) timerDisqus() {
|
func (c *Cache) timerDisqus() {
|
||||||
dur := time.Duration(config.Conf.BlogApp.Disqus.Interval)
|
dur := time.Duration(config.Conf.EiBlogApp.Disqus.Interval)
|
||||||
ticker := time.NewTicker(dur * time.Hour)
|
ticker := time.NewTicker(dur * time.Hour)
|
||||||
|
|
||||||
for range ticker.C {
|
for range ticker.C {
|
||||||
|
|||||||
4
pkg/cache/render/render.go
vendored
4
pkg/cache/render/render.go
vendored
@@ -36,7 +36,7 @@ const (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
// 渲染markdown操作和截取摘要操作
|
// 渲染markdown操作和截取摘要操作
|
||||||
regIdentifier = regexp.MustCompile(config.Conf.BlogApp.General.Identifier)
|
regIdentifier = regexp.MustCompile(config.Conf.EiBlogApp.General.Identifier)
|
||||||
// header
|
// header
|
||||||
regHeader = regexp.MustCompile("</nav></div>")
|
regHeader = regexp.MustCompile("</nav></div>")
|
||||||
)
|
)
|
||||||
@@ -60,7 +60,7 @@ func RenderPage(md []byte) []byte {
|
|||||||
|
|
||||||
// GenerateExcerptMarkdown 生成预览和描述
|
// GenerateExcerptMarkdown 生成预览和描述
|
||||||
func GenerateExcerptMarkdown(article *model.Article) {
|
func GenerateExcerptMarkdown(article *model.Article) {
|
||||||
blogapp := config.Conf.BlogApp
|
blogapp := config.Conf.EiBlogApp
|
||||||
|
|
||||||
if strings.HasPrefix(article.Content, blogapp.General.DescPrefix) {
|
if strings.HasPrefix(article.Content, blogapp.General.DescPrefix) {
|
||||||
index := strings.Index(article.Content, "\r\n")
|
index := strings.Index(article.Content, "\r\n")
|
||||||
|
|||||||
6
pkg/cache/store/mongodb.go
vendored
6
pkg/cache/store/mongodb.go
vendored
@@ -117,7 +117,7 @@ func (db *mongodb) LoadInsertAccount(ctx context.Context,
|
|||||||
|
|
||||||
collection := db.Database(mongoDBName).Collection(collectionAccount)
|
collection := db.Database(mongoDBName).Collection(collectionAccount)
|
||||||
|
|
||||||
filter := bson.M{"username": config.Conf.BlogApp.Account.Username}
|
filter := bson.M{"username": config.Conf.EiBlogApp.Account.Username}
|
||||||
result := collection.FindOne(ctx, filter)
|
result := collection.FindOne(ctx, filter)
|
||||||
err = result.Err()
|
err = result.Err()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -211,7 +211,7 @@ func (db *mongodb) InsertArticle(ctx context.Context, article *model.Article) er
|
|||||||
// 可手动分配ID或者分配ID, 占位至起始id
|
// 可手动分配ID或者分配ID, 占位至起始id
|
||||||
for article.ID == 0 {
|
for article.ID == 0 {
|
||||||
id := db.nextValue(ctx, counterNameArticle)
|
id := db.nextValue(ctx, counterNameArticle)
|
||||||
if id < config.Conf.BlogApp.General.StartID {
|
if id < config.Conf.EiBlogApp.General.StartID {
|
||||||
continue
|
continue
|
||||||
} else {
|
} else {
|
||||||
article.ID = id
|
article.ID = id
|
||||||
@@ -236,7 +236,7 @@ func (db *mongodb) RemoveArticle(ctx context.Context, id int) error {
|
|||||||
func (db *mongodb) CleanArticles(ctx context.Context) error {
|
func (db *mongodb) CleanArticles(ctx context.Context) error {
|
||||||
collection := db.Database(mongoDBName).Collection(collectionArticle)
|
collection := db.Database(mongoDBName).Collection(collectionArticle)
|
||||||
|
|
||||||
exp := time.Now().Add(time.Duration(config.Conf.BlogApp.General.Trash) * time.Hour)
|
exp := time.Now().Add(time.Duration(config.Conf.EiBlogApp.General.Trash) * time.Hour)
|
||||||
filter := bson.M{"deleted_at": bson.M{"$gt": time.Time{}, "$lt": exp}}
|
filter := bson.M{"deleted_at": bson.M{"$gt": time.Time{}, "$lt": exp}}
|
||||||
_, err := collection.DeleteMany(ctx, filter)
|
_, err := collection.DeleteMany(ctx, filter)
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -107,8 +107,8 @@ type Blogger struct {
|
|||||||
Copyright string `yaml:"copyright"`
|
Copyright string `yaml:"copyright"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// BlogApp config
|
// EiBlogApp config
|
||||||
type BlogApp struct {
|
type EiBlogApp struct {
|
||||||
Mode
|
Mode
|
||||||
|
|
||||||
StaticVersion int `yaml:"staticversion"`
|
StaticVersion int `yaml:"staticversion"`
|
||||||
@@ -125,12 +125,12 @@ type BlogApp struct {
|
|||||||
|
|
||||||
// Config app config
|
// Config app config
|
||||||
type Config struct {
|
type Config struct {
|
||||||
RunMode string `yaml:"runmode"`
|
RunMode string `yaml:"runmode"`
|
||||||
AppName string `yaml:"appname"`
|
AppName string `yaml:"appname"`
|
||||||
Database Database `yaml:"database"`
|
Database Database `yaml:"database"`
|
||||||
ESHost string `yaml:"eshost"`
|
ESHost string `yaml:"eshost"`
|
||||||
BlogApp BlogApp `yaml:"blogapp"`
|
EiBlogApp EiBlogApp `yaml:"eiblogapp"`
|
||||||
BackupApp Mode `yaml:"backupapp"`
|
BackupApp Mode `yaml:"backupapp"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// load config file
|
// load config file
|
||||||
|
|||||||
8
pkg/core/backup/api.go
Normal file
8
pkg/core/backup/api.go
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
// Package backup provides ...
|
||||||
|
package backup
|
||||||
|
|
||||||
|
// @title APP Demo API
|
||||||
|
// @version 1.0
|
||||||
|
// @description This is a sample server celler server.
|
||||||
|
|
||||||
|
// @BasePath /api
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||||
// This file was generated by swaggo/swag at
|
// This file was generated by swaggo/swag at
|
||||||
// 2021-04-26 15:31:15.52194 +0800 CST m=+0.022347488
|
// 2021-04-29 11:12:59.387582 +0800 CST m=+0.016433684
|
||||||
|
|
||||||
package docs
|
package docs
|
||||||
|
|
||||||
@@ -12,7 +12,7 @@ import (
|
|||||||
|
|
||||||
"github.com/eiblog/eiblog/pkg/cache"
|
"github.com/eiblog/eiblog/pkg/cache"
|
||||||
"github.com/eiblog/eiblog/pkg/config"
|
"github.com/eiblog/eiblog/pkg/config"
|
||||||
"github.com/eiblog/eiblog/pkg/core/blog"
|
"github.com/eiblog/eiblog/pkg/core/eiblog"
|
||||||
"github.com/eiblog/eiblog/pkg/internal"
|
"github.com/eiblog/eiblog/pkg/internal"
|
||||||
"github.com/eiblog/eiblog/pkg/model"
|
"github.com/eiblog/eiblog/pkg/model"
|
||||||
"github.com/eiblog/eiblog/tools"
|
"github.com/eiblog/eiblog/tools"
|
||||||
@@ -67,7 +67,7 @@ func handleAcctLogin(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 登录成功
|
// 登录成功
|
||||||
blog.SetLogin(c, user)
|
eiblog.SetLogin(c, user)
|
||||||
|
|
||||||
cache.Ei.Account.LoginIP = c.ClientIP()
|
cache.Ei.Account.LoginIP = c.ClientIP()
|
||||||
cache.Ei.Account.LoginAt = time.Now()
|
cache.Ei.Account.LoginAt = time.Now()
|
||||||
@@ -197,7 +197,7 @@ func handleAPIPostDelete(c *gin.Context) {
|
|||||||
var ids []int
|
var ids []int
|
||||||
for _, v := range c.PostFormArray("cid[]") {
|
for _, v := range c.PostFormArray("cid[]") {
|
||||||
id, err := strconv.Atoi(v)
|
id, err := strconv.Atoi(v)
|
||||||
if err != nil || id < config.Conf.BlogApp.General.StartID {
|
if err != nil || id < config.Conf.EiBlogApp.General.StartID {
|
||||||
responseNotice(c, NoticeNotice, "参数错误", "")
|
responseNotice(c, NoticeNotice, "参数错误", "")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
// Package blog provides ...
|
// Package eiblog provides ...
|
||||||
package blog
|
package eiblog
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
65
pkg/core/eiblog/docs/docs.go
Normal file
65
pkg/core/eiblog/docs/docs.go
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||||
|
// This file was generated by swaggo/swag at
|
||||||
|
// 2021-04-29 11:12:59.414073 +0800 CST m=+0.019228292
|
||||||
|
|
||||||
|
package docs
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"encoding/json"
|
||||||
|
|
||||||
|
"github.com/alecthomas/template"
|
||||||
|
"github.com/swaggo/swag"
|
||||||
|
)
|
||||||
|
|
||||||
|
var doc = `{
|
||||||
|
"schemes": {{ marshal .Schemes }},
|
||||||
|
"swagger": "2.0",
|
||||||
|
"info": {
|
||||||
|
"description": "This is a sample server celler server.",
|
||||||
|
"title": "APP Demo API",
|
||||||
|
"contact": {},
|
||||||
|
"license": {},
|
||||||
|
"version": "1.0"
|
||||||
|
},
|
||||||
|
"host": "{{.Host}}",
|
||||||
|
"basePath": "/api",
|
||||||
|
"paths": {}
|
||||||
|
}`
|
||||||
|
|
||||||
|
type swaggerInfo struct {
|
||||||
|
Version string
|
||||||
|
Host string
|
||||||
|
BasePath string
|
||||||
|
Schemes []string
|
||||||
|
Title string
|
||||||
|
Description string
|
||||||
|
}
|
||||||
|
|
||||||
|
// SwaggerInfo holds exported Swagger Info so clients can modify it
|
||||||
|
var SwaggerInfo = swaggerInfo{ Schemes: []string{}}
|
||||||
|
|
||||||
|
type s struct{}
|
||||||
|
|
||||||
|
func (s *s) ReadDoc() string {
|
||||||
|
t, err := template.New("swagger_info").Funcs(template.FuncMap{
|
||||||
|
"marshal": func(v interface {}) string {
|
||||||
|
a, _ := json.Marshal(v)
|
||||||
|
return string(a)
|
||||||
|
},
|
||||||
|
}).Parse(doc)
|
||||||
|
if err != nil {
|
||||||
|
return doc
|
||||||
|
}
|
||||||
|
|
||||||
|
var tpl bytes.Buffer
|
||||||
|
if err := t.Execute(&tpl, SwaggerInfo); err != nil {
|
||||||
|
return doc
|
||||||
|
}
|
||||||
|
|
||||||
|
return tpl.String()
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
swag.Register(swag.Name, &s{})
|
||||||
|
}
|
||||||
13
pkg/core/eiblog/docs/swagger.json
Normal file
13
pkg/core/eiblog/docs/swagger.json
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"swagger": "2.0",
|
||||||
|
"info": {
|
||||||
|
"description": "This is a sample server celler server.",
|
||||||
|
"title": "APP Demo API",
|
||||||
|
"contact": {},
|
||||||
|
"license": {},
|
||||||
|
"version": "1.0"
|
||||||
|
},
|
||||||
|
"host": "{{.Host}}",
|
||||||
|
"basePath": "/api",
|
||||||
|
"paths": {}
|
||||||
|
}
|
||||||
10
pkg/core/eiblog/docs/swagger.yaml
Normal file
10
pkg/core/eiblog/docs/swagger.yaml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
basePath: /api
|
||||||
|
host: '{{.Host}}'
|
||||||
|
info:
|
||||||
|
contact: {}
|
||||||
|
description: This is a sample server celler server.
|
||||||
|
license: {}
|
||||||
|
title: APP Demo API
|
||||||
|
version: "1.0"
|
||||||
|
paths: {}
|
||||||
|
swagger: "2.0"
|
||||||
@@ -46,8 +46,8 @@ func timerFeed() {
|
|||||||
params := map[string]interface{}{
|
params := map[string]interface{}{
|
||||||
"Title": cache.Ei.Blogger.BTitle,
|
"Title": cache.Ei.Blogger.BTitle,
|
||||||
"SubTitle": cache.Ei.Blogger.SubTitle,
|
"SubTitle": cache.Ei.Blogger.SubTitle,
|
||||||
"Host": config.Conf.BlogApp.Host,
|
"Host": config.Conf.EiBlogApp.Host,
|
||||||
"FeedrURL": config.Conf.BlogApp.FeedRPC.FeedrURL,
|
"FeedrURL": config.Conf.EiBlogApp.FeedRPC.FeedrURL,
|
||||||
"BuildDate": now.Format(time.RFC1123Z),
|
"BuildDate": now.Format(time.RFC1123Z),
|
||||||
"Articles": articles,
|
"Articles": articles,
|
||||||
}
|
}
|
||||||
@@ -75,7 +75,7 @@ func timerSitemap() {
|
|||||||
|
|
||||||
params := map[string]interface{}{
|
params := map[string]interface{}{
|
||||||
"Articles": cache.Ei.Articles,
|
"Articles": cache.Ei.Articles,
|
||||||
"Host": config.Conf.BlogApp.Host,
|
"Host": config.Conf.EiBlogApp.Host,
|
||||||
}
|
}
|
||||||
f, err := os.OpenFile("assets/sitemap.xml", os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0666)
|
f, err := os.OpenFile("assets/sitemap.xml", os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0666)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -101,7 +101,7 @@ func generateOpensearch() {
|
|||||||
params := map[string]string{
|
params := map[string]string{
|
||||||
"BTitle": cache.Ei.Blogger.BTitle,
|
"BTitle": cache.Ei.Blogger.BTitle,
|
||||||
"SubTitle": cache.Ei.Blogger.SubTitle,
|
"SubTitle": cache.Ei.Blogger.SubTitle,
|
||||||
"Host": config.Conf.BlogApp.Host,
|
"Host": config.Conf.EiBlogApp.Host,
|
||||||
}
|
}
|
||||||
f, err := os.OpenFile("assets/opensearch.xml", os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0666)
|
f, err := os.OpenFile("assets/opensearch.xml", os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0666)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -124,7 +124,7 @@ func generateRobots() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
params := map[string]string{
|
params := map[string]string{
|
||||||
"Host": config.Conf.BlogApp.Host,
|
"Host": config.Conf.EiBlogApp.Host,
|
||||||
}
|
}
|
||||||
f, err := os.OpenFile("assets/robots.txt", os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0666)
|
f, err := os.OpenFile("assets/robots.txt", os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0666)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -147,7 +147,7 @@ func generateCrossdomain() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
params := map[string]string{
|
params := map[string]string{
|
||||||
"Host": config.Conf.BlogApp.Host,
|
"Host": config.Conf.EiBlogApp.Host,
|
||||||
}
|
}
|
||||||
f, err := os.OpenFile("assets/crossdomain.xml", os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0666)
|
f, err := os.OpenFile("assets/crossdomain.xml", os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0666)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -13,7 +13,7 @@ import (
|
|||||||
"github.com/eiblog/eiblog/pkg/cache"
|
"github.com/eiblog/eiblog/pkg/cache"
|
||||||
"github.com/eiblog/eiblog/pkg/cache/store"
|
"github.com/eiblog/eiblog/pkg/cache/store"
|
||||||
"github.com/eiblog/eiblog/pkg/config"
|
"github.com/eiblog/eiblog/pkg/config"
|
||||||
"github.com/eiblog/eiblog/pkg/core/blog"
|
"github.com/eiblog/eiblog/pkg/core/eiblog"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
@@ -23,7 +23,7 @@ import (
|
|||||||
func baseBEParams(c *gin.Context) gin.H {
|
func baseBEParams(c *gin.Context) gin.H {
|
||||||
return gin.H{
|
return gin.H{
|
||||||
"Author": cache.Ei.Account.Username,
|
"Author": cache.Ei.Account.Username,
|
||||||
"Qiniu": config.Conf.BlogApp.Qiniu,
|
"Qiniu": config.Conf.EiBlogApp.Qiniu,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,8 +31,8 @@ func baseBEParams(c *gin.Context) gin.H {
|
|||||||
func handleLoginPage(c *gin.Context) {
|
func handleLoginPage(c *gin.Context) {
|
||||||
logout := c.Query("logout")
|
logout := c.Query("logout")
|
||||||
if logout == "true" {
|
if logout == "true" {
|
||||||
blog.SetLogout(c)
|
eiblog.SetLogout(c)
|
||||||
} else if blog.IsLogined(c) {
|
} else if eiblog.IsLogined(c) {
|
||||||
c.Redirect(http.StatusFound, "/admin/profile")
|
c.Redirect(http.StatusFound, "/admin/profile")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -70,7 +70,7 @@ func handleAdminPost(c *gin.Context) {
|
|||||||
params["Title"] = "撰写文章 | " + cache.Ei.Blogger.BTitle
|
params["Title"] = "撰写文章 | " + cache.Ei.Blogger.BTitle
|
||||||
}
|
}
|
||||||
params["Path"] = c.Request.URL.Path
|
params["Path"] = c.Request.URL.Path
|
||||||
params["Domain"] = config.Conf.BlogApp.Host
|
params["Domain"] = config.Conf.EiBlogApp.Host
|
||||||
params["Series"] = cache.Ei.Series
|
params["Series"] = cache.Ei.Series
|
||||||
var tags []T
|
var tags []T
|
||||||
for tag := range cache.Ei.TagArticles {
|
for tag := range cache.Ei.TagArticles {
|
||||||
@@ -104,7 +104,7 @@ func handleAdminPosts(c *gin.Context) {
|
|||||||
params["KW"] = kw
|
params["KW"] = kw
|
||||||
var max int
|
var max int
|
||||||
params["List"], max = cache.Ei.PageArticleBE(se, kw, false, false,
|
params["List"], max = cache.Ei.PageArticleBE(se, kw, false, false,
|
||||||
pg, config.Conf.BlogApp.General.PageSize)
|
pg, config.Conf.EiBlogApp.General.PageSize)
|
||||||
if pg < max {
|
if pg < max {
|
||||||
vals.Set("page", fmt.Sprint(pg+1))
|
vals.Set("page", fmt.Sprint(pg+1))
|
||||||
params["Next"] = vals.Encode()
|
params["Next"] = vals.Encode()
|
||||||
@@ -26,19 +26,19 @@ func baseFEParams(c *gin.Context) gin.H {
|
|||||||
|
|
||||||
cookie, err := c.Request.Cookie("v")
|
cookie, err := c.Request.Cookie("v")
|
||||||
if err != nil || cookie.Value !=
|
if err != nil || cookie.Value !=
|
||||||
fmt.Sprint(config.Conf.BlogApp.StaticVersion) {
|
fmt.Sprint(config.Conf.EiBlogApp.StaticVersion) {
|
||||||
version = config.Conf.BlogApp.StaticVersion
|
version = config.Conf.EiBlogApp.StaticVersion
|
||||||
}
|
}
|
||||||
return gin.H{
|
return gin.H{
|
||||||
"BlogName": cache.Ei.Blogger.BlogName,
|
"BlogName": cache.Ei.Blogger.BlogName,
|
||||||
"SubTitle": cache.Ei.Blogger.SubTitle,
|
"SubTitle": cache.Ei.Blogger.SubTitle,
|
||||||
"BTitle": cache.Ei.Blogger.BTitle,
|
"BTitle": cache.Ei.Blogger.BTitle,
|
||||||
"BeiAn": cache.Ei.Blogger.BeiAn,
|
"BeiAn": cache.Ei.Blogger.BeiAn,
|
||||||
"Domain": config.Conf.BlogApp.Host,
|
"Domain": config.Conf.EiBlogApp.Host,
|
||||||
"CopyYear": time.Now().Year(),
|
"CopyYear": time.Now().Year(),
|
||||||
"Twitter": config.Conf.BlogApp.Twitter,
|
"Twitter": config.Conf.EiBlogApp.Twitter,
|
||||||
"Qiniu": config.Conf.BlogApp.Qiniu,
|
"Qiniu": config.Conf.EiBlogApp.Qiniu,
|
||||||
"Disqus": config.Conf.BlogApp.Disqus,
|
"Disqus": config.Conf.EiBlogApp.Disqus,
|
||||||
"Version": version,
|
"Version": version,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -65,7 +65,7 @@ func handleHomePage(c *gin.Context) {
|
|||||||
pn = 1
|
pn = 1
|
||||||
}
|
}
|
||||||
params["Prev"], params["Next"], params["List"] = cache.Ei.PageArticleFE(pn,
|
params["Prev"], params["Next"], params["List"] = cache.Ei.PageArticleFE(pn,
|
||||||
config.Conf.BlogApp.General.PageNum)
|
config.Conf.EiBlogApp.General.PageNum)
|
||||||
|
|
||||||
renderHTMLHomeLayout(c, "home", params)
|
renderHTMLHomeLayout(c, "home", params)
|
||||||
}
|
}
|
||||||
@@ -151,7 +151,7 @@ func handleSearchPage(c *gin.Context) {
|
|||||||
params["Word"] = q
|
params["Word"] = q
|
||||||
|
|
||||||
vals := c.Request.URL.Query()
|
vals := c.Request.URL.Query()
|
||||||
result, err := internal.ElasticSearch(q, config.Conf.BlogApp.General.PageNum, start-1)
|
result, err := internal.ElasticSearch(q, config.Conf.EiBlogApp.General.PageNum, start-1)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Error("HandleSearchPage.ElasticSearch: ", err)
|
logrus.Error("HandleSearchPage.ElasticSearch: ", err)
|
||||||
} else {
|
} else {
|
||||||
@@ -163,17 +163,17 @@ func handleSearchPage(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
params["SearchResult"] = result
|
params["SearchResult"] = result
|
||||||
if num := start - config.Conf.BlogApp.General.PageNum; num > 0 {
|
if num := start - config.Conf.EiBlogApp.General.PageNum; num > 0 {
|
||||||
vals.Set("start", fmt.Sprint(num))
|
vals.Set("start", fmt.Sprint(num))
|
||||||
params["Prev"] = vals.Encode()
|
params["Prev"] = vals.Encode()
|
||||||
}
|
}
|
||||||
if num := start + config.Conf.BlogApp.General.PageNum; result.Hits.Total >= num {
|
if num := start + config.Conf.EiBlogApp.General.PageNum; result.Hits.Total >= num {
|
||||||
vals.Set("start", fmt.Sprint(num))
|
vals.Set("start", fmt.Sprint(num))
|
||||||
params["Next"] = vals.Encode()
|
params["Next"] = vals.Encode()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
params["HotWords"] = config.Conf.BlogApp.HotWords
|
params["HotWords"] = config.Conf.EiBlogApp.HotWords
|
||||||
}
|
}
|
||||||
renderHTMLHomeLayout(c, "search", params)
|
renderHTMLHomeLayout(c, "search", params)
|
||||||
}
|
}
|
||||||
@@ -324,16 +324,16 @@ func handleBeaconPage(c *gin.Context) {
|
|||||||
ua := c.Request.UserAgent()
|
ua := c.Request.UserAgent()
|
||||||
|
|
||||||
vals := c.Request.URL.Query()
|
vals := c.Request.URL.Query()
|
||||||
vals.Set("v", config.Conf.BlogApp.Google.V)
|
vals.Set("v", config.Conf.EiBlogApp.Google.V)
|
||||||
vals.Set("tid", config.Conf.BlogApp.Google.Tid)
|
vals.Set("tid", config.Conf.EiBlogApp.Google.Tid)
|
||||||
vals.Set("t", config.Conf.BlogApp.Google.T)
|
vals.Set("t", config.Conf.EiBlogApp.Google.T)
|
||||||
cookie, _ := c.Cookie("u")
|
cookie, _ := c.Cookie("u")
|
||||||
vals.Set("cid", cookie)
|
vals.Set("cid", cookie)
|
||||||
|
|
||||||
vals.Set("dl", c.Request.Referer())
|
vals.Set("dl", c.Request.Referer())
|
||||||
vals.Set("uip", c.ClientIP())
|
vals.Set("uip", c.ClientIP())
|
||||||
go func() {
|
go func() {
|
||||||
req, err := http.NewRequest("POST", config.Conf.BlogApp.Google.URL,
|
req, err := http.NewRequest("POST", config.Conf.EiBlogApp.Google.URL,
|
||||||
strings.NewReader(vals.Encode()))
|
strings.NewReader(vals.Encode()))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Error("HandleBeaconPage.NewRequest: ", err)
|
logrus.Error("HandleBeaconPage.NewRequest: ", err)
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
package swag
|
package swag
|
||||||
|
|
||||||
import (
|
import (
|
||||||
_ "github.com/eiblog/eiblog/pkg/core/blog/docs" // docs
|
_ "github.com/eiblog/eiblog/pkg/core/eiblog/docs" // docs
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
ginSwagger "github.com/swaggo/gin-swagger"
|
ginSwagger "github.com/swaggo/gin-swagger"
|
||||||
@@ -24,9 +24,9 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func checkDisqusConfig() error {
|
func checkDisqusConfig() error {
|
||||||
if config.Conf.BlogApp.Disqus.ShortName != "" &&
|
if config.Conf.EiBlogApp.Disqus.ShortName != "" &&
|
||||||
config.Conf.BlogApp.Disqus.PublicKey != "" &&
|
config.Conf.EiBlogApp.Disqus.PublicKey != "" &&
|
||||||
config.Conf.BlogApp.Disqus.AccessToken != "" {
|
config.Conf.EiBlogApp.Disqus.AccessToken != "" {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return errors.New("disqus: config incompleted")
|
return errors.New("disqus: config incompleted")
|
||||||
@@ -49,8 +49,8 @@ func PostsCount(articles map[string]*model.Article) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
vals := url.Values{}
|
vals := url.Values{}
|
||||||
vals.Set("api_key", config.Conf.BlogApp.Disqus.PublicKey)
|
vals.Set("api_key", config.Conf.EiBlogApp.Disqus.PublicKey)
|
||||||
vals.Set("forum", config.Conf.BlogApp.Disqus.ShortName)
|
vals.Set("forum", config.Conf.EiBlogApp.Disqus.ShortName)
|
||||||
// batch get
|
// batch get
|
||||||
var count, index int
|
var count, index int
|
||||||
for _, article := range articles {
|
for _, article := range articles {
|
||||||
@@ -128,8 +128,8 @@ func PostsList(slug, cursor string) (*postsListResp, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
vals := url.Values{}
|
vals := url.Values{}
|
||||||
vals.Set("api_key", config.Conf.BlogApp.Disqus.PublicKey)
|
vals.Set("api_key", config.Conf.EiBlogApp.Disqus.PublicKey)
|
||||||
vals.Set("forum", config.Conf.BlogApp.Disqus.ShortName)
|
vals.Set("forum", config.Conf.EiBlogApp.Disqus.ShortName)
|
||||||
vals.Set("thread:ident", "post-"+slug)
|
vals.Set("thread:ident", "post-"+slug)
|
||||||
vals.Set("cursor", cursor)
|
vals.Set("cursor", cursor)
|
||||||
vals.Set("limit", "50")
|
vals.Set("limit", "50")
|
||||||
@@ -224,8 +224,8 @@ func PostApprove(post string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
vals := url.Values{}
|
vals := url.Values{}
|
||||||
vals.Set("api_key", config.Conf.BlogApp.Disqus.PublicKey)
|
vals.Set("api_key", config.Conf.EiBlogApp.Disqus.PublicKey)
|
||||||
vals.Set("access_token", config.Conf.BlogApp.Disqus.AccessToken)
|
vals.Set("access_token", config.Conf.EiBlogApp.Disqus.AccessToken)
|
||||||
vals.Set("post", post)
|
vals.Set("post", post)
|
||||||
|
|
||||||
header := http.Header{"Referer": {"https://disqus.com"}}
|
header := http.Header{"Referer": {"https://disqus.com"}}
|
||||||
@@ -263,13 +263,13 @@ func ThreadCreate(article *model.Article, btitle string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
vals := url.Values{}
|
vals := url.Values{}
|
||||||
vals.Set("api_key", config.Conf.BlogApp.Disqus.PublicKey)
|
vals.Set("api_key", config.Conf.EiBlogApp.Disqus.PublicKey)
|
||||||
vals.Set("access_token", config.Conf.BlogApp.Disqus.AccessToken)
|
vals.Set("access_token", config.Conf.EiBlogApp.Disqus.AccessToken)
|
||||||
vals.Set("forum", config.Conf.BlogApp.Disqus.ShortName)
|
vals.Set("forum", config.Conf.EiBlogApp.Disqus.ShortName)
|
||||||
vals.Set("title", article.Title+" | "+btitle)
|
vals.Set("title", article.Title+" | "+btitle)
|
||||||
vals.Set("identifier", "post-"+article.Slug)
|
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)
|
vals.Set("url", urlPath)
|
||||||
|
|
||||||
resp, err := httpPost(apiThreadCreate, vals)
|
resp, err := httpPost(apiThreadCreate, vals)
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import (
|
|||||||
|
|
||||||
// feedrPingFunc http://<your-hub-name>.superfeedr.com/
|
// feedrPingFunc http://<your-hub-name>.superfeedr.com/
|
||||||
var feedrPingFunc = func(btitle, slug string) error {
|
var feedrPingFunc = func(btitle, slug string) error {
|
||||||
feedrHost := config.Conf.BlogApp.FeedRPC.FeedrURL
|
feedrHost := config.Conf.EiBlogApp.FeedRPC.FeedrURL
|
||||||
if feedrHost == "" {
|
if feedrHost == "" {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -61,15 +61,15 @@ type rpcValue struct {
|
|||||||
|
|
||||||
// rpcPingFunc ping rpc
|
// rpcPingFunc ping rpc
|
||||||
var rpcPingFunc = func(btitle, slug string) error {
|
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
|
return nil
|
||||||
}
|
}
|
||||||
param := rpcPingParam{MethodName: "weblogUpdates.extendedPing"}
|
param := rpcPingParam{MethodName: "weblogUpdates.extendedPing"}
|
||||||
param.Params.Param = [4]rpcValue{
|
param.Params.Param = [4]rpcValue{
|
||||||
0: rpcValue{Value: btitle},
|
0: rpcValue{Value: btitle},
|
||||||
1: rpcValue{Value: "https://" + config.Conf.BlogApp.Host},
|
1: rpcValue{Value: "https://" + config.Conf.EiBlogApp.Host},
|
||||||
2: rpcValue{Value: fmt.Sprintf("https://%s/post/%s.html", config.Conf.BlogApp.Host, slug)},
|
2: rpcValue{Value: fmt.Sprintf("https://%s/post/%s.html", config.Conf.EiBlogApp.Host, slug)},
|
||||||
3: rpcValue{Value: "https://" + config.Conf.BlogApp.Host + "/rss.html"},
|
3: rpcValue{Value: "https://" + config.Conf.EiBlogApp.Host + "/rss.html"},
|
||||||
}
|
}
|
||||||
buf := bytes.Buffer{}
|
buf := bytes.Buffer{}
|
||||||
buf.WriteString(xml.Header)
|
buf.WriteString(xml.Header)
|
||||||
@@ -80,7 +80,7 @@ var rpcPingFunc = func(btitle, slug string) error {
|
|||||||
data := buf.Bytes()
|
data := buf.Bytes()
|
||||||
header := http.Header{}
|
header := http.Header{}
|
||||||
header.Set("Content-Type", "text/xml")
|
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)
|
resp, err := httpPostHeader(addr, data, header)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Error("rpcPingFunc.httpPostHeader: ", err)
|
logrus.Error("rpcPingFunc.httpPostHeader: ", err)
|
||||||
|
|||||||
@@ -15,17 +15,17 @@ import (
|
|||||||
|
|
||||||
// QiniuUpload 上传文件
|
// QiniuUpload 上传文件
|
||||||
func QiniuUpload(name string, size int64, data io.Reader) (string, error) {
|
func QiniuUpload(name string, size int64, data io.Reader) (string, error) {
|
||||||
if config.Conf.BlogApp.Qiniu.AccessKey == "" ||
|
if config.Conf.EiBlogApp.Qiniu.AccessKey == "" ||
|
||||||
config.Conf.BlogApp.Qiniu.SecretKey == "" {
|
config.Conf.EiBlogApp.Qiniu.SecretKey == "" {
|
||||||
return "", errors.New("qiniu config error")
|
return "", errors.New("qiniu config error")
|
||||||
}
|
}
|
||||||
key := completeQiniuKey(name)
|
key := completeQiniuKey(name)
|
||||||
|
|
||||||
mac := qbox.NewMac(config.Conf.BlogApp.Qiniu.AccessKey,
|
mac := qbox.NewMac(config.Conf.EiBlogApp.Qiniu.AccessKey,
|
||||||
config.Conf.BlogApp.Qiniu.SecretKey)
|
config.Conf.EiBlogApp.Qiniu.SecretKey)
|
||||||
// 设置上传策略
|
// 设置上传策略
|
||||||
putPolicy := &storage.PutPolicy{
|
putPolicy := &storage.PutPolicy{
|
||||||
Scope: config.Conf.BlogApp.Qiniu.Bucket,
|
Scope: config.Conf.EiBlogApp.Qiniu.Bucket,
|
||||||
Expires: 3600,
|
Expires: 3600,
|
||||||
InsertOnly: 1,
|
InsertOnly: 1,
|
||||||
}
|
}
|
||||||
@@ -46,7 +46,7 @@ func QiniuUpload(name string, size int64, data io.Reader) (string, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
url := "https://" + config.Conf.BlogApp.Qiniu.Domain + "/" + key
|
url := "https://" + config.Conf.EiBlogApp.Qiniu.Domain + "/" + key
|
||||||
return url, nil
|
return url, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,8 +54,8 @@ func QiniuUpload(name string, size int64, data io.Reader) (string, error) {
|
|||||||
func QiniuDelete(name string) error {
|
func QiniuDelete(name string) error {
|
||||||
key := completeQiniuKey(name)
|
key := completeQiniuKey(name)
|
||||||
|
|
||||||
mac := qbox.NewMac(config.Conf.BlogApp.Qiniu.AccessKey,
|
mac := qbox.NewMac(config.Conf.EiBlogApp.Qiniu.AccessKey,
|
||||||
config.Conf.BlogApp.Qiniu.SecretKey)
|
config.Conf.EiBlogApp.Qiniu.SecretKey)
|
||||||
// 上传配置
|
// 上传配置
|
||||||
cfg := &storage.Config{
|
cfg := &storage.Config{
|
||||||
Zone: &storage.ZoneHuadong,
|
Zone: &storage.ZoneHuadong,
|
||||||
@@ -64,7 +64,7 @@ func QiniuDelete(name string) error {
|
|||||||
// manager
|
// manager
|
||||||
bucketManager := storage.NewBucketManager(mac, cfg)
|
bucketManager := storage.NewBucketManager(mac, cfg)
|
||||||
// Delete
|
// Delete
|
||||||
return bucketManager.Delete(config.Conf.BlogApp.Qiniu.Bucket, key)
|
return bucketManager.Delete(config.Conf.EiBlogApp.Qiniu.Bucket, key)
|
||||||
}
|
}
|
||||||
|
|
||||||
// completeQiniuKey 修复路径
|
// completeQiniuKey 修复路径
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ for file in pkg/core/*; do
|
|||||||
_target="$app-$_tag.$os-$_arch.tar.gz"
|
_target="$app-$_tag.$os-$_arch.tar.gz"
|
||||||
CGO_ENABLED=0 GOOS=$os GOARCH=$_arch \
|
CGO_ENABLED=0 GOOS=$os GOARCH=$_arch \
|
||||||
go build -o bin/backend "./cmd/$app"
|
go build -o bin/backend "./cmd/$app"
|
||||||
if [ "$app" == "blog" ]; then
|
if [ "$app" = "eiblog" ]; then
|
||||||
tar czf $_target conf website assets bin/backend
|
tar czf $_target conf website assets bin/backend
|
||||||
else
|
else
|
||||||
tar czf $_target conf bin/backend
|
tar czf $_target conf bin/backend
|
||||||
|
|||||||
Reference in New Issue
Block a user