Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5ef4972

Browse files
committed
支持过滤特定作者的文章
1 parent 32e69af commit 5ef4972

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

config/init.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ VALUES
5858

5959
INSERT INTO `website_setting` (`name`, `domain`, `title_suffix`, `favicon`, `logo`, `start_year`, `blog_url`, `reading_menu`, `docs_menu`, `slogan`, `beian`, `friends_logo`, `footer_nav`, `project_df_logo`, `index_nav`, `created_at`)
6060
VALUES
61-
('Go语言中文网', 'studygolang.com', '- Go语言中文网 - Golang中文社区', '/static/img/go.ico', '/static/img/logo1.png', 2013, 'http://blog.studygolang.com', '', '', 'Go语言中文网,中国 Golang 社区,致力于构建完善的 Golang 中文社区,Go语言爱好者的学习家园。', '京ICP备14030343号-1', '', '[{\"name\":\"关于\",\"url\":\"/wiki/about\",\"outer_site\":false},{\"name\":\"贡献者\",\"url\":\"/wiki/contributors\",\"outer_site\":false},{\"name\":\"帮助推广\",\"url\":\"/wiki\",\"outer_site\":false},{\"name\":\"反馈\",\"url\":\"/topics/node/16\",\"outer_site\":false},{\"name\":\"Github\",\"url\":\"https://github.com/studygolang\",\"outer_site\":true},{\"name\":\"新浪微博\",\"url\":\"http://weibo.com/studygolang\",\"outer_site\":true},{\"name\":\"内嵌Wide\",\"url\":\"/wide/playground\",\"outer_site\":false},{\"name\":\"免责声明\",\"url\":\"/wiki/duty\",\"outer_site\":false}]', '', '[{"tab":"all","name":"全部","data_source":"feed"}]', '2017-05-21 10:22:00');
61+
('Go语言中文网', 'studygolang.com', '- Go语言中文网 - Golang中文社区', '/static/img/favicon.ico', '/static/img/logo.png', 2013, 'http://blog.studygolang.com', '', '', 'Go语言中文网,中国 Golang 社区,致力于构建完善的 Golang 中文社区,Go语言爱好者的学习家园。', '京ICP备14030343号-1', '', '[{\"name\":\"关于\",\"url\":\"/wiki/about\",\"outer_site\":false},{\"name\":\"贡献者\",\"url\":\"/wiki/contributors\",\"outer_site\":false},{\"name\":\"帮助推广\",\"url\":\"/wiki\",\"outer_site\":false},{\"name\":\"反馈\",\"url\":\"/topics/node/16\",\"outer_site\":false},{\"name\":\"Github\",\"url\":\"https://github.com/studygolang\",\"outer_site\":true},{\"name\":\"新浪微博\",\"url\":\"http://weibo.com/studygolang\",\"outer_site\":true},{\"name\":\"内嵌Wide\",\"url\":\"/wide/playground\",\"outer_site\":false},{\"name\":\"免责声明\",\"url\":\"/wiki/duty\",\"outer_site\":false}]', '', '[{"tab":"all","name":"全部","data_source":"feed"}]', '2017-05-21 10:22:00');
6262

6363
INSERT INTO `friend_link` (`id`, `name`, `url`, `seq`, `logo`, `created_at`)
6464
VALUES

logic/article.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,13 @@ func (self ArticleLogic) ParseArticle(ctx context.Context, articleUrl string, au
142142
}
143143
}
144144

145+
filters := config.ConfigFile.MustValueArray("crawl", "filter", ",")
146+
for _, filter := range filters {
147+
if filter == author {
148+
return nil, errors.New(author + "'s article, skip")
149+
}
150+
}
151+
145152
title := ""
146153
doc.Find(rule.Title).Each(func(i int, selection *goquery.Selection) {
147154
if title != "" {

template/common/layout.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
<!-- <link rel="stylesheet" href="https://cdn.staticfile.org/bootswatch/3.2.0/css/cosmo/bootstrap.min.css"> -->
1515
<link rel="stylesheet" href="https://lib.baomitu.com/bootswatch/3.4.0/cosmo/bootstrap.css">
16-
<link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/4.7.0/css/font-awesome.min.css">
16+
<link rel="stylesheet" href="https://lib.baomitu.com/font-awesome/4.7.0/css/font-awesome.min.css">
1717
<link rel="stylesheet" href="{{.static_domain}}/static/dist/css/sg_libs.min.css?v=20180305"/>
1818
<link rel="stylesheet" href="{{.static_domain}}/static/dist/css/sg_styles.min.css?v=20191127"/>
1919

template/install/install.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<link rel="stylesheet" href="/static/css/install/install.css" type="text/css" />
77
</head>
88
<body>
9-
<h1 id="logo"><img alt="studygolang" src="/static/img/logo1.png" /></h1>
9+
<h1 id="logo"><img alt="studygolang" src="/static/img/logo.png" /></h1>
1010
{{if eq .step 3}}
1111
<h1>成功!</h1>
1212

0 commit comments

Comments
 (0)