Add 2026 theme build and retrieval timeline

This commit is contained in:
Orion
2026-06-05 12:18:04 +08:00
parent 7a62a79763
commit a8615aca0b
3 changed files with 38 additions and 6 deletions
+10
View File
@@ -18,6 +18,15 @@ RUN echo "$FRONTEND_CACHE_BUST" >/tmp/frontend-cache-bust && \
pnpm install --frozen-lockfile --prod=false && \ pnpm install --frozen-lockfile --prod=false && \
pnpm run build 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 主题 # 克隆并构建 2023 主题
ARG FRONTEND_2023_REPO=https://git.orionc.me/orion/FileCodeBoxFronted2023.git ARG FRONTEND_2023_REPO=https://git.orionc.me/orion/FileCodeBoxFronted2023.git
ARG FRONTEND_2023_BRANCH=main 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-2024/dist ./themes/2024
COPY --from=frontend-builder /build/fronted-2026/dist ./themes/2026
COPY --from=frontend-builder /build/fronted-2023/dist ./themes/2023 COPY --from=frontend-builder /build/fronted-2023/dist ./themes/2023
# 安装 Python 依赖 # 安装 Python 依赖
+22 -6
View File
@@ -643,7 +643,7 @@ class FileService:
is_permanent=is_permanent, is_permanent=is_permanent,
can_download=can_download, can_download=can_download,
) )
timeline = self._build_file_timeline( timeline = await self._build_file_timeline(
file_code=file_code, file_code=file_code,
detail=detail, detail=detail,
now=now, now=now,
@@ -1205,7 +1205,7 @@ class FileService:
}, },
} }
def _build_file_timeline( async def _build_file_timeline(
self, self,
file_code: FileCodes, file_code: FileCodes,
detail: dict[str, Any], detail: dict[str, Any],
@@ -1249,7 +1249,7 @@ class FileService:
"key": "expiration_policy", "key": "expiration_policy",
"status": "unlimited", "status": "unlimited",
"severity": "success", "severity": "success",
"timestamp": None, "timestamp": file_code.created_at,
} }
) )
elif file_code.expired_at is not None: elif file_code.expired_at is not None:
@@ -1271,7 +1271,7 @@ class FileService:
"key": "download_limit", "key": "download_limit",
"status": "exhausted" if exhausted else "active", "status": "exhausted" if exhausted else "active",
"severity": "danger" if exhausted else "info", "severity": "danger" if exhausted else "info",
"timestamp": None, "timestamp": file_code.created_at,
"value": remaining_downloads, "value": remaining_downloads,
} }
) )
@@ -1281,20 +1281,36 @@ class FileService:
"key": "download_limit", "key": "download_limit",
"status": "unlimited", "status": "unlimited",
"severity": "success", "severity": "success",
"timestamp": None, "timestamp": file_code.created_at,
"value": None, "value": None,
} }
) )
download_stats = await TransferStats.filter(
action="download", file_code_id=file_code.id
).order_by("created_at")
timeline.append( timeline.append(
{ {
"key": "retrieved", "key": "retrieved",
"status": "done" if file_code.used_count > 0 else "pending", "status": "done" if file_code.used_count > 0 else "pending",
"severity": "success" if file_code.used_count > 0 else "neutral", "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, "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 return timeline
def _seconds_between( def _seconds_between(
+6
View File
@@ -62,6 +62,12 @@ DEFAULT_CONFIG = {
"author": "Lan", "author": "Lan",
"version": "1.0", "version": "1.0",
}, },
{
"name": "2026",
"key": "themes/2026",
"author": "Orion",
"version": "1.0",
},
], ],
"themesSelect": "themes/2024", "themesSelect": "themes/2024",
"errorMinute": 1, "errorMinute": 1,