winlin

refine the api server.

@@ -527,6 +527,7 @@ class ArmServer: @@ -527,6 +527,7 @@ class ArmServer:
527 self.id = str(global_arm_server_id) 527 self.id = str(global_arm_server_id)
528 self.ip = None 528 self.ip = None
529 self.device_id = None 529 self.device_id = None
  530 + self.summaries = None
530 531
531 self.public_ip = cherrypy.request.remote.ip 532 self.public_ip = cherrypy.request.remote.ip
532 self.heartbeat = time.time() 533 self.heartbeat = time.time()
@@ -544,10 +545,11 @@ class ArmServer: @@ -544,10 +545,11 @@ class ArmServer:
544 data["id"] = self.id 545 data["id"] = self.id
545 data["ip"] = self.ip 546 data["ip"] = self.ip
546 data["device_id"] = self.device_id 547 data["device_id"] = self.device_id
  548 + data["summaries"] = self.summaries
547 data["public_ip"] = self.public_ip 549 data["public_ip"] = self.public_ip
548 data["heartbeat"] = self.heartbeat 550 data["heartbeat"] = self.heartbeat
549 data["heartbeat_h"] = time.strftime("%Y-%m-%d %H:%M:%S",time.localtime(self.heartbeat)) 551 data["heartbeat_h"] = time.strftime("%Y-%m-%d %H:%M:%S",time.localtime(self.heartbeat))
550 - data["summaries"] = "http://%s:1985/api/v1/summaries"%(self.ip) 552 + data["api"] = "http://%s:1985/api/v1/summaries"%(self.ip)
551 data["console"] = "http://ossrs.net/console/ng_index.html#/summaries?host=%s&port=1985"%(self.ip) 553 data["console"] = "http://ossrs.net/console/ng_index.html#/summaries?host=%s&port=1985"%(self.ip)
552 return data 554 return data
553 555
@@ -606,6 +608,8 @@ class RESTServers(object): @@ -606,6 +608,8 @@ class RESTServers(object):
606 self.__nodes.append(node) 608 self.__nodes.append(node)
607 609
608 node.ip = json_req["ip"] 610 node.ip = json_req["ip"]
  611 + if "summaries" in json_req:
  612 + node.summaries = json_req["summaries"]
609 node.device_id = device_id 613 node.device_id = device_id
610 node.public_ip = cherrypy.request.remote.ip 614 node.public_ip = cherrypy.request.remote.ip
611 node.heartbeat = time.time() 615 node.heartbeat = time.time()