fix: if server password exists, use basic auth for plugin client by default (#17213)

This commit is contained in:
Aiden Cline 2026-03-12 15:41:46 -05:00 committed by GitHub
parent 42a5af6c8f
commit d722026a8d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -25,6 +25,11 @@ export namespace Plugin {
const client = createOpencodeClient({
baseUrl: "http://localhost:4096",
directory: Instance.directory,
headers: Flag.OPENCODE_SERVER_PASSWORD
? {
Authorization: `Basic ${Buffer.from(`${Flag.OPENCODE_SERVER_USERNAME ?? "opencode"}:${Flag.OPENCODE_SERVER_PASSWORD}`).toString("base64")}`,
}
: undefined,
fetch: async (...args) => Server.Default().fetch(...args),
})
const config = await Config.get()