Added install button and some descriptive text

This commit is contained in:
Rob Hudson 2012-12-03 12:28:40 -08:00
Родитель 6a6272d93f
Коммит c4c39d85fa
1 изменённых файлов: 28 добавлений и 2 удалений

Просмотреть файл

@ -45,13 +45,39 @@ def _get_local_ip():
def index(environ, start_response): def index(environ, start_response):
template = '''
<!DOCTYPE html>
<html>
<head>
<title>{name} - Packaged App Server</title>
<style>
button {{
font-size: 18px;
padding: 5px;
width: 100%;
}}
</style>
</head>
<body>
<p><a href="{manifest}">{manifest}</a>: The mini-manifest is what
is provided to the <code>installPackage</code> API and provides
information about your app to Firefox OS.</p>
<p><a href="{package}">{package}</a>: The zipped-on-the-fly path to
your packaged app. The mini-manifest points to this URL inside the
mini-manifest.</p>
<button onclick="{install}('{manifest}');">Install</button>
</body>
</html>
'''
context = { context = {
'name': NAME,
'install': 'navigator.mozApps.installPackage',
'manifest': _absolutify('manifest.webapp'), 'manifest': _absolutify('manifest.webapp'),
'package': _absolutify('package.zip'), 'package': _absolutify('package.zip'),
} }
start_response('200 OK', [('Content-Type', 'text/html')]) start_response('200 OK', [('Content-Type', 'text/html')])
return ['<a href="%(manifest)s">%(manifest)s</a><br>' return [template.format(**context)]
'<a href="%(package)s">%(package)s</a>' % context]
def manifest(environ, start_response): def manifest(environ, start_response):