Check if installed

This commit is contained in:
Kload 2013-07-04 08:06:44 +00:00
parent 5568743006
commit 75fb9d5a8a

View file

@ -19,6 +19,7 @@ if not __debug__:
gettext.install('YunoHost') gettext.install('YunoHost')
dev = False dev = False
installed = True
action_dict = {} action_dict = {}
api = APIResource() api = APIResource()
@ -36,7 +37,7 @@ def http_exec(request, **kwargs):
return '' return ''
# Simple HTTP auth # Simple HTTP auth
else: elif installed:
authorized = request.getUser() == 'admin' authorized = request.getUser() == 'admin'
pwd = request.getPassword() pwd = request.getPassword()
if dev and 'api_key' in request.args: if dev and 'api_key' in request.args:
@ -203,6 +204,7 @@ def main():
try: try:
with open('/etc/yunohost/installed') as f: pass with open('/etc/yunohost/installed') as f: pass
except IOError: except IOError:
installed = False
api = APIResource() api = APIResource()
api.register('POST', '/postinstall', http_exec) api.register('POST', '/postinstall', http_exec)
api.register('OPTIONS', '/postinstall', http_exec) api.register('OPTIONS', '/postinstall', http_exec)