diff --git a/frontend/src/app/tiktok/page.tsx b/frontend/src/app/tiktok/page.tsx
index 9bae4a5..4ded0bf 100644
--- a/frontend/src/app/tiktok/page.tsx
+++ b/frontend/src/app/tiktok/page.tsx
@@ -3,8 +3,6 @@
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import Link from "next/link";
import {
- CheckCircle2,
- Circle,
Clock3,
ExternalLink,
KeyRound,
@@ -23,8 +21,6 @@ import { useToast } from "@/components/Toast";
import { PageLoader } from "@/components/ui";
import { fetchJson, fmtTs, todayBeijingISO } from "@/lib/api";
-type SetupStep = { id: string; title: string; url?: string; done: boolean };
-
type Channel = {
id: string;
name: string;
@@ -137,13 +133,24 @@ export default function TikTokPage() {
});
const setup = status?.setup;
- const setupDone = setup?.steps?.every((s: SetupStep) => s.done);
+ const hasChannels = channels.length > 0;
+ const authorizedCount = channels.filter((c) => c.authorized).length;
+ const allReady = hasChannels && authorizedCount === channels.length;
+ const setupDone = allReady;
const board = status?.board || {};
const boardChannels: BoardChannel[] = board.channels || [];
const upcoming: Upcoming[] = board.upcoming || [];
const beijingWindow = board.beijing_window || "";
- const cookiesDir = status?.setup?.cookies_dir || "";
- const authMode = status?.auth_mode || "cookie";
+
+ const openAddForm = () => {
+ setEditId("");
+ setFormName("TikTok 账号");
+ setFormPrivacy("PUBLIC_TO_EVERYONE");
+ setFormTitle("{anchor} #fyp");
+ setFormDesc("{anchor}\n{url}");
+ setShowForm(true);
+ setShowSessionForm(false);
+ };
const togglePipeline = async () => {
const on = status?.enabled;
@@ -183,7 +190,7 @@ export default function TikTokPage() {
};
const addChannel = async () => {
- await fetchJson("/api/tiktok/channels", {
+ const r = await fetchJson("/api/tiktok/channels", {
method: "POST",
body: JSON.stringify({
name: formName,
@@ -194,6 +201,10 @@ export default function TikTokPage() {
});
toast.push("账号已添加,请粘贴 Cookie", "ok");
setShowForm(false);
+ const ch = r?.channel as Channel | undefined;
+ if (ch?.id) {
+ openSessionForm(ch.id, ch);
+ }
void load();
};
@@ -232,6 +243,7 @@ export default function TikTokPage() {
setSessionId("");
setSessionDcId("useast2a");
setSessionUsername(ch?.tiktok_username || "");
+ setShowForm(false);
setShowSessionForm(true);
};
@@ -355,62 +367,35 @@ export default function TikTokPage() {
- {/* Setup wizard */}
- {!setupDone && (
+ {/* 首次使用:仅显示引导或表单,不堆叠 */}
+ {!hasChannels && !showForm && !showSessionForm && (
- 浏览器登录 tiktok.com 后导出 ⚠️ {setup.note}🚀 Cookie 会话配置(无需开发者 API)
+ 开始使用 TikTok 上传
sessionid,粘贴到账号即可上传。
- 模式:{authMode}
+ 无需 TikTok 开发者应用。浏览器登录 tiktok.com 后复制{" "}
+ sessionid,粘贴即可上传。
+
+
+ {setup?.note &&
⚠️ {setup.note}
- )} - {cookiesDir ? ( -Cookie 存储:{cookiesDir}
- ) : null} + {/* 有账号但未全部配置 Cookie */} + {hasChannels && !allReady && !showForm && !showSessionForm && ( +sessionidtiktok_enabled 开启后再点「启动自动上传」