1
0
Fork 0

Change user agent

This commit is contained in:
Frédéric Guillot 2018-01-22 20:43:03 -08:00
parent da5c8c2edb
commit 577bcddb2a
2 changed files with 3 additions and 4 deletions

View file

@ -17,10 +17,9 @@ import (
"github.com/miniflux/miniflux/logger" "github.com/miniflux/miniflux/logger"
"github.com/miniflux/miniflux/timer" "github.com/miniflux/miniflux/timer"
"github.com/miniflux/miniflux/version"
) )
// Note: Some websites have a user agent filter.
const userAgent = "Mozilla/5.0 (like Gecko, like Safari, like Chrome) - Miniflux <https://miniflux.net/>"
const requestTimeout = 300 const requestTimeout = 300
const maxBodySize = 1024 * 1024 * 15 const maxBodySize = 1024 * 1024 * 15
@ -136,7 +135,7 @@ func (c *Client) buildClient() http.Client {
func (c *Client) buildHeaders() http.Header { func (c *Client) buildHeaders() http.Header {
headers := make(http.Header) headers := make(http.Header)
headers.Add("User-Agent", userAgent) headers.Add("User-Agent", "Mozilla/5.0 (compatible; Miniflux/"+version.Version+"; +https://miniflux.net)")
headers.Add("Accept", "*/*") headers.Add("Accept", "*/*")
if c.etagHeader != "" { if c.etagHeader != "" {

View file

@ -5,7 +5,7 @@
package version package version
// Version of the application (generated with "make build") // Version of the application (generated with "make build")
var Version = "undefined" var Version = "2.0.x-dev"
// BuildDate is generated with "make build" // BuildDate is generated with "make build"
var BuildDate = "undefined" var BuildDate = "undefined"