Compare commits

..

2 Commits

Author SHA1 Message Date
dw-0
8df75dc8d0 fix(webclients): print to screen if symlink does not exist
Signed-off-by: Dominik Willner <th33xitus@gmail.com>
2024-03-02 21:47:27 +01:00
dw-0
5c37b68463 fix(webclients): default to port 80 if none/invalid configured in kiauh.cfg
Signed-off-by: Dominik Willner <th33xitus@gmail.com>
2024-03-02 21:25:17 +01:00
3 changed files with 8 additions and 4 deletions

View File

@@ -53,12 +53,16 @@ def remove_client_config_dir(client_config: ClientConfigData) -> None:
def remove_client_config_symlink(client_config: ClientConfigData) -> None: def remove_client_config_symlink(client_config: ClientConfigData) -> None:
Logger.print_status(f"Removing {client_config.get('cfg_filename')} symlinks ...")
im = InstanceManager(Klipper) im = InstanceManager(Klipper)
instances: List[Klipper] = im.instances instances: List[Klipper] = im.instances
for instance in instances: for instance in instances:
Logger.print_status(f"Removing symlink from '{instance.cfg_file}' ...") Logger.print_status(f"Removing symlink from '{instance.cfg_file}' ...")
symlink = instance.cfg_dir.joinpath(client_config.get("cfg_filename"))
if not symlink.exists():
Logger.print_info(f"'{symlink}' does not exist. Skipping ...")
continue
try: try:
remove_file(instance.cfg_dir.joinpath(client_config.get("cfg_filename"))) remove_file(symlink)
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
Logger.print_error("Failed to remove symlink!") Logger.print_error("Failed to remove symlink!")

View File

@@ -71,7 +71,6 @@ def print_client_port_select_dialog(name: str, port: str, ports_in_use: List[str
| {line2:<54}| | {line2:<54}|
| port, you can set it now. Make sure the port is not | | port, you can set it now. Make sure the port is not |
| used by any other application on your system! | | used by any other application on your system! |
\\=======================================================/
""" """
)[1:] )[1:]

View File

@@ -107,7 +107,8 @@ def install_client(client_name: ClientName) -> None:
install_client_cfg = get_confirm(question, allow_go_back=False) install_client_cfg = get_confirm(question, allow_go_back=False)
cm = ConfigManager(cfg_file=KIAUH_CFG) cm = ConfigManager(cfg_file=KIAUH_CFG)
client_port = cm.get_value(client.get("name"), "port") default_port = cm.get_value(client.get("name"), "port")
client_port = default_port if default_port and default_port.isdigit() else "80"
ports_in_use = read_ports_from_nginx_configs() ports_in_use = read_ports_from_nginx_configs()
# check if configured port is a valid number and not in use already # check if configured port is a valid number and not in use already