Skip to content

Commit a308bc1

Browse files
author
Claude Agent
committed
fix: add auth headers to YOLO mode fetch calls for desktop compatibility
1 parent e16a9f2 commit a308bc1

16 files changed

Lines changed: 6608 additions & 8 deletions

packages/app/dist-mirror/assets/ghostty-web-BG18ggZB.js

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/app/dist-mirror/assets/home-BXC2hA1W.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/app/dist-mirror/assets/mirror-CG5OfKsh.js

Lines changed: 2160 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/app/dist-mirror/assets/mirror-Vrhk6YUM.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/app/dist-mirror/assets/session-Bk7UX8F7.js

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/app/src/components/settings-general.tsx

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { useLanguage } from "@/context/language"
1111
import { usePlatform } from "@/context/platform"
1212
import { useSettings, monoFontFamily } from "@/context/settings"
1313
import { useGlobalSDK } from "@/context/global-sdk"
14+
import { useServer } from "@/context/server"
1415
import { playSound, SOUND_OPTIONS } from "@/utils/sound"
1516
import { Link } from "./link"
1617

@@ -44,15 +45,22 @@ export const SettingsGeneral: Component = () => {
4445
const platform = usePlatform()
4546
const settings = useSettings()
4647
const globalSDK = useGlobalSDK()
48+
const server = useServer()
4749

48-
// YOLO state - wird später vom Server geladen
50+
// Build auth headers from server connection credentials
51+
const authHeaders = (): Record<string, string> => {
52+
const http = server.current?.http
53+
if (!http?.password) return {}
54+
return { Authorization: `Basic ${btoa(`${http.username ?? "opencode"}:${http.password}`)}` }
55+
}
56+
57+
// YOLO state
4958
const [yoloEnabled, setYoloEnabled] = createSignal(false)
5059
const [yoloPersisted, setYoloPersisted] = createSignal(false)
5160

52-
// Lade YOLO status beim Öffnen - mit kleinem Delay für Stabilität
5361
const loadYoloStatus = () => {
5462
const doFetch = platform.fetch ?? fetch
55-
doFetch(`${globalSDK.url}/config/yolo`)
63+
doFetch(`${globalSDK.url}/config/yolo`, { headers: authHeaders() })
5664
.then((response) => {
5765
if (response.ok) return response.json()
5866
return null
@@ -63,19 +71,16 @@ export const SettingsGeneral: Component = () => {
6371
setYoloPersisted(data.persisted === true)
6472
}
6573
})
66-
.catch(() => {
67-
// Silently ignore errors
68-
})
74+
.catch(() => {})
6975
}
7076

71-
// Initialer Load mit kleinem Delay
7277
setTimeout(loadYoloStatus, 100)
7378

7479
const setYolo = (enabled: boolean, persist: boolean) => {
7580
const doFetch = platform.fetch ?? fetch
7681
doFetch(`${globalSDK.url}/config/yolo`, {
7782
method: "POST",
78-
headers: { "Content-Type": "application/json" },
83+
headers: { "Content-Type": "application/json", ...authHeaders() },
7984
body: JSON.stringify({ enabled, persist }),
8085
})
8186
.then((response) => {

packages/desktop/src-tauri/web-ui/assets/ghostty-web-BG18ggZB.js

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/desktop/src-tauri/web-ui/assets/ghostty-web-dXNjV0mO.js

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/desktop/src-tauri/web-ui/assets/home-BXC2hA1W.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/desktop/src-tauri/web-ui/assets/home-DIg2aeq9.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)