mirror of
https://github.com/SuperBFG7/ympd
synced 2024-11-26 14:57:17 +00:00
add WITH_DYNAMIC_SERVING for theme developing
This commit is contained in:
parent
2b5a4c6fa0
commit
dc15e3b0d7
@ -7,6 +7,7 @@ set(CPACK_PACKAGE_VERSION_MINOR "2")
|
||||
set(CPACK_PACKAGE_VERSION_PATCH "3")
|
||||
|
||||
option(WITH_MPD_HOST_CHANGE "Let users of the web frontend change the MPD Host" ON)
|
||||
option(WITH_DYNAMIC_SERVING "Serve file of ./htdocs dynamically (development)" OFF)
|
||||
option(WITH_IPV6 "enable IPv6 support" ON)
|
||||
|
||||
find_package(LibMPDClient REQUIRED)
|
||||
|
@ -22,8 +22,8 @@
|
||||
#define YMPD_VERSION_MAJOR ${CPACK_PACKAGE_VERSION_MAJOR}
|
||||
#define YMPD_VERSION_MINOR ${CPACK_PACKAGE_VERSION_MINOR}
|
||||
#define YMPD_VERSION_PATCH ${CPACK_PACKAGE_VERSION_PATCH}
|
||||
#define DATADIR "${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}"
|
||||
#define LOCAL_RESOURCE_PATH DATADIR"/htdocs"
|
||||
#define SRC_PATH "${PROJECT_SOURCE_DIR}/htdocs"
|
||||
#cmakedefine WITH_MPD_HOST_CHANGE
|
||||
#cmakedefine WITH_DYNAMIC_SERVING
|
||||
#endif
|
||||
|
||||
|
@ -51,7 +51,11 @@ static int server_callback(struct mg_connection *c, enum mg_event ev) {
|
||||
else
|
||||
return MG_TRUE;
|
||||
} else
|
||||
#ifdef WITH_DYNAMIC_SERVING
|
||||
return MG_FALSE;
|
||||
#else
|
||||
return callback_http(c);
|
||||
#endif
|
||||
case MG_AUTH:
|
||||
return MG_TRUE;
|
||||
default:
|
||||
@ -69,6 +73,10 @@ int main(int argc, char **argv)
|
||||
|
||||
atexit(bye);
|
||||
error_msg = mg_set_option(server, "listening_port", "8080");
|
||||
#ifdef WITH_DYNAMIC_SERVING
|
||||
mg_set_option(server, "document_root", SRC_PATH);
|
||||
#endif
|
||||
|
||||
mpd.port = 6600;
|
||||
strcpy(mpd.host, "127.0.0.1");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user