From 137042f80c9d9180682e6b4a1ac86ed0195c852d Mon Sep 17 00:00:00 2001 From: Luciano Iam Date: Fri, 17 Apr 2020 11:58:53 +0200 Subject: WebSockets: rename _lws_mnt_index to _lws_mnt_root This mount point not only serves the index but everything that is under / , including the built-in surfaces directory --- libs/surfaces/websockets/server.cc | 24 ++++++++++++------------ libs/surfaces/websockets/server.h | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/libs/surfaces/websockets/server.cc b/libs/surfaces/websockets/server.cc index 8bd7eb178b..5b2306a135 100644 --- a/libs/surfaces/websockets/server.cc +++ b/libs/surfaces/websockets/server.cc @@ -57,7 +57,7 @@ WebsocketsServer::WebsocketsServer (ArdourSurface::ArdourWebsockets& surface) #if LWS_LIBRARY_VERSION_MAJOR >= 3 proto.tx_packet_size = 0; #endif - + _lws_proto[0] = proto; memset (&_lws_proto[1], 0, sizeof (lws_protocols)); @@ -66,11 +66,11 @@ WebsocketsServer::WebsocketsServer (ArdourSurface::ArdourWebsockets& surface) * surfaces so there is no need to create a dedicated mount point for them * list of surfaces is available as a dynamically generated json file */ - memset (&_lws_mnt_index, 0, sizeof (lws_http_mount)); - _lws_mnt_index.mountpoint = "/"; - _lws_mnt_index.mountpoint_len = strlen (_lws_mnt_index.mountpoint); - _lws_mnt_index.origin_protocol = LWSMPRO_FILE; - _lws_mnt_index.origin = _resources.index_dir ().c_str (); + memset (&_lws_mnt_root, 0, sizeof (lws_http_mount)); + _lws_mnt_root.mountpoint = "/"; + _lws_mnt_root.mountpoint_len = strlen (_lws_mnt_root.mountpoint); + _lws_mnt_root.origin_protocol = LWSMPRO_FILE; + _lws_mnt_root.origin = _resources.index_dir ().c_str (); /* user defined surfaces in the user config directory */ memset (&_lws_mnt_user, 0, sizeof (lws_http_mount)); @@ -79,12 +79,12 @@ WebsocketsServer::WebsocketsServer (ArdourSurface::ArdourWebsockets& surface) _lws_mnt_user.origin_protocol = LWSMPRO_FILE; _lws_mnt_user.origin = _resources.user_dir ().c_str (); - _lws_mnt_index.mount_next = &_lws_mnt_user; + _lws_mnt_root.mount_next = &_lws_mnt_user; memset (&_lws_info, 0, sizeof (lws_context_creation_info)); _lws_info.port = WEBSOCKET_LISTEN_PORT; _lws_info.protocols = _lws_proto; - _lws_info.mounts = &_lws_mnt_index; + _lws_info.mounts = &_lws_mnt_root; _lws_info.uid = -1; _lws_info.gid = -1; _lws_info.user = this; @@ -92,10 +92,10 @@ WebsocketsServer::WebsocketsServer (ArdourSurface::ArdourWebsockets& surface) #if LWS_LIBRARY_VERSION_MAJOR < 3 /* older libwebsockets does not define mime type for svg files */ memset (&_lws_vhost_opt, 0, sizeof (lws_protocol_vhost_options)); - _lws_vhost_opt.name = ".svg"; - _lws_vhost_opt.value = "image/svg+xml"; - _lws_mnt_index.extra_mimetypes = &_lws_vhost_opt; - _lws_mnt_user.extra_mimetypes = &_lws_vhost_opt; + _lws_vhost_opt.name = ".svg"; + _lws_vhost_opt.value = "image/svg+xml"; + _lws_mnt_root.extra_mimetypes = &_lws_vhost_opt; + _lws_mnt_user.extra_mimetypes = &_lws_vhost_opt; #endif } diff --git a/libs/surfaces/websockets/server.h b/libs/surfaces/websockets/server.h index 677ef21780..f3dde841c1 100644 --- a/libs/surfaces/websockets/server.h +++ b/libs/surfaces/websockets/server.h @@ -66,7 +66,7 @@ private: struct lws_protocol_vhost_options _lws_vhost_opt; #endif struct lws_protocols _lws_proto[2]; - struct lws_http_mount _lws_mnt_index; + struct lws_http_mount _lws_mnt_root; struct lws_http_mount _lws_mnt_user; struct lws_context_creation_info _lws_info; struct lws_context* _lws_context; -- cgit v1.2.3