diff --git a/plugin/rsshub/domain/model.go b/plugin/rsshub/domain/model.go index 64c9d334..8c7d34ce 100644 --- a/plugin/rsshub/domain/model.go +++ b/plugin/rsshub/domain/model.go @@ -9,8 +9,6 @@ import ( // ======== RSS ========[START] -// type SingleFeedItem gofeed.Item - func genHashForFeedItem(link, guid string) string { idString := link + "||" + guid h := fnv.New32() @@ -51,8 +49,6 @@ type RssSource struct { Link string `gorm:"column:link" json:"link"` // UpdatedParsed RSS页面更新时间 UpdatedParsed time.Time `gorm:"column:updated_parsed" json:"updated_parsed"` - //// Ctime create time - // Ctime int64 `gorm:"column:ctime;default:current_timestamp" json:"ctime"` // Mtime update time Mtime time.Time `gorm:"column:mtime;default:current_timestamp;" json:"mtime"` } @@ -83,8 +79,6 @@ type RssContent struct { Author string `gorm:"column:author" json:"author"` Thumbnail string `gorm:"column:thumbnail" json:"thumbnail"` Content string `gorm:"column:content" json:"content"` - //// Ctime create time - // Ctime int64 `gorm:"column:ctime;default:current_timestamp" json:"ctime"` // Mtime update time Mtime time.Time `gorm:"column:mtime;default:current_timestamp;" json:"mtime"` } @@ -109,8 +103,6 @@ type RssSubscribe struct { GroupID int64 `gorm:"column:group_id;not null;uniqueIndex:uk_sid_gid"` // 订阅频道 RssSourceID int64 `gorm:"column:rss_source_id;not null;uniqueIndex:uk_sid_gid"` - //// Ctime create time - // Ctime int64 `gorm:"column:ctime;default:current_timestamp" json:"ctime"` // Mtime update time Mtime time.Time `gorm:"column:mtime;default:current_timestamp;" json:"mtime"` } diff --git a/plugin/rsshub/domain/rawFeed.go b/plugin/rsshub/domain/rawFeed.go index a8f6ee5d..0b29fe32 100644 --- a/plugin/rsshub/domain/rawFeed.go +++ b/plugin/rsshub/domain/rawFeed.go @@ -12,11 +12,6 @@ import ( "github.com/sirupsen/logrus" ) -// const ( -// acceptHeader = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" -// userHeader = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36 Edg/84.0.522.63" -//) - var ( // RSSHubMirrors RSSHub镜像站地址列表,第一个为默认地址 rssHubMirrors = []string{ @@ -48,10 +43,6 @@ func (c *RssHubClient) FetchFeed(path string) (feed *gofeed.Feed, err error) { logrus.Errorf("[rsshub FetchFeed] fetch feed error: data is empty") return nil, errors.New("feed data is empty") } - // data, err = web.RequestDataWith(c.Client, domain+path, "GET", "", web.RandUA(), nil) - // if err != nil { - // return nil, err - //} feed, err = gofeed.NewParser().Parse(bytes.NewBuffer(data)) if err != nil { return diff --git a/plugin/rsshub/main.go b/plugin/rsshub/main.go index 26984eae..7803d4ef 100644 --- a/plugin/rsshub/main.go +++ b/plugin/rsshub/main.go @@ -18,19 +18,8 @@ import ( // 初始化 repo var ( - rssRepo domain.RssDomain - initErr error - //// getRssRepo repo 初始化方法,单例 - // getRssRepo = ctxext.DoOnceOnSuccess(func(ctx *zero.Ctx) bool { - // logrus.Infoln("RssHub订阅姬:初始化") - // rssRepo, initErr = domain.NewRssDomain(engine.DataFolder() + "rsshub.db") - // if initErr != nil { - // ctx.SendChain(message.Text("RssHub订阅姬:初始化失败", initErr.Error())) - // return false - // } - // return true - // }) - // regexpForSQL 防注入 + rssRepo domain.RssDomain + initErr error regexpForSQL = regexp.MustCompile(`[\^<>\[\]%&\*\(\)\{\}\|\=]|(union\s+select|update\s+|delete\s+|drop\s+|truncate\s+|insert\s+|exec\s+|declare\s+)`) )