Add 2026 theme build and retrieval timeline
This commit is contained in:
+10
@@ -18,6 +18,15 @@ RUN echo "$FRONTEND_CACHE_BUST" >/tmp/frontend-cache-bust && \
|
||||
pnpm install --frozen-lockfile --prod=false && \
|
||||
pnpm run build
|
||||
|
||||
# 克隆并构建 2026 主题
|
||||
ARG FRONTEND_2026_REPO=https://git.orionc.me/orion/FileCodeBoxFronted2026.git
|
||||
ARG FRONTEND_2026_BRANCH=main
|
||||
RUN echo "$FRONTEND_CACHE_BUST" >/tmp/frontend-2026-cache-bust && \
|
||||
git clone --depth 1 --branch "$FRONTEND_2026_BRANCH" "$FRONTEND_2026_REPO" /build/fronted-2026 && \
|
||||
cd /build/fronted-2026 && \
|
||||
pnpm install --frozen-lockfile --prod=false && \
|
||||
pnpm run build
|
||||
|
||||
# 克隆并构建 2023 主题
|
||||
ARG FRONTEND_2023_REPO=https://git.orionc.me/orion/FileCodeBoxFronted2023.git
|
||||
ARG FRONTEND_2023_BRANCH=main
|
||||
@@ -42,6 +51,7 @@ RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
|
||||
|
||||
# 从构建阶段复制编译好的前端主题
|
||||
COPY --from=frontend-builder /build/fronted-2024/dist ./themes/2024
|
||||
COPY --from=frontend-builder /build/fronted-2026/dist ./themes/2026
|
||||
COPY --from=frontend-builder /build/fronted-2023/dist ./themes/2023
|
||||
|
||||
# 安装 Python 依赖
|
||||
|
||||
+22
-6
@@ -643,7 +643,7 @@ class FileService:
|
||||
is_permanent=is_permanent,
|
||||
can_download=can_download,
|
||||
)
|
||||
timeline = self._build_file_timeline(
|
||||
timeline = await self._build_file_timeline(
|
||||
file_code=file_code,
|
||||
detail=detail,
|
||||
now=now,
|
||||
@@ -1205,7 +1205,7 @@ class FileService:
|
||||
},
|
||||
}
|
||||
|
||||
def _build_file_timeline(
|
||||
async def _build_file_timeline(
|
||||
self,
|
||||
file_code: FileCodes,
|
||||
detail: dict[str, Any],
|
||||
@@ -1249,7 +1249,7 @@ class FileService:
|
||||
"key": "expiration_policy",
|
||||
"status": "unlimited",
|
||||
"severity": "success",
|
||||
"timestamp": None,
|
||||
"timestamp": file_code.created_at,
|
||||
}
|
||||
)
|
||||
elif file_code.expired_at is not None:
|
||||
@@ -1271,7 +1271,7 @@ class FileService:
|
||||
"key": "download_limit",
|
||||
"status": "exhausted" if exhausted else "active",
|
||||
"severity": "danger" if exhausted else "info",
|
||||
"timestamp": None,
|
||||
"timestamp": file_code.created_at,
|
||||
"value": remaining_downloads,
|
||||
}
|
||||
)
|
||||
@@ -1281,20 +1281,36 @@ class FileService:
|
||||
"key": "download_limit",
|
||||
"status": "unlimited",
|
||||
"severity": "success",
|
||||
"timestamp": None,
|
||||
"timestamp": file_code.created_at,
|
||||
"value": None,
|
||||
}
|
||||
)
|
||||
|
||||
download_stats = await TransferStats.filter(
|
||||
action="download", file_code_id=file_code.id
|
||||
).order_by("created_at")
|
||||
timeline.append(
|
||||
{
|
||||
"key": "retrieved",
|
||||
"status": "done" if file_code.used_count > 0 else "pending",
|
||||
"severity": "success" if file_code.used_count > 0 else "neutral",
|
||||
"timestamp": None,
|
||||
"timestamp": (
|
||||
download_stats[-1].created_at if download_stats else file_code.created_at
|
||||
),
|
||||
"value": file_code.used_count,
|
||||
}
|
||||
)
|
||||
for index, stat in enumerate(download_stats, start=1):
|
||||
timeline.append(
|
||||
{
|
||||
"key": "retrieved_event",
|
||||
"status": "done",
|
||||
"severity": "success",
|
||||
"timestamp": stat.created_at,
|
||||
"value": index,
|
||||
"detail": stat.ip or "",
|
||||
}
|
||||
)
|
||||
return timeline
|
||||
|
||||
def _seconds_between(
|
||||
|
||||
@@ -62,6 +62,12 @@ DEFAULT_CONFIG = {
|
||||
"author": "Lan",
|
||||
"version": "1.0",
|
||||
},
|
||||
{
|
||||
"name": "2026",
|
||||
"key": "themes/2026",
|
||||
"author": "Orion",
|
||||
"version": "1.0",
|
||||
},
|
||||
],
|
||||
"themesSelect": "themes/2024",
|
||||
"errorMinute": 1,
|
||||
|
||||
Reference in New Issue
Block a user