summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/http.cc33
-rw-r--r--src/muniad.cc3
2 files changed, 31 insertions, 5 deletions
diff --git a/src/http.cc b/src/http.cc
index 6b14ed5..396e042 100644
--- a/src/http.cc
+++ b/src/http.cc
@@ -46,16 +46,25 @@ int callback_http(struct libwebsocket_context * context,
//
// add favicon later
if(in && strcmp((const char *)in, "/favicon.ico") == 0) {
- if(libwebsockets_serve_http_file(wsi,
+ if(libwebsockets_serve_http_file(context, wsi,
LOCAL_RESOURCE_PATH"/favicon.ico",
"image/x-icon"))
DEBUG(httpd,"Failed to send favicon\n");
break;
}
+ // css
+ if(in && strcmp((const char *)in, "/munia.css") == 0) {
+ if(libwebsockets_serve_http_file(context, wsi,
+ LOCAL_RESOURCE_PATH"/munia.css",
+ "text/css"))
+ DEBUG(httpd,"Failed to send css\n");
+ break;
+ }
+
// script
if(in && strcmp((const char *)in, "/proto.js") == 0) {
- if(libwebsockets_serve_http_file(wsi,
+ if(libwebsockets_serve_http_file(context, wsi,
LOCAL_RESOURCE_PATH"/proto.js",
"text/javascript"))
DEBUG(httpd,"Failed to send javascript\n");
@@ -63,16 +72,32 @@ int callback_http(struct libwebsocket_context * context,
}
if(in && strcmp((const char *)in, "/handler.js") == 0) {
- if(libwebsockets_serve_http_file(wsi,
+ if(libwebsockets_serve_http_file(context, wsi,
LOCAL_RESOURCE_PATH"/handler.js",
"text/javascript"))
DEBUG(httpd,"Failed to send javascript\n");
break;
}
+ if(in && strcmp((const char *)in, "/view.js") == 0) {
+ if(libwebsockets_serve_http_file(context, wsi,
+ LOCAL_RESOURCE_PATH"/view.js",
+ "text/javascript"))
+ DEBUG(httpd,"Failed to send javascript\n");
+ break;
+ }
+
+ if(in && strcmp((const char *)in, "/task.js") == 0) {
+ if(libwebsockets_serve_http_file(context, wsi,
+ LOCAL_RESOURCE_PATH"/task.js",
+ "text/javascript"))
+ DEBUG(httpd,"Failed to send javascript\n");
+ break;
+ }
+
/* send the script... when it runs it'll start websockets */
- if(libwebsockets_serve_http_file(wsi,
+ if(libwebsockets_serve_http_file(context, wsi,
LOCAL_RESOURCE_PATH"/munia.html",
"text/html"))
DEBUG(httpd,"Failed to send HTTP file\n");
diff --git a/src/muniad.cc b/src/muniad.cc
index 3ea7d6c..ebf0870 100644
--- a/src/muniad.cc
+++ b/src/muniad.cc
@@ -123,7 +123,8 @@ int main(int argc, char **argv)
context = libwebsocket_create_context(port, interface, protocols,
libwebsocket_internal_extensions,
- cert_path, key_path, -1, -1, opts);
+ cert_path, key_path, "", -1, -1, opts,
+ NULL);
if (context == NULL) {
fprintf(stderr, "libwebsocket init failed\n");
return -1;