Skip to content

Commit a0bac76

Browse files
committed
Disable Cookies When Using Custom FileHandler
1 parent d761c1e commit a0bac76

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/webui.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -907,6 +907,11 @@ void webui_set_file_handler(size_t window, const void*(*handler)(const char* fil
907907
win->files_handler = handler;
908908
// And reset any previous `files_handler_window`
909909
win->files_handler_window = NULL;
910+
911+
// By default, WebUI uses cookies to prevent unauthorized clients from
912+
// accessing the UI. When the user provides a custom file handler, security
913+
// becomes the user's responsibility, so WebUI disables cookies automatically.
914+
webui_set_config(use_cookies, false);
910915
}
911916

912917
void webui_set_file_handler_window(size_t window, const void*(*handler)(size_t window, const char* filename, int* length)) {
@@ -926,6 +931,11 @@ void webui_set_file_handler_window(size_t window, const void*(*handler)(size_t w
926931
win->files_handler = NULL;
927932
// And set `files_handler_window`
928933
win->files_handler_window = handler;
934+
935+
// By default, WebUI uses cookies to prevent unauthorized clients from
936+
// accessing the UI. When the user provides a custom file handler, security
937+
// becomes the user's responsibility, so WebUI disables cookies automatically.
938+
webui_set_config(use_cookies, false);
929939
}
930940

931941
bool webui_script_client(webui_event_t* e, const char* script, size_t timeout,

0 commit comments

Comments
 (0)