Compare commits

...

20 Commits
v2.2.10 ... v2

Author SHA1 Message Date
henry.chen
77ad657cea chore: update README.md 2025-08-05 13:31:24 +08:00
henry.chen
6be2733a21 chore: update README.md 2025-08-05 13:29:40 +08:00
henry.chen
0a410f09f3 chore(release): 2.2.17 2025-04-22 15:18:23 +08:00
henry.chen
0fe849ae67 fix: backup file auto delete 2025-04-22 15:12:50 +08:00
henry.chen
c06a32a268 chore(release): 2.2.16 2025-03-13 13:40:50 +08:00
henry.chen
79fccb958c fix: empty "beian" display issue 2025-03-13 13:40:33 +08:00
henry.chen
8e2679e49f chore(release): 2.2.15 2025-01-01 02:53:10 +08:00
henry.chen
52fe7303f3 fix: disqus list posts 2025-01-01 02:49:21 +08:00
henry.chen
616248d33f fix: disqus thread not store 2025-01-01 02:19:48 +08:00
henry.chen
6e1965a764 chore: replace ioutil -> io 2024-11-04 10:31:28 +08:00
henry.chen
27bc610a31 chore(release): 2.2.14 2024-10-10 13:39:32 +08:00
henry.chen
b53fc91ce7 fix: 1. bei_an cannot update error
2. CleanArticles deleted all article error in rdbms, fixed #43,fixed #44
2024-10-10 13:38:38 +08:00
henry.chen
720387ecd5 chore: update 2024-05-28 13:09:10 +08:00
henry.chen
88f23bd1a0 fix(serie): update serie did not rerender 2024-01-23 09:43:17 +08:00
henry.chen
6a2d720d36 chore(release): 2.2.13 2024-01-02 21:40:39 +08:00
henry.chen
95e55ee13c fix: load more comments 2024-01-02 21:39:36 +08:00
henry.chen
ca293a4933 chore(release): 2.2.12 2024-01-02 20:01:16 +08:00
henry.chen
c82d73ca34 chore: downgrade mongodb driver 2024-01-02 20:01:14 +08:00
henry.chen
433064de00 chore(release): 2.2.11 2024-01-02 19:09:40 +08:00
henry.chen
9d71ca8198 fix(disqus): fix returned posts list not have parent post 2024-01-02 19:09:37 +08:00
19 changed files with 194 additions and 2784 deletions

View File

