mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-21 11:26:39 +00:00
deslop
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@ export type WslDistroProbe = {
|
||||
canExecute: boolean
|
||||
hasBash: boolean
|
||||
hasCurl: boolean
|
||||
isRoot: boolean | null
|
||||
error: string | null
|
||||
}
|
||||
export type WslOpencodeCheck = {
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ export type WslDistroProbe = {
|
||||
canExecute: boolean
|
||||
hasBash: boolean
|
||||
hasCurl: boolean
|
||||
isRoot: boolean | null
|
||||
error: string | null
|
||||
}
|
||||
export type WslOpencodeCheck = {
|
||||
|
||||
Reference in New Issue
Block a user