mirror of
https://github.com/webui-dev/webui
synced 2025-03-28 21:13:17 +00:00
Adding new API webui_open_url
This commit is contained in:
parent
f25dd98112
commit
6ca760163e
@ -595,6 +595,15 @@ WEBUI_EXPORT void webui_set_proxy(size_t window, const char* proxy_server);
|
||||
*/
|
||||
WEBUI_EXPORT const char* webui_get_url(size_t window);
|
||||
|
||||
/**
|
||||
* @brief Open an URL in the native default web browser.
|
||||
*
|
||||
* @param url The URL to open
|
||||
*
|
||||
* @example webui_open_url("https://webui.me");
|
||||
*/
|
||||
WEBUI_EXPORT void webui_open_url(const char* url);
|
||||
|
||||
/**
|
||||
* @brief Allow a specific window address to be accessible from a public network.
|
||||
*
|
||||
|
14
src/webui.c
14
src/webui.c
@ -2612,6 +2612,18 @@ void webui_set_proxy(size_t window, const char* proxy_server) {
|
||||
win->proxy_set = true;
|
||||
}
|
||||
|
||||
void webui_open_url(const char* url) {
|
||||
|
||||
#ifdef WEBUI_LOG
|
||||
printf("[User] webui_open_url([%s])\n", url);
|
||||
#endif
|
||||
|
||||
// Initialization
|
||||
_webui_init();
|
||||
|
||||
_webui_open_url_native(url);
|
||||
}
|
||||
|
||||
const char* webui_get_url(size_t window) {
|
||||
|
||||
#ifdef WEBUI_LOG
|
||||
@ -7495,6 +7507,8 @@ static void _webui_http_send_file(
|
||||
|
||||
// Send body
|
||||
mg_send_file_body(client, path);
|
||||
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
static void _webui_http_send(
|
||||
|
Loading…
x
Reference in New Issue
Block a user