mirror of
https://github.com/BaaRai/ARTEX.git
synced 2026-11-25 17:30:56 +08:00
Merge remote-tracking branch 'upstream/main' into codex/s3-archive-ui-docs
This commit is contained in:
@@ -7,6 +7,7 @@ import { Loader2Icon, PlusIcon, SendIcon, XIcon } from "lucide-react";
|
||||
import { HttpCodeBlock, statusTone } from "@/components/http-code-block";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Checkbox } from "@/components/ui/checkbox";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
@@ -23,6 +24,7 @@ type ReplayForm = {
|
||||
url: string;
|
||||
rows: HeaderRow[];
|
||||
body: string;
|
||||
applyRules: boolean;
|
||||
// Headers of the recorded request that the server would not send.
|
||||
dropped: string[];
|
||||
binary: boolean;
|
||||
@@ -40,6 +42,7 @@ function initialForm(exchange: TrafficExchange, raw: string): ReplayForm {
|
||||
url: exchange.url,
|
||||
rows: toRows(sent),
|
||||
body: parsed.binary ? "" : parsed.body,
|
||||
applyRules: false,
|
||||
dropped: notSent.filter((n) => n.toLowerCase() !== "host"),
|
||||
binary: parsed.binary,
|
||||
bodyPreviewOnly: parsed.bodyPreviewOnly,
|
||||
@@ -83,6 +86,7 @@ export function ReplayPanel({
|
||||
// Answers for an older exchange are dropped.
|
||||
const generation = React.useRef(0);
|
||||
const methodListId = React.useId();
|
||||
const applyRulesId = React.useId();
|
||||
|
||||
React.useEffect(() => {
|
||||
generation.current++;
|
||||
@@ -111,6 +115,7 @@ export function ReplayPanel({
|
||||
headers: splitReplayHeaders(form.rows).sent,
|
||||
body: form.body,
|
||||
body_base64: false,
|
||||
apply_rules: form.applyRules,
|
||||
})
|
||||
.then((r) => {
|
||||
if (gen !== generation.current) return;
|
||||
@@ -230,10 +235,20 @@ export function ReplayPanel({
|
||||
)}
|
||||
</div>
|
||||
|
||||
<Button onClick={send} disabled={!canSend}>
|
||||
{sending ? <Loader2Icon className="animate-spin" /> : <SendIcon />}
|
||||
{t("Send")}
|
||||
</Button>
|
||||
<div className="flex flex-wrap items-center gap-4">
|
||||
<Button onClick={send} disabled={!canSend}>
|
||||
{sending ? <Loader2Icon className="animate-spin" /> : <SendIcon />}
|
||||
{t("Send")}
|
||||
</Button>
|
||||
<label htmlFor={applyRulesId} className="flex cursor-pointer items-center gap-2 text-xs select-none">
|
||||
<Checkbox
|
||||
id={applyRulesId}
|
||||
checked={form.applyRules}
|
||||
onCheckedChange={(checked) => update({ applyRules: checked === true })}
|
||||
/>
|
||||
<span>{t("Apply capture rewrite rules")}</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
{error && (
|
||||
<div className="space-y-1 rounded-md border border-red-500/40 bg-red-500/10 p-3 text-xs">
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
ArrowUpNarrowWideIcon,
|
||||
ChevronLeftIcon,
|
||||
ChevronRightIcon,
|
||||
DownloadIcon,
|
||||
EraserIcon,
|
||||
FilterXIcon,
|
||||
ListChecksIcon,
|
||||
@@ -14,11 +15,14 @@ import {
|
||||
RadioTowerIcon,
|
||||
SearchIcon,
|
||||
Trash2Icon,
|
||||
UploadIcon,
|
||||
XIcon,
|
||||
} from "lucide-react";
|
||||
import { toast } from "sonner";
|
||||
|
||||
import { HttpCodeBlock } from "@/components/http-code-block";
|
||||
import { LinkTrafficDialog } from "@/components/link-traffic-dialog";
|
||||
import { Alert, AlertDescription } from "@/components/ui/alert";
|
||||
import {
|
||||
AlertDialog,
|
||||
AlertDialogAction,
|
||||
@@ -44,7 +48,7 @@ import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip
|
||||
import { api } from "@/lib/api";
|
||||
import { setVisibleInterval } from "@/lib/polling";
|
||||
import { useStoredSortPreference } from "@/lib/sort-preference";
|
||||
import type { TrafficDetail, TrafficExchange, TrafficHost, TrafficResp } from "@/lib/types";
|
||||
import type { TrafficDetail, TrafficExchange, TrafficHARImportResult, TrafficHost, TrafficResp } from "@/lib/types";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { intlLocale, t } from "@/i18n";
|
||||
|
||||
@@ -135,6 +139,7 @@ export default function TrafficPage() {
|
||||
const [path, setPath] = React.useState("");
|
||||
const [pathQ, setPathQ] = React.useState("");
|
||||
const [statusFilter, setStatusFilter] = React.useState("all");
|
||||
const [rewrittenFilter, setRewrittenFilter] = React.useState("all");
|
||||
const [respMin, setRespMin] = React.useState("");
|
||||
const [respMinQ, setRespMinQ] = React.useState("");
|
||||
const [respMax, setRespMax] = React.useState("");
|
||||
@@ -158,6 +163,13 @@ export default function TrafficPage() {
|
||||
const [deleting, setDeleting] = React.useState(false);
|
||||
const [reloadTick, setReloadTick] = React.useState(0); // manual refetch trigger
|
||||
|
||||
// HAR 1.2 import/export state
|
||||
const harInputRef = React.useRef<HTMLInputElement | null>(null);
|
||||
const [harImporting, setHarImporting] = React.useState(false);
|
||||
const [harExporting, setHarExporting] = React.useState(false);
|
||||
const [harSummary, setHarSummary] = React.useState<TrafficHARImportResult | null>(null);
|
||||
const [harError, setHarError] = React.useState<string | null>(null);
|
||||
|
||||
// Debounce both filters so we don't refetch on every keystroke.
|
||||
React.useEffect(() => {
|
||||
const t = setTimeout(() => setHostQ(host.trim()), 300);
|
||||
@@ -184,13 +196,15 @@ export default function TrafficPage() {
|
||||
return () => clearTimeout(t);
|
||||
}, [respMax]);
|
||||
|
||||
const hasAdvancedFilter = Boolean(bodyQ || pathQ || respMinQ || respMaxQ) || statusFilter !== "all";
|
||||
const hasAdvancedFilter =
|
||||
Boolean(bodyQ || pathQ || respMinQ || respMaxQ) || statusFilter !== "all" || rewrittenFilter !== "all";
|
||||
const resetAdvancedFilters = () => {
|
||||
setBody("");
|
||||
setBodyQ("");
|
||||
setPath("");
|
||||
setPathQ("");
|
||||
setStatusFilter("all");
|
||||
setRewrittenFilter("all");
|
||||
setRespMin("");
|
||||
setRespMinQ("");
|
||||
setRespMax("");
|
||||
@@ -201,7 +215,7 @@ export default function TrafficPage() {
|
||||
// biome-ignore lint/correctness/useExhaustiveDependencies: these values intentionally trigger a page reset.
|
||||
React.useEffect(() => {
|
||||
setPage(0);
|
||||
}, [hostQ, queryQ, method, size, bodyQ, pathQ, statusFilter, respMinQ, respMaxQ, sort]);
|
||||
}, [hostQ, queryQ, method, size, bodyQ, pathQ, statusFilter, rewrittenFilter, respMinQ, respMaxQ, sort]);
|
||||
|
||||
// Load the current page. Auto-refresh only on page 0 (newest) so paging back
|
||||
// through history isn't yanked out from under the user.
|
||||
@@ -214,6 +228,7 @@ export default function TrafficPage() {
|
||||
body: bodyQ,
|
||||
path: pathQ,
|
||||
status: statusFilter,
|
||||
rewritten: rewrittenFilter,
|
||||
respMin: respMinQ,
|
||||
respMax: respMaxQ,
|
||||
sort: sort.field,
|
||||
@@ -243,7 +258,21 @@ export default function TrafficPage() {
|
||||
alive = false;
|
||||
stopPolling();
|
||||
};
|
||||
}, [page, size, hostQ, method, queryQ, bodyQ, pathQ, statusFilter, respMinQ, respMaxQ, sort, reloadTick]);
|
||||
}, [
|
||||
page,
|
||||
size,
|
||||
hostQ,
|
||||
method,
|
||||
queryQ,
|
||||
bodyQ,
|
||||
pathQ,
|
||||
statusFilter,
|
||||
rewrittenFilter,
|
||||
respMinQ,
|
||||
respMaxQ,
|
||||
sort,
|
||||
reloadTick,
|
||||
]);
|
||||
|
||||
// Delete traffic for the current host filter (substring) or the checked
|
||||
// hosts (exact batch), then refetch.
|
||||
@@ -349,6 +378,76 @@ export default function TrafficPage() {
|
||||
: { field, direction: "desc" },
|
||||
);
|
||||
|
||||
const handleHarFileChange = async (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const file = event.target.files?.[0];
|
||||
event.target.value = "";
|
||||
if (!file) return;
|
||||
setHarError(null);
|
||||
setHarSummary(null);
|
||||
if (file.size > 32 * 1024 * 1024) {
|
||||
const msg = t("HAR file exceeds the 32 MiB limit");
|
||||
setHarError(msg);
|
||||
toast.error(msg);
|
||||
return;
|
||||
}
|
||||
setHarImporting(true);
|
||||
try {
|
||||
const raw = await file.text();
|
||||
const res = await api.trafficImportHAR(raw);
|
||||
setHarSummary(res);
|
||||
const summary = t("HAR import complete: {imported} imported, {skipped} skipped, {failed} failed", {
|
||||
imported: res.imported,
|
||||
skipped: res.skipped,
|
||||
failed: res.failed,
|
||||
});
|
||||
if (res.failed > 0 || res.truncated) {
|
||||
toast.warning(summary);
|
||||
} else {
|
||||
toast.success(summary);
|
||||
}
|
||||
setPage(0);
|
||||
setReloadTick((n) => n + 1);
|
||||
} catch (e) {
|
||||
const msg = t("HAR import failed: {error}", { error: (e as Error).message });
|
||||
setHarError(msg);
|
||||
toast.error(msg);
|
||||
} finally {
|
||||
setHarImporting(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleHarExport = async () => {
|
||||
setHarExporting(true);
|
||||
try {
|
||||
const meta = await api.trafficExportHAR({
|
||||
host: hostQ,
|
||||
method,
|
||||
q: queryQ,
|
||||
body: bodyQ,
|
||||
path: pathQ,
|
||||
status: statusFilter,
|
||||
rewritten: rewrittenFilter,
|
||||
respMin: respMinQ,
|
||||
respMax: respMaxQ,
|
||||
});
|
||||
if (meta.truncated) {
|
||||
toast.warning(
|
||||
t("Exported {exported} of {matched} matching exchanges (truncated: {reason})", {
|
||||
exported: meta.exported,
|
||||
matched: meta.matched,
|
||||
reason: meta.truncatedReason ?? "limit",
|
||||
}),
|
||||
);
|
||||
} else {
|
||||
toast.success(t("Exported {count} exchanges to HAR", { count: meta.exported }));
|
||||
}
|
||||
} catch (e) {
|
||||
toast.error((e as Error).message);
|
||||
} finally {
|
||||
setHarExporting(false);
|
||||
}
|
||||
};
|
||||
|
||||
const exchanges = React.useMemo(() => traffic?.exchanges ?? [], [traffic]);
|
||||
const total = traffic?.total ?? exchanges.length;
|
||||
const pageCount = Math.max(1, Math.ceil(total / size));
|
||||
@@ -378,9 +477,76 @@ export default function TrafficPage() {
|
||||
<span className="text-xs text-muted-foreground tabular-nums">
|
||||
{t("{count} records", { count: traffic?.count ?? 0 })}
|
||||
</span>
|
||||
<input
|
||||
ref={harInputRef}
|
||||
type="file"
|
||||
accept=".har,application/json"
|
||||
className="hidden"
|
||||
onChange={(e) => void handleHarFileChange(e)}
|
||||
/>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="h-8"
|
||||
disabled={harImporting}
|
||||
onClick={() => harInputRef.current?.click()}
|
||||
>
|
||||
{harImporting ? <Loader2Icon className="size-3.5 animate-spin" /> : <UploadIcon className="size-3.5" />}
|
||||
{harImporting ? t("Importing HAR…") : t("Import HAR")}
|
||||
</Button>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="h-8"
|
||||
disabled={harExporting || !traffic?.count}
|
||||
onClick={() => void handleHarExport()}
|
||||
>
|
||||
{harExporting ? <Loader2Icon className="size-3.5 animate-spin" /> : <DownloadIcon className="size-3.5" />}
|
||||
{harExporting ? t("Exporting HAR…") : t("Export HAR")}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{harError ? (
|
||||
<Alert variant="destructive" className="flex items-center justify-between gap-2 py-2">
|
||||
<AlertDescription className="text-xs">{harError}</AlertDescription>
|
||||
<Button variant="ghost" size="icon-xs" aria-label={t("Dismiss")} onClick={() => setHarError(null)}>
|
||||
<XIcon className="size-3.5" />
|
||||
</Button>
|
||||
</Alert>
|
||||
) : null}
|
||||
|
||||
{harSummary ? (
|
||||
<Alert className="flex items-start justify-between gap-2 py-2">
|
||||
<AlertDescription className="space-y-1 text-xs">
|
||||
<p>
|
||||
{t("HAR import complete: {imported} imported, {skipped} skipped, {failed} failed", {
|
||||
imported: harSummary.imported,
|
||||
skipped: harSummary.skipped,
|
||||
failed: harSummary.failed,
|
||||
})}
|
||||
</p>
|
||||
{harSummary.truncated ? (
|
||||
<p className="text-amber-600 dark:text-amber-400">
|
||||
{t("HAR import stopped early at the 32 MiB decoded body cap.")}
|
||||
</p>
|
||||
) : null}
|
||||
{harSummary.errors && harSummary.errors.length > 0 ? (
|
||||
<ul className="list-disc pl-4 text-muted-foreground">
|
||||
{harSummary.errors.slice(0, 5).map((item) => (
|
||||
<li key={`${item.index}-${item.reason}`} className="font-mono">
|
||||
#{item.index}: {item.reason}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
) : null}
|
||||
</AlertDescription>
|
||||
<Button variant="ghost" size="icon-xs" aria-label={t("Dismiss")} onClick={() => setHarSummary(null)}>
|
||||
<XIcon className="size-3.5" />
|
||||
</Button>
|
||||
</Alert>
|
||||
) : null}
|
||||
|
||||
{/* Toolbar */}
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
<Popover open={pickerOpen} onOpenChange={setPickerOpen}>
|
||||
@@ -598,6 +764,16 @@ export default function TrafficPage() {
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<Select value={rewrittenFilter} onValueChange={setRewrittenFilter}>
|
||||
<SelectTrigger size="sm" className="w-32">
|
||||
<SelectValue placeholder={t("Rewritten")} />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="all">{t("All traffic")}</SelectItem>
|
||||
<SelectItem value="rewritten">{t("Rewritten")}</SelectItem>
|
||||
<SelectItem value="original">{t("Original")}</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<div className="flex items-center gap-1 text-xs text-muted-foreground">
|
||||
<span>{t("Response size")}</span>
|
||||
<Input
|
||||
@@ -721,7 +897,17 @@ export default function TrafficPage() {
|
||||
<MethodBadge method={e.method} />
|
||||
</TableCell>
|
||||
<TableCell className="max-w-0">
|
||||
<span className="block truncate font-mono text-xs">{e.url}</span>
|
||||
<div className="flex items-center gap-1.5">
|
||||
<span className="min-w-0 truncate font-mono text-xs">{e.url}</span>
|
||||
{e.rewritten ? (
|
||||
<Badge
|
||||
variant="outline"
|
||||
className="shrink-0 border-amber-500/30 bg-amber-500/10 px-1.5 py-0 text-[10px] font-medium text-amber-600 dark:text-amber-400"
|
||||
>
|
||||
{t("Rewritten")}
|
||||
</Badge>
|
||||
) : null}
|
||||
</div>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<span className={cn("font-mono text-xs font-semibold tabular-nums", statusTone(e.status))}>
|
||||
@@ -762,6 +948,14 @@ export default function TrafficPage() {
|
||||
<Badge variant="secondary" className={cn("font-mono tabular-nums", statusTone(selected.status))}>
|
||||
{selected.status}
|
||||
</Badge>
|
||||
{selected.rewritten ? (
|
||||
<Badge
|
||||
variant="outline"
|
||||
className="border-amber-500/30 bg-amber-500/10 text-amber-600 dark:text-amber-400"
|
||||
>
|
||||
{t("Rewritten")}
|
||||
</Badge>
|
||||
) : null}
|
||||
<span className="ml-auto text-xs text-muted-foreground tabular-nums">{fmtTime(selected.ts)}</span>
|
||||
</div>
|
||||
<SheetTitle className="break-all font-mono">{selected.host}</SheetTitle>
|
||||
|
||||
@@ -82,41 +82,52 @@ export function TrafficEvidenceViewer({
|
||||
<AlertDescription>{error}</AlertDescription>
|
||||
</Alert>
|
||||
) : detail ? (
|
||||
<Tabs defaultValue="request">
|
||||
<TabsList>
|
||||
<TabsTrigger value="request">{t("Request")}</TabsTrigger>
|
||||
<TabsTrigger value="response">{t("Response")}</TabsTrigger>
|
||||
</TabsList>
|
||||
{(["request", "response"] as const).map((side) => (
|
||||
<TabsContent key={side} value={side}>
|
||||
<div className="flex flex-wrap items-center justify-between gap-2">
|
||||
<span className="text-xs text-muted-foreground">
|
||||
{t("Body {size} bytes", { size: detail[side].total.toLocaleString(intlLocale) })}
|
||||
{detail[side].truncated ? ` · ${t("preview")}` : ""}
|
||||
</span>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={() =>
|
||||
void api
|
||||
.downloadFindingTrafficBody(findingId, detail.binding.id, side, contextTask)
|
||||
.catch((e: Error) => toast.error(e.message))
|
||||
}
|
||||
>
|
||||
{side === "request" ? t("Download full request body") : t("Download full response body")}
|
||||
</Button>
|
||||
</div>
|
||||
<HttpCodeBlock
|
||||
raw={`${(side === "request" ? detail.binding.snapshot.req_head : detail.binding.snapshot.resp_head)?.trimEnd() ?? ""}\n\n${detail[side].content}`}
|
||||
/>
|
||||
{detail[side].truncated && !detail[side].binary ? (
|
||||
<Button variant="outline" size="sm" disabled={busy} onClick={() => void more(side)}>
|
||||
{t("Load more body")}
|
||||
</Button>
|
||||
) : null}
|
||||
</TabsContent>
|
||||
))}
|
||||
</Tabs>
|
||||
<>
|
||||
{detail.binding.snapshot.rewritten ? (
|
||||
<p className="text-xs text-amber-600 dark:text-amber-400">
|
||||
{detail.binding.snapshot.rewrite_rule_ids?.length
|
||||
? t("Rewritten by capture rules: {ids}", {
|
||||
ids: detail.binding.snapshot.rewrite_rule_ids.map((id) => `#${id}`).join(", "),
|
||||
})
|
||||
: t("Rewritten by capture rules")}
|
||||
</p>
|
||||
) : null}
|
||||
<Tabs defaultValue="request">
|
||||
<TabsList>
|
||||
<TabsTrigger value="request">{t("Request")}</TabsTrigger>
|
||||
<TabsTrigger value="response">{t("Response")}</TabsTrigger>
|
||||
</TabsList>
|
||||
{(["request", "response"] as const).map((side) => (
|
||||
<TabsContent key={side} value={side}>
|
||||
<div className="flex flex-wrap items-center justify-between gap-2">
|
||||
<span className="text-xs text-muted-foreground">
|
||||
{t("Body {size} bytes", { size: detail[side].total.toLocaleString(intlLocale) })}
|
||||
{detail[side].truncated ? ` · ${t("preview")}` : ""}
|
||||
</span>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={() =>
|
||||
void api
|
||||
.downloadFindingTrafficBody(findingId, detail.binding.id, side, contextTask)
|
||||
.catch((e: Error) => toast.error(e.message))
|
||||
}
|
||||
>
|
||||
{side === "request" ? t("Download full request body") : t("Download full response body")}
|
||||
</Button>
|
||||
</div>
|
||||
<HttpCodeBlock
|
||||
raw={`${(side === "request" ? detail.binding.snapshot.req_head : detail.binding.snapshot.resp_head)?.trimEnd() ?? ""}\n\n${detail[side].content}`}
|
||||
/>
|
||||
{detail[side].truncated && !detail[side].binary ? (
|
||||
<Button variant="outline" size="sm" disabled={busy} onClick={() => void more(side)}>
|
||||
{t("Load more body")}
|
||||
</Button>
|
||||
) : null}
|
||||
</TabsContent>
|
||||
))}
|
||||
</Tabs>
|
||||
</>
|
||||
) : (
|
||||
<Skeleton className="h-56 w-full" />
|
||||
)}
|
||||
|
||||
@@ -249,6 +249,7 @@
|
||||
"All statuses": "Tüm durumlar",
|
||||
"All tasks": "Tüm görevler",
|
||||
"All tool execution records": "Tüm araç çalıştırma kayıtları",
|
||||
"All traffic": "Tüm trafik",
|
||||
"All types": "Tüm türler",
|
||||
"all used": "tümü kullanıldı",
|
||||
"All verification states": "Tüm doğrulama durumları",
|
||||
@@ -279,6 +280,7 @@
|
||||
"Appended {count} scopes": "{count} kapsam eklendi",
|
||||
"Applies only to this profile, overriding the global defaults from \"Retry & backoff\". Each field left empty = follow the global; attempts -1 = disable this layer; a filled interval replaces the exponential backoff with a fixed one. The breaker and intent rerun are process-level and can only be tuned on the global page.": "Yalnızca bu profile uygulanır ve \"Yeniden deneme ve geri çekilme\" sekmesindeki genel varsayılanları geçersiz kılar. Boş bırakılan her alan = genel ayarı izle; deneme sayısı -1 = bu katmanı devre dışı bırak; doldurulan aralık üstel geri çekilmeyi sabit bir aralıkla değiştirir. Devre kesici ve niyet yeniden çalıştırma süreç düzeyindedir ve yalnızca genel sayfada ayarlanabilir.",
|
||||
"Applies to this task only and is not written to global rules. Evaluation order: \"Block\" rules (including global ones) match first, and a hit forbids testing; with no hit and \"Allow\" rules configured for this task, an asset must match an allow rule to be permitted, otherwise testing is likewise forbidden; with no allow rules configured, no whitelist is active.": "Yalnızca bu göreve uygulanır ve genel kurallara yazılmaz. Değerlendirme sırası: önce \"Engelle\" kuralları (genel olanlar dahil) eşleştirilir ve eşleşme testi yasaklar; eşleşme yoksa ve bu görev için \"İzin ver\" kuralları yapılandırılmışsa, bir varlığa izin verilmesi için bir izin kuralıyla eşleşmesi gerekir, aksi halde test yine yasaktır; izin kuralı yapılandırılmamışsa beyaz liste etkin değildir.",
|
||||
"Apply capture rewrite rules": "Yakalama yeniden yazma kurallarını uygula",
|
||||
"Approval calls": "Onay çağrıları",
|
||||
"Approval decision": "Onay kararı",
|
||||
"Approval details #{id}": "Onay ayrıntıları #{id}",
|
||||
@@ -769,6 +771,7 @@
|
||||
"Discovery time": "Keşif zamanı",
|
||||
"Discovery time currently ascending, click to toggle sort direction": "Keşif zamanı şu anda artan sırada, sıralama yönünü değiştirmek için tıklayın",
|
||||
"Discovery time currently descending, click to toggle sort direction": "Keşif zamanı şu anda azalan sırada, sıralama yönünü değiştirmek için tıklayın",
|
||||
"Dismiss": "Kapat",
|
||||
"Dismiss update notice": "Güncelleme bildirimini kapat",
|
||||
"dismissed": "yok sayıldı",
|
||||
"Dismissed": "Yok sayıldı",
|
||||
@@ -927,9 +930,13 @@
|
||||
"Export failed: {error}": "Dışa aktarma başarısız: {error}",
|
||||
"Export findings": "Bulguları dışa aktar",
|
||||
"Export format": "Dışa aktarma biçimi",
|
||||
"Export HAR": "HAR dışa aktar",
|
||||
"Export scope": "Dışa aktarma kapsamı",
|
||||
"Export the {count} selected items": "Seçili {count} öğeyi dışa aktar",
|
||||
"Export the current filter results ({count} items)": "Mevcut süzgeç sonuçlarını dışa aktar ({count} öğe)",
|
||||
"Exported {count} exchanges to HAR": "{count} değişim HAR olarak dışa aktarıldı",
|
||||
"Exported {exported} of {matched} matching exchanges (truncated: {reason})": "Eşleşen {matched} değişimin {exported} tanesi dışa aktarıldı (kısaltıldı: {reason})",
|
||||
"Exporting HAR…": "HAR dışa aktarılıyor…",
|
||||
"Exporting…": "Dışa aktarılıyor…",
|
||||
"External MCP tool servers · visibility granted per agent": "Harici MCP araç sunucuları · görünürlük ajan bazında verilir",
|
||||
"Fact": "Olgu",
|
||||
@@ -1072,6 +1079,13 @@
|
||||
"greater than": "büyüktür",
|
||||
"greater than or equal": "büyük veya eşittir",
|
||||
"Handle automatically after the timeout instead of waiting": "Beklemek yerine zaman aşımından sonra otomatik olarak işle",
|
||||
"HAR export failed: {error}": "HAR dışa aktarma başarısız: {error}",
|
||||
"HAR export is not available in mock mode": "HAR dışa aktarma sahte modda kullanılamaz",
|
||||
"HAR file exceeds the 32 MiB limit": "HAR dosyası 32 MiB sınırını aşıyor",
|
||||
"HAR import complete: {imported} imported, {skipped} skipped, {failed} failed": "HAR içe aktarma tamamlandı: {imported} içe aktarıldı, {skipped} atlandı, {failed} başarısız",
|
||||
"HAR import failed: {error}": "HAR içe aktarma başarısız: {error}",
|
||||
"HAR import is not available in mock mode": "HAR içe aktarma sahte modda kullanılamaz",
|
||||
"HAR import stopped early at the 32 MiB decoded body cap.": "HAR içe aktarma 32 MiB çözülmüş gövde sınırında erken durdu.",
|
||||
"Hard delete": "Kalıcı silme",
|
||||
"Header": "Başlık",
|
||||
"Header name": "Başlık adı",
|
||||
@@ -1114,6 +1128,8 @@
|
||||
"Idle": "Boşta",
|
||||
"Ignored": "Yok sayıldı",
|
||||
"Implicit TLS": "Örtük TLS",
|
||||
"Import HAR": "HAR içe aktar",
|
||||
"Importing HAR…": "HAR içe aktarılıyor…",
|
||||
"In": "Girdi",
|
||||
"In {input} (incl. cache {cache}) · Out {output}": "Girdi {input} (önbellek {cache} dahil) · Çıktı {output}",
|
||||
"In flight": "Devam eden",
|
||||
@@ -1602,6 +1618,7 @@
|
||||
"OR (either one matches)": "OR (herhangi biri eşleşir)",
|
||||
"Ordered failover: workers share the current profile and switch after quota exhaustion or repeated provider failures.": "Sıralı yedeğe geçiş: çalışanlar geçerli profili paylaşır ve kota tükendiğinde veya sağlayıcı tekrar tekrar başarısız olduğunda geçiş yapar.",
|
||||
"origin": "başlangıç",
|
||||
"Original": "Orijinal",
|
||||
"Original status": "Önceki durum",
|
||||
"Other": "Diğer",
|
||||
"Out": "Çıktı",
|
||||
@@ -1908,6 +1925,9 @@
|
||||
"Revoked Skill \"{name}\" visibility": "\"{name}\" becerisinin görünürlüğü kaldırıldı",
|
||||
"Revoked visibility from \"{agent}\"": "\"{agent}\" için görünürlük kaldırıldı",
|
||||
"Revoked visibility to \"{name}\"": "\"{name}\" için görünürlük kaldırıldı",
|
||||
"Rewritten": "Yeniden yazılmış",
|
||||
"Rewritten by capture rules": "Yakalama kuralları tarafından yeniden yazıldı",
|
||||
"Rewritten by capture rules: {ids}": "Yakalama kuralları tarafından yeniden yazıldı: {ids}",
|
||||
"Risk": "Risk",
|
||||
"Risk accepted": "Risk kabul edildi",
|
||||
"Risk score {score}/100": "Risk puanı {score}/100",
|
||||
|
||||
+82
-3
@@ -102,6 +102,8 @@ import type {
|
||||
TrafficDetail,
|
||||
TrafficEvidenceRef,
|
||||
TrafficEvidenceRole,
|
||||
TrafficHARExportMeta,
|
||||
TrafficHARImportResult,
|
||||
TrafficHost,
|
||||
TrafficReplayRequest,
|
||||
TrafficReplayResult,
|
||||
@@ -840,6 +842,7 @@ export const api = {
|
||||
body?: string;
|
||||
path?: string;
|
||||
status?: string;
|
||||
rewritten?: string;
|
||||
respMin?: string;
|
||||
respMax?: string;
|
||||
sort?: string;
|
||||
@@ -854,6 +857,7 @@ export const api = {
|
||||
(opts.body ? `&body=${encodeURIComponent(opts.body)}` : "") +
|
||||
(opts.path ? `&path=${encodeURIComponent(opts.path)}` : "") +
|
||||
(opts.status && opts.status !== "all" ? `&status=${encodeURIComponent(opts.status)}` : "") +
|
||||
(opts.rewritten && opts.rewritten !== "all" ? `&rewritten=${encodeURIComponent(opts.rewritten)}` : "") +
|
||||
(opts.respMin ? `&resp_min=${encodeURIComponent(opts.respMin)}` : "") +
|
||||
(opts.respMax ? `&resp_max=${encodeURIComponent(opts.respMax)}` : "") +
|
||||
(opts.sort ? `&sort=${encodeURIComponent(opts.sort)}` : "") +
|
||||
@@ -874,11 +878,86 @@ export const api = {
|
||||
if (!r.ok) throw new Error(t("Blob download failed: {error}", { error: r.status }));
|
||||
return new Uint8Array(await r.arrayBuffer());
|
||||
},
|
||||
// Re-sends an edited request through the proxy. Errors carry the HTTP status
|
||||
// (ApiError): 413 body too large, 502 proxy/upstream, 503 capture off, 504 timeout.
|
||||
// Re-sends an edited request through the proxy (bypasses capture rewrite rules
|
||||
// unless req.apply_rules is true). Errors carry the HTTP status (ApiError):
|
||||
// 413 body too large, 502 proxy/upstream, 503 capture off, 504 timeout.
|
||||
trafficReplay: async (req: TrafficReplayRequest) => {
|
||||
if (MOCK) throw new Error(t("Replay is not available in mock mode"));
|
||||
return post<TrafficReplayResult>(`/traffic/replay`, req);
|
||||
return post<TrafficReplayResult>(`/traffic/replay`, {
|
||||
...req,
|
||||
apply_rules: Boolean(req.apply_rules),
|
||||
});
|
||||
},
|
||||
// Imports a raw HAR 1.2 JSON document into the traffic store.
|
||||
trafficImportHAR: async (rawJSON: string): Promise<TrafficHARImportResult> => {
|
||||
if (MOCK) throw new Error(t("HAR import is not available in mock mode"));
|
||||
return http<TrafficHARImportResult>(`/traffic/import/har`, {
|
||||
method: "POST",
|
||||
body: rawJSON,
|
||||
});
|
||||
},
|
||||
// Exports filtered traffic as a HAR 1.2 file download and returns truncation metadata.
|
||||
trafficExportHAR: async (
|
||||
opts: {
|
||||
host?: string;
|
||||
method?: string;
|
||||
q?: string;
|
||||
body?: string;
|
||||
path?: string;
|
||||
status?: string;
|
||||
rewritten?: string;
|
||||
respMin?: string;
|
||||
respMax?: string;
|
||||
} = {},
|
||||
): Promise<TrafficHARExportMeta> => {
|
||||
if (MOCK) throw new Error(t("HAR export is not available in mock mode"));
|
||||
const qs = new URLSearchParams();
|
||||
if (opts.host) qs.set("host", opts.host);
|
||||
if (opts.method && opts.method !== "all") qs.set("method", opts.method);
|
||||
if (opts.q) qs.set("q", opts.q);
|
||||
if (opts.body) qs.set("body", opts.body);
|
||||
if (opts.path) qs.set("path", opts.path);
|
||||
if (opts.status && opts.status !== "all") qs.set("status", opts.status);
|
||||
if (opts.rewritten && opts.rewritten !== "all") qs.set("rewritten", opts.rewritten);
|
||||
if (opts.respMin) qs.set("resp_min", opts.respMin);
|
||||
if (opts.respMax) qs.set("resp_max", opts.respMax);
|
||||
const suffix = qs.toString();
|
||||
const token = getToken();
|
||||
const r = await fetch(`/api/traffic/export/har${suffix ? `?${suffix}` : ""}`, {
|
||||
headers: { ...(token ? { Authorization: `Bearer ${token}` } : {}) },
|
||||
});
|
||||
if (r.status === 401) {
|
||||
if (typeof window !== "undefined") {
|
||||
localStorage.removeItem("artex_token");
|
||||
document.cookie = "artex_token=; path=/; max-age=0";
|
||||
window.location.href = "/login";
|
||||
}
|
||||
throw new Error(t("Unauthorized"));
|
||||
}
|
||||
if (!r.ok) {
|
||||
let msg = String(r.status);
|
||||
try {
|
||||
const payload = (await r.json()) as { error?: unknown };
|
||||
if (typeof payload.error === "string" && payload.error.trim()) msg = payload.error.trim();
|
||||
} catch {
|
||||
// Keep status fallback.
|
||||
}
|
||||
throw new ApiError(t("HAR export failed: {error}", { error: msg }), r.status);
|
||||
}
|
||||
const blob = await r.blob();
|
||||
const exported = Number(r.headers.get("X-ARTEX-HAR-Exported") ?? "0") || 0;
|
||||
const matched = Number(r.headers.get("X-ARTEX-HAR-Matched") ?? "0") || 0;
|
||||
const truncated = r.headers.get("X-ARTEX-HAR-Truncated") === "true";
|
||||
const truncatedReason = r.headers.get("X-ARTEX-HAR-Truncated-Reason") ?? undefined;
|
||||
const objectUrl = URL.createObjectURL(blob);
|
||||
const a = document.createElement("a");
|
||||
a.href = objectUrl;
|
||||
a.download = "artex-traffic.har";
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
a.remove();
|
||||
URL.revokeObjectURL(objectUrl);
|
||||
return { exported, matched, truncated, truncatedReason };
|
||||
},
|
||||
trafficHosts: () => get<{ hosts: TrafficHost[] }>(`/traffic/hosts`),
|
||||
trafficDeleteHost: (host: string) => del<{ deleted: number }>(`/traffic?host=${encodeURIComponent(host)}`),
|
||||
|
||||
@@ -904,6 +904,36 @@ export interface TrafficExchange {
|
||||
status: number;
|
||||
content_type: string;
|
||||
resp_len: number;
|
||||
rewritten?: boolean;
|
||||
}
|
||||
|
||||
export interface TrafficRewriteStats {
|
||||
large_responses: number;
|
||||
capacity_refusals: number;
|
||||
tombstone_drops: number;
|
||||
conversions: number;
|
||||
sweeps: number;
|
||||
}
|
||||
|
||||
export interface TrafficHARImportError {
|
||||
index: number;
|
||||
url?: string;
|
||||
reason: string;
|
||||
}
|
||||
|
||||
export interface TrafficHARImportResult {
|
||||
imported: number;
|
||||
skipped: number;
|
||||
failed: number;
|
||||
truncated?: boolean;
|
||||
errors?: TrafficHARImportError[];
|
||||
}
|
||||
|
||||
export interface TrafficHARExportMeta {
|
||||
exported: number;
|
||||
matched: number;
|
||||
truncated: boolean;
|
||||
truncatedReason?: string;
|
||||
}
|
||||
|
||||
export interface TrafficResp {
|
||||
@@ -914,6 +944,7 @@ export interface TrafficResp {
|
||||
page?: number;
|
||||
size?: number;
|
||||
exchanges?: TrafficExchange[];
|
||||
rewrite?: TrafficRewriteStats;
|
||||
}
|
||||
|
||||
// Full raw request/response of one exchange (lazy-loaded on row select).
|
||||
@@ -956,12 +987,14 @@ export interface TrafficReplayHeader {
|
||||
}
|
||||
|
||||
// POST /api/traffic/replay. Host is not sent: the server takes it from url.
|
||||
// apply_rules defaults to false (bypasses capture rewrite rules).
|
||||
export interface TrafficReplayRequest {
|
||||
method: string;
|
||||
url: string;
|
||||
headers: TrafficReplayHeader[];
|
||||
body: string;
|
||||
body_base64: boolean;
|
||||
apply_rules?: boolean;
|
||||
}
|
||||
|
||||
export interface TrafficReplayResult {
|
||||
@@ -1677,6 +1710,8 @@ export interface TrafficEvidenceSnapshot {
|
||||
resp_hash: string;
|
||||
req_len: number;
|
||||
resp_len: number;
|
||||
rewritten?: boolean;
|
||||
rewrite_rule_ids?: number[];
|
||||
}
|
||||
export interface FindingTrafficBinding {
|
||||
id: string;
|
||||
|
||||
Reference in New Issue
Block a user