|
2 | 2 | ; #Requires AutoHotkey v1.1.33 |
3 | 3 | #Include ./Modules/Lib/AHK-GDIp-Library-Compilation/ahk-v1-1/Gdip_All.ahk ; https://github.com/marius-sucan/AHK-GDIp-Library-Compilation |
4 | 4 |
|
| 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 | + |
5 | 11 | global brainstorming := false |
6 | 12 | global brainstormed := false |
7 | 13 | global brainstorm_origin := CLX_Config("BrainStorm", "Website", "https://brainstorm.snomiao.com") |
@@ -194,9 +200,10 @@ brainstorm_quick_capture(skip_prompt:=false, defaultPrompt:="") |
194 | 200 | ; heat up |
195 | 201 | global brainstorm_origin |
196 | 202 | endpoint := brainstorm_origin . "/ai/chat?ret=polling" |
197 | | - xhrHeatUp := ComObjCreate("Msxml2.XMLHTTP") |
| 203 | + xhrHeatUp := ComObjCreate("WinHttp.WinHttpRequest.5.1") |
198 | 204 | 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) |
200 | 207 | xhrHeatUp.Send("") |
201 | 208 |
|
202 | 209 | clipboardContent := brainstorm_capture_window() |
@@ -251,9 +258,10 @@ brainstorm_prompt(skip_prompt:=false, defaultPrompt:="") |
251 | 258 | ; heat up |
252 | 259 | global brainstorm_origin |
253 | 260 | endpoint := brainstorm_origin . "/ai/chat?ret=polling" |
254 | | - xhrHeatUp := ComObjCreate("Msxml2.XMLHTTP") |
| 261 | + xhrHeatUp := ComObjCreate("WinHttp.WinHttpRequest.5.1") |
255 | 262 | 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) |
257 | 265 | xhrHeatUp.Send("") |
258 | 266 |
|
259 | 267 | clipboardContent := brainstorm_copy() |
@@ -314,8 +322,9 @@ brainstorm_questionPost(question, imagePath) |
314 | 322 | { |
315 | 323 | global brainstorm_origin |
316 | 324 | endpoint := brainstorm_origin . "/ai/chat?ret=polling" |
317 | | - xhr := ComObjCreate("Msxml2.XMLHTTP") |
| 325 | + xhr := ComObjCreate("WinHttp.WinHttpRequest.5.1") |
318 | 326 | xhr.Open("POST", endpoint) |
| 327 | + xhr.SetProxy(0) ; 0 = HTTPREQUEST_PROXYSETTING_PRECONFIG (use system proxy settings) |
319 | 328 | xhr.setRequestHeader("Authorization", "Bearer " . brainstormApiKey) |
320 | 329 | global brainstorming |
321 | 330 | if (!brainstorming) { |
@@ -381,8 +390,9 @@ tokenAppend(questionId) |
381 | 390 | return |
382 | 391 | global brainstorm_origin |
383 | 392 | endpoint := brainstorm_origin "/ai/" questionId |
384 | | - xhra := ComObjCreate("Msxml2.XMLHTTP") |
| 393 | + xhra := ComObjCreate("WinHttp.WinHttpRequest.5.1") |
385 | 394 | xhra.open("GET", endpoint) |
| 395 | + xhra.SetProxy(0) ; 0 = HTTPREQUEST_PROXYSETTING_PRECONFIG (use system proxy settings) |
386 | 396 | xhra.onreadystatechange := Func("tokenAppend_onReadyStateChange").Bind(xhra) |
387 | 397 | xhra.Send() |
388 | 398 | } |
|
0 commit comments