Merge branch 'master' of https://github.com/janeczku/calibre-web
This commit is contained in:
commit
752192a057
|
@ -41,6 +41,6 @@ Open a new GitHub pull request with the patch. Ensure the PR description clearly
|
||||||
|
|
||||||
In case your code enhances features of Calibre-Web: Create your pull request for the development branch if your enhancement consists of more than some lines of code in a local section of Calibre-Webs code. This makes it easier to test it and check all implication before it's made public.
|
In case your code enhances features of Calibre-Web: Create your pull request for the development branch if your enhancement consists of more than some lines of code in a local section of Calibre-Webs code. This makes it easier to test it and check all implication before it's made public.
|
||||||
|
|
||||||
Please check if your code runs on Python 2.7 (still necessary in 2020) and mainly on python 3. If possible and the feature is related to operating system functions, try to check it on Windows and Linux.
|
Please check if your code runs with python 3, python 2 is no longer supported. If possible and the feature is related to operating system functions, try to check it on Windows and Linux.
|
||||||
Calibre-Web is automatically tested on Linux in combination with python 3.7. The code for testing is in a [separate repo](https://github.com/OzzieIsaacs/calibre-web-test) on Github. It uses unit tests and performs real system tests with selenium; it would be great if you could consider also writing some tests.
|
Calibre-Web is automatically tested on Linux in combination with python 3.8. The code for testing is in a [separate repo](https://github.com/OzzieIsaacs/calibre-web-test) on Github. It uses unit tests and performs real system tests with selenium; it would be great if you could consider also writing some tests.
|
||||||
A static code analysis is done by Codacy, but it's partly broken and doesn't run automatically. You could check your code with ESLint before contributing, a configuration file can be found in the projects root folder.
|
A static code analysis is done by Codacy, but it's partly broken and doesn't run automatically. You could check your code with ESLint before contributing, a configuration file can be found in the projects root folder.
|
||||||
|
|
|
@ -102,8 +102,9 @@ def create_app():
|
||||||
|
|
||||||
log.info('Starting Calibre Web...')
|
log.info('Starting Calibre Web...')
|
||||||
if sys.version_info < (3, 0):
|
if sys.version_info < (3, 0):
|
||||||
log.info('Python2 is EOL since end of 2019, this version of Calibre-Web is no longer supporting Python2 please consider upgrading to Python3')
|
log.info('*** Python2 is EOL since end of 2019, this version of Calibre-Web is no longer supporting Python2, please update your installation to Python3 ***')
|
||||||
print('Python2 is EOL since end of 2019, this version of Calibre-Web is no longer supporting Python2 please consider upgrading to Python3')
|
print('*** Python2 is EOL since end of 2019, this version of Calibre-Web is no longer supporting Python2, please update your installation to Python3 ***')
|
||||||
|
sys.exit(5)
|
||||||
Principal(app)
|
Principal(app)
|
||||||
lm.init_app(app)
|
lm.init_app(app)
|
||||||
app.secret_key = os.getenv('SECRET_KEY', config_sql.get_flask_session_key(ub.session))
|
app.secret_key = os.getenv('SECRET_KEY', config_sql.get_flask_session_key(ub.session))
|
||||||
|
|
|
@ -39,7 +39,9 @@ def _get_command_version(path, pattern, argument=None):
|
||||||
if argument:
|
if argument:
|
||||||
command.append(argument)
|
command.append(argument)
|
||||||
try:
|
try:
|
||||||
return process_wait(command, pattern=pattern).string
|
match = process_wait(command, pattern=pattern)
|
||||||
|
if isinstance(match, re.Match):
|
||||||
|
return match.string
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
log.warning("%s: %s", path, ex)
|
log.warning("%s: %s", path, ex)
|
||||||
return _EXECUTION_ERROR
|
return _EXECUTION_ERROR
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
<input type="checkbox" id="config_use_google_drive" name="config_use_google_drive" data-control="gdrive_settings" {% if config.config_use_google_drive %}checked{% endif %} >
|
<input type="checkbox" id="config_use_google_drive" name="config_use_google_drive" data-control="gdrive_settings" {% if config.config_use_google_drive %}checked{% endif %} >
|
||||||
<label for="config_use_google_drive">{{_('Use Google Drive?')}}</label>
|
<label for="config_use_google_drive">{{_('Use Google Drive?')}}</label>
|
||||||
</div>
|
</div>
|
||||||
{% if not gdriveError %}
|
{% if not gdriveError and config.config_use_google_drive %}
|
||||||
{% if show_authenticate_google_drive and config.config_use_google_drive %}
|
{% if show_authenticate_google_drive and config.config_use_google_drive %}
|
||||||
<div class="form-group required">
|
<div class="form-group required">
|
||||||
<a href="{{ url_for('gdrive.authenticate_google_drive') }}" id="gdrive_auth" class="btn btn-primary">{{_('Authenticate Google Drive')}}</a>
|
<a href="{{ url_for('gdrive.authenticate_google_drive') }}" id="gdrive_auth" class="btn btn-primary">{{_('Authenticate Google Drive')}}</a>
|
||||||
|
|
|
@ -15,10 +15,10 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-6 col-sm-7">
|
<div class="col-xs-6 col-sm-7">
|
||||||
{% if log_enable %}
|
{% if log_enable %}
|
||||||
<a class="btn btn-default" id="log_file" href="{{url_for('admin.download_log', logtype=0)}}">{{_('Download Calibre-Web Log')}}</a>
|
<a class="btn btn-default" id="log_file_0" href="{{url_for('admin.download_log', logtype=0)}}">{{_('Download Calibre-Web Log')}}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if accesslog_enable %}
|
{% if accesslog_enable %}
|
||||||
<a class="btn btn-default" id="log_file" href="{{url_for('admin.download_log', logtype=1)}}">{{_('Download Access Log')}}</a>
|
<a class="btn btn-default" id="log_file_1" href="{{url_for('admin.download_log', logtype=1)}}">{{_('Download Access Log')}}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1523,6 +1523,7 @@ def login():
|
||||||
login_result, error = services.ldap.bind_user(form['username'], form['password'])
|
login_result, error = services.ldap.bind_user(form['username'], form['password'])
|
||||||
if login_result:
|
if login_result:
|
||||||
login_user(user, remember=bool(form.get('remember_me')))
|
login_user(user, remember=bool(form.get('remember_me')))
|
||||||
|
#ub.store_user_session()
|
||||||
log.debug(u"You are now logged in as: '%s'", user.name)
|
log.debug(u"You are now logged in as: '%s'", user.name)
|
||||||
flash(_(u"you are now logged in as: '%(nickname)s'", nickname=user.name),
|
flash(_(u"you are now logged in as: '%(nickname)s'", nickname=user.name),
|
||||||
category="success")
|
category="success")
|
||||||
|
@ -1530,6 +1531,7 @@ def login():
|
||||||
elif login_result is None and user and check_password_hash(str(user.password), form['password']) \
|
elif login_result is None and user and check_password_hash(str(user.password), form['password']) \
|
||||||
and user.name != "Guest":
|
and user.name != "Guest":
|
||||||
login_user(user, remember=bool(form.get('remember_me')))
|
login_user(user, remember=bool(form.get('remember_me')))
|
||||||
|
#ub.store_user_session()
|
||||||
log.info("Local Fallback Login as: '%s'", user.name)
|
log.info("Local Fallback Login as: '%s'", user.name)
|
||||||
flash(_(u"Fallback Login as: '%(nickname)s', LDAP Server not reachable, or user not known",
|
flash(_(u"Fallback Login as: '%(nickname)s', LDAP Server not reachable, or user not known",
|
||||||
nickname=user.name),
|
nickname=user.name),
|
||||||
|
@ -1559,6 +1561,7 @@ def login():
|
||||||
else:
|
else:
|
||||||
if user and check_password_hash(str(user.password), form['password']) and user.name != "Guest":
|
if user and check_password_hash(str(user.password), form['password']) and user.name != "Guest":
|
||||||
login_user(user, remember=bool(form.get('remember_me')))
|
login_user(user, remember=bool(form.get('remember_me')))
|
||||||
|
# ub.store_user_session()
|
||||||
log.debug(u"You are now logged in as: '%s'", user.name)
|
log.debug(u"You are now logged in as: '%s'", user.name)
|
||||||
flash(_(u"You are now logged in as: '%(nickname)s'", nickname=user.name), category="success")
|
flash(_(u"You are now logged in as: '%(nickname)s'", nickname=user.name), category="success")
|
||||||
config.config_is_initial = False
|
config.config_is_initial = False
|
||||||
|
@ -1582,6 +1585,7 @@ def login():
|
||||||
@login_required
|
@login_required
|
||||||
def logout():
|
def logout():
|
||||||
if current_user is not None and current_user.is_authenticated:
|
if current_user is not None and current_user.is_authenticated:
|
||||||
|
# ub.delete_user_session(current_user.id, flask_session.get('_id',""))
|
||||||
logout_user()
|
logout_user()
|
||||||
if feature_support['oauth'] and (config.config_login_type == 2 or config.config_login_type == 3):
|
if feature_support['oauth'] and (config.config_login_type == 2 or config.config_login_type == 3):
|
||||||
logout_oauth_user()
|
logout_oauth_user()
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user