Compare commits
2 commits
8475113ad8
...
e127a9008b
Author | SHA1 | Date | |
---|---|---|---|
e127a9008b | |||
02f86675a8 |
1 changed files with 6 additions and 2 deletions
|
@ -19,7 +19,6 @@ rotate = os.environ.get("SCREEN_ROTATE", default="0")
|
|||
wait = os.environ.get("SCREEN_WAIT", default="5")
|
||||
ha_url = os.environ.get("SCREEN_HA_URL", default="")
|
||||
ha_token = os.environ.get("SCREEN_HA_TOKEN", default="")
|
||||
ha_token = os.environ.get("SUPERVISOR_TOKEN", default="")
|
||||
ha_language = os.environ.get("SCREEN_HA_LANGUAGE", default="en")
|
||||
|
||||
# enable browser logging
|
||||
|
@ -63,6 +62,11 @@ while True:
|
|||
driver.implicitly_wait(10)
|
||||
|
||||
if task.get("ha_auth"):
|
||||
#def interceptor(request):
|
||||
# if request.headers['Authorization']:
|
||||
# del request.headers['Authorization'] # Remember to delete the header first
|
||||
# request.headers['Authorization'] = f"Bearer {ha_token}" # Spoof the referer
|
||||
#driver.request_interceptor = interceptor
|
||||
def response_interceptor(req, response):
|
||||
response.headers['Access-Control-Allow-Origin'] = '*'
|
||||
driver.response_interceptor = response_interceptor
|
||||
|
@ -70,7 +74,7 @@ while True:
|
|||
driver.get("http://172.30.32.1:8123")
|
||||
time.sleep(int(wait))
|
||||
logging.info("Doing HA Auth")
|
||||
driver.execute_script(f"window.localStorage.setItem('hassTokens', JSON.stringify({{hassUrl: 'http://172.30.32.1:8123', access_token: '{ha_token}', token_type: 'Bearer'}}));")
|
||||
driver.execute_script(f"window.localStorage.setItem('hassTokens', JSON.stringify({{hassUrl: '{ha_url}', access_token: '{ha_token}', token_type: 'Bearer'}}));")
|
||||
|
||||
driver.get(task["url"])
|
||||
time.sleep(int(wait))
|
||||
|
|
Loading…
Reference in a new issue