mirror of
https://github.com/janeczku/calibre-web
synced 2024-12-25 09:30:31 +00:00
Bugfix for visibility opds feed
This commit is contained in:
parent
737d758362
commit
cb62d36e44
@ -24,7 +24,7 @@ import datetime
|
|||||||
import json
|
import json
|
||||||
from urllib.parse import unquote_plus
|
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_login import current_user
|
||||||
from flask_babel import get_locale
|
from flask_babel import get_locale
|
||||||
from flask_babel import gettext as _
|
from flask_babel import gettext as _
|
||||||
@ -117,7 +117,7 @@ def feed_discover():
|
|||||||
@opds.route("/opds/rated")
|
@opds.route("/opds/rated")
|
||||||
@requires_basic_auth_if_no_ano
|
@requires_basic_auth_if_no_ano
|
||||||
def feed_best_rated():
|
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)
|
abort(404)
|
||||||
off = request.args.get("offset") or 0
|
off = request.args.get("offset") or 0
|
||||||
entries, __, pagination = calibre_db.fill_indexpage((int(off) / (int(config.config_books_per_page)) + 1), 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):
|
def feed_shelf(book_id):
|
||||||
if not (current_user.is_authenticated or g.allow_anonymous):
|
if not (current_user.is_authenticated or g.allow_anonymous):
|
||||||
abort(404)
|
abort(404)
|
||||||
|
off = request.args.get("offset") or 0
|
||||||
if current_user.is_anonymous:
|
if current_user.is_anonymous:
|
||||||
shelf = ub.session.query(ub.Shelf).filter(ub.Shelf.is_public == 1,
|
shelf = ub.session.query(ub.Shelf).filter(ub.Shelf.is_public == 1,
|
||||||
ub.Shelf.id == book_id).first()
|
ub.Shelf.id == book_id).first()
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
<updated>{{ current_time }}</updated>
|
<updated>{{ current_time }}</updated>
|
||||||
<content type="text">{{_('Books sorted alphabetically')}}</content>
|
<content type="text">{{_('Books sorted alphabetically')}}</content>
|
||||||
</entry>
|
</entry>
|
||||||
|
{% if current_user.check_visibility(g.constants.SIDEBAR_DOWNLOAD) and (not current_user.is_anonymous) %}
|
||||||
<entry>
|
<entry>
|
||||||
<title>{{_('Hot Books')}}</title>
|
<title>{{_('Hot Books')}}</title>
|
||||||
<link href="{{url_for('opds.feed_hot')}}" type="application/atom+xml;profile=opds-catalog"/>
|
<link href="{{url_for('opds.feed_hot')}}" type="application/atom+xml;profile=opds-catalog"/>
|
||||||
@ -29,6 +30,8 @@
|
|||||||
<updated>{{ current_time }}</updated>
|
<updated>{{ current_time }}</updated>
|
||||||
<content type="text">{{_('Popular publications from this catalog based on Downloads.')}}</content>
|
<content type="text">{{_('Popular publications from this catalog based on Downloads.')}}</content>
|
||||||
</entry>
|
</entry>
|
||||||
|
{%endif %}
|
||||||
|
{% if current_user.check_visibility(g.constants.SIDEBAR_BEST_RATED) %}
|
||||||
<entry>
|
<entry>
|
||||||
<title>{{_('Top Rated Books')}}</title>
|
<title>{{_('Top Rated Books')}}</title>
|
||||||
<link href="{{url_for('opds.feed_best_rated')}}" type="application/atom+xml;profile=opds-catalog"/>
|
<link href="{{url_for('opds.feed_best_rated')}}" type="application/atom+xml;profile=opds-catalog"/>
|
||||||
@ -36,6 +39,8 @@
|
|||||||
<updated>{{ current_time }}</updated>
|
<updated>{{ current_time }}</updated>
|
||||||
<content type="text">{{_('Popular publications from this catalog based on Rating.')}}</content>
|
<content type="text">{{_('Popular publications from this catalog based on Rating.')}}</content>
|
||||||
</entry>
|
</entry>
|
||||||
|
{%endif %}
|
||||||
|
{% if current_user.check_visibility(g.constants.SIDEBAR_RECENT) %}
|
||||||
<entry>
|
<entry>
|
||||||
<title>{{_('Recently added Books')}}</title>
|
<title>{{_('Recently added Books')}}</title>
|
||||||
<link href="{{url_for('opds.feed_new')}}" type="application/atom+xml;profile=opds-catalog"/>
|
<link href="{{url_for('opds.feed_new')}}" type="application/atom+xml;profile=opds-catalog"/>
|
||||||
@ -43,6 +48,8 @@
|
|||||||
<updated>{{ current_time }}</updated>
|
<updated>{{ current_time }}</updated>
|
||||||
<content type="text">{{_('The latest Books')}}</content>
|
<content type="text">{{_('The latest Books')}}</content>
|
||||||
</entry>
|
</entry>
|
||||||
|
{%endif %}
|
||||||
|
{% if current_user.check_visibility(g.constants.SIDEBAR_RANDOM) %}
|
||||||
<entry>
|
<entry>
|
||||||
<title>{{_('Random Books')}}</title>
|
<title>{{_('Random Books')}}</title>
|
||||||
<link href="{{url_for('opds.feed_discover')}}" type="application/atom+xml;profile=opds-catalog"/>
|
<link href="{{url_for('opds.feed_discover')}}" type="application/atom+xml;profile=opds-catalog"/>
|
||||||
@ -50,7 +57,8 @@
|
|||||||
<updated>{{ current_time }}</updated>
|
<updated>{{ current_time }}</updated>
|
||||||
<content type="text">{{_('Show Random Books')}}</content>
|
<content type="text">{{_('Show Random Books')}}</content>
|
||||||
</entry>
|
</entry>
|
||||||
{% if not current_user.is_anonymous %}
|
{%endif %}
|
||||||
|
{% if current_user.check_visibility(g.constants.SIDEBAR_READ_AND_UNREAD) and not current_user.is_anonymous %}
|
||||||
<entry>
|
<entry>
|
||||||
<title>{{_('Read Books')}}</title>
|
<title>{{_('Read Books')}}</title>
|
||||||
<link href="{{url_for('opds.feed_read_books')}}" type="application/atom+xml;profile=opds-catalog"/>
|
<link href="{{url_for('opds.feed_read_books')}}" type="application/atom+xml;profile=opds-catalog"/>
|
||||||
@ -66,6 +74,7 @@
|
|||||||
<content type="text">{{_('Unread Books')}}</content>
|
<content type="text">{{_('Unread Books')}}</content>
|
||||||
</entry>
|
</entry>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if current_user.check_visibility(g.constants.SIDEBAR_AUTHOR) %}
|
||||||
<entry>
|
<entry>
|
||||||
<title>{{_('Authors')}}</title>
|
<title>{{_('Authors')}}</title>
|
||||||
<link href="{{url_for('opds.feed_authorindex')}}" type="application/atom+xml;profile=opds-catalog"/>
|
<link href="{{url_for('opds.feed_authorindex')}}" type="application/atom+xml;profile=opds-catalog"/>
|
||||||
@ -73,13 +82,17 @@
|
|||||||
<updated>{{ current_time }}</updated>
|
<updated>{{ current_time }}</updated>
|
||||||
<content type="text">{{_('Books ordered by Author')}}</content>
|
<content type="text">{{_('Books ordered by Author')}}</content>
|
||||||
</entry>
|
</entry>
|
||||||
<entry>
|
{% endif %}
|
||||||
|
{% if current_user.check_visibility(g.constants.SIDEBAR_PUBLISHER) %}
|
||||||
|
<entry>
|
||||||
<title>{{_('Publishers')}}</title>
|
<title>{{_('Publishers')}}</title>
|
||||||
<link href="{{url_for('opds.feed_publisherindex')}}" type="application/atom+xml;profile=opds-catalog"/>
|
<link href="{{url_for('opds.feed_publisherindex')}}" type="application/atom+xml;profile=opds-catalog"/>
|
||||||
<id>{{url_for('opds.feed_publisherindex')}}</id>
|
<id>{{url_for('opds.feed_publisherindex')}}</id>
|
||||||
<updated>{{ current_time }}</updated>
|
<updated>{{ current_time }}</updated>
|
||||||
<content type="text">{{_('Books ordered by publisher')}}</content>
|
<content type="text">{{_('Books ordered by publisher')}}</content>
|
||||||
</entry>
|
</entry>
|
||||||
|
{% endif %}
|
||||||
|
{% if current_user.check_visibility(g.constants.SIDEBAR_CATEGORY) %}
|
||||||
<entry>
|
<entry>
|
||||||
<title>{{_('Categories')}}</title>
|
<title>{{_('Categories')}}</title>
|
||||||
<link href="{{url_for('opds.feed_categoryindex')}}" type="application/atom+xml;profile=opds-catalog"/>
|
<link href="{{url_for('opds.feed_categoryindex')}}" type="application/atom+xml;profile=opds-catalog"/>
|
||||||
@ -87,6 +100,8 @@
|
|||||||
<updated>{{ current_time }}</updated>
|
<updated>{{ current_time }}</updated>
|
||||||
<content type="text">{{_('Books ordered by category')}}</content>
|
<content type="text">{{_('Books ordered by category')}}</content>
|
||||||
</entry>
|
</entry>
|
||||||
|
{% endif %}
|
||||||
|
{% if current_user.check_visibility(g.constants.SIDEBAR_SERIES) %}
|
||||||
<entry>
|
<entry>
|
||||||
<title>{{_('Series')}}</title>
|
<title>{{_('Series')}}</title>
|
||||||
<link href="{{url_for('opds.feed_seriesindex')}}" type="application/atom+xml;profile=opds-catalog"/>
|
<link href="{{url_for('opds.feed_seriesindex')}}" type="application/atom+xml;profile=opds-catalog"/>
|
||||||
@ -94,6 +109,8 @@
|
|||||||
<updated>{{ current_time }}</updated>
|
<updated>{{ current_time }}</updated>
|
||||||
<content type="text">{{_('Books ordered by series')}}</content>
|
<content type="text">{{_('Books ordered by series')}}</content>
|
||||||
</entry>
|
</entry>
|
||||||
|
{% endif %}
|
||||||
|
{% if current_user.check_visibility(g.constants.SIDEBAR_LANGUAGE) %}
|
||||||
<entry>
|
<entry>
|
||||||
<title>{{_('Languages')}}</title>
|
<title>{{_('Languages')}}</title>
|
||||||
<link href="{{url_for('opds.feed_languagesindex')}}" type="application/atom+xml;profile=opds-catalog"/>
|
<link href="{{url_for('opds.feed_languagesindex')}}" type="application/atom+xml;profile=opds-catalog"/>
|
||||||
@ -101,6 +118,8 @@
|
|||||||
<updated>{{ current_time }}</updated>
|
<updated>{{ current_time }}</updated>
|
||||||
<content type="text">{{_('Books ordered by Languages')}}</content>
|
<content type="text">{{_('Books ordered by Languages')}}</content>
|
||||||
</entry>
|
</entry>
|
||||||
|
{% endif %}
|
||||||
|
{% if current_user.check_visibility(g.constants.SIDEBAR_RATING) %}
|
||||||
<entry>
|
<entry>
|
||||||
<title>{{_('Ratings')}}</title>
|
<title>{{_('Ratings')}}</title>
|
||||||
<link href="{{url_for('opds.feed_ratingindex')}}" type="application/atom+xml;profile=opds-catalog"/>
|
<link href="{{url_for('opds.feed_ratingindex')}}" type="application/atom+xml;profile=opds-catalog"/>
|
||||||
@ -108,7 +127,8 @@
|
|||||||
<updated>{{ current_time }}</updated>
|
<updated>{{ current_time }}</updated>
|
||||||
<content type="text">{{_('Books ordered by Rating')}}</content>
|
<content type="text">{{_('Books ordered by Rating')}}</content>
|
||||||
</entry>
|
</entry>
|
||||||
|
{% endif %}
|
||||||
|
{% if current_user.check_visibility(g.constants.SIDEBAR_FORMAT) %}
|
||||||
<entry>
|
<entry>
|
||||||
<title>{{_('File formats')}}</title>
|
<title>{{_('File formats')}}</title>
|
||||||
<link href="{{url_for('opds.feed_formatindex')}}" type="application/atom+xml;profile=opds-catalog"/>
|
<link href="{{url_for('opds.feed_formatindex')}}" type="application/atom+xml;profile=opds-catalog"/>
|
||||||
@ -116,6 +136,8 @@
|
|||||||
<updated>{{ current_time }}</updated>
|
<updated>{{ current_time }}</updated>
|
||||||
<content type="text">{{_('Books ordered by file formats')}}</content>
|
<content type="text">{{_('Books ordered by file formats')}}</content>
|
||||||
</entry>
|
</entry>
|
||||||
|
{% endif %}
|
||||||
|
{% if current_user.is_authenticated or g.allow_anonymous %}
|
||||||
<entry>
|
<entry>
|
||||||
<title>{{_('Shelves')}}</title>
|
<title>{{_('Shelves')}}</title>
|
||||||
<link href="{{url_for('opds.feed_shelfindex')}}" type="application/atom+xml;profile=opds-catalog"/>
|
<link href="{{url_for('opds.feed_shelfindex')}}" type="application/atom+xml;profile=opds-catalog"/>
|
||||||
@ -123,4 +145,5 @@
|
|||||||
<updated>{{ current_time }}</updated>
|
<updated>{{ current_time }}</updated>
|
||||||
<content type="text">{{_('Books organized in shelves')}}</content>
|
<content type="text">{{_('Books organized in shelves')}}</content>
|
||||||
</entry>
|
</entry>
|
||||||
|
{% endif %}
|
||||||
</feed>
|
</feed>
|
||||||
|
Loading…
Reference in New Issue
Block a user