File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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
48from __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+
106122def 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
Original file line number Diff line number Diff line change 22name = " roborock-local-server"
33version = " 0.1.0"
44description = " Clean release surface for a private local Roborock server stack."
5- requires-python = " >=3.11,<4 "
5+ requires-python = " >=3.11,<3.14 "
66readme = " README.md"
77authors = [{ name = " Codex" }]
88dependencies = [
You can’t perform that action at this time.
0 commit comments