This commit is contained in:
eric
2026-03-29 01:34:23 -05:00
parent 8bce529255
commit 784a4468b8
8 changed files with 308 additions and 218 deletions

View File

@@ -4,6 +4,7 @@ import asyncio
import json
import os
import platform
import re
import shutil
import socket
import subprocess
@@ -24,6 +25,9 @@ HW_PROFILE_JSON = CONFIG_DIR / "hardware-profile.json"
STACK_ENV = CONFIG_DIR / "system-stack.env"
MAX_FILES_PER_ROOT = 256
_PRO_URL_CONFIG_INI = re.compile(r"^URL_config\.[a-zA-Z0-9_.-]+\.ini$")
_PRO_YOUTUBE_INI = re.compile(r"^youtube\.[a-zA-Z0-9_.-]+\.ini$")
@dataclass(frozen=True)
class ManagedRoot:
@@ -44,7 +48,13 @@ class ManagedRoot:
def allows(self, rel_path: Path) -> bool:
rel_posix = rel_path.as_posix()
if self.explicit_names:
return rel_posix in self.explicit_names
if rel_posix in self.explicit_names:
return True
if len(rel_path.parts) == 1:
n = rel_path.name
if _PRO_URL_CONFIG_INI.match(n) or _PRO_YOUTUBE_INI.match(n):
return True
return False
return rel_path.suffix.lower() in self.allowed_suffixes