support for Atom feeds with updated but not published timestamp
This commit is contained in:
parent
8ba82c6373
commit
6e216c0c15
5 changed files with 49 additions and 9 deletions
28
LICENSE
Normal file
28
LICENSE
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
Simplifed BSD License
|
||||||
|
|
||||||
|
Copyright (c) 2015, Kyle Mahan
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are
|
||||||
|
met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
2. 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
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
6
README.md
Normal file
6
README.md
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
Woodwind
|
||||||
|
========
|
||||||
|
|
||||||
|
A minimum viable stream-style feed reader.
|
||||||
|
|
||||||
|
Supports mf2 h-feed and xml feeds (thanks to Universal Feed Parser).
|
|
@ -3,11 +3,12 @@ from .extensions import db
|
||||||
|
|
||||||
|
|
||||||
bleach.ALLOWED_TAGS += ['a', 'img', 'p', 'br', 'marquee', 'blink',
|
bleach.ALLOWED_TAGS += ['a', 'img', 'p', 'br', 'marquee', 'blink',
|
||||||
'audio', 'video']
|
'audio', 'video', 'table', 'tbody', 'td', 'tr']
|
||||||
bleach.ALLOWED_ATTRIBUTES.update({
|
bleach.ALLOWED_ATTRIBUTES.update({
|
||||||
'img': ['src', 'alt', 'title'],
|
'img': ['src', 'alt', 'title'],
|
||||||
'audio': ['preload', 'controls', 'src'],
|
'audio': ['preload', 'controls', 'src'],
|
||||||
'video': ['preload', 'controls', 'src'],
|
'video': ['preload', 'controls', 'src'],
|
||||||
|
'td': ['colspan'],
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -104,12 +104,17 @@ def process_xml_feed_for_new_entries(session, feed):
|
||||||
if not uid or uid in preexisting:
|
if not uid or uid in preexisting:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if 'updated_parsed' in p_entry:
|
||||||
updated = datetime.datetime.fromtimestamp(
|
updated = datetime.datetime.fromtimestamp(
|
||||||
time.mktime(p_entry.updated_parsed)
|
time.mktime(p_entry.updated_parsed))
|
||||||
) if 'updated_parsed' in p_entry else None
|
else:
|
||||||
|
updated = None
|
||||||
|
|
||||||
|
if 'published_parsed' in p_entry:
|
||||||
published = datetime.datetime.fromtimestamp(
|
published = datetime.datetime.fromtimestamp(
|
||||||
time.mktime(p_entry.published_parsed)
|
time.mktime(p_entry.published_parsed))
|
||||||
) if 'published_parsed' in p_entry else now
|
else:
|
||||||
|
published = updated or now
|
||||||
|
|
||||||
title = p_entry.get('title')
|
title = p_entry.get('title')
|
||||||
|
|
||||||
|
|
|
@ -62,14 +62,14 @@ $(attachListeners);
|
||||||
<footer>
|
<footer>
|
||||||
<a href="{{ entry.permalink }}">{{ entry.published }}</a>
|
<a href="{{ entry.permalink }}">{{ entry.published }}</a>
|
||||||
|
|
||||||
<form action="{{ current_user.micropub_endpoint }}" method="POST">
|
<form action="{{ current_user.micropub_endpoint }}" method="POST" style="display:inline">
|
||||||
<input type="hidden" name="access_token" value="{{current_user.access_token}}"/>
|
<input type="hidden" name="access_token" value="{{current_user.access_token}}"/>
|
||||||
<input type="hidden" name="h" value="entry"/>
|
<input type="hidden" name="h" value="entry"/>
|
||||||
<input type="hidden" name="like-of" value="{{ entry.permalink }}"/>
|
<input type="hidden" name="like-of" value="{{ entry.permalink }}"/>
|
||||||
<button type="submit">Like</button>
|
<button type="submit">Like</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<a href="#" class="show-reply-form">Reply</a>
|
<button class="show-reply-form">Reply</button>
|
||||||
|
|
||||||
<form class="reply-form" action="{{ current_user.micropub_endpoint }}" method="POST">
|
<form class="reply-form" action="{{ current_user.micropub_endpoint }}" method="POST">
|
||||||
<input type="hidden" name="access_token" value="{{current_user.access_token}}"/>
|
<input type="hidden" name="access_token" value="{{current_user.access_token}}"/>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue