aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r/views/feed.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyaggr3g470r/views/feed.py')
-rw-r--r--pyaggr3g470r/views/feed.py21
1 files changed, 4 insertions, 17 deletions
diff --git a/pyaggr3g470r/views/feed.py b/pyaggr3g470r/views/feed.py
index fb3ea4c7..afb51903 100644
--- a/pyaggr3g470r/views/feed.py
+++ b/pyaggr3g470r/views/feed.py
@@ -14,6 +14,7 @@ from flask.ext.login import login_required
import conf
from pyaggr3g470r import utils
+from pyaggr3g470r.lib.view_utils import etag_match
from pyaggr3g470r.lib.feed_utils import construct_feed_from
from pyaggr3g470r.forms import AddFeedForm
from pyaggr3g470r.controllers import FeedController, ArticleController
@@ -24,6 +25,7 @@ feed_bp = Blueprint('feed', __name__, url_prefix='/feed')
@feeds_bp.route('/', methods=['GET'])
@login_required
+@etag_match
def feeds():
"Lists the subscribed feeds in a table."
art_contr = ArticleController(g.user.id)
@@ -35,6 +37,7 @@ def feeds():
@feed_bp.route('/<int:feed_id>', methods=['GET'])
@login_required
+@etag_match
def feed(feed_id=None):
"Presents detailed information about a feed."
feed = FeedController(g.user.id).get(id=feed_id)
@@ -138,6 +141,7 @@ def update(action, feed_id=None):
@feed_bp.route('/create', methods=['GET'])
@feed_bp.route('/edit/<int:feed_id>', methods=['GET'])
@login_required
+@etag_match
def form(feed_id=None):
action = gettext("Add a feed")
head_titles = [action]
@@ -196,20 +200,3 @@ def process_form(feed_id=None):
flash(gettext("Downloading articles for the new feed..."), 'info')
return redirect(url_for('feed.form', feed_id=new_feed.id))
-
-
-@feed_bp.route('/icon/<int:feed_id>', methods=['GET'])
-@login_required
-def icon(feed_id):
- icon = FeedController(None if g.user.is_admin() else g.user.id)\
- .get(id=feed_id).icon
- etag = md5(icon.encode('utf8')).hexdigest()
- headers = {'Cache-Control': 'max-age=86400', 'etag': etag}
- if request.headers.get('if-none-match') == etag:
- return Response(status=304, headers=headers)
- if '\n' in icon:
- content_type, *_, icon = icon.split()
- headers['content-type'] = content_type
- else:
- headers['content-type'] = 'application/image'
- return Response(base64.b64decode(icon), headers=headers)
bgstack15