mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-29 18:53:35 +05:00
Compare commits
1 Commits
4c0c33b46b
...
64708fecb7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
64708fecb7 |
@@ -13,7 +13,6 @@ from typing import List
|
|||||||
from components.webui_client.base_data import BaseWebClient
|
from components.webui_client.base_data import BaseWebClient
|
||||||
from core.menus.base_menu import print_back_footer
|
from core.menus.base_menu import print_back_footer
|
||||||
from utils.constants import COLOR_CYAN, COLOR_YELLOW, RESET_FORMAT
|
from utils.constants import COLOR_CYAN, COLOR_YELLOW, RESET_FORMAT
|
||||||
from utils.logger import DialogType, Logger
|
|
||||||
|
|
||||||
|
|
||||||
def print_moonraker_not_found_dialog():
|
def print_moonraker_not_found_dialog():
|
||||||
@@ -85,35 +84,25 @@ def print_client_port_select_dialog(name: str, port: int, ports_in_use: List[int
|
|||||||
print(dialog, end="")
|
print(dialog, end="")
|
||||||
|
|
||||||
|
|
||||||
def print_install_client_config_dialog(client: BaseWebClient) -> None:
|
def print_install_client_config_dialog(client: BaseWebClient):
|
||||||
name = client.display_name
|
name = client.display_name
|
||||||
url = client.client_config.repo_url.replace(".git", "")
|
url = client.client_config.repo_url.replace(".git", "")
|
||||||
Logger.print_dialog(
|
line1 = f"have {name} fully functional and working."
|
||||||
DialogType.INFO,
|
line2 = f"The recommended macros for {name} can be seen here:"
|
||||||
[
|
dialog = textwrap.dedent(
|
||||||
f"It is recommended to use special macros in order to have {name} fully "
|
f"""
|
||||||
f"functional and working.",
|
/=======================================================\\
|
||||||
"\n\n",
|
| It is recommended to use special macros in order to |
|
||||||
f"The recommended macros for {name} can be seen here:",
|
| {line1:<54}|
|
||||||
url,
|
| |
|
||||||
"\n\n",
|
| {line2:<54}|
|
||||||
"If you already use these macros skip this step. Otherwise you should "
|
| {url:<54}|
|
||||||
"consider to answer with 'Y' to download the recommended macros.",
|
| |
|
||||||
],
|
| If you already use these macros skip this step. |
|
||||||
end="",
|
| Otherwise you should consider to answer with 'Y' to |
|
||||||
)
|
| download the recommended macros. |
|
||||||
|
\\=======================================================/
|
||||||
|
"""
|
||||||
|
)[1:]
|
||||||
|
|
||||||
|
print(dialog, end="")
|
||||||
def print_ipv6_warning_dialog() -> None:
|
|
||||||
Logger.print_dialog(
|
|
||||||
DialogType.WARNING,
|
|
||||||
[
|
|
||||||
"It looks like IPv6 is enabled on this system!",
|
|
||||||
"This may cause issues with the installation of NGINX in the following "
|
|
||||||
"steps! It is recommended to disable IPv6 on your system to avoid this issue.",
|
|
||||||
"\n\n",
|
|
||||||
"If you think this warning is a false alarm, and you are sure that "
|
|
||||||
"IPv6 is disabled, you can continue with the installation.",
|
|
||||||
],
|
|
||||||
end="",
|
|
||||||
)
|
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ from components.webui_client.client_config.client_config_setup import (
|
|||||||
from components.webui_client.client_dialogs import (
|
from components.webui_client.client_dialogs import (
|
||||||
print_client_port_select_dialog,
|
print_client_port_select_dialog,
|
||||||
print_install_client_config_dialog,
|
print_install_client_config_dialog,
|
||||||
print_ipv6_warning_dialog,
|
|
||||||
print_moonraker_not_found_dialog,
|
print_moonraker_not_found_dialog,
|
||||||
)
|
)
|
||||||
from components.webui_client.client_utils import (
|
from components.webui_client.client_utils import (
|
||||||
@@ -50,7 +49,6 @@ from utils.fs_utils import (
|
|||||||
from utils.input_utils import get_confirm, get_number_input
|
from utils.input_utils import get_confirm, get_number_input
|
||||||
from utils.logger import Logger
|
from utils.logger import Logger
|
||||||
from utils.sys_utils import (
|
from utils.sys_utils import (
|
||||||
check_ipv6,
|
|
||||||
cmd_sysctl_service,
|
cmd_sysctl_service,
|
||||||
download_file,
|
download_file,
|
||||||
get_ipv4_addr,
|
get_ipv4_addr,
|
||||||
@@ -117,13 +115,6 @@ def install_client(client: BaseWebClient) -> None:
|
|||||||
)
|
)
|
||||||
valid_port = is_valid_port(port, ports_in_use)
|
valid_port = is_valid_port(port, ports_in_use)
|
||||||
|
|
||||||
# check if ipv6 is enabled, as this may cause issues with nginx
|
|
||||||
if check_ipv6():
|
|
||||||
print_ipv6_warning_dialog()
|
|
||||||
if not get_confirm(f"Continue with {client.display_name} installation?"):
|
|
||||||
Logger.print_info(f"Exiting {client.display_name} installation ...")
|
|
||||||
return
|
|
||||||
|
|
||||||
check_install_dependencies(["nginx", "unzip"])
|
check_install_dependencies(["nginx", "unzip"])
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -402,34 +402,3 @@ def log_process(process: Popen) -> None:
|
|||||||
|
|
||||||
if process.poll() is not None:
|
if process.poll() is not None:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
def check_ipv6() -> bool:
|
|
||||||
"""
|
|
||||||
Check if IPv6 is enabled
|
|
||||||
:return: True if IPv6 is enabled, False otherwise
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
file1 = Path("/proc/sys/net/ipv6/conf/all/disable_ipv6")
|
|
||||||
if file1.exists():
|
|
||||||
with open(file1, "r") as file:
|
|
||||||
if file.read().strip() == "0":
|
|
||||||
return True
|
|
||||||
elif file.read().strip() == "1":
|
|
||||||
return False
|
|
||||||
|
|
||||||
file3 = Path("/etc/sysctl.conf")
|
|
||||||
if file3.exists():
|
|
||||||
with open(file3, "r") as file:
|
|
||||||
for line in file.readlines():
|
|
||||||
if (
|
|
||||||
"net.ipv6.conf.all.disable_ipv6" in line
|
|
||||||
and not line.startswith("#")
|
|
||||||
and line.split("=")[1].strip() == "0"
|
|
||||||
):
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
Logger.print_error(f"Error checking IPv6: {e}")
|
|
||||||
return True
|
|
||||||
|
|||||||
Reference in New Issue
Block a user