Skip to content

Commit f936a8c

Browse files
committed
Update webui_set_proxy (Incomplete)
* Firefox proxy is not implemented yet
1 parent c56260f commit f936a8c

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/webui.c

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1845,18 +1845,20 @@ void webui_set_proxy(size_t window, const char* proxy_server) {
18451845
memcpy((char*)proxy_server_cpy, proxy_server, len);
18461846
}
18471847

1848-
18491848
// Free
18501849
if (win->proxy_server != NULL)
1851-
_webui_free_mem((void * ) win->proxy_server);
1852-
1850+
_webui_free_mem((void*)win->proxy_server);
18531851

18541852
// Save
18551853
win->proxy_server = proxy_server_cpy;
18561854

1857-
if (proxy_server_cpy == NULL)
1855+
// Set
1856+
if (_webui_is_empty(win->proxy_server))
1857+
// Disable the proxy because the server
1858+
// address is an empty string
18581859
win->proxy_set = false;
18591860
else
1861+
// Enable proxy
18601862
win->proxy_set = true;
18611863
}
18621864

@@ -4914,6 +4916,7 @@ static int _webui_get_browser_args(_webui_window_t * win, size_t browser, char*
49144916
// Window Position
49154917
if (win->position_set)
49164918
c += sprintf(buffer + c, " --window-position=%u,%u", win->x, win->y);
4919+
// Proxy
49174920
if (win->proxy_set)
49184921
c += sprintf(buffer + c, " --proxy-server=%s", win->proxy_server);
49194922
else
@@ -4939,6 +4942,14 @@ static int _webui_get_browser_args(_webui_window_t * win, size_t browser, char*
49394942
c += sprintf(buffer + c, " -width %u -height %u", win->width, win->height);
49404943
// Window Position
49414944
// Firefox does not support window positioning.
4945+
// Proxy
4946+
if (win->proxy_set) {
4947+
// Server: `win->proxy_server`
4948+
4949+
// TODO: Add proxy feature to Firefox
4950+
// Method 1: modifying `prefs.js` / user.js
4951+
// Method 2: use Proxy Auto-Configuration (PAC) file
4952+
}
49424953

49434954
// URL (END)
49444955
c += sprintf(buffer + c, " -new-window ");

0 commit comments

Comments
 (0)