13
0

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
This commit is contained in:
Luciano Iam 2020-04-17 11:58:53 +02:00 committed by Robin Gareus
parent 36a27b8a90
commit 137042f80c
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 13 additions and 13 deletions

View File

@ -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
}

View File

@ -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;