Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ docker compose up -d
| `SERVER_PORT` | 服务监听端口 | `8000` |
| `SERVER_WORKERS` | Granian worker 数量 | `1` |
| `HOST_PORT` | Docker Compose 宿主机映射端口 | `8000` |
| `DATA_DIR` | 本地数据目录 | `./data` |
| `DATA_DIR` | 本地数据根目录(账号库、本地媒体文件、缓存索引统一位于此目录下) | `./data` |
| `LOG_DIR` | 本地日志目录 | `./logs` |
| `ACCOUNT_STORAGE` | 账号存储后端 | `local` |
| `ACCOUNT_LOCAL_PATH` | `local` 模式账号 SQLite 路径 | `${DATA_DIR}/accounts.db` |
Expand All @@ -202,6 +202,7 @@ docker compose up -d
| `proxy.clearance` | `mode`, `cf_cookies`, `user_agent`, `browser`, `flaresolverr_url`, `timeout_sec`, `refresh_interval` |
| `retry` | `reset_session_status_codes`, `max_retries`, `on_codes` |
| `account.refresh` | `basic_interval_sec`, `super_interval_sec`, `heavy_interval_sec`, `usage_concurrency`, `on_demand_min_interval_sec` |
| `cache.local` | `image_max_mb`, `video_max_mb` |
| `chat` | `timeout` |
| `image` | `timeout`, `stream_timeout` |
| `video` | `timeout` |
Expand Down
2 changes: 2 additions & 0 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from app.platform.errors import AppError
from app.platform.meta import get_project_version
from app.platform.paths import data_path
from app.platform.storage import reconcile_local_media_cache_async


load_dotenv()
Expand Down Expand Up @@ -144,6 +145,7 @@ async def lifespan(app: FastAPI):
)
# Reload config in case it was just seeded/migrated into the backend.
await _config.load()
await reconcile_local_media_cache_async()

directory = await get_account_directory(repo)

Expand Down
17 changes: 16 additions & 1 deletion app/platform/storage/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
"""Platform storage helpers."""

from .media_cache import (
clear_local_media_files,
delete_local_media_file,
reconcile_local_media_cache_async,
save_local_image,
save_local_video,
)
from .media_paths import image_files_dir, video_files_dir

__all__ = ["image_files_dir", "video_files_dir"]
__all__ = [
"clear_local_media_files",
"delete_local_media_file",
"image_files_dir",
"reconcile_local_media_cache_async",
"save_local_image",
"save_local_video",
"video_files_dir",
]
Loading
Loading