From d49f567b245340308819c67ec94a672aabd9ccaf Mon Sep 17 00:00:00 2001 From: nikp123 Date: Sun, 18 Jan 2026 16:44:26 +0100 Subject: [PATCH] Add FR_IGNORE_NAMES --- config/config.php | 6 ++++++ src/lib/FS.php | 22 ++++++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/config/config.php b/config/config.php index 893d597..aad87a2 100644 --- a/config/config.php +++ b/config/config.php @@ -119,6 +119,12 @@ define('FR_OIDC_DEBUG', false); } } +// Optional: which file or directory names to ignore while indexing +// Set FR_IGNORE_NAMES to a comma-separated list of file or directory names to ignore. +if (!defined('FR_IGNORE_NAMES')) { + $envVal = getenv('FR_IGNORE_NAMES'); + define('FR_IGNORE_NAMES', ($envVal !== false && $envVal !== '') ? $envVal : '@eaDir,#recycle,.DS_Store,Thumbs.db'); +} // Optional: trusted proxy IP resolution for rate limiting/logging // Set FR_TRUSTED_PROXIES to a comma-separated list of IPs/CIDRs (e.g. "127.0.0.1,10.0.0.0/8"). if (!defined('FR_TRUSTED_PROXIES')) { diff --git a/src/lib/FS.php b/src/lib/FS.php index 1091edd..79f76bb 100644 --- a/src/lib/FS.php +++ b/src/lib/FS.php @@ -9,7 +9,25 @@ final class FS { /** Hidden/system names to ignore entirely */ public static function IGNORE(): array { - return ['@eaDir', '#recycle', '.DS_Store', 'Thumbs.db']; + $raw = ''; + if (defined('FR_IGNORE_NAMES')) { + $raw = FR_IGNORE_NAMES; + } else { + $env = getenv('FR_IGNORE_NAMES'); + if ($env !== false && $env !== '') { + $raw = $env; + } + } + + if (is_array($raw)) { + return $raw; + } + if (!is_string($raw) || trim($raw) === '') { + return []; + } + + $parts = array_map('trim', explode(',', $raw)); + return array_values(array_filter($parts, fn($part) => $part !== '')); } /** App-specific names to skip from UI */ @@ -84,4 +102,4 @@ public static function hasReadableDescendant( } return false; } -} \ No newline at end of file +}