remove USER_FILE usage in ssl_decrypt.py and ssl_encrypt.py; switch to argparse for command-line arguments

This commit is contained in:
2025-05-21 21:29:21 +02:00
parent 4cdcfadbac
commit 5ac37ad9ad
7 changed files with 106 additions and 70 deletions

View File

@ -4,7 +4,7 @@
import gettext
import locale
from pathlib import Path
import subprocess
from subprocess import CompletedProcess, run
from typing import Dict, Any
@ -36,7 +36,6 @@ class AppConfig:
BASE_DIR: Path = Path.home()
CONFIG_DIR: Path = BASE_DIR / ".config/wire_py"
TEMP_DIR: Path = Path("/tmp/tlecdcwg")
USER_FILE: Path = Path("/tmp/.log_user")
PUBLICKEY: Path = CONFIG_DIR / "pbwgk.pem"
# Configuration files
@ -135,14 +134,12 @@ class AppConfig:
if not cls.SYSTEMD_USER_FOLDER.exists():
cls.SYSTEMD_USER_FOLDER.mkdir(parents=True, exist_ok=True)
from subprocess import CompletedProcess
if not cls.AUTOSTART_SERVICE.is_file():
content = "\n".join([line for line in SYSTEMD_FILE])
cls.AUTOSTART_SERVICE.write_text(content)
process: CompletedProcess[str] = subprocess.run(
process: CompletedProcess[str] = run(
["systemctl", "--user", "enable", "wg_start.service"],
capture_output=True,
text=True,