Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
douban-api-proxy
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
captainwong
douban-api-proxy
Commits
3e008ef2
Commit
3e008ef2
authored
Jul 21, 2019
by
Ozzieisaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix update dates shown in local time format again
Fix "to update" history is shown again
parent
5c6be5d6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
admin.py
cps/admin.py
+1
-1
updater.py
cps/updater.py
+7
-7
No files found.
cps/admin.py
View file @
3e008ef2
...
@@ -663,7 +663,7 @@ def send_logfile(logtype):
...
@@ -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'
])
...
...
cps/updater.py
View file @
3e008ef2
...
@@ -33,7 +33,7 @@ import requests
...
@@ -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):
...
@@ -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):
...
@@ -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):
...
@@ -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):
...
@@ -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):
...
@@ -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'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment