From b438d72415b4302d59182a8833ab83596825df82 Mon Sep 17 00:00:00 2001 From: Mostly_Harmless <105110769+MostlyHarmlessxyz@users.noreply.github.com> Date: Sun, 16 Aug 2026 14:05:20 +0000 Subject: [PATCH] =?UTF-8?q?feat(web):=20=E5=AE=8C=E5=96=84=E8=B4=A6?= =?UTF-8?q?=E5=8F=B7=E7=AE=A1=E7=90=86=E3=80=81=E7=A8=BF=E4=BB=B6=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E4=B8=8E=E5=AE=89=E5=85=A8=E8=BE=B9=E7=95=8C=20(#1660?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 启动 Web 服务时自动登记 CLI 指定的 B 站凭据,并为账号登记、刷新和删除统一补上并发去重、原子写入及引用检查。 同时收紧默认监听、管理员初始化、认证路由、静态文件和日志 WebSocket,恢复 server 的 ds_update.log,并避免凭据及上游响应进入日志。 新增按账号查询远程稿件的 API 与 Web 页面,补齐严格分页和响应校验。 关联 biliup/biliup#1624 关联 biliup/biliup#1658 关联 biliup/biliup#724 --- Cargo.lock | 2 + Cargo.toml | 2 +- app/(app)/archives/page.tsx | 134 ++++ app/(app)/layout.tsx | 19 + app/(app)/upload-manager/page.tsx | 4 +- app/(auth)/login/page.jsx | 19 +- app/lib/api-streamer.ts | 25 + app/lib/use-streamers.ts | 13 +- app/ui/AvatarCard/index.tsx | 4 +- app/ui/UserList.tsx | 18 +- biliup/plugins/bili_webup.py | 68 +- biliup/plugins/bili_webup_sync.py | 52 +- crates/biliup-cli/Cargo.toml | 1 + .../3_secure_configuration_identities.sql | 23 + crates/biliup-cli/src/cli.rs | 33 +- crates/biliup-cli/src/lib.rs | 112 ++- crates/biliup-cli/src/main.rs | 51 +- crates/biliup-cli/src/server/api/auth.rs | 93 ++- .../src/server/api/bilibili_endpoints.rs | 181 ++++- crates/biliup-cli/src/server/api/endpoints.rs | 191 +++-- crates/biliup-cli/src/server/api/ws.rs | 114 ++- crates/biliup-cli/src/server/app.rs | 72 +- crates/biliup-cli/src/server/core/monitor.rs | 5 +- .../server/infrastructure/connection_pool.rs | 50 ++ .../src/server/infrastructure/repositories.rs | 665 ++++++++++++++++++ .../src/server/infrastructure/users.rs | 186 ++++- crates/biliup-cli/src/server/router.rs | 171 ++++- crates/biliup-cli/src/uploader.rs | 23 +- crates/biliup/Cargo.toml | 1 + crates/biliup/src/downloader/hls.rs | 7 +- crates/biliup/src/downloader/live/bilibili.rs | 7 +- crates/biliup/src/downloader/live/douyu.rs | 18 +- crates/biliup/src/downloader/live/huya.rs | 12 +- crates/biliup/src/downloader/live/picarto.rs | 4 +- crates/biliup/src/downloader/live/twitch.rs | 91 ++- crates/biliup/src/downloader/live/youtube.rs | 15 +- crates/biliup/src/error.rs | 46 +- crates/biliup/src/uploader/bilibili.rs | 329 +++++++-- crates/biliup/src/uploader/credential.rs | 378 +++++++++- crates/stream-gears/src/login.rs | 17 +- crates/stream-gears/src/server.rs | 9 +- 41 files changed, 2917 insertions(+), 348 deletions(-) create mode 100644 app/(app)/archives/page.tsx create mode 100644 crates/biliup-cli/migrations/3_secure_configuration_identities.sql diff --git a/Cargo.lock b/Cargo.lock index 1da15a9..9379b2d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -413,6 +413,7 @@ dependencies = [ "serde_json", "serde_urlencoded", "serde_yaml", + "tempfile", "thiserror 2.0.18", "time", "tokio", @@ -476,6 +477,7 @@ dependencies = [ "tower-sessions", "tower-sessions-sqlx-store", "tracing", + "tracing-appender", "tracing-subscriber", "url", "urlencoding", diff --git a/Cargo.toml b/Cargo.toml index 44bf7b0..614796a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,7 @@ bytes = "1.10.1" rand = "0.8" serde_urlencoded = "0.7" -tokio = { version = "1", features = ["macros", "rt-multi-thread", "process", "signal"] } +tokio = { version = "1", features = ["macros", "rt-multi-thread", "process", "signal", "sync"] } futures = "0.3.31" async-trait = "0.1.87" diff --git a/app/(app)/archives/page.tsx b/app/(app)/archives/page.tsx new file mode 100644 index 0000000..8990dfe --- /dev/null +++ b/app/(app)/archives/page.tsx @@ -0,0 +1,134 @@ +'use client' + +import { BiliArchive, BiliArchivePage, fetcher } from '@/app/lib/api-streamer' +import { humDate } from '@/app/lib/utils' +import { useBiliUsers } from '@/app/lib/use-streamers' +import { IconUserCardVideo } from '@douyinfe/semi-icons' +import { Banner, Layout, Nav, Pagination, Select, Table, Typography } from '@douyinfe/semi-ui' +import { useState } from 'react' +import useSWR from 'swr' + +const statusOptions = [ + { label: '全部状态', value: 'all' }, + { label: '审核中', value: 'is_pubing' }, + { label: '已通过', value: 'pubed' }, + { label: '未通过', value: 'not_pubed' }, +] + +export default function ArchivesPage() { + const { Header, Content } = Layout + const { Text } = Typography + const { biliUsers, isLoading: usersLoading } = useBiliUsers() + const [userId, setUserId] = useState() + const [status, setStatus] = useState('all') + const [pageNumber, setPageNumber] = useState(1) + const key = userId + ? `/v1/users/${userId}/archives?status=${status}&from_page=${pageNumber}&max_pages=1` + : null + const { data, error, isLoading } = useSWR(key, fetcher) + + const columns = [ + { + title: 'BV号', + dataIndex: 'bvid', + render: (bvid: string) => ( + + {bvid} + + ), + }, + { + title: '标题', + dataIndex: 'title', + render: (title: string) => {title}, + }, + { + title: '状态', + dataIndex: 'state_desc', + render: (stateDescription: string, archive: BiliArchive) => + archive.reject_reason || stateDescription || `状态 ${archive.state}`, + }, + { + title: '时长', + dataIndex: 'duration', + render: (duration: number) => `${Math.floor(duration / 60)}:${String(duration % 60).padStart(2, '0')}`, + }, + { + title: '发布时间', + dataIndex: 'ptime', + render: (ptime: number, archive: BiliArchive) => { + const timestamp = ptime || archive.ctime + return timestamp ? humDate(timestamp) : '-' + }, + }, + ] + + return ( + <> +
+
+ +
+ +