Merge pull request #842 from dadav/develop

Some fixes
This commit is contained in:
Simone Margaritelli
2020-04-03 14:49:17 +02:00
committed by GitHub
27 changed files with 241 additions and 123 deletions

View File

@ -2,8 +2,8 @@ import logging
import json
import toml
import _thread
import pwnagotchi.plugins as plugins
from pwnagotchi import restart
from pwnagotchi import restart, plugins
from pwnagotchi.utils import save_config
from flask import abort
from flask import render_template_string
@ -499,13 +499,10 @@ class WebConfig(plugins.Plugin):
elif request.method == "POST":
if path == "save-config":
try:
parsed_toml = toml.loads(request.get_json())
with open('/etc/pwnagotchi/config.toml') as config_file:
toml.dump(parsed_toml, config_file)
save_config(request.get_json(), '/etc/pwnagotchi/config.toml') # test
_thread.start_new_thread(restart, (self.mode,))
return "success"
except Exception as ex:
logging.error(ex)
return "config error"
return "config error", 500
abort(404)