visual feedback during updates
This commit is contained in:
parent
0f0202a3aa
commit
516397ae44
9 changed files with 274 additions and 25 deletions
|
|
@ -1,7 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vi:si:et:sw=4:sts=4:ts=4
|
||||
|
||||
|
||||
import os
|
||||
import sys
|
||||
import signal
|
||||
|
|
@ -23,6 +22,7 @@ import setup
|
|||
import state
|
||||
import tasks
|
||||
import websocket
|
||||
import update
|
||||
|
||||
import logging
|
||||
|
||||
|
|
@ -31,13 +31,15 @@ logger = logging.getLogger(__name__)
|
|||
class MainHandler(OMLHandler):
|
||||
|
||||
def get(self, path):
|
||||
path = os.path.join(settings.static_path, 'html', 'oml.html')
|
||||
with open(path) as fd:
|
||||
content = fd.read()
|
||||
version = settings.MINOR_VERSION.split('-')[0]
|
||||
if version == 'git':
|
||||
version = int(time.mktime(time.gmtime()))
|
||||
content = content.replace('oml.js?1', 'oml.js?%s' % version)
|
||||
path = os.path.join(settings.static_path, 'html', 'oml.html')
|
||||
with open(path) as fd:
|
||||
content = fd.read()
|
||||
content = content.replace('.js?1', '.js?%s' % version)
|
||||
if state.update:
|
||||
content = content.replace('oml.js', 'oml.update.js')
|
||||
self.set_header('Content-Type', 'text/html')
|
||||
self.set_header('Content-Length', str(len(content)))
|
||||
self.write(content)
|
||||
|
|
@ -133,11 +135,11 @@ def run():
|
|||
with open(PID, 'w') as pid:
|
||||
pid.write('%s' % os.getpid())
|
||||
|
||||
state.update = update.update_available()
|
||||
state.PID = PID
|
||||
state.http_server = http_server
|
||||
state.main = IOLoop.instance()
|
||||
state.cache = Cache(ttl=60)
|
||||
state.tasks = tasks.Tasks()
|
||||
|
||||
def start_node():
|
||||
import downloads
|
||||
|
|
@ -156,7 +158,13 @@ def run():
|
|||
else:
|
||||
nodes.publish_node()
|
||||
state.main.add_callback(publish)
|
||||
state.main.add_callback(start_node)
|
||||
|
||||
if not state.update:
|
||||
state.tasks = tasks.Tasks()
|
||||
state.main.add_callback(start_node)
|
||||
else:
|
||||
state.tasks = update.Update()
|
||||
|
||||
if ':' in settings.server['address']:
|
||||
host = '[%s]' % settings.server['address']
|
||||
elif not settings.server['address']:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue