diff --git a/frontend/src/app/globals.css b/frontend/src/app/globals.css index cacdf4b..a4dc267 100644 --- a/frontend/src/app/globals.css +++ b/frontend/src/app/globals.css @@ -300,6 +300,44 @@ button { animation: pulse-ring 1.6s ease-out infinite; } +.live-dot-douyin { + position: relative; + display: inline-flex; + width: 0.55rem; + height: 0.55rem; + border-radius: 9999px; + background: #e879f9; + box-shadow: 0 0 0 0 rgba(232, 121, 249, 0.55); +} + +.live-dot-douyin::after { + content: ""; + position: absolute; + inset: -3px; + border-radius: 9999px; + border: 1.5px solid rgba(217, 70, 239, 0.75); + animation: pulse-ring 1.6s ease-out infinite; +} + +.live-dot-youtube { + position: relative; + display: inline-flex; + width: 0.55rem; + height: 0.55rem; + border-radius: 9999px; + background: #ef4444; + box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.55); +} + +.live-dot-youtube::after { + content: ""; + position: absolute; + inset: -3px; + border-radius: 9999px; + border: 1.5px solid rgba(248, 113, 113, 0.85); + animation: pulse-ring 1.6s ease-out infinite; +} + .glass-panel { border: 1px solid rgba(255, 255, 255, 0.1); background: linear-gradient(160deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02)); diff --git a/frontend/src/app/youtube/health/page.tsx b/frontend/src/app/youtube/health/page.tsx index 1cdf92f..24ffaa2 100644 --- a/frontend/src/app/youtube/health/page.tsx +++ b/frontend/src/app/youtube/health/page.tsx @@ -5,6 +5,7 @@ import Link from "next/link"; import { Loader2, RefreshCw, ShieldCheck } from "lucide-react"; import { Shell } from "@/components/Shell"; +import { YppBadge } from "@/components/YtChannelMetaBadges"; import { YtChannelProfileSnippet, type YtProfileSnippet } from "@/components/YtChannelProfileSnippet"; import { useToast } from "@/components/Toast"; import { fetchJson } from "@/lib/api"; @@ -137,7 +138,7 @@ export default function YoutubeOAuthHealthPage() { {ch.brand_hint ? (
Google 品牌:{ch.brand_hint}
) : null} - {ch.ypp_ok === 1 ?
YPP · 获利
: null} + {ch.oauth_error ?
{ch.oauth_error}
: null} diff --git a/frontend/src/components/DouyinLiveBadge.tsx b/frontend/src/components/DouyinLiveBadge.tsx index 9cdd7a4..5c1d917 100644 --- a/frontend/src/components/DouyinLiveBadge.tsx +++ b/frontend/src/components/DouyinLiveBadge.tsx @@ -48,7 +48,7 @@ export function DouyinLiveBadge({ if (overlay) { if (!roomId && !lastStatus) return null; const color = isLive - ? "bg-rose-500 ring-rose-300/60 live-dot" + ? "bg-fuchsia-500 ring-fuchsia-300/70 live-dot-douyin" : status === "error" ? "bg-amber-400 ring-amber-200/60" : showOffline @@ -64,8 +64,8 @@ export function DouyinLiveBadge({ } if (isLive) { - const label = compact ? "LIVE" : "直播中"; - const inner = ; + const label = compact ? "DY·LIVE" : "抖音·直播中"; + const inner = ; const href = live?.url || (roomId ? `https://live.douyin.com/${roomId}` : ""); if (href) { return ( @@ -90,8 +90,8 @@ export function DouyinLiveBadge({ status === "error" ? "text-amber-200 ring-amber-500/30 bg-amber-500/10" : status === "offline" - ? "text-slate-400 ring-white/10 bg-white/5" - : "text-slate-500 ring-white/10 bg-white/5"; + ? "text-fuchsia-200/50 ring-fuchsia-500/20 bg-fuchsia-500/5" + : "text-fuchsia-200/40 ring-fuchsia-500/15 bg-fuchsia-500/5"; return ( {dyLiveCount > 0 ? ( - + ) : null} {ytLiveCount > 0 ? ( - + ) : null} {ytLiveMap?.checked_at ? ( diff --git a/frontend/src/components/YouTubeLiveBadge.tsx b/frontend/src/components/YouTubeLiveBadge.tsx index 53b4839..294b852 100644 --- a/frontend/src/components/YouTubeLiveBadge.tsx +++ b/frontend/src/components/YouTubeLiveBadge.tsx @@ -30,8 +30,10 @@ export function YouTubeLiveBadge({ if (!live) { if (!showOffline) return null; return ( - - 检测中 + + YT·检测中 ); } @@ -41,20 +43,20 @@ export function YouTubeLiveBadge({ const tip = live.error ? String(live.error) : "YouTube 未开播"; return ( - 离线 + YT·离线 ); } - const label = compact ? "LIVE" : "LIVE"; + const label = compact ? "YT·LIVE" : "YT·直播中"; const inner = ( <> - + {showTitle && live.title ? ( - {live.title} + {live.title} ) : null} ); diff --git a/frontend/src/components/YouTubeLiveTicker.tsx b/frontend/src/components/YouTubeLiveTicker.tsx index 3d3e3a5..5a55280 100644 --- a/frontend/src/components/YouTubeLiveTicker.tsx +++ b/frontend/src/components/YouTubeLiveTicker.tsx @@ -24,7 +24,7 @@ export function YouTubeLiveTicker() { return (
- + 分组 → @@ -39,7 +39,7 @@ export function YouTubeLiveTicker() { rel="noreferrer" className="inline-flex items-center gap-2 whitespace-nowrap hover:text-white" > - + {item.title} {item.source ? {item.source} : null} diff --git a/frontend/src/components/YtChannelMetaBadges.tsx b/frontend/src/components/YtChannelMetaBadges.tsx index 5f0bc5b..fe772b4 100644 --- a/frontend/src/components/YtChannelMetaBadges.tsx +++ b/frontend/src/components/YtChannelMetaBadges.tsx @@ -30,6 +30,41 @@ function oauthLabel(oauthOk?: number | boolean | null, authorized?: boolean, oau return "未授权"; } +/** Standalone YPP pill — gold/amber, visually distinct from OAuth / live badges. */ +export function YppBadge({ yppOk, compact = false }: { yppOk?: number | null; compact?: boolean }) { + if (yppOk === 1) { + return ( + + {compact ? "★ YPP" : "★ YPP·获利"} + + ); + } + if (yppOk === 0) { + return ( + + 非 YPP + + ); + } + if (yppOk === -1 || yppOk === undefined) { + return ( + + YPP ? + + ); + } + return null; +} + export function YtChannelMetaBadges({ meta, layout = "column", @@ -46,6 +81,7 @@ export function YtChannelMetaBadges({ return (
{meta.oauthProfileId ? : null} + {meta.enabled === false ? ( 停用 ) : meta.enabled === true ? ( @@ -62,15 +98,6 @@ export function YtChannelMetaBadges({ Google·{meta.brandHint} ) : null} - {meta.yppOk === 1 ? ( - - YPP·获利 - - ) : meta.yppOk === 0 ? ( - 非 YPP - ) : meta.yppOk === -1 || meta.yppOk === undefined ? ( - YPP 未检测 - ) : null}
); } diff --git a/frontend/src/components/ui.tsx b/frontend/src/components/ui.tsx index 334174f..ee47c47 100644 --- a/frontend/src/components/ui.tsx +++ b/frontend/src/components/ui.tsx @@ -43,10 +43,39 @@ export function AnimatedNumber({ ); } -export function LivePulse({ label = "LIVE" }: { label?: string }) { +export type LivePulseVariant = "douyin" | "youtube" | "default"; + +const LIVE_PULSE_VARIANT: Record< + LivePulseVariant, + { wrap: string; dot: string } +> = { + douyin: { + wrap: "border-fuchsia-500/45 bg-gradient-to-r from-fuchsia-600/25 to-pink-500/15 text-fuchsia-50", + dot: "live-dot-douyin", + }, + youtube: { + wrap: "border-red-500/55 bg-gradient-to-r from-red-600/25 to-red-500/10 text-red-50", + dot: "live-dot-youtube", + }, + default: { + wrap: "border-rose-500/30 bg-rose-500/10 text-rose-100", + dot: "live-dot", + }, +}; + +export function LivePulse({ + label = "LIVE", + variant = "default", +}: { + label?: string; + variant?: LivePulseVariant; +}) { + const v = LIVE_PULSE_VARIANT[variant]; return ( - - + + {label} ); diff --git a/scripts/_deploy_live_badge_ui.py b/scripts/_deploy_live_badge_ui.py new file mode 100644 index 0000000..6724f00 --- /dev/null +++ b/scripts/_deploy_live_badge_ui.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +from __future__ import annotations +import sys, time +from pathlib import Path +import paramiko +sys.stdout.reconfigure(encoding="utf-8", errors="replace") +ROOT = Path(__file__).resolve().parents[1] +APP = "/opt/douyinWEB" +FILES = [ + "frontend/src/components/ui.tsx", + "frontend/src/app/globals.css", + "frontend/src/components/DouyinLiveBadge.tsx", + "frontend/src/components/YouTubeLiveBadge.tsx", + "frontend/src/components/YtChannelMetaBadges.tsx", + "frontend/src/components/Shell.tsx", + "frontend/src/components/YouTubeLiveTicker.tsx", + "frontend/src/app/youtube/health/page.tsx", +] +c = paramiko.SSHClient() +c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) +c.connect("108.174.50.68", 22, "root", "Xiao4669805", timeout=60, allow_agent=False, look_for_keys=False) +sftp = c.open_sftp() +for rel in FILES: + print("upload", rel) + sftp.put(str(ROOT / rel), f"{APP}/{rel}") +sftp.close() +_, o, _ = c.exec_command("cd /opt/douyinWEB/frontend && npm run build 2>&1 | tail -8 && systemctl restart douyinweb-web && systemctl is-active douyinweb-web", timeout=300) +print(o.read().decode()) +c.close()