Skip to content

Commit fe2373f

Browse files
snomiaoclaude
andcommitted
fix(Brainstorm): Improve system proxy support
- Switch from Msxml2.XMLHTTP to WinHttp.WinHttpRequest.5.1 for better proxy handling - Explicitly configure SetProxy(0) to use system proxy settings - Fix xhrHeatUp binding error (was binding xhr instead of xhrHeatUp) - Add documentation about proxy configuration options This ensures the Brainstorm module properly respects Windows system proxy settings configured in Internet Options. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent e9e62f2 commit fe2373f

1 file changed

Lines changed: 16 additions & 6 deletions

File tree

Modules/CLX-Brainstorm.ahk

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
; #Requires AutoHotkey v1.1.33
33
#Include ./Modules/Lib/AHK-GDIp-Library-Compilation/ahk-v1-1/Gdip_All.ahk ; https://github.com/marius-sucan/AHK-GDIp-Library-Compilation
44

5+
; Note: This module uses WinHttp.WinHttpRequest.5.1 for HTTP requests
6+
; which automatically respects Windows system proxy settings.
7+
; Proxy configuration: SetProxy(0) = use system proxy settings
8+
; SetProxy(1) = direct connection (no proxy)
9+
; SetProxy(2, "proxy:port") = use specific proxy
10+
511
global brainstorming := false
612
global brainstormed := false
713
global brainstorm_origin := CLX_Config("BrainStorm", "Website", "https://brainstorm.snomiao.com")
@@ -194,9 +200,10 @@ brainstorm_quick_capture(skip_prompt:=false, defaultPrompt:="")
194200
; heat up
195201
global brainstorm_origin
196202
endpoint := brainstorm_origin . "/ai/chat?ret=polling"
197-
xhrHeatUp := ComObjCreate("Msxml2.XMLHTTP")
203+
xhrHeatUp := ComObjCreate("WinHttp.WinHttpRequest.5.1")
198204
xhrHeatUp.Open("PUT", endpoint)
199-
xhrHeatUp.onreadystatechange := Func("BS_heatUp_onReadyStateChange").Bind(xhr)
205+
xhrHeatUp.SetProxy(0) ; 0 = HTTPREQUEST_PROXYSETTING_PRECONFIG (use system proxy settings)
206+
xhrHeatUp.onreadystatechange := Func("BS_heatUp_onReadyStateChange").Bind(xhrHeatUp)
200207
xhrHeatUp.Send("")
201208

202209
clipboardContent := brainstorm_capture_window()
@@ -251,9 +258,10 @@ brainstorm_prompt(skip_prompt:=false, defaultPrompt:="")
251258
; heat up
252259
global brainstorm_origin
253260
endpoint := brainstorm_origin . "/ai/chat?ret=polling"
254-
xhrHeatUp := ComObjCreate("Msxml2.XMLHTTP")
261+
xhrHeatUp := ComObjCreate("WinHttp.WinHttpRequest.5.1")
255262
xhrHeatUp.Open("PUT", endpoint)
256-
xhrHeatUp.onreadystatechange := Func("BS_heatUp_onReadyStateChange").Bind(xhr)
263+
xhrHeatUp.SetProxy(0) ; 0 = HTTPREQUEST_PROXYSETTING_PRECONFIG (use system proxy settings)
264+
xhrHeatUp.onreadystatechange := Func("BS_heatUp_onReadyStateChange").Bind(xhrHeatUp)
257265
xhrHeatUp.Send("")
258266

259267
clipboardContent := brainstorm_copy()
@@ -314,8 +322,9 @@ brainstorm_questionPost(question, imagePath)
314322
{
315323
global brainstorm_origin
316324
endpoint := brainstorm_origin . "/ai/chat?ret=polling"
317-
xhr := ComObjCreate("Msxml2.XMLHTTP")
325+
xhr := ComObjCreate("WinHttp.WinHttpRequest.5.1")
318326
xhr.Open("POST", endpoint)
327+
xhr.SetProxy(0) ; 0 = HTTPREQUEST_PROXYSETTING_PRECONFIG (use system proxy settings)
319328
xhr.setRequestHeader("Authorization", "Bearer " . brainstormApiKey)
320329
global brainstorming
321330
if (!brainstorming) {
@@ -381,8 +390,9 @@ tokenAppend(questionId)
381390
return
382391
global brainstorm_origin
383392
endpoint := brainstorm_origin "/ai/" questionId
384-
xhra := ComObjCreate("Msxml2.XMLHTTP")
393+
xhra := ComObjCreate("WinHttp.WinHttpRequest.5.1")
385394
xhra.open("GET", endpoint)
395+
xhra.SetProxy(0) ; 0 = HTTPREQUEST_PROXYSETTING_PRECONFIG (use system proxy settings)
386396
xhra.onreadystatechange := Func("tokenAppend_onReadyStateChange").Bind(xhra)
387397
xhra.Send()
388398
}

0 commit comments

Comments
 (0)