fix(app): include basic auth
This commit is contained in:
@@ -11,6 +11,7 @@ export const { use: useGlobalSDK, provider: GlobalSDKProvider } = createSimpleCo
|
|||||||
const server = useServer()
|
const server = useServer()
|
||||||
const platform = usePlatform()
|
const platform = usePlatform()
|
||||||
const abort = new AbortController()
|
const abort = new AbortController()
|
||||||
|
const password = window.__OPENCODE__?.serverPassword
|
||||||
|
|
||||||
// Prefer the WebView fetch implementation for streaming responses.
|
// Prefer the WebView fetch implementation for streaming responses.
|
||||||
// @tauri-apps/plugin-http 2.5.x has known issues with streaming/cancellation that can
|
// @tauri-apps/plugin-http 2.5.x has known issues with streaming/cancellation that can
|
||||||
@@ -18,6 +19,11 @@ export const { use: useGlobalSDK, provider: GlobalSDKProvider } = createSimpleCo
|
|||||||
const eventSdk = createOpencodeClient({
|
const eventSdk = createOpencodeClient({
|
||||||
baseUrl: server.url,
|
baseUrl: server.url,
|
||||||
signal: abort.signal,
|
signal: abort.signal,
|
||||||
|
headers: password
|
||||||
|
? {
|
||||||
|
Authorization: `Basic ${btoa(`opencode:${password}`)}`,
|
||||||
|
}
|
||||||
|
: undefined,
|
||||||
})
|
})
|
||||||
const emitter = createGlobalEmitter<{
|
const emitter = createGlobalEmitter<{
|
||||||
[key: string]: Event
|
[key: string]: Event
|
||||||
|
|||||||
Reference in New Issue
Block a user