2020-07-04 19:47:56 +00:00
|
|
|
from owrx.controllers import Controller
|
|
|
|
from owrx.receiverid import ReceiverId
|
|
|
|
from datetime import datetime
|
|
|
|
|
|
|
|
|
|
|
|
class ReceiverIdController(Controller):
|
|
|
|
def __init__(self, handler, request, options):
|
|
|
|
super().__init__(handler, request, options)
|
2020-07-09 19:32:57 +00:00
|
|
|
self.authHeader = None
|
2020-07-04 19:47:56 +00:00
|
|
|
|
|
|
|
def send_response(self, content, code=200, content_type="text/html", last_modified: datetime = None, max_age=None, headers=None):
|
2020-07-09 19:32:57 +00:00
|
|
|
if self.authHeader is not None:
|
|
|
|
if headers is None:
|
|
|
|
headers = {}
|
|
|
|
headers['Authorization'] = self.authHeader
|
2020-07-04 19:47:56 +00:00
|
|
|
super().send_response(content, code=code, content_type=content_type, last_modified=last_modified, max_age=max_age, headers=headers)
|
|
|
|
pass
|
|
|
|
|
|
|
|
def handle_request(self):
|
2020-07-09 19:32:57 +00:00
|
|
|
if "Authorization" in self.request.headers:
|
|
|
|
self.authHeader = ReceiverId.getResponseHeader(self.request.headers['Authorization'])
|
2020-07-04 19:47:56 +00:00
|
|
|
super().handle_request()
|