mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-28 02:03:36 +05:00
Compare commits
13 Commits
f225ed028d
...
v6.0.0-alp
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a58288e7e3 | ||
|
|
3852464ab7 | ||
|
|
d9626adc98 | ||
|
|
b02df9a1e0 | ||
|
|
243ea6582a | ||
|
|
a63cf8c9d9 | ||
|
|
425d86a12f | ||
|
|
1b5691f2f5 | ||
|
|
dc026a7a2b | ||
|
|
a8a73249a5 | ||
|
|
ec3f93eeda | ||
|
|
4cf523a758 | ||
|
|
1d06bf76f3 |
@@ -37,7 +37,6 @@ from components.webui_client.client_utils import (
|
|||||||
)
|
)
|
||||||
from core.instance_manager.instance_manager import InstanceManager
|
from core.instance_manager.instance_manager import InstanceManager
|
||||||
from core.logger import DialogType, Logger
|
from core.logger import DialogType, Logger
|
||||||
from core.services.message_service import Message
|
|
||||||
from core.settings.kiauh_settings import KiauhSettings
|
from core.settings.kiauh_settings import KiauhSettings
|
||||||
from core.types.color import Color
|
from core.types.color import Color
|
||||||
from utils.common import backup_printer_config_dir, check_install_dependencies
|
from utils.common import backup_printer_config_dir, check_install_dependencies
|
||||||
@@ -56,21 +55,14 @@ def install_client(
|
|||||||
client: BaseWebClient,
|
client: BaseWebClient,
|
||||||
settings: KiauhSettings,
|
settings: KiauhSettings,
|
||||||
reinstall: bool = False,
|
reinstall: bool = False,
|
||||||
) -> Message:
|
) -> None:
|
||||||
completion_msg = Message(
|
|
||||||
title=f"{client.display_name} Installation Process completed",
|
|
||||||
color=Color.GREEN,
|
|
||||||
)
|
|
||||||
mr_instances: List[Moonraker] = get_instances(Moonraker)
|
mr_instances: List[Moonraker] = get_instances(Moonraker)
|
||||||
|
|
||||||
enable_remotemode = False
|
enable_remotemode = False
|
||||||
if not mr_instances:
|
if not mr_instances:
|
||||||
print_moonraker_not_found_dialog(client.display_name)
|
print_moonraker_not_found_dialog(client.display_name)
|
||||||
if not get_confirm(f"Continue {client.display_name} installation?"):
|
if not get_confirm(f"Continue {client.display_name} installation?"):
|
||||||
completion_msg.color = Color.YELLOW
|
return
|
||||||
completion_msg.title = f"{client.display_name} Installation Process aborted"
|
|
||||||
completion_msg.text.append("Installation was aborted by the user!")
|
|
||||||
return completion_msg
|
|
||||||
|
|
||||||
# if moonraker is not installed or multiple instances
|
# if moonraker is not installed or multiple instances
|
||||||
# are installed we enable mainsails remote mode
|
# are installed we enable mainsails remote mode
|
||||||
@@ -98,9 +90,9 @@ def install_client(
|
|||||||
default_port if reinstall else get_client_port_selection(client, settings)
|
default_port if reinstall else get_client_port_selection(client, settings)
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
check_install_dependencies({"nginx"})
|
||||||
check_install_dependencies({"nginx"})
|
|
||||||
|
|
||||||
|
try:
|
||||||
download_client(client)
|
download_client(client)
|
||||||
if enable_remotemode and client.client == WebClientType.MAINSAIL:
|
if enable_remotemode and client.client == WebClientType.MAINSAIL:
|
||||||
enable_mainsail_remotemode()
|
enable_mainsail_remotemode()
|
||||||
@@ -138,17 +130,23 @@ def install_client(
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
Logger.print_error(e)
|
Logger.print_error(e)
|
||||||
completion_msg.color = Color.RED
|
Logger.print_dialog(
|
||||||
completion_msg.title = f"{client.display_name} Installation Process failed!"
|
DialogType.ERROR,
|
||||||
completion_msg.text.append(
|
center_content=True,
|
||||||
f"An unexpected error occured. Please see the output above. {client.display_name} installation failed!")
|
content=[f"{client.display_name} installation failed!"],
|
||||||
return completion_msg
|
)
|
||||||
|
return
|
||||||
|
|
||||||
# noinspection HttpUrlsUsage
|
# noinspection HttpUrlsUsage
|
||||||
completion_msg.text.append(
|
Logger.print_dialog(
|
||||||
f"Open {client.display_name} now on: http://{get_ipv4_addr()}:{port}")
|
DialogType.CUSTOM,
|
||||||
|
custom_title=f"{client.display_name} installation complete!",
|
||||||
return completion_msg
|
custom_color=Color.GREEN,
|
||||||
|
center_content=True,
|
||||||
|
content=[
|
||||||
|
f"Open {client.display_name} now on: http://{get_ipv4_addr()}:{port}",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def download_client(client: BaseWebClient) -> None:
|
def download_client(client: BaseWebClient) -> None:
|
||||||
|
|||||||
@@ -65,8 +65,7 @@ class ClientInstallMenu(BaseMenu):
|
|||||||
print(menu, end="")
|
print(menu, end="")
|
||||||
|
|
||||||
def reinstall_client(self, **kwargs) -> None:
|
def reinstall_client(self, **kwargs) -> None:
|
||||||
completion_msg = install_client(self.client, settings=self.settings, reinstall=True)
|
install_client(self.client, settings=self.settings, reinstall=True)
|
||||||
self.message_service.set_message(completion_msg)
|
|
||||||
|
|
||||||
def change_listen_port(self, **kwargs) -> None:
|
def change_listen_port(self, **kwargs) -> None:
|
||||||
curr_port = self._get_current_port()
|
curr_port = self._get_current_port()
|
||||||
|
|||||||
@@ -81,13 +81,21 @@ class InstallMenu(BaseMenu):
|
|||||||
moonraker_setup.install_moonraker()
|
moonraker_setup.install_moonraker()
|
||||||
|
|
||||||
def install_mainsail(self, **kwargs) -> None:
|
def install_mainsail(self, **kwargs) -> None:
|
||||||
self._install_client(MainsailData())
|
client: MainsailData = MainsailData()
|
||||||
|
if client.client_dir.exists():
|
||||||
|
ClientInstallMenu(client, self.__class__).run()
|
||||||
|
else:
|
||||||
|
install_client(client, settings=KiauhSettings())
|
||||||
|
|
||||||
def install_mainsail_config(self, **kwargs) -> None:
|
def install_mainsail_config(self, **kwargs) -> None:
|
||||||
install_client_config(MainsailData())
|
install_client_config(MainsailData())
|
||||||
|
|
||||||
def install_fluidd(self, **kwargs) -> None:
|
def install_fluidd(self, **kwargs) -> None:
|
||||||
self._install_client(FluiddData())
|
client: FluiddData = FluiddData()
|
||||||
|
if client.client_dir.exists():
|
||||||
|
ClientInstallMenu(client, self.__class__).run()
|
||||||
|
else:
|
||||||
|
install_client(client, settings=KiauhSettings())
|
||||||
|
|
||||||
def install_fluidd_config(self, **kwargs) -> None:
|
def install_fluidd_config(self, **kwargs) -> None:
|
||||||
install_client_config(FluiddData())
|
install_client_config(FluiddData())
|
||||||
@@ -97,10 +105,3 @@ class InstallMenu(BaseMenu):
|
|||||||
|
|
||||||
def install_crowsnest(self, **kwargs) -> None:
|
def install_crowsnest(self, **kwargs) -> None:
|
||||||
install_crowsnest()
|
install_crowsnest()
|
||||||
|
|
||||||
def _install_client(self, client: MainsailData | FluiddData) -> None:
|
|
||||||
if client.client_dir.exists():
|
|
||||||
ClientInstallMenu(client, self.__class__).run()
|
|
||||||
else:
|
|
||||||
completion_msg = install_client(client, settings=KiauhSettings())
|
|
||||||
self.message_service.set_message(completion_msg)
|
|
||||||
|
|||||||
@@ -21,9 +21,7 @@ from core.menus import Option
|
|||||||
from core.menus.base_menu import BaseMenu
|
from core.menus.base_menu import BaseMenu
|
||||||
from core.settings.kiauh_settings import KiauhSettings, RepoSettings
|
from core.settings.kiauh_settings import KiauhSettings, RepoSettings
|
||||||
from core.types.color import Color
|
from core.types.color import Color
|
||||||
from core.types.component_status import ComponentStatus
|
|
||||||
from procedures.switch_repo import run_switch_repo_routine
|
from procedures.switch_repo import run_switch_repo_routine
|
||||||
from utils.git_utils import get_repo_name
|
|
||||||
from utils.input_utils import get_confirm, get_string_input
|
from utils.input_utils import get_confirm, get_string_input
|
||||||
|
|
||||||
|
|
||||||
@@ -141,12 +139,12 @@ class SettingsMenu(BaseMenu):
|
|||||||
|
|
||||||
repo = get_string_input(
|
repo = get_string_input(
|
||||||
"Enter new repository URL",
|
"Enter new repository URL",
|
||||||
regex="^[\w/.:-]+$",
|
regex=r"^[\w/.:-]+$",
|
||||||
default=KLIPPER_REPO_URL if repo_name == "klipper" else MOONRAKER_REPO_URL,
|
default=KLIPPER_REPO_URL if repo_name == "klipper" else MOONRAKER_REPO_URL,
|
||||||
)
|
)
|
||||||
branch = get_string_input(
|
branch = get_string_input(
|
||||||
"Enter new branch name",
|
"Enter new branch name",
|
||||||
regex="^.+$",
|
regex=r"^.+$",
|
||||||
default="master"
|
default="master"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ def change_system_hostname() -> None:
|
|||||||
)
|
)
|
||||||
hostname = get_string_input(
|
hostname = get_string_input(
|
||||||
"Enter the new hostname",
|
"Enter the new hostname",
|
||||||
regex="^[a-z0-9]+([a-z0-9-]*[a-z0-9])?$",
|
regex=r"^[a-z0-9]+([a-z0-9-]*[a-z0-9])?$",
|
||||||
)
|
)
|
||||||
if not get_confirm(f"Change the hostname to '{hostname}'?", default_choice=False):
|
if not get_confirm(f"Change the hostname to '{hostname}'?", default_choice=False):
|
||||||
Logger.print_info("Aborting hostname change ...")
|
Logger.print_info("Aborting hostname change ...")
|
||||||
|
|||||||
Reference in New Issue
Block a user