[chore]: Bump github.com/gorilla/feeds from 1.1.1 to 1.1.2 (#2414)
Bumps [github.com/gorilla/feeds](https://github.com/gorilla/feeds) from 1.1.1 to 1.1.2. - [Release notes](https://github.com/gorilla/feeds/releases) - [Commits](https://github.com/gorilla/feeds/compare/v1.1.1...v1.1.2) --- updated-dependencies: - dependency-name: github.com/gorilla/feeds dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
parent
5556767ff7
commit
bffc67d764
2
go.mod
2
go.mod
|
@ -31,7 +31,7 @@ require (
|
||||||
github.com/go-fed/httpsig v1.1.0
|
github.com/go-fed/httpsig v1.1.0
|
||||||
github.com/go-playground/form/v4 v4.2.1
|
github.com/go-playground/form/v4 v4.2.1
|
||||||
github.com/google/uuid v1.4.0
|
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/gorilla/websocket v1.5.1
|
||||||
github.com/h2non/filetype v1.1.3
|
github.com/h2non/filetype v1.1.3
|
||||||
github.com/jackc/pgx/v5 v5.5.0
|
github.com/jackc/pgx/v5 v5.5.0
|
||||||
|
|
4
go.sum
4
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/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 h1:BQqNyPTi50JCFMTw/b67hByjMVXZRwGha6wxVGkeihY=
|
||||||
github.com/gorilla/css v1.0.0/go.mod h1:Dn721qIggHpt4+EFCcTLTU/vk5ySda2ReITrtgBl60c=
|
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.2 h1:pxzZ5PD3RJdhFH2FsJJ4x6PqMqbgFk1+Vez4XWBW8Iw=
|
||||||
github.com/gorilla/feeds v1.1.1/go.mod h1:Nk0jZrvPFZX1OBe5NPiddPw7CfwF6Q9eqzaBbaightA=
|
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 h1:miw7JPhV+b/lAHSXz4qd/nN9jRiAFV5FwjeKyCS8BvQ=
|
||||||
github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4=
|
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=
|
github.com/gorilla/sessions v1.2.1 h1:DHd3rPN5lE3Ts3D8rKkQ8x/0kqfeNmBAaiSi+o7FsgI=
|
||||||
|
|
|
@ -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
|
|
@ -0,0 +1 @@
|
||||||
|
coverage.coverprofile
|
|
@ -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 ./...
|
|
|
@ -1,29 +0,0 @@
|
||||||
# This is the official list of gorilla/feeds authors for copyright purposes.
|
|
||||||
# Please keep the list sorted.
|
|
||||||
|
|
||||||
Dmitry Chestnykh <dmitry@codingrobots.com>
|
|
||||||
Eddie Scholtz <eascholtz@gmail.com>
|
|
||||||
Gabriel Simmer <bladesimmer@gmail.com>
|
|
||||||
Google LLC (https://opensource.google.com/)
|
|
||||||
honky <honky@defendtheplanet.net>
|
|
||||||
James Gregory <james@jagregory.com>
|
|
||||||
Jason Hall <imjasonh@gmail.com>
|
|
||||||
Jason Moiron <jmoiron@jmoiron.net>
|
|
||||||
Kamil Kisiel <kamil@kamilkisiel.net>
|
|
||||||
Kevin Stock <kevinstock@tantalic.com>
|
|
||||||
Markus Zimmermann <markus.zimmermann@nethead.at>
|
|
||||||
Matt Silverlock <matt@eatsleeprepeat.net>
|
|
||||||
Matthew Dawson <matthew@mjdsystems.ca>
|
|
||||||
Milan Aleksic <milanaleksic@gmail.com>
|
|
||||||
Milan Aleksić <milanaleksic@gmail.com>
|
|
||||||
nlimpid <jshuangzl@gmail.com>
|
|
||||||
Paul Petring <paul@defendtheplanet.net>
|
|
||||||
Sean Enck <enckse@users.noreply.github.com>
|
|
||||||
Sue Spence <virtuallysue@gmail.com>
|
|
||||||
Supermighty <ukiah@faction.com>
|
|
||||||
Toru Fukui <fukuimone@gmail.com>
|
|
||||||
Vabd <vabd@anon.acme>
|
|
||||||
Volker <lists.volker@gmail.com>
|
|
||||||
ZhiFeng Hu <hufeng1987@gmail.com>
|
|
||||||
weberc2 <weberc2@gmail.com>
|
|
||||||
|
|
|
@ -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
|
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
|
* Redistributions of source code must retain the above copyright
|
||||||
list of conditions and the following disclaimer.
|
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 SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
this list of conditions and the following disclaimer in the documentation
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
and/or other materials provided with the distribution.
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
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.
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
|
|
@ -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 ./...
|
|
@ -1,6 +1,10 @@
|
||||||
## gorilla/feeds
|
## gorilla/feeds
|
||||||
[![GoDoc](https://godoc.org/github.com/gorilla/feeds?status.svg)](https://godoc.org/github.com/gorilla/feeds)
|
![testing](https://github.com/gorilla/feeds/actions/workflows/test.yml/badge.svg)
|
||||||
[![Build Status](https://travis-ci.org/gorilla/feeds.svg?branch=master)](https://travis-ci.org/gorilla/feeds)
|
[![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
|
feeds is a web feed generator library for generating RSS, Atom and JSON feeds from Go
|
||||||
applications.
|
applications.
|
||||||
|
@ -13,7 +17,7 @@ applications.
|
||||||
|
|
||||||
[atom]: https://tools.ietf.org/html/rfc4287
|
[atom]: https://tools.ietf.org/html/rfc4287
|
||||||
[rss]: http://www.rssboard.org/rss-specification
|
[rss]: http://www.rssboard.org/rss-specification
|
||||||
[jsonfeed]: https://jsonfeed.org/version/1
|
[jsonfeed]: https://jsonfeed.org/version/1.1
|
||||||
|
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
|
@ -147,13 +151,18 @@ Outputs:
|
||||||
</rss>
|
</rss>
|
||||||
|
|
||||||
{
|
{
|
||||||
"version": "https://jsonfeed.org/version/1",
|
"version": "https://jsonfeed.org/version/1.1",
|
||||||
"title": "jmoiron.net blog",
|
"title": "jmoiron.net blog",
|
||||||
"home_page_url": "http://jmoiron.net/blog",
|
"home_page_url": "http://jmoiron.net/blog",
|
||||||
"description": "discussion about tech, footie, photos",
|
"description": "discussion about tech, footie, photos",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Jason Moiron"
|
"name": "Jason Moiron"
|
||||||
},
|
},
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Jason Moiron"
|
||||||
|
}
|
||||||
|
],
|
||||||
"items": [
|
"items": [
|
||||||
{
|
{
|
||||||
"id": "",
|
"id": "",
|
||||||
|
@ -163,7 +172,12 @@ Outputs:
|
||||||
"date_published": "2013-01-16T03:22:24.530817846-05:00",
|
"date_published": "2013-01-16T03:22:24.530817846-05:00",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Jason Moiron"
|
"name": "Jason Moiron"
|
||||||
}
|
},
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Jason Moiron"
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "",
|
"id": "",
|
||||||
|
@ -182,4 +196,3 @@ Outputs:
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -89,15 +89,16 @@ type Atom struct {
|
||||||
|
|
||||||
func newAtomEntry(i *Item) *AtomEntry {
|
func newAtomEntry(i *Item) *AtomEntry {
|
||||||
id := i.Id
|
id := i.Id
|
||||||
// assume the description is html
|
link := i.Link
|
||||||
s := &AtomSummary{Content: i.Description, Type: "html"}
|
if link == nil {
|
||||||
|
link = &Link{}
|
||||||
|
}
|
||||||
if len(id) == 0 {
|
if len(id) == 0 {
|
||||||
// if there's no id set, try to create one, either from data or just a uuid
|
// 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)
|
dateStr := anyTimeFormat("2006-01-02", i.Updated, i.Created)
|
||||||
host, path := i.Link.Href, "/invalid.html"
|
host, path := link.Href, "/invalid.html"
|
||||||
if url, err := url.Parse(i.Link.Href); err == nil {
|
if url, err := url.Parse(link.Href); err == nil {
|
||||||
host, path = url.Host, url.Path
|
host, path = url.Host, url.Path
|
||||||
}
|
}
|
||||||
id = fmt.Sprintf("tag:%s,%s:%s", host, dateStr, 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
|
name, email = i.Author.Name, i.Author.Email
|
||||||
}
|
}
|
||||||
|
|
||||||
link_rel := i.Link.Rel
|
link_rel := link.Rel
|
||||||
if link_rel == "" {
|
if link_rel == "" {
|
||||||
link_rel = "alternate"
|
link_rel = "alternate"
|
||||||
}
|
}
|
||||||
x := &AtomEntry{
|
x := &AtomEntry{
|
||||||
Title: i.Title,
|
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,
|
Id: id,
|
||||||
Updated: anyTimeFormat(time.RFC3339, i.Updated, i.Created),
|
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
|
// 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
|
// create a new AtomFeed with a generic Feed struct's data
|
||||||
func (a *Atom) AtomFeed() *AtomFeed {
|
func (a *Atom) AtomFeed() *AtomFeed {
|
||||||
updated := anyTimeFormat(time.RFC3339, a.Updated, a.Created)
|
updated := anyTimeFormat(time.RFC3339, a.Updated, a.Created)
|
||||||
|
link := a.Link
|
||||||
|
if link == nil {
|
||||||
|
link = &Link{}
|
||||||
|
}
|
||||||
feed := &AtomFeed{
|
feed := &AtomFeed{
|
||||||
Xmlns: ns,
|
Xmlns: ns,
|
||||||
Title: a.Title,
|
Title: a.Title,
|
||||||
Link: &AtomLink{Href: a.Link.Href, Rel: a.Link.Rel},
|
Link: &AtomLink{Href: link.Href, Rel: link.Rel},
|
||||||
Subtitle: a.Description,
|
Subtitle: a.Description,
|
||||||
Id: a.Link.Href,
|
Id: link.Href,
|
||||||
Updated: updated,
|
Updated: updated,
|
||||||
Rights: a.Copyright,
|
Rights: a.Copyright,
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"time"
|
"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
|
// JSONAuthor represents the author of the feed or of an individual item
|
||||||
// in the feed
|
// in the feed
|
||||||
|
@ -77,7 +77,8 @@ type JSONItem struct {
|
||||||
BannerImage string `json:"banner_,omitempty"`
|
BannerImage string `json:"banner_,omitempty"`
|
||||||
PublishedDate *time.Time `json:"date_published,omitempty"`
|
PublishedDate *time.Time `json:"date_published,omitempty"`
|
||||||
ModifiedDate *time.Time `json:"date_modified,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"`
|
Tags []string `json:"tags,omitempty"`
|
||||||
Attachments []JSONAttachment `json:"attachments,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.
|
// JSONFeed represents a syndication feed in the JSON Feed Version 1 format.
|
||||||
// Matching the specification found here: https://jsonfeed.org/version/1.
|
// Matching the specification found here: https://jsonfeed.org/version/1.
|
||||||
type JSONFeed struct {
|
type JSONFeed struct {
|
||||||
Version string `json:"version"`
|
Version string `json:"version"`
|
||||||
Title string `json:"title"`
|
Title string `json:"title"`
|
||||||
HomePageUrl string `json:"home_page_url,omitempty"`
|
Language string `json:"language,omitempty"`
|
||||||
FeedUrl string `json:"feed_url,omitempty"`
|
HomePageUrl string `json:"home_page_url,omitempty"`
|
||||||
Description string `json:"description,omitempty"`
|
FeedUrl string `json:"feed_url,omitempty"`
|
||||||
UserComment string `json:"user_comment,omitempty"`
|
Description string `json:"description,omitempty"`
|
||||||
NextUrl string `json:"next_url,omitempty"`
|
UserComment string `json:"user_comment,omitempty"`
|
||||||
Icon string `json:"icon,omitempty"`
|
NextUrl string `json:"next_url,omitempty"`
|
||||||
Favicon string `json:"favicon,omitempty"`
|
Icon string `json:"icon,omitempty"`
|
||||||
Author *JSONAuthor `json:"author,omitempty"`
|
Favicon string `json:"favicon,omitempty"`
|
||||||
Expired *bool `json:"expired,omitempty"`
|
Author *JSONAuthor `json:"author,omitempty"` // deprecated in JSON Feed v1.1, keeping for backwards compatibility
|
||||||
Hubs []*JSONItem `json:"hubs,omitempty"`
|
Authors []*JSONAuthor `json:"authors,omitempty"`
|
||||||
Items []*JSONItem `json:"items,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.
|
// 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
|
feed.HomePageUrl = f.Link.Href
|
||||||
}
|
}
|
||||||
if f.Author != nil {
|
if f.Author != nil {
|
||||||
feed.Author = &JSONAuthor{
|
author := &JSONAuthor{
|
||||||
Name: f.Author.Name,
|
Name: f.Author.Name,
|
||||||
}
|
}
|
||||||
|
feed.Author = author
|
||||||
|
feed.Authors = []*JSONAuthor{author}
|
||||||
}
|
}
|
||||||
for _, e := range f.Items {
|
for _, e := range f.Items {
|
||||||
feed.Items = append(feed.Items, newJSONItem(e))
|
feed.Items = append(feed.Items, newJSONItem(e))
|
||||||
|
@ -165,9 +170,11 @@ func newJSONItem(i *Item) *JSONItem {
|
||||||
item.ExternalUrl = i.Source.Href
|
item.ExternalUrl = i.Source.Href
|
||||||
}
|
}
|
||||||
if i.Author != nil {
|
if i.Author != nil {
|
||||||
item.Author = &JSONAuthor{
|
author := &JSONAuthor{
|
||||||
Name: i.Author.Name,
|
Name: i.Author.Name,
|
||||||
}
|
}
|
||||||
|
item.Author = author
|
||||||
|
item.Authors = []*JSONAuthor{author}
|
||||||
}
|
}
|
||||||
if !i.Created.IsZero() {
|
if !i.Created.IsZero() {
|
||||||
item.PublishedDate = &i.Created
|
item.PublishedDate = &i.Created
|
||||||
|
|
|
@ -95,11 +95,13 @@ type Rss struct {
|
||||||
func newRssItem(i *Item) *RssItem {
|
func newRssItem(i *Item) *RssItem {
|
||||||
item := &RssItem{
|
item := &RssItem{
|
||||||
Title: i.Title,
|
Title: i.Title,
|
||||||
Link: i.Link.Href,
|
|
||||||
Description: i.Description,
|
Description: i.Description,
|
||||||
Guid: i.Id,
|
Guid: i.Id,
|
||||||
PubDate: anyTimeFormat(time.RFC1123Z, i.Created, i.Updated),
|
PubDate: anyTimeFormat(time.RFC1123Z, i.Created, i.Updated),
|
||||||
}
|
}
|
||||||
|
if i.Link != nil {
|
||||||
|
item.Link = i.Link.Href
|
||||||
|
}
|
||||||
if len(i.Content) > 0 {
|
if len(i.Content) > 0 {
|
||||||
item.Content = &RssContent{Content: i.Content}
|
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}
|
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{
|
channel := &RssFeed{
|
||||||
Title: r.Title,
|
Title: r.Title,
|
||||||
Link: r.Link.Href,
|
Link: href,
|
||||||
Description: r.Description,
|
Description: r.Description,
|
||||||
ManagingEditor: author,
|
ManagingEditor: author,
|
||||||
PubDate: pub,
|
PubDate: pub,
|
||||||
|
|
|
@ -278,8 +278,8 @@ github.com/gorilla/context
|
||||||
# github.com/gorilla/css v1.0.0
|
# github.com/gorilla/css v1.0.0
|
||||||
## explicit
|
## explicit
|
||||||
github.com/gorilla/css/scanner
|
github.com/gorilla/css/scanner
|
||||||
# github.com/gorilla/feeds v1.1.1
|
# github.com/gorilla/feeds v1.1.2
|
||||||
## explicit
|
## explicit; go 1.20
|
||||||
github.com/gorilla/feeds
|
github.com/gorilla/feeds
|
||||||
# github.com/gorilla/securecookie v1.1.1
|
# github.com/gorilla/securecookie v1.1.1
|
||||||
## explicit
|
## explicit
|
||||||
|
|
Loading…
Reference in New Issue