Skip to content

Commit

Permalink
Remove "s from email and password and ignore env files
Browse files Browse the repository at this point in the history
  • Loading branch information
mrlt8 committed Aug 26, 2021
1 parent 2d0c938 commit 42d7ed8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 17 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ docker-compose.yml
*.pickle
mfa_token
.vscode
.env
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ If you wish to continue using your camera with the bridge, you should downgrade
| V3 | 4.36.2.5 (June 14, 2021) | ✅ 4.36.2.5 |
| PAN | 4.10.6.241 (March 9, 2021) | ❌ 4.10.7.798 |

## Changes in v0.5.12
## Changes in v0.5.13

- Clear local cache when switching accounts.
- Remove `"`s from email and password.

[View older changes](https://github.com/mrlt8/docker-wyze-bridge/releases)

Expand Down
26 changes: 11 additions & 15 deletions app/wyze_bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

class wyze_bridge:
def __init__(self):
print("\n🚀 STARTING DOCKER-WYZE-BRIDGE v0.5.12")
print("\n🚀 STARTING DOCKER-WYZE-BRIDGE v0.5.13")
if "DEBUG_LEVEL" in os.environ:
print(f'DEBUG_LEVEL set to {os.environ.get("DEBUG_LEVEL")}')
debug_level = getattr(logging, os.environ.get("DEBUG_LEVEL").upper(), 10)
Expand All @@ -44,10 +44,11 @@ def get_env(self, env):
[]
if not os.environ.get(env)
else [
x.strip().upper().replace(":", "") for x in os.environ[env].split(",")
x.strip("'\" ").upper().replace(":", "")
for x in os.environ[env].split(",")
]
if "," in os.environ[env]
else [os.environ[env].strip().upper().replace(":", "")]
else [os.environ[env].strip("'\" ").upper().replace(":", "")]
)

def env_filter(self, cam):
Expand All @@ -63,8 +64,10 @@ def env_filter(self, cam):
def auth_wyze(self):
phone_id = str(wyzecam.api.uuid.uuid4())
payload = {
"email": os.environ["WYZE_EMAIL"],
"password": wyzecam.api.triplemd5(os.environ["WYZE_PASSWORD"]),
"email": os.environ["WYZE_EMAIL"].strip("'\" "),
"password": wyzecam.api.triplemd5(
os.environ["WYZE_PASSWORD"].strip("'\" ")
),
}
response = wyzecam.api.requests.post(
"https://auth-prod.api.wyze.com/user/login",
Expand Down Expand Up @@ -98,7 +101,7 @@ def auth_wyze(self):
while True:
if os.path.exists(mfa_token) and os.path.getsize(mfa_token) > 0:
with open(mfa_token, "r+") as f:
verification_code = f.read().strip()
verification_code = f.read().strip("'\" ")
f.truncate(0)
self.log.info(f"🔑 Using {verification_code} for authentication")
try:
Expand Down Expand Up @@ -275,16 +278,9 @@ def start_stream(self, camera):
f'🎉 Starting {stream} for WyzeCam {self.model_names.get(camera.product_model) if self.model_names.get(camera.product_model) else camera.product_model} in "{"P2P" if sess.session_check().mode ==0 else "Relay" if sess.session_check().mode == 1 else "LAN" if sess.session_check().mode == 2 else "Other ("+sess.session_check().mode+")" } mode" FW: {sess.camera.camera_info["basicInfo"]["firmware"]} IP: {camera.ip} WiFi: {sess.camera.camera_info["basicInfo"]["wifidb"]}%'
)
cmd = (
(
os.environ[f"FFMPEG_CMD_{uri}"]
.strip()
.strip("'")
.strip('"')
).split()
(os.environ[f"FFMPEG_CMD_{uri}"].strip("'\" ")).split()
if f"FFMPEG_CMD_{uri}" in os.environ
else (
os.environ["FFMPEG_CMD"].strip().strip("'").strip('"')
).split()
else (os.environ["FFMPEG_CMD"].strip("'\" ")).split()
if os.environ.get("FFMPEG_CMD")
else ["-loglevel"]
+ (
Expand Down

0 comments on commit 42d7ed8

Please sign in to comment.