From d29192b67a4e1f88462d46d8608df98bc978da45 Mon Sep 17 00:00:00 2001 From: kj_sh604 Date: Sun, 8 Mar 2026 20:06:32 -0400 Subject: refactor: more friendly font lookup for most server set-ups --- src/font.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/font.php b/src/font.php index de39569..d12ceb8 100644 --- a/src/font.php +++ b/src/font.php @@ -15,10 +15,16 @@ if ($file === false || !file_exists($file)) { $real = realpath($file); $allowed = ['/usr/share/fonts', '/usr/local/share/fonts']; -$ok = false; + +foreach (glob('/home/*', GLOB_ONLYDIR) as $home) { + $allowed[] = $home . '/.local/share/fonts'; + $allowed[] = $home . '/.fonts'; +} + +$ok = false; foreach ($allowed as $dir) { - if (str_starts_with($real, $dir)) { + if (str_starts_with($real, realpath($dir) ?: $dir)) { $ok = true; break; } -- cgit v1.2.3