chore: WebSocket 演示地址切换为 wss://echo.websocket.org(含存量数据迁移)

This commit is contained in:
logan committed 2026-09-18 01:08:20 +08:00
1 parent f1911450d1
commit 2ff3f4270b
3 files changed
+12 -3

No files matched your search

+2 -2
View File
@@ -59,7 +59,7 @@ export function defaultRequestData(kind: RequestKind) {
case "websocket":
return {
kind,
url: "wss://echo.websocket.events",
url: "wss://echo.websocket.org",
headers: [],
protocols: "",
} satisfies WebsocketRequestData;
@@ -228,7 +228,7 @@ export function createSeedWorkspace(): WorkspaceData {
]),
createFolder("实时协议", [
createRequest("websocket", "WebSocket · echo", {
data: { url: "wss://echo.websocket.events" },
data: { url: "wss://echo.websocket.org" },
description: "发送什么就回什么。",
}),
createRequest("sse", "SSE · 维基媒体变更流", {
@@ -31,7 +31,7 @@ export function WebsocketEditor({ node }: { node: WebsocketApiNode }) {
<span className="ops-chip inline-flex items-center gap-1" style={{ padding: "2px 10px" }}><Icon name="zap" size={13} /> WS</span>
<VarHintInput
className="ops-input flex-1 font-mono text-[13px]"
placeholder="wss://echo.websocket.events"
placeholder="wss://echo.websocket.org"
value={data.url}
onChange={(v) => patch({ url: v })}
/>
+9
View File
@@ -148,6 +148,15 @@ function sanitizeCollections(collections: Collection[]): Collection[] {
const fix = (nodes: CollectionNode[]): CollectionNode[] =>
nodes.map((n) => {
if (n.type === "folder") return { ...n, children: fix(n.children) };
// 一次性迁移:旧演示地址更新为新的公共 echo 服务
if (
n.type === "request" &&
n.kind === "websocket" &&
n.data &&
(n.data as { url?: string }).url === "wss://echo.websocket.events"
) {
(n.data as { url: string }).url = "wss://echo.websocket.org";
}
if (n.type === "request" && (!n.data || !n.kind)) {
const kind = (n.kind ?? "http") as RequestKind;
return {