diff --git a/cps/opds.py b/cps/opds.py
index c0ed6c20..cd77db35 100644
--- a/cps/opds.py
+++ b/cps/opds.py
@@ -24,7 +24,7 @@ import datetime
import json
from urllib.parse import unquote_plus
-from flask import Blueprint, request, render_template, make_response, abort, Response
+from flask import Blueprint, request, render_template, make_response, abort, Response, g
from flask_login import current_user
from flask_babel import get_locale
from flask_babel import gettext as _
@@ -117,7 +117,7 @@ def feed_discover():
@opds.route("/opds/rated")
@requires_basic_auth_if_no_ano
def feed_best_rated():
- if not current_user.check_visibility(constants.SIDEBAR_RATED):
+ if not current_user.check_visibility(constants.SIDEBAR_BEST_RATED):
abort(404)
off = request.args.get("offset") or 0
entries, __, pagination = calibre_db.fill_indexpage((int(off) / (int(config.config_books_per_page)) + 1), 0,
@@ -384,6 +384,7 @@ def feed_shelfindex():
def feed_shelf(book_id):
if not (current_user.is_authenticated or g.allow_anonymous):
abort(404)
+ off = request.args.get("offset") or 0
if current_user.is_anonymous:
shelf = ub.session.query(ub.Shelf).filter(ub.Shelf.is_public == 1,
ub.Shelf.id == book_id).first()
diff --git a/cps/templates/index.xml b/cps/templates/index.xml
index cae3f629..8d4cfadb 100644
--- a/cps/templates/index.xml
+++ b/cps/templates/index.xml
@@ -22,6 +22,7 @@
{{ current_time }}
{{_('Books sorted alphabetically')}}
+ {% if current_user.check_visibility(g.constants.SIDEBAR_DOWNLOAD) and (not current_user.is_anonymous) %}
{{_('Hot Books')}}
@@ -29,6 +30,8 @@
{{ current_time }}
{{_('Popular publications from this catalog based on Downloads.')}}
+ {%endif %}
+ {% if current_user.check_visibility(g.constants.SIDEBAR_BEST_RATED) %}
{{_('Top Rated Books')}}
@@ -36,6 +39,8 @@
{{ current_time }}
{{_('Popular publications from this catalog based on Rating.')}}
+ {%endif %}
+ {% if current_user.check_visibility(g.constants.SIDEBAR_RECENT) %}
{{_('Recently added Books')}}
@@ -43,6 +48,8 @@
{{ current_time }}
{{_('The latest Books')}}
+ {%endif %}
+ {% if current_user.check_visibility(g.constants.SIDEBAR_RANDOM) %}
{{_('Random Books')}}
@@ -50,7 +57,8 @@
{{ current_time }}
{{_('Show Random Books')}}
- {% if not current_user.is_anonymous %}
+ {%endif %}
+ {% if current_user.check_visibility(g.constants.SIDEBAR_READ_AND_UNREAD) and not current_user.is_anonymous %}
{{_('Read Books')}}
@@ -66,6 +74,7 @@
{{_('Unread Books')}}
{% endif %}
+ {% if current_user.check_visibility(g.constants.SIDEBAR_AUTHOR) %}
{{_('Authors')}}
@@ -73,13 +82,17 @@
{{ current_time }}
{{_('Books ordered by Author')}}
-
+ {% endif %}
+ {% if current_user.check_visibility(g.constants.SIDEBAR_PUBLISHER) %}
+
{{_('Publishers')}}
{{url_for('opds.feed_publisherindex')}}
{{ current_time }}
{{_('Books ordered by publisher')}}
+ {% endif %}
+ {% if current_user.check_visibility(g.constants.SIDEBAR_CATEGORY) %}
{{_('Categories')}}
@@ -87,6 +100,8 @@
{{ current_time }}
{{_('Books ordered by category')}}
+ {% endif %}
+ {% if current_user.check_visibility(g.constants.SIDEBAR_SERIES) %}
{{_('Series')}}
@@ -94,6 +109,8 @@
{{ current_time }}
{{_('Books ordered by series')}}
+ {% endif %}
+ {% if current_user.check_visibility(g.constants.SIDEBAR_LANGUAGE) %}
{{_('Languages')}}
@@ -101,6 +118,8 @@
{{ current_time }}
{{_('Books ordered by Languages')}}
+ {% endif %}
+ {% if current_user.check_visibility(g.constants.SIDEBAR_RATING) %}
{{_('Ratings')}}
@@ -108,7 +127,8 @@
{{ current_time }}
{{_('Books ordered by Rating')}}
-
+ {% endif %}
+ {% if current_user.check_visibility(g.constants.SIDEBAR_FORMAT) %}
{{_('File formats')}}
@@ -116,6 +136,8 @@
{{ current_time }}
{{_('Books ordered by file formats')}}
+ {% endif %}
+ {% if current_user.is_authenticated or g.allow_anonymous %}
{{_('Shelves')}}
@@ -123,4 +145,5 @@
{{ current_time }}
{{_('Books organized in shelves')}}
+ {% endif %}