Differentiate Douyin vs YouTube live badges and highlight YPP pill.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
a35088be13
commit
e51df6f35e
@ -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));
|
||||
|
||||
@ -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 ? (
|
||||
<div className="text-amber-200/90">Google 品牌:{ch.brand_hint}</div>
|
||||
) : null}
|
||||
{ch.ypp_ok === 1 ? <div className="text-teal-300">YPP · 获利</div> : null}
|
||||
<YppBadge yppOk={ch.ypp_ok} />
|
||||
{ch.oauth_error ? <div className="text-rose-300">{ch.oauth_error}</div> : null}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -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 = <LivePulse label={label} />;
|
||||
const label = compact ? "DY·LIVE" : "抖音·直播中";
|
||||
const inner = <LivePulse label={label} variant="douyin" />;
|
||||
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 (
|
||||
<span
|
||||
|
||||
@ -115,12 +115,12 @@ function ShellFrame({ children }: { children: React.ReactNode }) {
|
||||
<div className="mt-1.5 flex flex-wrap items-center gap-2 sm:mt-2">
|
||||
{dyLiveCount > 0 ? (
|
||||
<Link href="/rooms?q=&status=live">
|
||||
<LivePulse label={`抖音 ${dyLiveCount} 路在播`} />
|
||||
<LivePulse label={`抖音 ${dyLiveCount} 路在播`} variant="douyin" />
|
||||
</Link>
|
||||
) : null}
|
||||
{ytLiveCount > 0 ? (
|
||||
<Link href="/youtube">
|
||||
<LivePulse label={`YouTube ${ytLiveCount} 路在播`} />
|
||||
<LivePulse label={`YouTube ${ytLiveCount} 路在播`} variant="youtube" />
|
||||
</Link>
|
||||
) : null}
|
||||
{ytLiveMap?.checked_at ? (
|
||||
|
||||
@ -30,8 +30,10 @@ export function YouTubeLiveBadge({
|
||||
if (!live) {
|
||||
if (!showOffline) return null;
|
||||
return (
|
||||
<span className={`inline-flex items-center rounded px-1.5 py-0.5 text-[10px] text-slate-500 ring-1 ring-white/10 ${className}`}>
|
||||
检测中
|
||||
<span
|
||||
className={`inline-flex items-center rounded px-1.5 py-0.5 text-[10px] text-red-300/60 ring-1 ring-red-500/20 bg-red-950/20 ${className}`}
|
||||
>
|
||||
YT·检测中
|
||||
</span>
|
||||
);
|
||||
}
|
||||
@ -41,20 +43,20 @@ export function YouTubeLiveBadge({
|
||||
const tip = live.error ? String(live.error) : "YouTube 未开播";
|
||||
return (
|
||||
<span
|
||||
className={`inline-flex items-center rounded px-1.5 py-0.5 text-[10px] text-slate-500 ring-1 ring-white/10 ${className}`}
|
||||
className={`inline-flex items-center rounded px-1.5 py-0.5 text-[10px] text-red-300/55 ring-1 ring-red-500/25 bg-red-950/25 ${className}`}
|
||||
title={tip}
|
||||
>
|
||||
离线
|
||||
YT·离线
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
const label = compact ? "LIVE" : "LIVE";
|
||||
const label = compact ? "YT·LIVE" : "YT·直播中";
|
||||
const inner = (
|
||||
<>
|
||||
<LivePulse label={label} />
|
||||
<LivePulse label={label} variant="youtube" />
|
||||
{showTitle && live.title ? (
|
||||
<span className="max-w-[180px] truncate text-[11px] text-rose-100/90">{live.title}</span>
|
||||
<span className="max-w-[180px] truncate text-[11px] text-red-100/90">{live.title}</span>
|
||||
) : null}
|
||||
</>
|
||||
);
|
||||
|
||||
@ -24,7 +24,7 @@ export function YouTubeLiveTicker() {
|
||||
return (
|
||||
<div className="mb-6 overflow-hidden rounded-2xl border border-red-500/25 bg-red-500/5">
|
||||
<div className="flex items-center gap-2 border-b border-white/5 px-4 py-2 text-xs text-red-100/90">
|
||||
<LivePulse label={`YouTube ${items.length} 路在播`} />
|
||||
<LivePulse label={`YouTube ${items.length} 路在播`} variant="youtube" />
|
||||
<Link href="/groups" className="ml-auto text-teal-300 hover:underline">
|
||||
分组 →
|
||||
</Link>
|
||||
@ -39,7 +39,7 @@ export function YouTubeLiveTicker() {
|
||||
rel="noreferrer"
|
||||
className="inline-flex items-center gap-2 whitespace-nowrap hover:text-white"
|
||||
>
|
||||
<span className="live-dot" />
|
||||
<span className="live-dot-youtube" />
|
||||
<span className="font-medium">{item.title}</span>
|
||||
{item.source ? <span className="text-[10px] text-slate-500">{item.source}</span> : null}
|
||||
</a>
|
||||
|
||||
@ -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 (
|
||||
<span
|
||||
className="inline-flex items-center gap-0.5 rounded-md border border-amber-400/60 bg-gradient-to-r from-amber-500/35 via-yellow-500/25 to-amber-600/30 px-2 py-0.5 text-[10px] font-bold tracking-wide text-amber-50 shadow-[0_0_12px_rgba(251,191,36,0.25)] ring-1 ring-amber-300/40"
|
||||
title="YouTube Partner Program · 已开通获利"
|
||||
>
|
||||
{compact ? "★ YPP" : "★ YPP·获利"}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
if (yppOk === 0) {
|
||||
return (
|
||||
<span
|
||||
className="inline-flex items-center rounded-md border border-orange-500/35 bg-orange-950/40 px-1.5 py-0.5 text-[10px] font-medium text-orange-200/90 ring-1 ring-orange-500/25"
|
||||
title="未加入 YouTube 合作伙伴计划"
|
||||
>
|
||||
非 YPP
|
||||
</span>
|
||||
);
|
||||
}
|
||||
if (yppOk === -1 || yppOk === undefined) {
|
||||
return (
|
||||
<span
|
||||
className="inline-flex items-center rounded-md border border-dashed border-amber-500/30 bg-amber-950/15 px-1.5 py-0.5 text-[10px] text-amber-200/50"
|
||||
title="尚未检测 YPP 状态"
|
||||
>
|
||||
YPP ?
|
||||
</span>
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
export function YtChannelMetaBadges({
|
||||
meta,
|
||||
layout = "column",
|
||||
@ -46,6 +81,7 @@ export function YtChannelMetaBadges({
|
||||
return (
|
||||
<div className={`${wrap} ${className}`}>
|
||||
{meta.oauthProfileId ? <OauthClientBadge profileId={meta.oauthProfileId} size="sm" /> : null}
|
||||
<YppBadge yppOk={meta.yppOk} />
|
||||
{meta.enabled === false ? (
|
||||
<span className={`${badge} text-slate-500`}>停用</span>
|
||||
) : meta.enabled === true ? (
|
||||
@ -62,15 +98,6 @@ export function YtChannelMetaBadges({
|
||||
Google·{meta.brandHint}
|
||||
</span>
|
||||
) : null}
|
||||
{meta.yppOk === 1 ? (
|
||||
<span className={`${badge} text-emerald-300`} title="YouTube Partner Program · 上传后自动开广告获利">
|
||||
YPP·获利
|
||||
</span>
|
||||
) : meta.yppOk === 0 ? (
|
||||
<span className={`${badge} text-slate-500`}>非 YPP</span>
|
||||
) : meta.yppOk === -1 || meta.yppOk === undefined ? (
|
||||
<span className={`${badge} text-slate-600`}>YPP 未检测</span>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@ -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 (
|
||||
<span className="inline-flex items-center gap-2 rounded-md border border-rose-500/30 bg-rose-500/10 px-2 py-1 text-[11px] font-semibold tracking-wide text-rose-100">
|
||||
<span className="live-dot" />
|
||||
<span
|
||||
className={`inline-flex items-center gap-2 rounded-md border px-2 py-1 text-[11px] font-semibold tracking-wide ${v.wrap}`}
|
||||
>
|
||||
<span className={v.dot} />
|
||||
{label}
|
||||
</span>
|
||||
);
|
||||
|
||||
29
scripts/_deploy_live_badge_ui.py
Normal file
29
scripts/_deploy_live_badge_ui.py
Normal file
@ -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()
|
||||
Loading…
Reference in New Issue
Block a user