Compare commits
2 Commits
985185f47f
...
15951d228c
Author | SHA1 | Date |
---|---|---|
pictuga | 15951d228c | |
pictuga | c1b1f5f58a |
|
@ -91,6 +91,7 @@ The arguments are:
|
|||
- `debug`: to have some feedback from the script execution. Useful for debugging
|
||||
- `force`: force refetch the rss feed and articles
|
||||
- `silent`: don't output the final RSS (useless on its own, but can be nice when debugging)
|
||||
- `first`: return the feed items in the order they initially appear in the feed (morss ohterwise shows the newest items first)
|
||||
- http server only
|
||||
- `callback=NAME`: for JSONP calls
|
||||
- `cors`: allow Cross-origin resource sharing (allows XHR calls from other servers)
|
||||
|
|
|
@ -343,8 +343,15 @@ def FeedGather(rss, url, options):
|
|||
if options.cache:
|
||||
max_time = 0
|
||||
|
||||
if options.first:
|
||||
# :first to just take the first items in the feed (in sequence)
|
||||
sorted_items = rss.items
|
||||
|
||||
else:
|
||||
# otherwise, take the _newest_, i.e. sort by time
|
||||
now = datetime.now(tz.tzutc())
|
||||
sorted_items = sorted(rss.items, key=lambda x:x.updated or x.time or now, reverse=True)
|
||||
|
||||
for i, item in enumerate(sorted_items):
|
||||
if time.time() - start_time > lim_time >= 0 or i + 1 > lim_item >= 0:
|
||||
log('dropped')
|
||||
|
@ -605,7 +612,7 @@ def cgi_get(environ, start_response):
|
|||
output = req['data']
|
||||
|
||||
# return html page
|
||||
headers = {'status': '200 OK', 'content-type': 'text/html; charset=utf-8'}
|
||||
headers = {'status': '200 OK', 'content-type': 'text/html; charset=utf-8', 'X-Frame-Options': 'SAMEORIGIN'} # SAMEORIGIN to avoid potential abuse
|
||||
start_response(headers['status'], list(headers.items()))
|
||||
return [output]
|
||||
|
||||
|
|
|
@ -190,7 +190,12 @@
|
|||
<option value="">standard</option>
|
||||
<option value=":firstlink" title="Pull the article from the first available link in the description, instead of the standard link. Useful for Twitter feeds for example, to get the articles referred to in tweets rather than the tweet itself">first (?)</option>
|
||||
</select>
|
||||
link and
|
||||
link of the
|
||||
<select>
|
||||
<option value="">newest</option>
|
||||
<option value=":first" title="Return the feed items in the order they appear in the feed (morss ohterwise shows the newest items first)">first (?)</option>
|
||||
</select>
|
||||
items and
|
||||
<select>
|
||||
<option value="">keep</option>
|
||||
<option value=":nolink:noref">remove</option>
|
||||
|
|
Loading…
Reference in New Issue