@@ -2,6 +2,45 @@
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.2.16](https://github.com/eiblog/eiblog/compare/v2.2.15...v2.2.16) (2025-03-13)
### Bug Fixes
* empty "beian" display issue ([79fccb9](https://github.com/eiblog/eiblog/commit/79fccb958c3eb8e21615389359c1d613c5fb079b))
### [2.2.15](https://github.com/eiblog/eiblog/compare/v2.2.14...v2.2.15) (2024-12-31)
### Bug Fixes
* disqus list posts ([52fe730](https://github.com/eiblog/eiblog/commit/52fe7303f3345421c0f2e2989a6c174d5b1a689e))
* disqus thread not store ([616248d](https://github.com/eiblog/eiblog/commit/616248d33fdf44dbc3aed41e92adae001a4f5577))
### [2.2.14](https://github.com/eiblog/eiblog/compare/v2.2.13...v2.2.14) (2024-10-10)
### Bug Fixes
* 1. bei_an cannot update error ([b53fc91](https://github.com/eiblog/eiblog/commit/b53fc91ce7b67c3811c232ad6236898f84bc391b)), closes [#43](https://github.com/eiblog/eiblog/issues/43) [#44](https://github.com/eiblog/eiblog/issues/44)
* **serie:** update serie did not rerender ([88f23bd](https://github.com/eiblog/eiblog/commit/88f23bd1a0d6183d6de484cb79303506f0506d15))
### [2.2.13](https://github.com/eiblog/eiblog/compare/v2.2.12...v2.2.13) (2024-01-02)
### Bug Fixes
* load more comments ([95e55ee](https://github.com/eiblog/eiblog/commit/95e55ee13c1af13e2bb2149ccbe60013c93e4e69))
### [2.2.12](https://github.com/eiblog/eiblog/compare/v2.2.11...v2.2.12) (2024-01-02)
### [2.2.11](https://github.com/eiblog/eiblog/compare/v2.2.10...v2.2.11) (2024-01-02)
### Bug Fixes
* **disqus:** fix returned posts list not have parent post ([9d71ca8](https://github.com/eiblog/eiblog/commit/9d71ca81988bfc614d13fcb02079f0dba9ef43cc))
### [2.2.10](https://github.com/eiblog/eiblog/compare/v2.2.9...v2.2.10) (2023-12-22) ### [2.2.10](https://github.com/eiblog/eiblog/compare/v2.2.9...v2.2.10) (2023-12-22)
### [2.2.9](https://github.com/eiblog/eiblog/compare/v2.2.8...v2.2.9) (2023-09-25) ### [2.2.9](https://github.com/eiblog/eiblog/compare/v2.2.8...v2.2.9) (2023-09-25)

View File

@@ -1,8 +1,6 @@
# EiBlog [![License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE.md) [![Versuib](https://img.shields.io/github/tag/eiblog/eiblog.svg)](https://github.com/eiblog/eiblog/releases) # EiBlog [![License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE.md) [![Versuib](https://img.shields.io/github/tag/eiblog/eiblog.svg)](https://github.com/eiblog/eiblog/releases)
> 博客项目结构参考模版https://github.com/deepzz0/appdemo 用过其它博客系统,不喜欢,不够轻,不够快!这是我开发的第二款博客系统,也实在不想再在这件事情上过多纠结了。`EiBlog` 是一个比较稳定的博客系统,现已迭代至 `2.0` 版本,稳定性和维护你是不用担心的。[V3 版本](https://github.com/eiblog/eiblog/tree/v3) 正在积极开发中!
用过其它博客系统,不喜欢,不够轻,不够快!这是我开发的第二款博客系统,也实在不想再在这件事情上过多纠结了。`EiBlog` 是一个比较稳定的博客系统,现已迭代至 `2.0` 版本,稳定性和维护你是不用担心的。
但它有着部署简单(上线复杂!)的特点,不推荐没有计算机知识的朋友搭建,欢迎咨询。该博客的个中优点(简洁、轻快,安全),等你体验。 但它有着部署简单(上线复杂!)的特点,不推荐没有计算机知识的朋友搭建,欢迎咨询。该博客的个中优点(简洁、轻快,安全),等你体验。
@@ -33,8 +31,6 @@ $ docker run --name eiblog \
参考项目根目录下的 [docker-compose.yml](https://github.com/eiblog/eiblog/blob/v2/docker-compose.yml),修改相关配置: 参考项目根目录下的 [docker-compose.yml](https://github.com/eiblog/eiblog/blob/v2/docker-compose.yml),修改相关配置:
``` ```
$ docker compose up -d
$ docker-compose up -d $ docker-compose up -d
``` ```

6
go.mod
View File

@@ -4,7 +4,7 @@ go 1.15
require ( require (
github.com/eiblog/blackfriday v0.0.0-20161010144836-c0ec111761ae github.com/eiblog/blackfriday v0.0.0-20161010144836-c0ec111761ae
github.com/gin-contrib/sessions v0.0.5 github.com/gin-contrib/sessions v0.0.4
github.com/gin-gonic/gin v1.9.1 github.com/gin-gonic/gin v1.9.1
github.com/lib/pq v1.10.9 github.com/lib/pq v1.10.9
github.com/qiniu/go-sdk/v7 v7.11.0 github.com/qiniu/go-sdk/v7 v7.11.0
@@ -13,9 +13,9 @@ require (
github.com/swaggo/files v0.0.0-20190704085106-630677cd5c14 github.com/swaggo/files v0.0.0-20190704085106-630677cd5c14
github.com/swaggo/gin-swagger v1.3.3 github.com/swaggo/gin-swagger v1.3.3
github.com/swaggo/swag v1.7.4 github.com/swaggo/swag v1.7.4
go.mongodb.org/mongo-driver v1.11.4 go.mongodb.org/mongo-driver v1.5.4
gopkg.in/yaml.v3 v3.0.1 gopkg.in/yaml.v3 v3.0.1
gorm.io/driver/clickhouse v0.6.0 gorm.io/driver/clickhouse v0.4.2
gorm.io/driver/mysql v1.5.2 gorm.io/driver/mysql v1.5.2
gorm.io/driver/postgres v1.5.4 gorm.io/driver/postgres v1.5.4
gorm.io/driver/sqlite v1.5.4 gorm.io/driver/sqlite v1.5.4

2814
go.sum

File diff suppressed because it is too large Load Diff

View File

@@ -144,7 +144,7 @@ func (db *rdbms) RemoveArticle(ctx context.Context, id int) error {
// CleanArticles 清理回收站文章 // CleanArticles 清理回收站文章
func (db *rdbms) CleanArticles(ctx context.Context, exp time.Time) error { func (db *rdbms) CleanArticles(ctx context.Context, exp time.Time) error {
return db.Where("deleted_at BETWEEN ? AND ?", time.Time{}, exp).Delete(model.Article{}).Error return db.Where("deleted_at > ? AND deleted_at < ?", time.Time{}, exp).Delete(model.Article{}).Error
} }
// UpdateArticle 更新文章 // UpdateArticle 更新文章

View File

@@ -2,7 +2,6 @@
package config package config
import ( import (
"io/ioutil"
"os" "os"
"path/filepath" "path/filepath"
"strings" "strings"
@@ -147,7 +146,7 @@ func init() {
WorkDir = workDir() WorkDir = workDir()
path := filepath.Join(WorkDir, "conf", "app.yml") path := filepath.Join(WorkDir, "conf", "app.yml")
data, err := ioutil.ReadFile(path) data, err := os.ReadFile(path)
if err != nil { if err != nil {
panic(err) panic(err)
} }

View File

@@ -88,7 +88,7 @@ func backupFromMongoDB(now time.Time) error {
} }
// after days delete // after days delete
deleteParams := internal.DeleteParams{ deleteParams := internal.DeleteParams{
Name: name, Name: filepath.Join("blog", name), // blog/eiblog-xx.tar.gz
Days: config.Conf.BackupApp.Validity, Days: config.Conf.BackupApp.Validity,
NoCompletePath: true, NoCompletePath: true,

View File

@@ -40,7 +40,7 @@ func Start(restore bool) (err error) {
for now := range t.C { for now := range t.C {
err = storage.BackupData(now) err = storage.BackupData(now)
if err != nil { if err != nil {
logrus.Error("timer: Start.BackupData: ", now, err) logrus.Error("timer: Start.BackupData: ", now.Format(time.RFC3339), err)
} }
} }
return nil return nil

View File

@@ -94,6 +94,7 @@ func handleAPIBlogger(c *gin.Context) {
err := cache.Ei.UpdateBlogger(context.Background(), map[string]interface{}{ err := cache.Ei.UpdateBlogger(context.Background(), map[string]interface{}{
"blog_name": bn, "blog_name": bn,
"b_title": bt, "b_title": bt,
"bei_an": ba,
"sub_title": st, "sub_title": st,
"series_say": ss, "series_say": ss,
"archives_say": as, "archives_say": as,
@@ -287,14 +288,14 @@ func handleAPIPostCreate(c *gin.Context) {
cid = article.ID cid = article.ID
if !article.IsDraft { if !article.IsDraft {
// disqus
internal.ThreadCreate(article, cache.Ei.Blogger.BTitle)
// 异步执行,快 // 异步执行,快
go func() { go func() {
// elastic // elastic
internal.ElasticAddIndex(article) internal.ElasticAddIndex(article)
// rss // rss
internal.PingFunc(cache.Ei.Blogger.BTitle, slug) internal.PingFunc(cache.Ei.Blogger.BTitle, slug)
// disqus
internal.ThreadCreate(article, cache.Ei.Blogger.BTitle)
}() }()
} }
return return
@@ -326,16 +327,16 @@ func handleAPIPostCreate(c *gin.Context) {
} }
if !article.IsDraft { if !article.IsDraft {
cache.Ei.RepArticle(artc, article) cache.Ei.RepArticle(artc, article)
// disqus
if artc == nil {
internal.ThreadCreate(article, cache.Ei.Blogger.BTitle)
}
// 异步执行,快 // 异步执行,快
go func() { go func() {
// elastic // elastic
internal.ElasticAddIndex(article) internal.ElasticAddIndex(article)
// rss // rss
internal.PingFunc(cache.Ei.Blogger.BTitle, slug) internal.PingFunc(cache.Ei.Blogger.BTitle, slug)
// disqus
if artc == nil {
internal.ThreadCreate(article, cache.Ei.Blogger.BTitle)
}
}() }()
} }
} }
@@ -398,6 +399,7 @@ func handleAPISerieCreate(c *gin.Context) {
serie.Slug = slug serie.Slug = slug
serie.Name = name serie.Name = name
serie.Desc = desc serie.Desc = desc
cache.PagesCh <- cache.PageSeries
} else { } else {
err = cache.Ei.AddSerie(&model.Serie{ err = cache.Ei.AddSerie(&model.Serie{
Slug: slug, Slug: slug,

View File

@@ -6,7 +6,7 @@ import (
"context" "context"
"fmt" "fmt"
htemplate "html/template" htemplate "html/template"
"io/ioutil" "io"
"math/rand" "math/rand"
"net/http" "net/http"
"strconv" "strconv"
@@ -204,7 +204,7 @@ func handleDisqusList(c *gin.Context) {
if artc != nil { if artc != nil {
dcs.Data.Thread = artc.Thread dcs.Data.Thread = artc.Thread
} }
postsList, err := internal.PostsList(slug, cursor) postsList, err := internal.PostsList(artc, cursor)
if err != nil { if err != nil {
logrus.Error("hadnleDisqusList.PostsList: ", err) logrus.Error("hadnleDisqusList.PostsList: ", err)
dcs.ErrNo = 0 dcs.ErrNo = 0
@@ -370,7 +370,7 @@ func handleBeaconPage(c *gin.Context) {
return return
} }
defer res.Body.Close() defer res.Body.Close()
data, err := ioutil.ReadAll(res.Body) data, err := io.ReadAll(res.Body)
if err != nil { if err != nil {
logrus.Error("HandleBeaconPage.ReadAll: ", err) logrus.Error("HandleBeaconPage.ReadAll: ", err)
return return

View File

@@ -18,7 +18,7 @@ var htmlTmpl *template.Template
func init() { func init() {
htmlTmpl = template.New("eiblog").Funcs(tools.TplFuncMap) htmlTmpl = template.New("eiblog").Funcs(tools.TplFuncMap)
root := filepath.Join(config.WorkDir, "website") root := filepath.Join(config.WorkDir, "website")
files := tools.ReadDirFiles(root, func(fi fs.FileInfo) bool { files := tools.ReadDirFiles(root, func(fi fs.DirEntry) bool {
name := fi.Name() name := fi.Name()
if name == ".DS_Store" { if name == ".DS_Store" {
return true return true

10
pkg/internal/CHANGELOG.md Normal file
View File

@@ -0,0 +1,10 @@
# Changelog
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.2.17](https://github.com/eiblog/eiblog/compare/v2.2.16...v2.2.17) (2025-04-22)
### Bug Fixes
* backup file auto delete ([0fe849a](https://github.com/eiblog/eiblog/commit/0fe849ae67de36f2d249e3306ac7d098bc057070))

View File

@@ -5,7 +5,7 @@ import (
"encoding/json" "encoding/json"
"errors" "errors"
"fmt" "fmt"
"io/ioutil" "io"
"net/http" "net/http"
"net/url" "net/url"
"strings" "strings"
@@ -17,11 +17,13 @@ import (
// disqus api // disqus api
const ( const (
apiPostsCount = "https://disqus.com/api/3.0/threads/set.json" apiPostsCount = "https://disqus.com/api/3.0/threads/set.json"
apiPostsList = "https://disqus.com/api/3.0/threads/listPosts.json" apiPostsList = "https://disqus.com/api/3.0/threads/listPostsThreaded"
apiPostCreate = "https://disqus.com/api/3.0/posts/create.json" apiPostCreate = "https://disqus.com/api/3.0/posts/create.json"
apiPostApprove = "https://disqus.com/api/3.0/posts/approve.json" apiPostApprove = "https://disqus.com/api/3.0/posts/approve.json"
apiThreadCreate = "https://disqus.com/api/3.0/threads/create.json" apiThreadCreate = "https://disqus.com/api/3.0/threads/create.json"
apiThreadDetails = "https://disqus.com/api/3.0/threads/details.json" apiThreadDetails = "https://disqus.com/api/3.0/threads/details.json"
disqusAPIKey = "E8Uh5l5fHZ6gD8U3KycjAIAk46f68Zw7C6eW8WSjZvCLXebZ7p0r1yrYDrLilk2F"
) )
func checkDisqusConfig() error { func checkDisqusConfig() error {
@@ -69,7 +71,7 @@ func PostsCount(articles map[string]*model.Article) error {
} }
defer resp.Body.Close() defer resp.Body.Close()
b, err := ioutil.ReadAll(resp.Body) b, err := io.ReadAll(resp.Body)
if err != nil { if err != nil {
return err return err
} }
@@ -89,7 +91,9 @@ func PostsCount(articles map[string]*model.Article) error {
if article := articles[slug]; article != nil { if article := articles[slug]; article != nil {
article.Count = v.Posts article.Count = v.Posts
article.Thread = v.ID if article.Thread == "" && v.ID != "" {
article.Thread = v.ID
}
} }
} }
} }
@@ -123,16 +127,17 @@ type postDetail struct {
} }
// PostsList 评论列表 // PostsList 评论列表
func PostsList(slug, cursor string) (*PostsListResp, error) { func PostsList(article *model.Article, cursor string) (*PostsListResp, error) {
if err := checkDisqusConfig(); err != nil { if err := checkDisqusConfig(); err != nil {
return nil, err return nil, err
} }
vals := url.Values{} vals := url.Values{}
vals.Set("api_key", config.Conf.EiBlogApp.Disqus.PublicKey) vals.Set("api_key", disqusAPIKey)
vals.Set("forum", config.Conf.EiBlogApp.Disqus.ShortName) vals.Set("forum", config.Conf.EiBlogApp.Disqus.ShortName)
vals.Set("thread:ident", "post-"+slug) vals.Set("thread:ident", "post-"+article.Slug)
vals.Set("cursor", cursor) vals.Set("cursor", cursor)
vals.Set("order", "popular")
vals.Set("limit", "50") vals.Set("limit", "50")
resp, err := httpGet(apiPostsList + "?" + vals.Encode()) resp, err := httpGet(apiPostsList + "?" + vals.Encode())
@@ -141,7 +146,7 @@ func PostsList(slug, cursor string) (*PostsListResp, error) {
} }
defer resp.Body.Close() defer resp.Body.Close()
b, err := ioutil.ReadAll(resp.Body) b, err := io.ReadAll(resp.Body)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@@ -181,7 +186,7 @@ func PostCreate(pc *PostComment) (*PostCreateResp, error) {
return nil, err return nil, err
} }
vals := url.Values{} vals := url.Values{}
vals.Set("api_key", "E8Uh5l5fHZ6gD8U3KycjAIAk46f68Zw7C6eW8WSjZvCLXebZ7p0r1yrYDrLilk2F") vals.Set("api_key", disqusAPIKey)
vals.Set("message", pc.Message) vals.Set("message", pc.Message)
vals.Set("parent", pc.Parent) vals.Set("parent", pc.Parent)
vals.Set("thread", pc.Thread) vals.Set("thread", pc.Thread)
@@ -195,7 +200,7 @@ func PostCreate(pc *PostComment) (*PostCreateResp, error) {
return nil, err return nil, err
} }
defer resp.Body.Close() defer resp.Body.Close()
b, err := ioutil.ReadAll(resp.Body) b, err := io.ReadAll(resp.Body)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@@ -237,7 +242,7 @@ func PostApprove(post string) error {
} }
defer resp.Body.Close() defer resp.Body.Close()
b, err := ioutil.ReadAll(resp.Body) b, err := io.ReadAll(resp.Body)
if err != nil { if err != nil {
return err return err
} }
@@ -279,7 +284,7 @@ func ThreadCreate(article *model.Article, btitle string) error {
return err return err
} }
b, err := ioutil.ReadAll(resp.Body) b, err := io.ReadAll(resp.Body)
if err != nil { if err != nil {
return err return err
} }
@@ -322,7 +327,7 @@ func ThreadDetails(article *model.Article) error {
return err return err
} }
b, err := ioutil.ReadAll(resp.Body) b, err := io.ReadAll(resp.Body)
if err != nil { if err != nil {
return err return err
} }

View File

@@ -6,7 +6,7 @@ import (
"encoding/json" "encoding/json"
"errors" "errors"
"fmt" "fmt"
"io/ioutil" "io"
"net/http" "net/http"
"regexp" "regexp"
"strings" "strings"
@@ -160,7 +160,7 @@ func createIndexAndMappings(index, typ string, mappings []byte) error {
return err return err
} }
defer resp.Body.Close() defer resp.Body.Close()
data, err := ioutil.ReadAll(resp.Body) data, err := io.ReadAll(resp.Body)
if err != nil { if err != nil {
return err return err
} }
@@ -183,7 +183,7 @@ func indexOrUpdateDocument(index, typ string, id int, doc []byte) (err error) {
return err return err
} }
defer resp.Body.Close() defer resp.Body.Close()
data, err := ioutil.ReadAll(resp.Body) data, err := io.ReadAll(resp.Body)
if err != nil { if err != nil {
return err return err
} }
@@ -220,7 +220,7 @@ func deleteIndexDocument(index, typ string, ids []string) error {
return err return err
} }
defer resp.Body.Close() defer resp.Body.Close()
data, err := ioutil.ReadAll(resp.Body) data, err := io.ReadAll(resp.Body)
if err != nil { if err != nil {
return err return err
} }
@@ -272,7 +272,7 @@ func indexQueryDSL(index, typ string, size, from int, dsl []byte) (*SearchIndexR
return nil, err return nil, err
} }
defer resp.Body.Close() defer resp.Body.Close()
data, err := ioutil.ReadAll(resp.Body) data, err := io.ReadAll(resp.Body)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@@ -5,7 +5,7 @@ import (
"bytes" "bytes"
"encoding/xml" "encoding/xml"
"fmt" "fmt"
"io/ioutil" "io"
"net/http" "net/http"
"net/url" "net/url"
@@ -30,7 +30,7 @@ var feedrPingFunc = func(btitle, slug string) error {
return err return err
} }
defer resp.Body.Close() defer resp.Body.Close()
data, err := ioutil.ReadAll(resp.Body) data, err := io.ReadAll(resp.Body)
if err != nil { if err != nil {
return err return err
} }
@@ -43,10 +43,11 @@ var feedrPingFunc = func(btitle, slug string) error {
// rpcPingParam ping to rpc, eg. google baidu // rpcPingParam ping to rpc, eg. google baidu
// params: // params:
// BlogName string `xml:"param>value>string"` //
// HomePage string `xml:"param>value>string"` // BlogName string `xml:"param>value>string"`
// Article string `xml:"param>value>string"` // HomePage string `xml:"param>value>string"`
// RSS_URL string `xml:"param>value>string"` // Article string `xml:"param>value>string"`
// RSS_URL string `xml:"param>value>string"`
type rpcPingParam struct { type rpcPingParam struct {
XMLName xml.Name `xml:"methodCall"` XMLName xml.Name `xml:"methodCall"`
MethodName string `xml:"methodName"` MethodName string `xml:"methodName"`
@@ -87,13 +88,13 @@ var rpcPingFunc = func(btitle, slug string) error {
continue continue
} }
defer resp.Body.Close() defer resp.Body.Close()
data, err := ioutil.ReadAll(resp.Body) data, err := io.ReadAll(resp.Body)
if err != nil { if err != nil {
logrus.Error("rpcPingFunc.ReadAll: ", err) logrus.Error("rpcPingFunc.ReadAll: ", err)
continue continue
} }
if resp.StatusCode != 200 { if resp.StatusCode != 200 {
logrus.Error("rpcPingFunc.failed: ", string(data)) logrus.Error("rpcPingFunc.failed: ", string(data), resp.StatusCode)
} }
} }
return nil return nil

View File

@@ -4,7 +4,7 @@ package tools
import ( import (
"encoding/base64" "encoding/base64"
htmpl "html/template" htmpl "html/template"
"io/ioutil" "io"
"log" "log"
"net/http" "net/http"
"strings" "strings"
@@ -62,7 +62,7 @@ func GetAvatar(domain string) string {
} }
defer resp.Body.Close() defer resp.Body.Close()
data, err := ioutil.ReadAll(resp.Body) data, err := io.ReadAll(resp.Body)
if err != nil { if err != nil {
log.Println(err) log.Println(err)
return "" return ""

View File

@@ -6,7 +6,7 @@ import (
"fmt" "fmt"
"io" "io"
"io/fs" "io/fs"
"io/ioutil" "os"
"path" "path"
"regexp" "regexp"
"time" "time"
@@ -23,8 +23,8 @@ func EncryptPasswd(name, pass string) string {
} }
// ReadDirFiles 读取目录 // ReadDirFiles 读取目录
func ReadDirFiles(dir string, filter func(fi fs.FileInfo) bool) (files []string) { func ReadDirFiles(dir string, filter func(fi fs.DirEntry) bool) (files []string) {
fileInfos, err := ioutil.ReadDir(dir) fileInfos, err := os.ReadDir(dir)
if err != nil { if err != nil {
return return
} }

View File

@@ -1 +1 @@
<!DOCTYPE html><html lang="zh-cn"><head><meta charset="utf-8"><meta content="width=device-width,minimum-scale=1.0" name="viewport"><meta name="format-detection" content="telephone=no"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="referrer" content="always"><title>{{.Title}}</title>{{.AdSense}}<script>!function(n,t){function e(){o("nls",1)}function c(){t.documentElement.style.display="none",u(),location.reload()}function r(n){var t="";try{t=f[n]||"",t.length<99&&c()}catch(e){u()}return t}function i(n,t){try{f[n]=t,t!==f[n]&&u()}catch(e){u()}}function o(n,e){var c=999;e||(c=-1),c=new Date(+new Date+864e5*c).toGMTString();var r=n+"="+e+";path=/;secure;expires="+c;t.cookie=r}function a(n){var e=t.getElementById(n).innerHTML;i(n,e)}function l(e,c){var i=r(e),o=t.createElement(c?"script":"style");return n.execScript&&c?n.execScript(i):(o.innerHTML=i,void t.head.appendChild(o))}function u(){o("v",0)}var f,h=function(){},d=n.L={h:h,l:h,c:h};try{f=localStorage,d.h=a,d.l=l,d.c=o}catch(p){e()}}(this,document);</script>{{if .Version}}<script>L.c('v', {{.Version}})</script>{{end}}<link rel="apple-touch-icon" href="//{{.Qiniu.Domain}}/static/img/favicon.ico"><link rel="search" type="application/opensearchdescription+xml" href="//{{.Domain}}/opensearch.xml" title="{{.BTitle}}">{{if .Version}}<style id="blog_css">{{template "blog_css" .}}</style><script>L.h('blog_css')</script>{{else}}<script>L.l("blog_css")</script>{{end}}<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="//{{.Domain}}/rss.html"><meta name="description" content="{{.Description}}"><meta name="twitter:card" content={{.Twitter.Card}}><meta name="twitter:site" content="@{{.Twitter.Site}}"><meta name="twitter:title" content="{{.Title}}"><meta name="twitter:description" content="{{.Description}}"><meta name="twitter:image" content="https://{{.Twitter.Image}}"></head><body><div class="container"><div class="left-col"><div class="intrude-less"><header id="header" class="inner"><div class="profilepic"><a href="/"></a></div><h1><a href="/">{{.BlogName}}</a></h1><p class="subtitle">{{.SubTitle}}</p><nav id="main-nav"><ul><li {{if eq .Path "/"}}class="on" {{end}}><a href="/"><span>首页</span></a></li><li {{if eq .Path "/series.html"}}class="on" {{end}}><a href="/series.html"><span>专题</span></a></li><li {{if eq .Path "/archives.html"}}class="on" {{end}}><a href="/archives.html"><span>归档</span></a></li><li {{if eq .Path "/post/blogroll.html"}}class="on" {{end}}><a href="/post/blogroll.html"><span>友链</span></a></li><li {{if eq .Path "/post/about.html"}}class="on" {{end}}><a href="/post/about.html"><span>关于</span></a></li></ul></nav><nav id="sub-nav"><div class="social"><a target="_blank" class="twitter external" rel="nofollow" href="//{{.Twitter.Address}}" title="Twitter" aria-label="Twitter">Twitter</a><a target="_blank" class="rss" href="//{{.Domain}}/rss.html" title="RSS 订阅" aria-label="RSS 订阅">RSS</a><a class="search" href="/search.html" title="站内搜索" aria-label="站内搜索">Search</a></div></nav></header></div></div><div class="mid-col"><div class="mid-col-container">{{.LayoutContent}}</div><footer id=footer class=inner>© {{.CopyYear}} - {{.BTitle}} - <a target="_blank" rel="nofollow designer" class="external beian" href="https://beian.miit.gov.cn">{{.BeiAn}}</a><br>Powered by <a target=_blank href="//github.com/eiblog/eiblog">Eiblog</a> & <a target=_blank rel="nofollow designer" class=external href="//github.com/deepzz0">Deepzz</a></footer></div></div><input type=hidden id=CURRENT_PAGE value="{{.CurrentPage}}"><input type=hidden id=CDN_DOMAIN value="//{{.Qiniu.Domain}}">{{if .Version}}<script id="ana_js">{{template "ana_js"}}</script><script>L.h('ana_js')</script>{{else}}<script>L.l('ana_js', 1)</script>{{end}}{{if .Version}}<script id="jq_js">{{template "jq_js"}}</script><script>L.h('jq_js')</script>{{else}}<script>L.l('jq_js', 1)</script>{{end}}{{if .Version}}<script id="hl_js">{{template "hl_js"}}</script><script>L.h('hl_js')</script>{{else}}<script>L.l('hl_js', 1)</script>{{end}}{{if .Version}}<script id="blog_js">{{template "blog_js" .}}</script><script>L.h('blog_js')</script>{{else}}<script>L.l('blog_js', 1)</script>{{end}}</body></html> <!DOCTYPE html><html lang="zh-cn"><head><meta charset="utf-8"><meta content="width=device-width,minimum-scale=1.0" name="viewport"><meta name="format-detection" content="telephone=no"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="referrer" content="always"><title>{{.Title}}</title>{{.AdSense}}<script>!function(n,t){function e(){o("nls",1)}function c(){t.documentElement.style.display="none",u(),location.reload()}function r(n){var t="";try{t=f[n]||"",t.length<99&&c()}catch(e){u()}return t}function i(n,t){try{f[n]=t,t!==f[n]&&u()}catch(e){u()}}function o(n,e){var c=999;e||(c=-1),c=new Date(+new Date+864e5*c).toGMTString();var r=n+"="+e+";path=/;secure;expires="+c;t.cookie=r}function a(n){var e=t.getElementById(n).innerHTML;i(n,e)}function l(e,c){var i=r(e),o=t.createElement(c?"script":"style");return n.execScript&&c?n.execScript(i):(o.innerHTML=i,void t.head.appendChild(o))}function u(){o("v",0)}var f,h=function(){},d=n.L={h:h,l:h,c:h};try{f=localStorage,d.h=a,d.l=l,d.c=o}catch(p){e()}}(this,document);</script>{{if .Version}}<script>L.c('v', {{.Version}})</script>{{end}}<link rel="apple-touch-icon" href="//{{.Qiniu.Domain}}/static/img/favicon.ico"><link rel="search" type="application/opensearchdescription+xml" href="//{{.Domain}}/opensearch.xml" title="{{.BTitle}}">{{if .Version}}<style id="blog_css">{{template "blog_css" .}}</style><script>L.h('blog_css')</script>{{else}}<script>L.l("blog_css")</script>{{end}}<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="//{{.Domain}}/rss.html"><meta name="description" content="{{.Description}}"><meta name="twitter:card" content={{.Twitter.Card}}><meta name="twitter:site" content="@{{.Twitter.Site}}"><meta name="twitter:title" content="{{.Title}}"><meta name="twitter:description" content="{{.Description}}"><meta name="twitter:image" content="https://{{.Twitter.Image}}"></head><body><div class="container"><div class="left-col"><div class="intrude-less"><header id="header" class="inner"><div class="profilepic"><a href="/"></a></div><h1><a href="/">{{.BlogName}}</a></h1><p class="subtitle">{{.SubTitle}}</p><nav id="main-nav"><ul><li {{if eq .Path "/"}}class="on" {{end}}><a href="/"><span>首页</span></a></li><li {{if eq .Path "/series.html"}}class="on" {{end}}><a href="/series.html"><span>专题</span></a></li><li {{if eq .Path "/archives.html"}}class="on" {{end}}><a href="/archives.html"><span>归档</span></a></li><li {{if eq .Path "/post/blogroll.html"}}class="on" {{end}}><a href="/post/blogroll.html"><span>友链</span></a></li><li {{if eq .Path "/post/about.html"}}class="on" {{end}}><a href="/post/about.html"><span>关于</span></a></li></ul></nav><nav id="sub-nav"><div class="social"><a target="_blank" class="twitter external" rel="nofollow" href="//{{.Twitter.Address}}" title="Twitter" aria-label="Twitter">Twitter</a><a target="_blank" class="rss" href="//{{.Domain}}/rss.html" title="RSS 订阅" aria-label="RSS 订阅">RSS</a><a class="search" href="/search.html" title="站内搜索" aria-label="站内搜索">Search</a></div></nav></header></div></div><div class="mid-col"><div class="mid-col-container">{{.LayoutContent}}</div><footer id=footer class=inner>© {{.CopyYear}} - {{.BTitle}}{{if .BeiAn}} - <a target="_blank" rel="nofollow designer" class="external beian" href="https://beian.miit.gov.cn">{{.BeiAn}}</a>{{end}}<br>Powered by <a target=_blank href="//github.com/eiblog/eiblog">Eiblog</a> & <a target=_blank rel="nofollow designer" class=external href="//github.com/deepzz0">Deepzz</a></footer></div></div><input type=hidden id=CURRENT_PAGE value="{{.CurrentPage}}"><input type=hidden id=CDN_DOMAIN value="//{{.Qiniu.Domain}}">{{if .Version}}<script id="ana_js">{{template "ana_js"}}</script><script>L.h('ana_js')</script>{{else}}<script>L.l('ana_js', 1)</script>{{end}}{{if .Version}}<script id="jq_js">{{template "jq_js"}}</script><script>L.h('jq_js')</script>{{else}}<script>L.l('jq_js', 1)</script>{{end}}{{if .Version}}<script id="hl_js">{{template "hl_js"}}</script><script>L.h('hl_js')</script>{{else}}<script>L.l('hl_js', 1)</script>{{end}}{{if .Version}}<script id="blog_js">{{template "blog_js" .}}</script><script>L.h('blog_js')</script>{{else}}<script>L.l('blog_js', 1)</script>{{end}}</body></html>

File diff suppressed because one or more lines are too long