fix: restore visible auth form for douyin workbench

This commit is contained in:
kris
2026-03-21 05:05:44 +08:00
parent 7171dae91c
commit 6b3774b543
4 changed files with 38 additions and 21 deletions

View File

@@ -858,7 +858,10 @@ function renderPage(mode = "full") {
background: rgba(22, 49, 61, 0.1);
margin: 4px 0;
}
.business-mode .capture-grid,
.capture-only {
display: block;
}
.business-mode .capture-grid .capture-only,
.business-mode .recent-runs-section,
.business-mode .capture-footnote {
display: none;
@@ -885,24 +888,18 @@ function renderPage(mode = "full") {
<div class="grid capture-grid">
<section class="card stack">
<div>
<h2>开始新采集</h2>
<p class="hint">默认会导入 StoryForge如果只是想先抓本地 bundle可以勾选“仅采集不导入”。</p>
<h2>${isWorkbenchMode ? "连接 StoryForge" : "开始新采集"}</h2>
<p class="hint">${isWorkbenchMode ? "业务页里只保留登录和连接所需字段。采集新账号时,请切到“采集控制台”。" : "默认会导入 StoryForge如果只是想先抓本地 bundle可以勾选“仅采集不导入”。"}</p>
</div>
<form id="capture-form" class="stack">
<label>
<label class="capture-only">
抖音主页链接
<input id="profile-url" name="profileUrl" placeholder="https://www.douyin.com/user/..." autocomplete="url" required />
</label>
<div class="row">
<label>
StoryForge 地址
<input id="backend-url" name="backendUrl" value="${DEFAULT_BACKEND_URL}" autocomplete="url" />
</label>
<label>
备注
<input id="note" name="note" placeholder="例如:浏览器辅助采集" />
</label>
</div>
<div class="row">
<label>
StoryForge 用户名
@@ -913,14 +910,23 @@ function renderPage(mode = "full") {
<input id="password" name="password" type="password" placeholder="用于自动导入时登录" autocomplete="current-password" />
</label>
</div>
<div class="row">
<div class="row capture-only">
<label>
备注
<input id="note" name="note" placeholder="例如:浏览器辅助采集" />
</label>
<label>
最大作品页抓取数
<input id="max-videos" name="maxVideos" type="number" min="0" max="10" value="4" />
</label>
</div>
<div class="row">
<div class="field-note" style="display:flex;align-items:end;">
已登录工作台后会自动复用当前会话 Token。通常只需要填账号密码不需要手动维护 Token。
</div>
<div class="capture-only field-note" style="display:flex;align-items:end;">
采集模式下,这里的参数会用于打开真实浏览器并同步新账号数据。
</div>
</div>
<details class="advanced-box" id="token-details">
<summary class="advanced-toggle">
@@ -935,19 +941,20 @@ function renderPage(mode = "full") {
<div class="field-note">只有在你已经拿到 Bearer Token或者不希望页面保存密码时再手动填写这里。</div>
</div>
</details>
<div class="checks">
<div class="checks capture-only">
<label class="check"><input id="sync-enabled" type="checkbox" checked /> 导入 StoryForge</label>
<label class="check"><input id="headless" type="checkbox" /> Headless</label>
<label class="check"><input id="skip-creator-center" type="checkbox" /> 跳过 creator-center</label>
<label class="check"><input id="allow-fallback" type="checkbox" /> 允许 creator-center 兜底</label>
</div>
<div class="actions">
<button class="primary" type="submit">开始采集</button>
<button class="warning" id="continue-button" type="button" disabled>已完成登录,继续采集</button>
<button class="secondary" id="refresh-button" type="button">刷新状态</button>
<button class="primary capture-only" type="submit">开始采集</button>
<button class="warning capture-only" id="continue-button" type="button" disabled>已完成登录,继续采集</button>
<button class="secondary capture-only" id="refresh-button" type="button">刷新状态</button>
<button class="secondary" id="workbench-login-shortcut-button" type="button">${isWorkbenchMode ? "登录工作台" : "快速登录工作台"}</button>
</div>
</form>
<div class="steps">
<div class="steps capture-only">
<div class="step">1. 点击“开始采集”,脚本会在本机打开 Chromium。</div>
<div class="step">2. 在打开的浏览器里完成登录、滑块或验证码,并确认已进入目标主页。</div>
<div class="step">3. 回到这里点击“已完成登录,继续采集”。</div>
@@ -1180,6 +1187,7 @@ function renderPage(mode = "full") {
const similarSearchListEl = document.getElementById("similar-search-list");
const similarSearchDetailEl = document.getElementById("similar-search-detail");
const workbenchLoginButton = document.getElementById("workbench-login-button");
const workbenchLoginShortcutButton = document.getElementById("workbench-login-shortcut-button");
const workbenchRefreshButton = document.getElementById("workbench-refresh-button");
const workbenchLogoutButton = document.getElementById("workbench-logout-button");
const reloadSelectedAccountButton = document.getElementById("reload-selected-account-button");
@@ -2073,6 +2081,7 @@ function renderPage(mode = "full") {
});
workbenchLoginButton.addEventListener("click", loginWorkbench);
workbenchLoginShortcutButton.addEventListener("click", loginWorkbench);
workbenchRefreshButton.addEventListener("click", async () => {
if (!workbenchState.session) {

View File

@@ -5,13 +5,16 @@ ROOT="$(CDPATH= cd -- "$(dirname "$0")/.." && pwd)"
PORT="${DOUYIN_WORKBENCH_PORT:-3618}"
SCRIPT="$ROOT/scripts/douyin-browser-capture/control_panel.mjs"
LOG_FILE="${DOUYIN_WORKBENCH_LOG:-/tmp/storyforge-douyin-workbench.log}"
SESSION_NAME="${DOUYIN_WORKBENCH_SESSION:-storyforge-douyin-workbench}"
if lsof -nP -iTCP:"$PORT" -sTCP:LISTEN >/dev/null 2>&1; then
echo "douyin workbench already running: http://127.0.0.1:$PORT/workbench"
exit 0
fi
nohup env PORT="$PORT" node "$SCRIPT" >"$LOG_FILE" 2>&1 &
screen -wipe >/dev/null 2>&1 || true
screen -S "$SESSION_NAME" -X quit >/dev/null 2>&1 || true
screen -dmS "$SESSION_NAME" /bin/sh -lc "exec env PORT='$PORT' node '$SCRIPT' >>'$LOG_FILE' 2>&1"
python3 - <<'PY'
import os

View File

@@ -2,12 +2,15 @@
set -eu
PORT="${DOUYIN_WORKBENCH_PORT:-3618}"
SESSION_NAME="${DOUYIN_WORKBENCH_SESSION:-storyforge-douyin-workbench}"
if ! lsof -nP -iTCP:"$PORT" -sTCP:LISTEN >/dev/null 2>&1; then
echo "douyin workbench stopped"
exit 1
fi
screen -ls | grep "$SESSION_NAME" || true
echo "---"
python3 - <<'PY'
import os
import urllib.request

View File

@@ -2,6 +2,8 @@
set -eu
PORT="${DOUYIN_WORKBENCH_PORT:-3618}"
SESSION_NAME="${DOUYIN_WORKBENCH_SESSION:-storyforge-douyin-workbench}"
screen -S "$SESSION_NAME" -X quit >/dev/null 2>&1 || true
lsof -tiTCP:"$PORT" -sTCP:LISTEN | xargs -r kill
echo "douyin workbench stopped: $PORT"