allnet: add Alive get and post handlers

This commit is contained in:
Hay1tsme 2023-06-30 00:32:52 -04:00
parent 60b3bc7750
commit 610ef70bad
2 changed files with 17 additions and 0 deletions

View File

@ -257,6 +257,9 @@ class AllnetServlet:
self.logger.info(f"LoaderStateRecorder Request from {ip} {serial}: {num_files_dld}/{num_files_to_dl} Files download (State: {dl_state})") self.logger.info(f"LoaderStateRecorder Request from {ip} {serial}: {num_files_dld}/{num_files_to_dl} Files download (State: {dl_state})")
return "OK".encode() return "OK".encode()
def handle_alive(self, request: Request, match: Dict) -> bytes:
return "OK".encode()
def handle_billing_request(self, request: Request, _: Dict): def handle_billing_request(self, request: Request, _: Dict):
req_dict = self.billing_req_to_dict(request.content.getvalue()) req_dict = self.billing_req_to_dict(request.content.getvalue())
request_ip = Utils.get_ip_addr(request) request_ip = Utils.get_ip_addr(request)

View File

@ -70,6 +70,20 @@ class HttpDispatcher(resource.Resource):
action="handle_loaderstaterecorder", action="handle_loaderstaterecorder",
conditions=dict(method=["POST"]), conditions=dict(method=["POST"]),
) )
self.map_post.connect(
"allnet_alive",
"/sys/servlet/Alive",
controller="allnet",
action="handle_alive",
conditions=dict(method=["POST"]),
)
self.map_get.connect(
"allnet_alive",
"/sys/servlet/Alive",
controller="allnet",
action="handle_alive",
conditions=dict(method=["GET"]),
)
self.map_post.connect( self.map_post.connect(
"allnet_billing", "allnet_billing",
"/request", "/request",