Skip to content

Commit

Permalink
fix: allow other apps without "nouser" to pair
Browse files Browse the repository at this point in the history
  • Loading branch information
mariusmotea committed Nov 22, 2019
1 parent 532f498 commit 444fb78
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion BridgeEmulator/HueEmulator3.py
Original file line number Diff line number Diff line change
Expand Up @@ -1534,7 +1534,7 @@ def do_GET(self):
self._set_end_headers(bytes(json.dumps(scenelist["scenes"][url_pices[4]],separators=(',', ':'),ensure_ascii=False), "utf8"))
else:
self._set_end_headers(bytes(json.dumps(bridge_config[url_pices[3]][url_pices[4]],separators=(',', ':'),ensure_ascii=False), "utf8"))
elif (url_pices[2] == "nouser" or url_pices[2] == "none" or url_pices[2] == "config"): #used by applications to discover the bridge
elif (url_pices[3] == "config"): #used by applications to discover the bridge
self._set_end_headers(bytes(json.dumps({"name": bridge_config["config"]["name"],"datastoreversion": 70, "swversion": bridge_config["config"]["swversion"], "apiversion": bridge_config["config"]["apiversion"], "mac": bridge_config["config"]["mac"], "bridgeid": bridge_config["config"]["bridgeid"], "factorynew": False, "replacesbridgeid": None, "modelid": bridge_config["config"]["modelid"],"starterkitid":""},separators=(',', ':'),ensure_ascii=False), "utf8"))
else: #user is not in whitelist
self._set_end_headers(bytes(json.dumps([{"error": {"type": 1, "address": self.path, "description": "unauthorized user" }}],separators=(',', ':'),ensure_ascii=False), "utf8"))
Expand Down

4 comments on commit 444fb78

@alexyao2015
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tested this with sleep or huematic by chance? I remember this exact commit broke it last time.

@alexyao2015
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexyao2015
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually does this follow #293 by chance?

@mariusmotea
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I test the behaviour of the original bridge and i replicate the same. 'nouser' and 'none' where workarounds for application pair issue. Later i discovered that the username is not important.

Please sign in to comment.