Commit cdb1b526 authored by OzzieIsaacs's avatar OzzieIsaacs

Bugfix Get gdrive instances (#554, #525)

Metadata.db download works again
removed DEVELOPMENT constant
removed db logging in debug mode (too, noisy, to less information)
code refactoring url_for_other_page
feed languge set to en-EN
update status shos local time instead of UTC
Error handling (back to index page) in case of gdrive authenticate aborted
Mistyping page register fixed
Mistyping bokk fixed
Added uploaded books to tasklist (#442)
Error handling for failed file update added
Code refactoring worker thread
Tasks now never show any decimal values
Converter function unified
removed shell from subprocess call
preparation for limiting domain for registering emails
Book series can now increased in 0.1 steps (#562)
Accordion panels in config are now usable on touch devices like iPad (#545)
Gdrive authenticate button only visible after logged in (#525)
Fixed misstyping in german translation
parent f8132f4d
...@@ -3,8 +3,9 @@ try: ...@@ -3,8 +3,9 @@ try:
from pydrive.drive import GoogleDrive from pydrive.drive import GoogleDrive
from pydrive.auth import RefreshError from pydrive.auth import RefreshError
from apiclient import errors from apiclient import errors
gdrive_support = True
except ImportError: except ImportError:
pass gdrive_support = False
import os import os
from ub import config from ub import config
...@@ -259,6 +260,13 @@ def copyDriveFileRemote(drive, origin_file_id, copy_title): ...@@ -259,6 +260,13 @@ def copyDriveFileRemote(drive, origin_file_id, copy_title):
print ('An error occurred: %s' % error) print ('An error occurred: %s' % error)
return None return None
# Download metadata.db from gdrive
def downloadFile(path, filename, output):
f = getFileFromEbooksFolder(path, filename)
f.GetContentFile(output)
def moveGdriveFolderRemote(origin_file, target_folder): def moveGdriveFolderRemote(origin_file, target_folder):
drive = getDrive(Gdrive.Instance().drive) drive = getDrive(Gdrive.Instance().drive)
previous_parents = ",".join([parent["id"] for parent in origin_file.get('parents')]) previous_parents = ",".join([parent["id"] for parent in origin_file.get('parents')])
...@@ -339,7 +347,7 @@ def uploadFileToEbooksFolder(destFile, f): ...@@ -339,7 +347,7 @@ def uploadFileToEbooksFolder(destFile, f):
def watchChange(drive, channel_id, channel_type, channel_address, def watchChange(drive, channel_id, channel_type, channel_address,
channel_token=None, expiration=None): channel_token=None, expiration=None):
drive = getDrive(drive) # drive = getDrive(drive)
# Watch for all changes to a user's Drive. # Watch for all changes to a user's Drive.
# Args: # Args:
# service: Drive API service instance. # service: Drive API service instance.
...@@ -382,7 +390,7 @@ def watchFile(drive, file_id, channel_id, channel_type, channel_address, ...@@ -382,7 +390,7 @@ def watchFile(drive, file_id, channel_id, channel_type, channel_address,
Raises: Raises:
apiclient.errors.HttpError: if http request to create channel fails. apiclient.errors.HttpError: if http request to create channel fails.
""" """
drive = getDrive(drive) # drive = getDrive(drive)
body = { body = {
'id': channel_id, 'id': channel_id,
...@@ -405,7 +413,7 @@ def stopChannel(drive, channel_id, resource_id): ...@@ -405,7 +413,7 @@ def stopChannel(drive, channel_id, resource_id):
Raises: Raises:
apiclient.errors.HttpError: if http request to create channel fails. apiclient.errors.HttpError: if http request to create channel fails.
""" """
drive = getDrive(drive) # drive = getDrive(drive)
# service=drive.auth.service # service=drive.auth.service
body = { body = {
'id': channel_id, 'id': channel_id,
...@@ -415,7 +423,7 @@ def stopChannel(drive, channel_id, resource_id): ...@@ -415,7 +423,7 @@ def stopChannel(drive, channel_id, resource_id):
def getChangeById (drive, change_id): def getChangeById (drive, change_id):
drive = getDrive(drive) # drive = getDrive(drive)
# Print a single Change resource information. # Print a single Change resource information.
# #
# Args: # Args:
......
...@@ -53,6 +53,9 @@ ...@@ -53,6 +53,9 @@
</table> </table>
<div class="btn btn-default" id="admin_edit_email"><a href="{{url_for('edit_mailsettings')}}">{{_('Change SMTP settings')}}</a></div> <div class="btn btn-default" id="admin_edit_email"><a href="{{url_for('edit_mailsettings')}}">{{_('Change SMTP settings')}}</a></div>
{% if g.allow_registration %}
<div class="btn btn-default" id="admin_register_domain"><a href="{{url_for('edit_register_domains')}}">{{_('Edit allowed domains')}}</a></div>
{% endif %}
<h2>{{_('Configuration')}}</h2> <h2>{{_('Configuration')}}</h2>
<table class="table table-striped" id="table_configuration"> <table class="table table-striped" id="table_configuration">
...@@ -79,7 +82,6 @@ ...@@ -79,7 +82,6 @@
<div class="btn btn-default"><a href="{{url_for('configuration')}}">{{_('Basic Configuration')}}</a></div> <div class="btn btn-default"><a href="{{url_for('configuration')}}">{{_('Basic Configuration')}}</a></div>
<div class="btn btn-default"><a href="{{url_for('view_configuration')}}">{{_('UI Configuration')}}</a></div> <div class="btn btn-default"><a href="{{url_for('view_configuration')}}">{{_('UI Configuration')}}</a></div>
<h2>{{_('Administration')}}</h2> <h2>{{_('Administration')}}</h2>
{% if not development %}
<div>{{_('Current commit timestamp')}}: <span>{{commit}} </span></div> <div>{{_('Current commit timestamp')}}: <span>{{commit}} </span></div>
<div class="hidden" id="update_info">{{_('Newest commit timestamp')}}: <span></span></div> <div class="hidden" id="update_info">{{_('Newest commit timestamp')}}: <span></span></div>
<p></p> <p></p>
...@@ -88,7 +90,6 @@ ...@@ -88,7 +90,6 @@
<div class="btn btn-default" data-toggle="modal" data-target="#ShutdownDialog">{{_('Stop Calibre-web')}}</div> <div class="btn btn-default" data-toggle="modal" data-target="#ShutdownDialog">{{_('Stop Calibre-web')}}</div>
<div class="btn btn-default" id="check_for_update">{{_('Check for update')}}</div> <div class="btn btn-default" id="check_for_update">{{_('Check for update')}}</div>
<div class="btn btn-default hidden" id="perform_update" data-toggle="modal" data-target="#UpdateprogressDialog">{{_('Perform Update')}}</div> <div class="btn btn-default hidden" id="perform_update" data-toggle="modal" data-target="#UpdateprogressDialog">{{_('Perform Update')}}</div>
{% endif %}
</div> </div>
<!-- Modal --> <!-- Modal -->
<div id="RestartDialog" class="modal fade" role="dialog"> <div id="RestartDialog" class="modal fade" role="dialog">
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="series_index">{{_('Series id')}}</label> <label for="series_index">{{_('Series id')}}</label>
<input type="number" step="1" min="0" class="form-control" name="series_index" id="series_index" value="{{book.series_index}}"> <input type="number" step="0.1" min="0" class="form-control" name="series_index" id="series_index" value="{{book.series_index}}">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="rating">{{_('Rating')}}</label> <label for="rating">{{_('Rating')}}</label>
......
...@@ -7,10 +7,10 @@ ...@@ -7,10 +7,10 @@
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<h4 class="panel-title"> <h4 class="panel-title">
<div class="accordion-toggle" data-toggle="collapse" href="#collapseOne"> <a class="accordion-toggle" data-toggle="collapse" href="#collapseOne" style="text-decoration:none;">
<span class="glyphicon glyphicon-minus"></span> <span class="glyphicon glyphicon-minus"></span>
{{_('Library Configuration')}} {{_('Library Configuration')}}
</div> </a>
</h4> </h4>
</div> </div>
<div id="collapseOne" class="panel-collapse collapse in"> <div id="collapseOne" class="panel-collapse collapse in">
...@@ -31,11 +31,15 @@ ...@@ -31,11 +31,15 @@
</label> </label>
</div> </div>
{% else %} {% else %}
{% if show_authenticate_google_drive %} {% if show_authenticate_google_drive and g.user.is_authenticated %}
<div class="form-group required"> <div class="form-group required">
<a href="{{ url_for('authenticate_google_drive') }}" class="btn btn-primary">{{_('Authenticate Google Drive')}}</a> <a href="{{ url_for('authenticate_google_drive') }}" class="btn btn-primary">{{_('Authenticate Google Drive')}}</a>
</div> </div>
{% else %} {% else %}
{% if show_authenticate_google_drive and not g.user.is_authenticated %}
<div >{{_('Please finish Google Drive setup after login')}}</div>
{% endif %}
{% if not show_authenticate_google_drive %}
<div class="form-group required"> <div class="form-group required">
<label for="config_google_drive_folder">{{_('Google Drive Calibre folder')}}</label> <label for="config_google_drive_folder">{{_('Google Drive Calibre folder')}}</label>
<select name="config_google_drive_folder" id="config_google_drive_folder" class="form-control"> <select name="config_google_drive_folder" id="config_google_drive_folder" class="form-control">
...@@ -55,17 +59,19 @@ ...@@ -55,17 +59,19 @@
{% endif %} {% endif %}
{% endif %} {% endif %}
{% endif %} {% endif %}
{% endif %}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<h4 class="panel-title"> <h4 class="panel-title">
<div class="accordion-toggle" data-toggle="collapse" href="#collapsetwo"> <a class="accordion-toggle" data-toggle="collapse" href="#collapsetwo" style="text-decoration:none;">
<span class="glyphicon glyphicon-plus"></span> <span class="glyphicon glyphicon-plus"></span>
{{_('Server Configuration')}} {{_('Server Configuration')}}
</div> </a>
</h4> </h4>
</div> </div>
<div id="collapsetwo" class="panel-collapse collapse"> <div id="collapsetwo" class="panel-collapse collapse">
...@@ -88,10 +94,10 @@ ...@@ -88,10 +94,10 @@
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<h4 class="panel-title"> <h4 class="panel-title">
<div class="accordion-toggle" data-toggle="collapse" href="#collapsethree"> <a class="accordion-toggle" data-toggle="collapse" href="#collapsethree" style="text-decoration:none;">
<span class="glyphicon glyphicon-plus"></span> <span class="glyphicon glyphicon-plus"></span>
{{_('Logfile Configuration')}} {{_('Logfile Configuration')}}
</div> </a>
</h4> </h4>
</div> </div>
<div id="collapsethree" class="panel-collapse collapse"> <div id="collapsethree" class="panel-collapse collapse">
...@@ -115,10 +121,10 @@ ...@@ -115,10 +121,10 @@
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<h4 class="panel-title"> <h4 class="panel-title">
<div class="accordion-toggle" data-toggle="collapse" href="#collapsefive"> <a class="accordion-toggle" data-toggle="collapse" href="#collapsefive">
<span class="glyphicon glyphicon-plus"></span> <span class="glyphicon glyphicon-plus"></span>
{{_('Feature Configuration')}} {{_('Feature Configuration')}}
</div> </a>
</h4> </h4>
</div> </div>
<div id="collapsefive" class="panel-collapse collapse"> <div id="collapsefive" class="panel-collapse collapse">
...@@ -162,10 +168,10 @@ ...@@ -162,10 +168,10 @@
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<h4 class="panel-title"> <h4 class="panel-title">
<div class="accordion-toggle" data-toggle="collapse" href="#collapseeight"> <a class="accordion-toggle" data-toggle="collapse" href="#collapseeight" style="text-decoration:none;">
<span class="glyphicon glyphicon-plus"></span> <span class="glyphicon glyphicon-plus"></span>
{{_('E-Book converter')}} {{_('E-Book converter')}}
</div> </a>
</h4> </h4>
</div> </div>
<div id="collapseeight" class="panel-collapse collapse"> <div id="collapseeight" class="panel-collapse collapse">
......
...@@ -7,10 +7,10 @@ ...@@ -7,10 +7,10 @@
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<h4 class="panel-title"> <h4 class="panel-title">
<div class="accordion-toggle" data-toggle="collapse" href="#collapsefour"> <a class="accordion-toggle" data-toggle="collapse" href="#collapsefour" style="text-decoration:none;">
<span class="glyphicon glyphicon-plus"></span> <span class="glyphicon glyphicon-plus"></span>
{{_('View Configuration')}} {{_('View Configuration')}}
</div> </a>
</h4> </h4>
</div> </div>
<div id="collapsefour" class="panel-collapse collapse"> <div id="collapsefour" class="panel-collapse collapse">
...@@ -57,10 +57,10 @@ ...@@ -57,10 +57,10 @@
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<h4 class="panel-title"> <h4 class="panel-title">
<div class="accordion-toggle" data-toggle="collapse" href="#collapsesix"> <a class="accordion-toggle" data-toggle="collapse" href="#collapsesix" style="text-decoration:none;">
<span class="glyphicon glyphicon-plus"></span> <span class="glyphicon glyphicon-plus"></span>
{{_('Default settings for new users')}} {{_('Default settings for new users')}}
</div> </a>
</h4> </h4>
</div> </div>
<div id="collapsesix" class="panel-collapse collapse"> <div id="collapsesix" class="panel-collapse collapse">
...@@ -99,10 +99,10 @@ ...@@ -99,10 +99,10 @@
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<h4 class="panel-title"> <h4 class="panel-title">
<div class="accordion-toggle" data-toggle="collapse" href="#collapseseven"> <a class="accordion-toggle" data-toggle="collapse" href="#collapseseven" style="text-decoration:none;">
<span class="glyphicon glyphicon-plus"></span> <span class="glyphicon glyphicon-plus"></span>
{{_('Default visibilities for new users')}} {{_('Default visibilities for new users')}}
</div> </a>
</h4> </h4>
</div> </div>
<div id="collapseseven" class="panel-collapse collapse"> <div id="collapseseven" class="panel-collapse collapse">
......
...@@ -186,13 +186,13 @@ ...@@ -186,13 +186,13 @@
{% if pagination and (pagination.has_next or pagination.has_prev) %} {% if pagination and (pagination.has_next or pagination.has_prev) %}
<div class="pagination"> <div class="pagination">
{% if pagination.has_prev %} {% if pagination.has_prev %}
<a class="previous" href="{{ url_for_other_page(pagination.page - 1) <a class="previous" href="{{ (pagination.page - 1)|url_for_other_page
}}">&laquo; {{_('Previous')}}</a> }}">&laquo; {{_('Previous')}}</a>
{% endif %} {% endif %}
{% for page in pagination.iter_pages() %} {% for page in pagination.iter_pages() %}
{% if page %} {% if page %}
{% if page != pagination.page %} {% if page != pagination.page %}
<a href="{{ url_for_other_page(page) }}">{{ page }}</a> <a href="{{ (page)|url_for_other_page }}">{{ page }}</a>
{% else %} {% else %}
<strong>{{ page }}</strong> <strong>{{ page }}</strong>
{% endif %} {% endif %}
...@@ -201,7 +201,7 @@ ...@@ -201,7 +201,7 @@
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% if pagination.has_next %} {% if pagination.has_next %}
<a class="next" href="{{ url_for_other_page(pagination.page + 1) <a class="next" href="{{ (pagination.page + 1)|url_for_other_page
}}">{{_('Next')}} &raquo;</a> }}">{{_('Next')}} &raquo;</a>
{% endif %} {% endif %}
</div> </div>
......
...@@ -1287,7 +1287,7 @@ msgstr "Über" ...@@ -1287,7 +1287,7 @@ msgstr "Über"
#: cps/templates/layout.html:187 #: cps/templates/layout.html:187
msgid "Previous" msgid "Previous"
msgstr "Voerheriger" msgstr "Vorheriger"
#: cps/templates/layout.html:214 #: cps/templates/layout.html:214
msgid "Book Details" msgid "Book Details"
......
...@@ -46,7 +46,6 @@ DEFAULT_PASS = "admin123" ...@@ -46,7 +46,6 @@ DEFAULT_PASS = "admin123"
DEFAULT_PORT = int(os.environ.get("CALIBRE_PORT", 8083)) DEFAULT_PORT = int(os.environ.get("CALIBRE_PORT", 8083))
DEVELOPMENT = False
class UserBase: class UserBase:
...@@ -291,10 +290,7 @@ class Settings(Base): ...@@ -291,10 +290,7 @@ class Settings(Base):
config_default_show = Column(SmallInteger, default=2047) config_default_show = Column(SmallInteger, default=2047)
config_columns_to_ignore = Column(String) config_columns_to_ignore = Column(String)
config_use_google_drive = Column(Boolean) config_use_google_drive = Column(Boolean)
# config_google_drive_client_id = Column(String)
# config_google_drive_client_secret = Column(String)
config_google_drive_folder = Column(String) config_google_drive_folder = Column(String)
# config_google_drive_calibre_url_base = Column(String)
config_google_drive_watch_changes_response = Column(String) config_google_drive_watch_changes_response = Column(String)
config_remote_login = Column(Boolean) config_remote_login = Column(Boolean)
config_use_goodreads = Column(Boolean) config_use_goodreads = Column(Boolean)
...@@ -556,9 +552,6 @@ def migrate_Database(): ...@@ -556,9 +552,6 @@ def migrate_Database():
except exc.OperationalError: except exc.OperationalError:
conn = engine.connect() conn = engine.connect()
conn.execute("ALTER TABLE Settings ADD column `config_use_google_drive` INTEGER DEFAULT 0") conn.execute("ALTER TABLE Settings ADD column `config_use_google_drive` INTEGER DEFAULT 0")
# conn.execute("ALTER TABLE Settings ADD column `config_google_drive_client_id` String DEFAULT ''")
# conn.execute("ALTER TABLE Settings ADD column `config_google_drive_client_secret` String DEFAULT ''")
# conn.execute("ALTER TABLE Settings ADD column `config_google_drive_calibre_url_base` INTEGER DEFAULT 0")
conn.execute("ALTER TABLE Settings ADD column `config_google_drive_folder` String DEFAULT ''") conn.execute("ALTER TABLE Settings ADD column `config_google_drive_folder` String DEFAULT ''")
conn.execute("ALTER TABLE Settings ADD column `config_google_drive_watch_changes_response` String DEFAULT ''") conn.execute("ALTER TABLE Settings ADD column `config_google_drive_watch_changes_response` String DEFAULT ''")
try: try:
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment