Fix update checker: find git despite systemd minimal PATH
shutil.which("git") fails under systemd's stripped PATH. Added
_find_git() that checks common locations (/usr/bin/git, etc.)
as fallback. Also added null-safe check on apiFetch response
in the update checker frontend code.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
68fe9b4435
commit
eb1aa9d434
2 changed files with 15 additions and 2 deletions
|
|
@ -16,7 +16,20 @@ router = APIRouter(prefix="/api/updates", tags=["updates"])
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
_IS_GIT = (BASE_DIR / ".git").is_dir()
|
_IS_GIT = (BASE_DIR / ".git").is_dir()
|
||||||
_HAS_GIT = bool(shutil.which("git"))
|
|
||||||
|
|
||||||
|
def _find_git() -> bool:
|
||||||
|
"""Check if git is available, even with systemd's minimal PATH."""
|
||||||
|
if shutil.which("git"):
|
||||||
|
return True
|
||||||
|
# systemd services often have a stripped PATH — check common locations
|
||||||
|
for p in ("/usr/bin/git", "/usr/local/bin/git", "/bin/git"):
|
||||||
|
if os.path.isfile(p) and os.access(p, os.X_OK):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
_HAS_GIT = _find_git()
|
||||||
|
|
||||||
|
|
||||||
def _require_git():
|
def _require_git():
|
||||||
|
|
|
||||||
|
|
@ -397,7 +397,7 @@
|
||||||
if (updateDismissed) return;
|
if (updateDismissed) return;
|
||||||
try {
|
try {
|
||||||
const res = await Atlus.apiFetch('/api/updates/check');
|
const res = await Atlus.apiFetch('/api/updates/check');
|
||||||
if (!res.ok) return;
|
if (!res || !res.ok) return;
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
const panel = $('#panelUpdates');
|
const panel = $('#panelUpdates');
|
||||||
if (!panel) return;
|
if (!panel) return;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue