mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-10 17:26:38 +08:00
[功能] 移除代理路由页面中的缓存和请求头列,简化显示内容
This commit is contained in:
@@ -516,19 +516,6 @@ function parseUpstreams(rawValue: string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildCachePolicyLabel(policy: string) {
|
|
||||||
switch (policy) {
|
|
||||||
case 'suffix':
|
|
||||||
return '按后缀';
|
|
||||||
case 'path_prefix':
|
|
||||||
return '按前缀';
|
|
||||||
case 'path_exact':
|
|
||||||
return '按路径';
|
|
||||||
default:
|
|
||||||
return '按 URL';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getCacheRulesHint(policy: string) {
|
function getCacheRulesHint(policy: string) {
|
||||||
switch (policy) {
|
switch (policy) {
|
||||||
case 'suffix':
|
case 'suffix':
|
||||||
@@ -1537,35 +1524,20 @@ export function ProxyRoutesPage() {
|
|||||||
<th className="px-3 py-3 font-medium">域名</th>
|
<th className="px-3 py-3 font-medium">域名</th>
|
||||||
<th className="px-3 py-3 font-medium">源站地址</th>
|
<th className="px-3 py-3 font-medium">源站地址</th>
|
||||||
<th className="px-3 py-3 font-medium">HTTPS</th>
|
<th className="px-3 py-3 font-medium">HTTPS</th>
|
||||||
<th className="px-3 py-3 font-medium">缓存</th>
|
|
||||||
<th className="px-3 py-3 font-medium">请求头</th>
|
|
||||||
<th className="px-3 py-3 font-medium">状态</th>
|
<th className="px-3 py-3 font-medium">状态</th>
|
||||||
<th className="px-3 py-3 font-medium">备注</th>
|
<th className="px-3 py-3 font-medium">备注</th>
|
||||||
<th className="px-3 py-3 font-medium">更新时间</th>
|
|
||||||
<th className="px-3 py-3 font-medium">操作</th>
|
<th className="px-3 py-3 font-medium">操作</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody className="divide-y divide-[var(--border-default)]">
|
<tbody className="divide-y divide-[var(--border-default)]">
|
||||||
{routes.map((route) => {
|
{routes.map((route) => {
|
||||||
const headers = parseCustomHeaders(route.custom_headers);
|
|
||||||
const cacheRules = parseCacheRules(route.cache_rules);
|
|
||||||
const upstreams = parseUpstreams(route.upstreams);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<tr key={route.id} className="align-top">
|
<tr key={route.id} className="align-top">
|
||||||
<td className="px-3 py-4 font-medium text-[var(--foreground-primary)]">
|
<td className="px-3 py-4 font-medium text-[var(--foreground-primary)]">
|
||||||
{route.domain}
|
{route.domain}
|
||||||
</td>
|
</td>
|
||||||
<td className="px-3 py-4 text-[var(--foreground-secondary)]">
|
<td className="px-3 py-4 text-[var(--foreground-secondary)]">
|
||||||
<div className="space-y-1">
|
<p>{route.origin_url}</p>
|
||||||
<p>{route.origin_url}</p>
|
|
||||||
<p className="text-xs text-[var(--foreground-muted)]">
|
|
||||||
回源主机名: {route.origin_host || '$host'}
|
|
||||||
</p>
|
|
||||||
<p className="text-xs text-[var(--foreground-muted)]">
|
|
||||||
上游数量: {Math.max(upstreams.length, 1)}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</td>
|
</td>
|
||||||
<td className="px-3 py-4">
|
<td className="px-3 py-4">
|
||||||
{route.enable_https ? (
|
{route.enable_https ? (
|
||||||
@@ -1583,33 +1555,6 @@ export function ProxyRoutesPage() {
|
|||||||
<StatusBadge label="HTTP" variant="warning" />
|
<StatusBadge label="HTTP" variant="warning" />
|
||||||
)}
|
)}
|
||||||
</td>
|
</td>
|
||||||
<td className="px-3 py-4">
|
|
||||||
{route.cache_enabled ? (
|
|
||||||
<div className="space-y-2">
|
|
||||||
<StatusBadge
|
|
||||||
label={buildCachePolicyLabel(
|
|
||||||
route.cache_policy,
|
|
||||||
)}
|
|
||||||
variant="success"
|
|
||||||
/>
|
|
||||||
<p className="text-xs text-[var(--foreground-muted)]">
|
|
||||||
{cacheRules.length > 0
|
|
||||||
? `${cacheRules.length} 条规则`
|
|
||||||
: '按 URL 粒度缓存'}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
<StatusBadge label="关闭" variant="warning" />
|
|
||||||
)}
|
|
||||||
</td>
|
|
||||||
<td className="px-3 py-4">
|
|
||||||
<StatusBadge
|
|
||||||
label={
|
|
||||||
headers.length > 0 ? `${headers.length} 条` : '无'
|
|
||||||
}
|
|
||||||
variant={headers.length > 0 ? 'success' : 'warning'}
|
|
||||||
/>
|
|
||||||
</td>
|
|
||||||
<td className="px-3 py-4">
|
<td className="px-3 py-4">
|
||||||
<StatusBadge
|
<StatusBadge
|
||||||
label={route.enabled ? '启用' : '停用'}
|
label={route.enabled ? '启用' : '停用'}
|
||||||
@@ -1619,9 +1564,6 @@ export function ProxyRoutesPage() {
|
|||||||
<td className="px-3 py-4 text-[var(--foreground-secondary)]">
|
<td className="px-3 py-4 text-[var(--foreground-secondary)]">
|
||||||
{route.remark || '—'}
|
{route.remark || '—'}
|
||||||
</td>
|
</td>
|
||||||
<td className="px-3 py-4 text-[var(--foreground-secondary)]">
|
|
||||||
{formatDateTime(route.updated_at)}
|
|
||||||
</td>
|
|
||||||
<td className="px-3 py-4">
|
<td className="px-3 py-4">
|
||||||
<div className="flex flex-wrap gap-2">
|
<div className="flex flex-wrap gap-2">
|
||||||
<SecondaryButton
|
<SecondaryButton
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"packageManager": "pnpm@10.6.2",
|
"packageManager": "pnpm@10.6.2",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "NEXT_DEV_BACKEND_URL=${NEXT_DEV_BACKEND_URL:-http://127.0.0.1:3000} node scripts/dev-server.mjs",
|
"dev": "node scripts/dev-server.mjs",
|
||||||
"build": "next build",
|
"build": "next build",
|
||||||
"postbuild": "node scripts/prepare-static-export.mjs",
|
"postbuild": "node scripts/prepare-static-export.mjs",
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
|
|||||||
Reference in New Issue
Block a user