mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-26 01:03:35 +05:00
Compare commits
7 Commits
v6.0.0-alp
...
4978f22101
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4978f22101 | ||
|
|
8330f90b56 | ||
|
|
2a08e3eb15 | ||
|
|
a2a3e92b50 | ||
|
|
3852464ab7 | ||
|
|
4ae5a37ec6 | ||
|
|
935f81aab6 |
@@ -27,7 +27,6 @@ from components.crowsnest import (
|
||||
)
|
||||
from components.klipper.klipper import Klipper
|
||||
from core.backup_manager.backup_manager import BackupManager
|
||||
from core.constants import CURRENT_USER
|
||||
from core.logger import DialogType, Logger
|
||||
from core.settings.kiauh_settings import KiauhSettings
|
||||
from core.types.component_status import ComponentStatus
|
||||
@@ -73,7 +72,7 @@ def install_crowsnest() -> None:
|
||||
Logger.print_info("Installer will prompt you for sudo password!")
|
||||
try:
|
||||
run(
|
||||
f"sudo make install BASE_USER={CURRENT_USER}",
|
||||
f"sudo make install",
|
||||
cwd=CROWSNEST_DIR,
|
||||
shell=True,
|
||||
check=True,
|
||||
|
||||
@@ -165,7 +165,7 @@ def start_flash_process(flash_options: FlashOptions) -> None:
|
||||
if rc != 0:
|
||||
raise Exception(f"Flashing failed with returncode: {rc}")
|
||||
else:
|
||||
Logger.print_ok("Flashing successfull!", start="\n", end="\n\n")
|
||||
Logger.print_ok("Flashing successful!", start="\n", end="\n\n")
|
||||
|
||||
except (Exception, CalledProcessError):
|
||||
Logger.print_error("Flashing failed!", start="\n")
|
||||
|
||||
@@ -144,7 +144,7 @@ def install_client(
|
||||
custom_color=Color.GREEN,
|
||||
center_content=True,
|
||||
content=[
|
||||
f"Open {client.display_name} now on: http://{get_ipv4_addr()}:{port}",
|
||||
f"Open {client.display_name} now on: http://{get_ipv4_addr()}{'' if port == 80 else f':{port}'}",
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
@@ -79,14 +79,14 @@ class BackupManager:
|
||||
|
||||
if source is None or not Path(source).exists():
|
||||
Logger.print_info("Source directory does not exist! Skipping ...")
|
||||
return
|
||||
return None
|
||||
|
||||
target = self.backup_root_dir if target is None else target
|
||||
try:
|
||||
date = get_current_date().get("date")
|
||||
time = get_current_date().get("time")
|
||||
backup_target = target.joinpath(f"{name.lower()}-{date}-{time}")
|
||||
shutil.copytree(source, backup_target, ignore=self.ignore_folders_func)
|
||||
shutil.copytree(source, backup_target, ignore=self.ignore_folders_func, ignore_dangling_symlinks=True)
|
||||
Logger.print_ok("Backup successful!")
|
||||
|
||||
return backup_target
|
||||
|
||||
@@ -21,9 +21,7 @@ from core.menus import Option
|
||||
from core.menus.base_menu import BaseMenu
|
||||
from core.settings.kiauh_settings import KiauhSettings, RepoSettings
|
||||
from core.types.color import Color
|
||||
from core.types.component_status import ComponentStatus
|
||||
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
|
||||
|
||||
|
||||
@@ -141,12 +139,12 @@ class SettingsMenu(BaseMenu):
|
||||
|
||||
repo = get_string_input(
|
||||
"Enter new repository URL",
|
||||
regex="^[\w/.:-]+$",
|
||||
regex=r"^[\w/.:-]+$",
|
||||
default=KLIPPER_REPO_URL if repo_name == "klipper" else MOONRAKER_REPO_URL,
|
||||
)
|
||||
branch = get_string_input(
|
||||
"Enter new branch name",
|
||||
regex="^.+$",
|
||||
regex=r"^.+$",
|
||||
default="master"
|
||||
)
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ def change_system_hostname() -> None:
|
||||
"http://<hostname>.local",
|
||||
"\n\n",
|
||||
"Example: If you set your hostname to 'my-printer', you can access an "
|
||||
"installed webinterface by tyoing 'http://my-printer.local' in the "
|
||||
"installed webinterface by typing 'http://my-printer.local' in the "
|
||||
"browser.",
|
||||
],
|
||||
custom_title="CHANGE SYSTEM HOSTNAME",
|
||||
@@ -51,7 +51,7 @@ def change_system_hostname() -> None:
|
||||
)
|
||||
hostname = get_string_input(
|
||||
"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):
|
||||
Logger.print_info("Aborting hostname change ...")
|
||||
|
||||
@@ -43,7 +43,8 @@ def get_kiauh_version() -> str:
|
||||
Helper method to get the current KIAUH version by reading the latest tag
|
||||
:return: string of the latest tag
|
||||
"""
|
||||
return get_local_tags(Path(__file__).parent.parent)[-1]
|
||||
lastest_tag: str = get_local_tags(Path(__file__).parent.parent)[-1]
|
||||
return lastest_tag
|
||||
|
||||
|
||||
def convert_camelcase_to_kebabcase(name: str) -> str:
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import re
|
||||
import shutil
|
||||
import urllib.request
|
||||
from http.client import HTTPResponse
|
||||
@@ -118,7 +119,7 @@ def get_local_tags(repo_path: Path, _filter: str | None = None) -> List[str]:
|
||||
:return: List of tags
|
||||
"""
|
||||
try:
|
||||
cmd = ["git", "tag", "-l"]
|
||||
cmd: List[str] = ["git", "tag", "-l"]
|
||||
|
||||
if _filter is not None:
|
||||
cmd.append(f"'${_filter}'")
|
||||
@@ -129,8 +130,10 @@ def get_local_tags(repo_path: Path, _filter: str | None = None) -> List[str]:
|
||||
cwd=repo_path.as_posix(),
|
||||
).decode(encoding="utf-8")
|
||||
|
||||
tags = result.split("\n")
|
||||
return tags[:-1]
|
||||
tags: List[str] = result.split("\n")[:-1]
|
||||
|
||||
return sorted(tags, key=lambda x: [int(i) if i.isdigit() else i for i in
|
||||
re.split(r'(\d+)', x)])
|
||||
|
||||
except CalledProcessError:
|
||||
return []
|
||||
|
||||
@@ -105,7 +105,7 @@ function install_crowsnest(){
|
||||
pushd "${HOME}/crowsnest" &> /dev/null || exit 1
|
||||
title_msg "Installer will prompt you for sudo password!"
|
||||
status_msg "Launching crowsnest installer ..."
|
||||
if ! sudo make install BASE_USER=$USER; then
|
||||
if ! sudo make install; then
|
||||
error_msg "Something went wrong! Please try again..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user