1
0
mirror of https://github.com/aquatix/digimarks.git synced 2025-12-06 20:55:10 +01:00

Endpoint to download all missing icons

This commit is contained in:
2018-03-23 13:03:08 +01:00
parent 8372d6e2a5
commit 0548f35b39

View File

@@ -951,6 +951,24 @@ def refreshfavicons(systemkey):
abort(404)
@app.route('/<systemkey>/findmissingfavicons')
def findmissingfavicons(systemkey):
""" Add user endpoint, convenience """
if systemkey == settings.SYSTEMKEY:
bookmarks = Bookmark.select()
for bookmark in bookmarks:
try:
filename = os.path.join(MEDIA_ROOT, 'favicons/' + bookmark.favicon)
if not os.path.isfile(filename):
# This favicon is missing
bookmark.set_favicon()
except OSError as e:
print(e)
return redirect('/')
else:
abort(404)
# Initialisation == create the bookmark, user and public tag tables if they do not exist
Bookmark.create_table(True)
User.create_table(True)