Added clear cache button to admin settings, updated cache busting for book cover images

This commit is contained in:
mmonkey
2020-12-23 03:25:25 -06:00
parent 541fc7e14e
commit 626051e489
20 changed files with 278 additions and 57 deletions
+18 -1
View File
@@ -38,7 +38,7 @@ from sqlalchemy import and_
from sqlalchemy.exc import IntegrityError, OperationalError, InvalidRequestError
from sqlalchemy.sql.expression import func, or_
from . import constants, logger, helper, services
from . import constants, logger, helper, services, fs
from . import db, calibre_db, ub, web_server, get_locale, config, updater_thread, babel, gdriveutils
from .helper import check_valid_domain, send_test_mail, reset_password, generate_password_hash
from .gdriveutils import is_gdrive_ready, gdrive_support
@@ -157,6 +157,23 @@ def shutdown():
return json.dumps(showtext), 400
@admi.route("/clear-cache")
@login_required
@admin_required
def clear_cache():
cache_type = request.args.get('cache_type'.strip())
showtext = {}
if cache_type == fs.CACHE_TYPE_THUMBNAILS:
log.info('clearing cover thumbnail cache')
showtext['text'] = _(u'Cleared cover thumbnail cache')
helper.clear_cover_thumbnail_cache()
return json.dumps(showtext)
showtext['text'] = _(u'Unknown command')
return json.dumps(showtext)
@admi.route("/admin/view")
@login_required
@admin_required