Beginning bumper's new journey #4
1 changed files with 14 additions and 7 deletions
|
|
@ -195,22 +195,29 @@ class ConfServer():
|
||||||
|
|
||||||
async def handle_usersapi(self, request):
|
async def handle_usersapi(self, request):
|
||||||
body = {}
|
body = {}
|
||||||
|
postbody = {}
|
||||||
json_body = json.loads(await request.text())
|
if request.content_type == "application/x-www-form-urlencoded":
|
||||||
todo = json_body['todo']
|
postbody = await request.post()
|
||||||
|
|
||||||
|
else:
|
||||||
|
postbody = json.loads(await request.text())
|
||||||
|
|
||||||
|
logging.debug(postbody)
|
||||||
|
|
||||||
|
todo = postbody['todo']
|
||||||
if todo == 'FindBest':
|
if todo == 'FindBest':
|
||||||
service = json_body['service']
|
service = postbody['service']
|
||||||
if service == 'EcoMsgNew':
|
if service == 'EcoMsgNew':
|
||||||
body = {"result":"ok","ip":socket.gethostbyname(socket.gethostname()),"port":5223}
|
body = {"result":"ok","ip":socket.gethostbyname(socket.gethostname()),"port":5223}
|
||||||
elif service == 'EcoUpdate':
|
elif service == 'EcoUpdate':
|
||||||
body = {"result":"ok","ip":"47.88.66.164","port":8005}
|
body = {"result":"ok","ip":"47.88.66.164","port":8005}
|
||||||
elif todo == 'loginByItToken':
|
elif todo == 'loginByItToken':
|
||||||
body = {
|
body = {
|
||||||
"resource": json_body["resource"],
|
"resource": postbody["resource"],
|
||||||
"result": "ok",
|
"result": "ok",
|
||||||
"todo": "result",
|
"todo": "result",
|
||||||
"token": json_body["token"], #RandomChar(32)
|
"token": postbody["token"], #RandomChar(32)
|
||||||
"userId": json_body["userId"] #RandomChar(16)
|
"userId": postbody["userId"] #RandomChar(16)
|
||||||
}
|
}
|
||||||
elif todo == 'GetDeviceList':
|
elif todo == 'GetDeviceList':
|
||||||
active_bots = self.bumper_bots.get()
|
active_bots = self.bumper_bots.get()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue