()
| 160 | |
| 161 | |
| 162 | def main() -> int: |
| 163 | print() |
| 164 | print(bold("MasterHttpRelayVPN - setup wizard")) |
| 165 | print(dim("Answer a few questions and we'll write config.json for you.")) |
| 166 | |
| 167 | if CONFIG_PATH.exists(): |
| 168 | if not prompt_yes_no("config.json already exists. Overwrite?", default=False): |
| 169 | print(dim("Nothing changed.")) |
| 170 | return 0 |
| 171 | |
| 172 | cfg = load_base_config() |
| 173 | |
| 174 | suggested_key = random_auth_key() |
| 175 | print() |
| 176 | print(bold("Shared password (auth_key)")) |
| 177 | print(dim(" Must match AUTH_KEY inside apps_script/Code.gs.")) |
| 178 | cfg["auth_key"] = prompt("auth_key", default=suggested_key) |
| 179 | |
| 180 | cfg = configure_apps_script(cfg) |
| 181 | cfg = configure_network(cfg) |
| 182 | |
| 183 | write_config(cfg) |
| 184 | |
| 185 | print() |
| 186 | print(green(f"[OK] wrote {CONFIG_PATH.name}")) |
| 187 | print() |
| 188 | print(bold("Next step:")) |
| 189 | print(f" python main.py") |
| 190 | print() |
| 191 | print(yellow("Reminder: the AUTH_KEY inside apps_script/Code.gs must match the auth_key")) |
| 192 | print(yellow("you just entered - otherwise the relay will return 'unauthorized'.")) |
| 193 | return 0 |
| 194 | |
| 195 | |
| 196 | if __name__ == "__main__": |
no test coverage detected