chore: generate
This commit is contained in:
@@ -11,6 +11,7 @@ export function terminalWebSocketURL(input: {
|
|||||||
next.searchParams.set("directory", input.directory)
|
next.searchParams.set("directory", input.directory)
|
||||||
next.searchParams.set("cursor", String(input.cursor))
|
next.searchParams.set("cursor", String(input.cursor))
|
||||||
next.protocol = next.protocol === "https:" ? "wss:" : "ws:"
|
next.protocol = next.protocol === "https:" ? "wss:" : "ws:"
|
||||||
if (!input.sameOrigin && input.password) next.searchParams.set("auth_token", btoa(`${input.username}:${input.password}`))
|
if (!input.sameOrigin && input.password)
|
||||||
|
next.searchParams.set("auth_token", btoa(`${input.username}:${input.password}`))
|
||||||
return next
|
return next
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,13 +39,16 @@ export function websocket(
|
|||||||
Effect.catchReason("SocketError", "SocketCloseError", () => Effect.void),
|
Effect.catchReason("SocketError", "SocketCloseError", () => Effect.void),
|
||||||
Effect.catch(() => Effect.void),
|
Effect.catch(() => Effect.void),
|
||||||
)
|
)
|
||||||
const closeAccepted = Effect.all(
|
const closeAccepted = Effect.all([closeSocket(inbound, writeInbound), closeSocket(outbound, writeOutbound)], {
|
||||||
[closeSocket(inbound, writeInbound), closeSocket(outbound, writeOutbound)],
|
concurrency: "unbounded",
|
||||||
{ concurrency: "unbounded", discard: true },
|
discard: true,
|
||||||
)
|
})
|
||||||
const registered = yield* WebSocketTracker.register(
|
const registered = yield* WebSocketTracker.register(
|
||||||
Effect.all(
|
Effect.all(
|
||||||
[writeInbound(WebSocketTracker.SERVER_CLOSING_EVENT()), writeOutbound(WebSocketTracker.SERVER_CLOSING_EVENT())],
|
[
|
||||||
|
writeInbound(WebSocketTracker.SERVER_CLOSING_EVENT()),
|
||||||
|
writeOutbound(WebSocketTracker.SERVER_CLOSING_EVENT()),
|
||||||
|
],
|
||||||
{ concurrency: "unbounded", discard: true },
|
{ concurrency: "unbounded", discard: true },
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -32,7 +32,12 @@ export const layer = Layer.sync(Service)(() => {
|
|||||||
const active = Array.from(sockets)
|
const active = Array.from(sockets)
|
||||||
sockets.clear()
|
sockets.clear()
|
||||||
yield* Effect.all(
|
yield* Effect.all(
|
||||||
active.map((close) => close.pipe(Effect.timeout("1 second"), Effect.catch(() => Effect.void))),
|
active.map((close) =>
|
||||||
|
close.pipe(
|
||||||
|
Effect.timeout("1 second"),
|
||||||
|
Effect.catch(() => Effect.void),
|
||||||
|
),
|
||||||
|
),
|
||||||
{ concurrency: "unbounded", discard: true },
|
{ concurrency: "unbounded", discard: true },
|
||||||
)
|
)
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -195,11 +195,7 @@ export async function listen(opts: ListenOptions): Promise<Listener> {
|
|||||||
url = next
|
url = next
|
||||||
|
|
||||||
const mdns =
|
const mdns =
|
||||||
opts.mdns &&
|
opts.mdns && inner.port && opts.hostname !== "127.0.0.1" && opts.hostname !== "localhost" && opts.hostname !== "::1"
|
||||||
inner.port &&
|
|
||||||
opts.hostname !== "127.0.0.1" &&
|
|
||||||
opts.hostname !== "localhost" &&
|
|
||||||
opts.hostname !== "::1"
|
|
||||||
if (mdns) {
|
if (mdns) {
|
||||||
MDNS.publish(inner.port, opts.mdnsDomain)
|
MDNS.publish(inner.port, opts.mdnsDomain)
|
||||||
} else if (opts.mdns) {
|
} else if (opts.mdns) {
|
||||||
@@ -326,7 +322,9 @@ async function listenHttpApi(opts: ListenOptions, selection: ServerBackend.Selec
|
|||||||
const requested = close ? forceStop() : Promise.resolve()
|
const requested = close ? forceStop() : Promise.resolve()
|
||||||
// The first call starts scope shutdown. A later stop(true) cannot undo
|
// The first call starts scope shutdown. A later stop(true) cannot undo
|
||||||
// that, but it still runs forceStop() before awaiting the original close.
|
// that, but it still runs forceStop() before awaiting the original close.
|
||||||
stopPromise ??= requested.then(() => Effect.runPromiseExit(Scope.close(resolved!.scope, Exit.void))).then(() => undefined)
|
stopPromise ??= requested
|
||||||
|
.then(() => Effect.runPromiseExit(Scope.close(resolved!.scope, Exit.void)))
|
||||||
|
.then(() => undefined)
|
||||||
return requested.then(() => stopPromise!)
|
return requested.then(() => stopPromise!)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user