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