diff --git a/go.mod b/go.mod index b7cd1a8f5..51c3ffe3f 100644 --- a/go.mod +++ b/go.mod @@ -31,7 +31,7 @@ require ( github.com/go-fed/httpsig v1.1.0 github.com/go-playground/form/v4 v4.2.1 github.com/google/uuid v1.4.0 - github.com/gorilla/feeds v1.1.1 + github.com/gorilla/feeds v1.1.2 github.com/gorilla/websocket v1.5.1 github.com/h2non/filetype v1.1.3 github.com/jackc/pgx/v5 v5.5.0 diff --git a/go.sum b/go.sum index b300003c7..fd5df8b47 100644 --- a/go.sum +++ b/go.sum @@ -318,8 +318,8 @@ github.com/gorilla/context v1.1.1 h1:AWwleXJkX/nhcU9bZSnZoi3h/qGYqQAGhq6zZe/aQW8 github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= github.com/gorilla/css v1.0.0 h1:BQqNyPTi50JCFMTw/b67hByjMVXZRwGha6wxVGkeihY= github.com/gorilla/css v1.0.0/go.mod h1:Dn721qIggHpt4+EFCcTLTU/vk5ySda2ReITrtgBl60c= -github.com/gorilla/feeds v1.1.1 h1:HwKXxqzcRNg9to+BbvJog4+f3s/xzvtZXICcQGutYfY= -github.com/gorilla/feeds v1.1.1/go.mod h1:Nk0jZrvPFZX1OBe5NPiddPw7CfwF6Q9eqzaBbaightA= +github.com/gorilla/feeds v1.1.2 h1:pxzZ5PD3RJdhFH2FsJJ4x6PqMqbgFk1+Vez4XWBW8Iw= +github.com/gorilla/feeds v1.1.2/go.mod h1:WMib8uJP3BbY+X8Szd1rA5Pzhdfh+HCCAYT2z7Fza6Y= github.com/gorilla/securecookie v1.1.1 h1:miw7JPhV+b/lAHSXz4qd/nN9jRiAFV5FwjeKyCS8BvQ= github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= github.com/gorilla/sessions v1.2.1 h1:DHd3rPN5lE3Ts3D8rKkQ8x/0kqfeNmBAaiSi+o7FsgI= diff --git a/vendor/github.com/gorilla/feeds/.editorconfig b/vendor/github.com/gorilla/feeds/.editorconfig new file mode 100644 index 000000000..2940ec92a --- /dev/null +++ b/vendor/github.com/gorilla/feeds/.editorconfig @@ -0,0 +1,20 @@ +; https://editorconfig.org/ + +root = true + +[*] +insert_final_newline = true +charset = utf-8 +trim_trailing_whitespace = true +indent_style = space +indent_size = 2 + +[{Makefile,go.mod,go.sum,*.go,.gitmodules}] +indent_style = tab +indent_size = 4 + +[*.md] +indent_size = 4 +trim_trailing_whitespace = false + +eclint_indent_style = unset diff --git a/vendor/github.com/gorilla/feeds/.gitignore b/vendor/github.com/gorilla/feeds/.gitignore new file mode 100644 index 000000000..84039fec6 --- /dev/null +++ b/vendor/github.com/gorilla/feeds/.gitignore @@ -0,0 +1 @@ +coverage.coverprofile diff --git a/vendor/github.com/gorilla/feeds/.travis.yml b/vendor/github.com/gorilla/feeds/.travis.yml deleted file mode 100644 index 7939a2186..000000000 --- a/vendor/github.com/gorilla/feeds/.travis.yml +++ /dev/null @@ -1,16 +0,0 @@ -language: go -sudo: false -matrix: - include: - - go: 1.8 - - go: 1.9 - - go: "1.10" - - go: 1.x - - go: tip - allow_failures: - - go: tip -script: - - go get -t -v ./... - - diff -u <(echo -n) <(gofmt -d -s .) - - go vet . - - go test -v -race ./... diff --git a/vendor/github.com/gorilla/feeds/AUTHORS b/vendor/github.com/gorilla/feeds/AUTHORS deleted file mode 100644 index 2c28cf943..000000000 --- a/vendor/github.com/gorilla/feeds/AUTHORS +++ /dev/null @@ -1,29 +0,0 @@ -# This is the official list of gorilla/feeds authors for copyright purposes. -# Please keep the list sorted. - -Dmitry Chestnykh -Eddie Scholtz -Gabriel Simmer -Google LLC (https://opensource.google.com/) -honky -James Gregory -Jason Hall -Jason Moiron -Kamil Kisiel -Kevin Stock -Markus Zimmermann -Matt Silverlock -Matthew Dawson -Milan Aleksic -Milan Aleksić -nlimpid -Paul Petring -Sean Enck -Sue Spence -Supermighty -Toru Fukui -Vabd -Volker -ZhiFeng Hu -weberc2 - diff --git a/vendor/github.com/gorilla/feeds/LICENSE b/vendor/github.com/gorilla/feeds/LICENSE index e24412d56..ee0d53cef 100644 --- a/vendor/github.com/gorilla/feeds/LICENSE +++ b/vendor/github.com/gorilla/feeds/LICENSE @@ -1,22 +1,28 @@ -Copyright (c) 2013-2018 The Gorilla Feeds Authors. All rights reserved. +Copyright (c) 2023 The Gorilla Authors. All rights reserved. Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: +modification, are permitted provided that the following conditions are +met: - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + diff --git a/vendor/github.com/gorilla/feeds/Makefile b/vendor/github.com/gorilla/feeds/Makefile new file mode 100644 index 000000000..ac37ffd32 --- /dev/null +++ b/vendor/github.com/gorilla/feeds/Makefile @@ -0,0 +1,34 @@ +GO_LINT=$(shell which golangci-lint 2> /dev/null || echo '') +GO_LINT_URI=github.com/golangci/golangci-lint/cmd/golangci-lint@latest + +GO_SEC=$(shell which gosec 2> /dev/null || echo '') +GO_SEC_URI=github.com/securego/gosec/v2/cmd/gosec@latest + +GO_VULNCHECK=$(shell which govulncheck 2> /dev/null || echo '') +GO_VULNCHECK_URI=golang.org/x/vuln/cmd/govulncheck@latest + +.PHONY: golangci-lint +golangci-lint: + $(if $(GO_LINT), ,go install $(GO_LINT_URI)) + @echo "##### Running golangci-lint" + golangci-lint run -v + +.PHONY: gosec +gosec: + $(if $(GO_SEC), ,go install $(GO_SEC_URI)) + @echo "##### Running gosec" + gosec ./... + +.PHONY: govulncheck +govulncheck: + $(if $(GO_VULNCHECK), ,go install $(GO_VULNCHECK_URI)) + @echo "##### Running govulncheck" + govulncheck ./... + +.PHONY: verify +verify: golangci-lint gosec govulncheck + +.PHONY: test +test: + @echo "##### Running tests" + go test -race -cover -coverprofile=coverage.coverprofile -covermode=atomic -v ./... diff --git a/vendor/github.com/gorilla/feeds/README.md b/vendor/github.com/gorilla/feeds/README.md index 4d733cf53..7d7137b46 100644 --- a/vendor/github.com/gorilla/feeds/README.md +++ b/vendor/github.com/gorilla/feeds/README.md @@ -1,6 +1,10 @@ ## gorilla/feeds -[![GoDoc](https://godoc.org/github.com/gorilla/feeds?status.svg)](https://godoc.org/github.com/gorilla/feeds) -[![Build Status](https://travis-ci.org/gorilla/feeds.svg?branch=master)](https://travis-ci.org/gorilla/feeds) +![testing](https://github.com/gorilla/feeds/actions/workflows/test.yml/badge.svg) +[![codecov](https://codecov.io/github/gorilla/feeds/branch/main/graph/badge.svg)](https://codecov.io/github/gorilla/feeds) +[![godoc](https://godoc.org/github.com/gorilla/feeds?status.svg)](https://godoc.org/github.com/gorilla/feeds) +[![sourcegraph](https://sourcegraph.com/github.com/gorilla/feeds/-/badge.svg)](https://sourcegraph.com/github.com/gorilla/feeds?badge) + +![Gorilla Logo](https://github.com/gorilla/.github/assets/53367916/d92caabf-98e0-473e-bfbf-ab554ba435e5) feeds is a web feed generator library for generating RSS, Atom and JSON feeds from Go applications. @@ -13,7 +17,7 @@ applications. [atom]: https://tools.ietf.org/html/rfc4287 [rss]: http://www.rssboard.org/rss-specification -[jsonfeed]: https://jsonfeed.org/version/1 +[jsonfeed]: https://jsonfeed.org/version/1.1 ### Usage @@ -147,13 +151,18 @@ Outputs: { - "version": "https://jsonfeed.org/version/1", + "version": "https://jsonfeed.org/version/1.1", "title": "jmoiron.net blog", "home_page_url": "http://jmoiron.net/blog", "description": "discussion about tech, footie, photos", "author": { "name": "Jason Moiron" }, + "authors": [ + { + "name": "Jason Moiron" + } + ], "items": [ { "id": "", @@ -163,7 +172,12 @@ Outputs: "date_published": "2013-01-16T03:22:24.530817846-05:00", "author": { "name": "Jason Moiron" - } + }, + "authors": [ + { + "name": "Jason Moiron" + } + ] }, { "id": "", @@ -182,4 +196,3 @@ Outputs: ] } ``` - diff --git a/vendor/github.com/gorilla/feeds/atom.go b/vendor/github.com/gorilla/feeds/atom.go index 7196f4781..73de995c1 100644 --- a/vendor/github.com/gorilla/feeds/atom.go +++ b/vendor/github.com/gorilla/feeds/atom.go @@ -89,15 +89,16 @@ type Atom struct { func newAtomEntry(i *Item) *AtomEntry { id := i.Id - // assume the description is html - s := &AtomSummary{Content: i.Description, Type: "html"} - + link := i.Link + if link == nil { + link = &Link{} + } if len(id) == 0 { // if there's no id set, try to create one, either from data or just a uuid - if len(i.Link.Href) > 0 && (!i.Created.IsZero() || !i.Updated.IsZero()) { + if len(link.Href) > 0 && (!i.Created.IsZero() || !i.Updated.IsZero()) { dateStr := anyTimeFormat("2006-01-02", i.Updated, i.Created) - host, path := i.Link.Href, "/invalid.html" - if url, err := url.Parse(i.Link.Href); err == nil { + host, path := link.Href, "/invalid.html" + if url, err := url.Parse(link.Href); err == nil { host, path = url.Host, url.Path } id = fmt.Sprintf("tag:%s,%s:%s", host, dateStr, path) @@ -110,16 +111,20 @@ func newAtomEntry(i *Item) *AtomEntry { name, email = i.Author.Name, i.Author.Email } - link_rel := i.Link.Rel + link_rel := link.Rel if link_rel == "" { link_rel = "alternate" } x := &AtomEntry{ Title: i.Title, - Links: []AtomLink{{Href: i.Link.Href, Rel: link_rel, Type: i.Link.Type}}, + Links: []AtomLink{{Href: link.Href, Rel: link_rel, Type: link.Type}}, Id: id, Updated: anyTimeFormat(time.RFC3339, i.Updated, i.Created), - Summary: s, + } + + // if there's a description, assume it's html + if len(i.Description) > 0 { + x.Summary = &AtomSummary{Content: i.Description, Type: "html"} } // if there's a content, assume it's html @@ -140,12 +145,16 @@ func newAtomEntry(i *Item) *AtomEntry { // create a new AtomFeed with a generic Feed struct's data func (a *Atom) AtomFeed() *AtomFeed { updated := anyTimeFormat(time.RFC3339, a.Updated, a.Created) + link := a.Link + if link == nil { + link = &Link{} + } feed := &AtomFeed{ Xmlns: ns, Title: a.Title, - Link: &AtomLink{Href: a.Link.Href, Rel: a.Link.Rel}, + Link: &AtomLink{Href: link.Href, Rel: link.Rel}, Subtitle: a.Description, - Id: a.Link.Href, + Id: link.Href, Updated: updated, Rights: a.Copyright, } diff --git a/vendor/github.com/gorilla/feeds/json.go b/vendor/github.com/gorilla/feeds/json.go index 75a82fd62..ae5deb76d 100644 --- a/vendor/github.com/gorilla/feeds/json.go +++ b/vendor/github.com/gorilla/feeds/json.go @@ -6,7 +6,7 @@ import ( "time" ) -const jsonFeedVersion = "https://jsonfeed.org/version/1" +const jsonFeedVersion = "https://jsonfeed.org/version/1.1" // JSONAuthor represents the author of the feed or of an individual item // in the feed @@ -77,7 +77,8 @@ type JSONItem struct { BannerImage string `json:"banner_,omitempty"` PublishedDate *time.Time `json:"date_published,omitempty"` ModifiedDate *time.Time `json:"date_modified,omitempty"` - Author *JSONAuthor `json:"author,omitempty"` + Author *JSONAuthor `json:"author,omitempty"` // deprecated in JSON Feed v1.1, keeping for backwards compatibility + Authors []*JSONAuthor `json:"authors,omitempty"` Tags []string `json:"tags,omitempty"` Attachments []JSONAttachment `json:"attachments,omitempty"` } @@ -92,19 +93,21 @@ type JSONHub struct { // JSONFeed represents a syndication feed in the JSON Feed Version 1 format. // Matching the specification found here: https://jsonfeed.org/version/1. type JSONFeed struct { - Version string `json:"version"` - Title string `json:"title"` - HomePageUrl string `json:"home_page_url,omitempty"` - FeedUrl string `json:"feed_url,omitempty"` - Description string `json:"description,omitempty"` - UserComment string `json:"user_comment,omitempty"` - NextUrl string `json:"next_url,omitempty"` - Icon string `json:"icon,omitempty"` - Favicon string `json:"favicon,omitempty"` - Author *JSONAuthor `json:"author,omitempty"` - Expired *bool `json:"expired,omitempty"` - Hubs []*JSONItem `json:"hubs,omitempty"` - Items []*JSONItem `json:"items,omitempty"` + Version string `json:"version"` + Title string `json:"title"` + Language string `json:"language,omitempty"` + HomePageUrl string `json:"home_page_url,omitempty"` + FeedUrl string `json:"feed_url,omitempty"` + Description string `json:"description,omitempty"` + UserComment string `json:"user_comment,omitempty"` + NextUrl string `json:"next_url,omitempty"` + Icon string `json:"icon,omitempty"` + Favicon string `json:"favicon,omitempty"` + Author *JSONAuthor `json:"author,omitempty"` // deprecated in JSON Feed v1.1, keeping for backwards compatibility + Authors []*JSONAuthor `json:"authors,omitempty"` + Expired *bool `json:"expired,omitempty"` + Hubs []*JSONHub `json:"hubs,omitempty"` + Items []*JSONItem `json:"items,omitempty"` } // JSON is used to convert a generic Feed to a JSONFeed. @@ -139,9 +142,11 @@ func (f *JSON) JSONFeed() *JSONFeed { feed.HomePageUrl = f.Link.Href } if f.Author != nil { - feed.Author = &JSONAuthor{ + author := &JSONAuthor{ Name: f.Author.Name, } + feed.Author = author + feed.Authors = []*JSONAuthor{author} } for _, e := range f.Items { feed.Items = append(feed.Items, newJSONItem(e)) @@ -165,9 +170,11 @@ func newJSONItem(i *Item) *JSONItem { item.ExternalUrl = i.Source.Href } if i.Author != nil { - item.Author = &JSONAuthor{ + author := &JSONAuthor{ Name: i.Author.Name, } + item.Author = author + item.Authors = []*JSONAuthor{author} } if !i.Created.IsZero() { item.PublishedDate = &i.Created diff --git a/vendor/github.com/gorilla/feeds/rss.go b/vendor/github.com/gorilla/feeds/rss.go index 09179dfb2..8c227a8b7 100644 --- a/vendor/github.com/gorilla/feeds/rss.go +++ b/vendor/github.com/gorilla/feeds/rss.go @@ -95,11 +95,13 @@ type Rss struct { func newRssItem(i *Item) *RssItem { item := &RssItem{ Title: i.Title, - Link: i.Link.Href, Description: i.Description, Guid: i.Id, PubDate: anyTimeFormat(time.RFC1123Z, i.Created, i.Updated), } + if i.Link != nil { + item.Link = i.Link.Href + } if len(i.Content) > 0 { item.Content = &RssContent{Content: i.Content} } @@ -135,9 +137,13 @@ func (r *Rss) RssFeed() *RssFeed { image = &RssImage{Url: r.Image.Url, Title: r.Image.Title, Link: r.Image.Link, Width: r.Image.Width, Height: r.Image.Height} } + var href string + if r.Link != nil { + href = r.Link.Href + } channel := &RssFeed{ Title: r.Title, - Link: r.Link.Href, + Link: href, Description: r.Description, ManagingEditor: author, PubDate: pub, diff --git a/vendor/modules.txt b/vendor/modules.txt index 32ae1af05..fb73dc7d8 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -278,8 +278,8 @@ github.com/gorilla/context # github.com/gorilla/css v1.0.0 ## explicit github.com/gorilla/css/scanner -# github.com/gorilla/feeds v1.1.1 -## explicit +# github.com/gorilla/feeds v1.1.2 +## explicit; go 1.20 github.com/gorilla/feeds # github.com/gorilla/securecookie v1.1.1 ## explicit