🐛 修复路径解压与挂载 (#1619)

This commit is contained in:
HibiKier 2024-09-10 20:17:09 +08:00 committed by GitHub
parent 4e42d1dda1
commit 95762bdddd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 3 deletions

View File

@ -25,7 +25,7 @@ async def init_public(app: FastAPI):
if not PUBLIC_PATH.exists(): if not PUBLIC_PATH.exists():
folders = await update_webui_assets() folders = await update_webui_assets()
else: else:
folders = [x.name for x in PUBLIC_PATH.iterdir()] folders = [x.name for x in PUBLIC_PATH.iterdir() if x.is_dir()]
app.include_router(router) app.include_router(router)
for pathname in folders: for pathname in folders:
logger.debug(f"挂载文件夹: {pathname}") logger.debug(f"挂载文件夹: {pathname}")

View File

@ -35,7 +35,7 @@ def _file_handle(webui_assets_path: Path):
logger.debug("解压 webui_assets 成功...", COMMAND_NAME) logger.debug("解压 webui_assets 成功...", COMMAND_NAME)
else: else:
raise Exception("解压 webui_assets 失败,文件不存在...", COMMAND_NAME) raise Exception("解压 webui_assets 失败,文件不存在...", COMMAND_NAME)
download_file_path = TMP_PATH / next(iter(TMP_PATH.iterdir())) download_file_path = next(f for f in TMP_PATH.iterdir() if f.is_dir())
shutil.rmtree(PUBLIC_PATH, ignore_errors=True) shutil.rmtree(PUBLIC_PATH, ignore_errors=True)
shutil.copytree(download_file_path / "dist", PUBLIC_PATH, dirs_exist_ok=True) shutil.copytree(download_file_path / "dist", PUBLIC_PATH, dirs_exist_ok=True)
logger.debug("复制 webui_assets 成功...", COMMAND_NAME) logger.debug("复制 webui_assets 成功...", COMMAND_NAME)

View File

@ -441,7 +441,7 @@ class ConfigsManager:
self._data[module] = config_group self._data[module] = config_group
logger.info( logger.info(
f"加载配置完成,共加载 <u><y>{len(temp_data)}</y></u> 个配置组及对应" f"加载配置完成,共加载 <u><y>{len(temp_data)}</y></u> 个配置组及对应"
" <u><y>{count}</y></u> 个配置项" f" <u><y>{count}</y></u> 个配置项"
) )
def get_data(self) -> dict[str, ConfigGroup]: def get_data(self) -> dict[str, ConfigGroup]: