diff --git a/libs/dmf-node/src/control_server.cpp b/libs/dmf-node/src/control_server.cpp index 61c268a..7872757 100644 --- a/libs/dmf-node/src/control_server.cpp +++ b/libs/dmf-node/src/control_server.cpp @@ -33,6 +33,12 @@ static int callback_ws(struct lws* wsi, enum lws_callback_reasons reason, void* user, void* in, size_t len); static const struct lws_protocols protocols[] = { + { + "http-only", + callback_ws, + sizeof(ControlServerData*), + 0, + }, { "dmf-control", callback_ws, @@ -119,6 +125,25 @@ static int callback_ws(struct lws* wsi, enum lws_callback_reasons reason, return 0; } +static const struct lws_http_mount mount = { + .mount_next = nullptr, + .mountpoint = "/", + .origin = "", + .def = "", + .protocol = "dmf-control", + .cgienv = nullptr, + .extra_mimetypes = nullptr, + .interpret = nullptr, + .cgi_timeout = 0, + .cache_max_age = 0, + .auth_mask = 0, + .cache_reusable = 0, + .cache_revalidate = 0, + .cache_intermediaries = 0, + .origin_protocol = LWSMPRO_CALLBACK, + .mountpoint_len = 1, +}; + ControlServer::ControlServer(uint16_t port, StatusCallback on_event) : impl_(std::make_unique()) { impl_->port = port; @@ -129,6 +154,7 @@ ControlServer::ControlServer(uint16_t port, StatusCallback on_event) std::memset(&info, 0, sizeof(info)); info.port = port; info.protocols = protocols; + info.mounts = &mount; info.user = impl_->data.get(); info.gid = -1; info.uid = -1;