1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-11-28 12:30:00 +00:00

Fix update dates shown in local time format again

Fix "to update" history is shown again
This commit is contained in:
Ozzieisaacs 2019-07-21 13:28:55 +02:00
parent 5c6be5d6d0
commit 3e008ef29b
2 changed files with 8 additions and 8 deletions

View File

@ -663,7 +663,7 @@ def send_logfile(logtype):
@admi.route("/get_update_status", methods=['GET']) @admi.route("/get_update_status", methods=['GET'])
@login_required_if_no_ano @login_required_if_no_ano
def get_update_status(): def get_update_status():
return updater_thread.get_available_updates(request.method) return updater_thread.get_available_updates(request.method, locale=get_locale())
@admi.route("/get_updater_status", methods=['GET', 'POST']) @admi.route("/get_updater_status", methods=['GET', 'POST'])

View File

@ -33,7 +33,7 @@ import requests
from babel.dates import format_datetime from babel.dates import format_datetime
from flask_babel import gettext as _ from flask_babel import gettext as _
from . import constants, logger, config, get_locale, web_server from . import constants, logger, config, web_server
log = logger.create() log = logger.create()
@ -62,10 +62,10 @@ class Updater(threading.Thread):
return self._stable_version_info() return self._stable_version_info()
return self._nightly_version_info() return self._nightly_version_info()
def get_available_updates(self, request_method): def get_available_updates(self, request_method, locale):
if config.config_updatechannel == constants.UPDATE_STABLE: if config.config_updatechannel == constants.UPDATE_STABLE:
return self._stable_available_updates(request_method) return self._stable_available_updates(request_method)
return self._nightly_available_updates(request_method) return self._nightly_available_updates(request_method,locale)
def run(self): def run(self):
try: try:
@ -239,7 +239,7 @@ class Updater(threading.Thread):
def _stable_version_info(cls): def _stable_version_info(cls):
return constants.STABLE_VERSION # Current version return constants.STABLE_VERSION # Current version
def _nightly_available_updates(self, request_method): def _nightly_available_updates(self, request_method, locale):
tz = datetime.timedelta(seconds=time.timezone if (time.localtime().tm_isdst == 0) else time.altzone) tz = datetime.timedelta(seconds=time.timezone if (time.localtime().tm_isdst == 0) else time.altzone)
if request_method == "GET": if request_method == "GET":
repository_url = _REPOSITORY_API_URL repository_url = _REPOSITORY_API_URL
@ -288,7 +288,7 @@ class Updater(threading.Thread):
update_data['committer']['date'], '%Y-%m-%dT%H:%M:%SZ') - tz update_data['committer']['date'], '%Y-%m-%dT%H:%M:%SZ') - tz
parents.append( parents.append(
[ [
format_datetime(new_commit_date, format='short', locale=get_locale()), format_datetime(new_commit_date, format='short', locale=locale),
update_data['message'], update_data['message'],
update_data['sha'] update_data['sha']
] ]
@ -319,7 +319,7 @@ class Updater(threading.Thread):
parent_commit_date = datetime.datetime.strptime( parent_commit_date = datetime.datetime.strptime(
parent_data['committer']['date'], '%Y-%m-%dT%H:%M:%SZ') - tz parent_data['committer']['date'], '%Y-%m-%dT%H:%M:%SZ') - tz
parent_commit_date = format_datetime( parent_commit_date = format_datetime(
parent_commit_date, format='short', locale=get_locale()) parent_commit_date, format='short', locale=locale)
parents.append([parent_commit_date, parents.append([parent_commit_date,
parent_data['message'].replace('\r\n', '<p>').replace('\n', '<p>')]) parent_data['message'].replace('\r\n', '<p>').replace('\n', '<p>')])
@ -331,7 +331,7 @@ class Updater(threading.Thread):
else: else:
# parent is our current version # parent is our current version
break break
status['history'] = parents[::-1]
else: else:
status['success'] = False status['success'] = False
status['message'] = _(u'Could not fetch update information') status['message'] = _(u'Could not fetch update information')