feat(web): 站点显示 Cloudflare 状态(CF-2)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
16083942c0
commit
f16b97151b
4 files changed
+155
-3
No files matched your search
@@ -1,9 +1,11 @@
|
||||
import type { SiteListItem } from "@umt/contracts";
|
||||
import { Link } from "react-router";
|
||||
import { useFeeds } from "~/api/feeds.ts";
|
||||
import { accessSummary, useSiteRequestStats, useSiteUserData } from "~/api/sites.ts";
|
||||
import { DetailSection } from "~/components/console/detail-sheet.tsx";
|
||||
import { ErrorState, LoadingState } from "~/components/console/empty-state.tsx";
|
||||
import { KvList } from "~/components/console/kv-list.tsx";
|
||||
import { consolePath } from "~/components/console/nav.ts";
|
||||
import { StatTile } from "~/components/console/stat-tile.tsx";
|
||||
import { StatusBadge } from "~/components/console/status-badge.tsx";
|
||||
import { TechInfo } from "~/components/console/tech-info.tsx";
|
||||
@@ -12,6 +14,8 @@ import {
|
||||
ACCOUNT_OVERALL,
|
||||
AUTH_KIND_LABEL,
|
||||
bytes,
|
||||
cloudflareLine,
|
||||
cloudflareTechItems,
|
||||
dataAccount,
|
||||
hasLogin,
|
||||
healthLine,
|
||||
@@ -26,6 +30,28 @@ import {
|
||||
} from "./site-fields.ts";
|
||||
import { UserDataChart } from "./user-data-chart.tsx";
|
||||
|
||||
/** Cloudflare 状态行(CF-2);需要你验证时给原站视图入口 */
|
||||
function cloudflareRow(site: SiteListItem) {
|
||||
const cf = cloudflareLine(site.config);
|
||||
if (!cf) return [];
|
||||
const text = cf.text.replace(/^Cloudflare:/, "");
|
||||
return [
|
||||
{
|
||||
label: "Cloudflare",
|
||||
value: cf.takeover ? (
|
||||
<span>
|
||||
<span className="text-warning">{text}</span>
|
||||
<Link className="ml-2 text-meta underline" to={`${consolePath("sites", site.id)}?tab=origin`}>
|
||||
去原站视图
|
||||
</Link>
|
||||
</span>
|
||||
) : (
|
||||
text
|
||||
),
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
const CAP_LABEL = [
|
||||
["search", "搜索"],
|
||||
["list", "列表抓取"],
|
||||
@@ -180,11 +206,16 @@ function AccountSiteOverview({ site }: { site: SiteListItem }) {
|
||||
),
|
||||
},
|
||||
{ label: "代理", value: site.proxy ? "使用" : "不使用" },
|
||||
...cloudflareRow(site),
|
||||
...(site.kind && site.kind !== "pt" ? [{ label: "类型", value: kindLabel(site.kind) }] : []),
|
||||
{ label: "获取方式", value: capabilityText(site) },
|
||||
]}
|
||||
/>
|
||||
<TechInfo className="mt-2" columns={1} items={healthTechItems(site.lastHealth)} />
|
||||
<TechInfo
|
||||
className="mt-2"
|
||||
columns={1}
|
||||
items={[...healthTechItems(site.lastHealth), ...cloudflareTechItems(site.config)]}
|
||||
/>
|
||||
</DetailSection>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user