Skip to content

Commit

Permalink
RSS feed changes
Browse files Browse the repository at this point in the history
  • Loading branch information
philborman committed Jun 2, 2018
1 parent 924d87f commit b50add8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lazylibrarian/webServe.py
Original file line number Diff line number Diff line change
Expand Up @@ -1807,6 +1807,8 @@ def mimetype(filename):
return 'application/pdf'
elif name.endswith('.mp3'):
return 'audio/mpeg3'
elif name.endswith('.xml'):
return 'application/rss+xml'
return "application/x-download"

@cherrypy.expose
Expand Down Expand Up @@ -3437,10 +3439,12 @@ def rssFeed(self, **kwargs):
netloc = cherrypy.request.headers['X-Forwarded-Host']
except KeyError:
pass
filename = 'LazyLibrarian_' + ftype + '.xml'
path = path.replace('rssFeed', '').rstrip('/')
baseurl = urlunsplit((scheme, netloc, path, qs, anchor))
remote_ip = cherrypy.request.remote.ip
logger.info("RSS Feed request %s %s%s for %s" % (limit, ftype, plural(limit), remote_ip))
logger.info("RSS Feed request %s %s%s" % (limit, ftype, plural(limit)))
cherrypy.response.headers["Content-Type"] = 'application/rss+xml'
cherrypy.response.headers["Content-Disposition"] = 'attachment; filename="%s"' % filename
return genFeed(ftype, limit=limit, user=userid, baseurl=baseurl)

@cherrypy.expose
Expand Down

0 comments on commit b50add8

Please sign in to comment.