Skip to content

Commit b2f505a

Browse files
committed
Update C Header - Adding et_mime_type
1 parent af46c34 commit b2f505a

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

include/webui.h

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,8 @@ WEBUI_EXPORT bool webui_set_root_folder(size_t window, const char* path);
422422
WEBUI_EXPORT bool webui_set_default_root_folder(const char* path);
423423

424424
/**
425-
* @brief Set a custom handler to serve files.
425+
* @brief Set a custom handler to serve files. This custom handler should
426+
* return full HTTP header and body.
426427
*
427428
* @param window The window number
428429
* @param handler The handler function: `void myHandler(const char* filename,
@@ -694,14 +695,12 @@ WEBUI_EXPORT size_t webui_get_parent_process_id(size_t window);
694695
WEBUI_EXPORT size_t webui_get_child_process_id(size_t window);
695696

696697
/**
697-
* @brief Get the web-server network port to be used by WebUI.
698-
* This can be useful to determine the HTTP link of `webui.js`
698+
* @brief Get the network port of a running window.
699+
* This can be useful to determine the HTTP link of `webui.js`
699700
*
700701
* @param window The window number
701-
* @param port The web-server network port WebUI should use
702-
*
703-
* @return Returns 0 if no port is used, or the port used by
704-
* web-server network port WebUI should use
702+
*
703+
* @return Returns the network port of the window
705704
*
706705
* @example size_t port = webui_get_port(myWindow);
707706
*/
@@ -722,11 +721,11 @@ WEBUI_EXPORT size_t webui_get_port(size_t window);
722721
WEBUI_EXPORT bool webui_set_port(size_t window, size_t port);
723722

724723
/**
725-
* @brief Get an available network port to be used by your app or by WebUI.
724+
* @brief Get an available usable free network port.
726725
*
727726
* @return Returns a free port
728727
*
729-
* @example int port = webui_get_free_port(); webui_set_port(myWindow, port);
728+
* @example size_t port = webui_get_free_port();
730729
*/
731730
WEBUI_EXPORT size_t webui_get_free_port(void);
732731

@@ -753,6 +752,15 @@ WEBUI_EXPORT void webui_set_config(webui_config option, bool status);
753752
*/
754753
WEBUI_EXPORT void webui_set_event_blocking(size_t window, bool status);
755754

755+
/**
756+
* @brief Get the HTTP mime type of a file.
757+
*
758+
* @return Returns the HTTP mime string
759+
*
760+
* @example const char* mime = webui_get_mime_type("foo.png");
761+
*/
762+
WEBUI_EXPORT const char* webui_get_mime_type(const char* file);
763+
756764
// -- SSL/TLS -------------------------
757765

758766
/**

0 commit comments

Comments
 (0)