Skip to content

Commit b1eb684

Browse files
committed
imrpove onboarding
1 parent fcad312 commit b1eb684

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

onboarding.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
#!/usr/bin/env python3
2+
# /// script
3+
# requires-python = ">=3.11"
4+
# dependencies = ["pycryptodome>=3.20,<4"]
5+
# ///
26
"""Run cfgwifi onboarding against rriot_rr."""
37

48
from __future__ import annotations
@@ -96,15 +100,28 @@ def build_parser() -> argparse.ArgumentParser:
96100
parser.add_argument(
97101
"--server",
98102
required=True,
99-
help="Value for token.r in the onboarding payload.",
103+
help="Your server that you are connecting to (don't include the api-)",
100104
)
101105
parser.add_argument("--ssid", required=True)
102106
parser.add_argument("--password", required=True)
103107
return parser
104108

105109

110+
def sanitize_server(url: str) -> str:
111+
"""Sanitize server URL: strip scheme/api- prefix, ensure trailing slash."""
112+
for prefix in ("https://", "http://"):
113+
if url.lower().startswith(prefix):
114+
url = url[len(prefix):]
115+
if url.lower().startswith("api-"):
116+
url = url[4:]
117+
if not url.endswith("/"):
118+
url += "/"
119+
return url
120+
121+
106122
def main() -> int:
107123
args = build_parser().parse_args()
124+
args.server = sanitize_server(args.server)
108125
token_s = f"S_TOKEN_{secrets.token_hex(16)}"
109126
token_t = f"T_TOKEN_{secrets.token_hex(16)}"
110127

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "roborock-local-server"
33
version = "0.1.0"
44
description = "Clean release surface for a private local Roborock server stack."
5-
requires-python = ">=3.11,<4"
5+
requires-python = ">=3.11,<3.14"
66
readme = "README.md"
77
authors = [{ name = "Codex" }]
88
dependencies = [

0 commit comments

Comments
 (0)