This commit is contained in:
LukeParkerDev
2026-05-04 11:26:25 +10:00
parent 7dd8b2b7f9
commit 58f569fbf7
5 changed files with 4 additions and 17 deletions

View File

@@ -275,7 +275,6 @@ export function DialogSelectServer(props: DialogSelectServerProps = {}) {
},
onSuccess: async (key) => {
server.remove(key)
if (defaultServer.defaultKey() === key) await defaultServer.setDefault(null)
},
onError: (err) => showRequestError(language, err),
}))
@@ -607,7 +606,7 @@ export function DialogSelectServer(props: DialogSelectServerProps = {}) {
const wsl = isWslSidecar(i)
const wslDistro = wsl ? i.distro : undefined
const blocked = () => health(key)?.healthy === false
const canChangeDefault = () => defaultServer.canDefault() && i.type !== "ssh"
const canChangeDefault = () => defaultServer.canDefault() && i.type === "http"
const canRemove = () => i.type === "http" || wsl
const opencodeAction = () => {
const check = wslCheck(i)

View File

@@ -61,7 +61,7 @@ export function DialogWslServer(props: DialogWslServerProps = {}) {
const distroWarningProbe = createMemo(() => {
const probe = selectedProbe()
if (!probe) return null
if (distroReady() && !probe.isRoot) return null
if (distroReady()) return null
return probe
})
const distroUnavailableMessage = createMemo(() => {
@@ -453,8 +453,7 @@ export function DialogWslServer(props: DialogWslServerProps = {}) {
when={
selectedInstalled()?.version === 1 ||
distroUnavailableMessage() ||
distroMissingTools() ||
distroWarningProbe()?.isRoot
distroMissingTools()
}
>
<div class="rounded-md border border-border-weak-base px-3 py-3 flex flex-col gap-1">
@@ -467,11 +466,6 @@ export function DialogWslServer(props: DialogWslServerProps = {}) {
<Show when={distroMissingTools()}>
<div class="text-12-regular text-text-warning-base">This distro needs bash and curl.</div>
</Show>
<Show when={distroWarningProbe()?.isRoot}>
<div class="text-12-regular text-text-warning-base">
This distro is using the root user right now.
</div>
</Show>
</div>
</Show>

View File

@@ -28,7 +28,6 @@ export type WslDistroProbe = {
canExecute: boolean
hasBash: boolean
hasCurl: boolean
isRoot: boolean | null
error: string | null
}
export type WslOpencodeCheck = {

View File

@@ -348,24 +348,20 @@ export async function probeWslDistro(name: string, opts?: RunWslOptions): Promis
canExecute: false,
hasBash: false,
hasCurl: false,
isRoot: null,
error: summarize(executable.stderr || executable.stdout) || "Cannot execute commands in distro",
}
}
const [bash, curl, user] = await Promise.all([
const [bash, curl] = await Promise.all([
runWslSh("command -v bash >/dev/null && printf yes || printf no", name, opts),
runWslSh("command -v curl >/dev/null && printf yes || printf no", name, opts),
runWslSh("id -un 2>/dev/null || true", name, opts),
])
const username = summarize(user.stdout)
return {
name,
canExecute: true,
hasBash: bash.code === 0 && summarize(bash.stdout) === "yes",
hasCurl: curl.code === 0 && summarize(curl.stdout) === "yes",
isRoot: username ? username === "root" : null,
error: null,
}
}

View File

@@ -27,7 +27,6 @@ export type WslDistroProbe = {
canExecute: boolean
hasBash: boolean
hasCurl: boolean
isRoot: boolean | null
error: string | null
}
export type WslOpencodeCheck = {