Loading config.two-widget-paths.yaml +0 −1 Original line number Diff line number Diff line Loading @@ -23,4 +23,3 @@ WEBEDIT: NODE: WIDGETDIR: - "/usr/local/share/blogi-editor/node/widgets" - "/var/lib/blogi-editor/node/widgets" debian/blogi-editor.install +0 −1 Original line number Diff line number Diff line Loading @@ -3,4 +3,3 @@ usr/lib/blogi/plugins/webedit/ usr/lib/blogi/libblogidev.a usr/share/blogi-editor/html/ usr/share/blogi-editor/node/ usr/lib/blogi-editor/node/bin/node debian/rules +2 −7 Original line number Diff line number Diff line #!/usr/bin/make -f export DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) NODE_BINARY := $(shell command -v node || command -v nodejs) %: ifndef ROOTBUILD Loading Loading @@ -32,17 +31,13 @@ ifeq ($(IS_NONSPAWN),) -DCMAKE_INSTALL_PREFIX=/usr \ -DCMAKE_INSTALL_LIBDIR=lib/$(DEB_HOST_MULTIARCH) \ -DCMAKE_BUILD_TYPE=Release \ -DBUILD_EDITOR=ON \ -DWEBEDIT_ENABLE_EMBEDDED_NODE=ON \ -DWEBEDIT_EMBEDDED_NODE_BINARY=$(NODE_BINARY) -DBUILD_EDITOR=ON else dh_auto_configure -- \ -DCMAKE_INSTALL_PREFIX=/usr \ -DCMAKE_INSTALL_LIBDIR=lib/$(DEB_HOST_MULTIARCH) \ -DCMAKE_BUILD_TYPE=Release \ -DBUILD_EDITOR=ON \ -DWEBEDIT_ENABLE_EMBEDDED_NODE=ON \ -DWEBEDIT_EMBEDDED_NODE_BINARY=$(NODE_BINARY) -DBUILD_EDITOR=ON endif override_dh_shlibdeps: Loading editor/CMakeLists.txt +0 −20 Original line number Diff line number Diff line Loading @@ -29,9 +29,6 @@ endif() configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) option(WEBEDIT_ENABLE_EMBEDDED_NODE "Install an embedded Node.js binary for editor widgets" OFF) set(WEBEDIT_EMBEDDED_NODE_BINARY "" CACHE FILEPATH "Path to Node.js binary used for embedded runtime") include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/../src ${CMAKE_CURRENT_BINARY_DIR} Loading Loading @@ -98,20 +95,3 @@ install(DIRECTORY html/ DESTINATION ${CMAKE_INSTALL_DATADIR}/blogi-editor/html) install(DIRECTORY node/ DESTINATION ${CMAKE_INSTALL_DATADIR}/blogi-editor/node PATTERN "node_widget_runner.js" EXCLUDE) install(FILES config.yaml DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/blogi-editor) if(WEBEDIT_ENABLE_EMBEDDED_NODE) set(_embedded_node_candidate "${WEBEDIT_EMBEDDED_NODE_BINARY}") if(NOT _embedded_node_candidate OR NOT EXISTS "${_embedded_node_candidate}") find_program(_embedded_node_candidate NAMES node nodejs) if(_embedded_node_candidate) message(STATUS "Using discovered Node.js binary for embedded runtime: ${_embedded_node_candidate}") endif() endif() if(_embedded_node_candidate AND EXISTS "${_embedded_node_candidate}") install(PROGRAMS "${_embedded_node_candidate}" DESTINATION ${CMAKE_INSTALL_LIBDIR}/blogi-editor/node/bin RENAME node) else() message(WARNING "WEBEDIT_ENABLE_EMBEDDED_NODE is ON but no valid Node.js binary was found (WEBEDIT_EMBEDDED_NODE_BINARY / node / nodejs). Continuing without embedded Node.js.") endif() endif() editor/src/node_bridge.h +14 −17 Original line number Diff line number Diff line Loading @@ -20,19 +20,6 @@ inline std::string getEnvOrDefault(const char *key, const char *fallback) { return std::string(fallback); } inline std::string quoteShell(const std::string &value) { std::string out = "'"; for (char c : value) { if (c == '\'') { out += "'\\''"; } else { out += c; } } out += "'"; return out; } inline int runNodeRunner(const std::string &reqPath, const std::string &resPath) { static const std::string bridgeScript = Loading Loading @@ -83,10 +70,20 @@ inline int runNodeRunner(const std::string &reqPath, "process.exitCode=1;" "});"; const std::string nodeBin = getEnvOrDefault("BLOGI_WEBEDIT_NODE_BIN", "node"); const std::string cmd = quoteShell(nodeBin) + " -e " + quoteShell(bridgeScript) + " " + quoteShell(reqPath) + " " + quoteShell(resPath); return std::system(cmd.c_str()); std::vector<std::string> args; args.emplace_back("blogi-editor-node"); args.emplace_back("-e"); args.emplace_back(bridgeScript); args.emplace_back(reqPath); args.emplace_back(resPath); std::vector<char*> argv; argv.reserve(args.size()); for (auto &arg : args) { argv.push_back(arg.data()); } return node::Start(static_cast<int>(argv.size()), argv.data()); } } // namespace blogi::webedit::nodebridge Loading
config.two-widget-paths.yaml +0 −1 Original line number Diff line number Diff line Loading @@ -23,4 +23,3 @@ WEBEDIT: NODE: WIDGETDIR: - "/usr/local/share/blogi-editor/node/widgets" - "/var/lib/blogi-editor/node/widgets"
debian/blogi-editor.install +0 −1 Original line number Diff line number Diff line Loading @@ -3,4 +3,3 @@ usr/lib/blogi/plugins/webedit/ usr/lib/blogi/libblogidev.a usr/share/blogi-editor/html/ usr/share/blogi-editor/node/ usr/lib/blogi-editor/node/bin/node
debian/rules +2 −7 Original line number Diff line number Diff line #!/usr/bin/make -f export DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) NODE_BINARY := $(shell command -v node || command -v nodejs) %: ifndef ROOTBUILD Loading Loading @@ -32,17 +31,13 @@ ifeq ($(IS_NONSPAWN),) -DCMAKE_INSTALL_PREFIX=/usr \ -DCMAKE_INSTALL_LIBDIR=lib/$(DEB_HOST_MULTIARCH) \ -DCMAKE_BUILD_TYPE=Release \ -DBUILD_EDITOR=ON \ -DWEBEDIT_ENABLE_EMBEDDED_NODE=ON \ -DWEBEDIT_EMBEDDED_NODE_BINARY=$(NODE_BINARY) -DBUILD_EDITOR=ON else dh_auto_configure -- \ -DCMAKE_INSTALL_PREFIX=/usr \ -DCMAKE_INSTALL_LIBDIR=lib/$(DEB_HOST_MULTIARCH) \ -DCMAKE_BUILD_TYPE=Release \ -DBUILD_EDITOR=ON \ -DWEBEDIT_ENABLE_EMBEDDED_NODE=ON \ -DWEBEDIT_EMBEDDED_NODE_BINARY=$(NODE_BINARY) -DBUILD_EDITOR=ON endif override_dh_shlibdeps: Loading
editor/CMakeLists.txt +0 −20 Original line number Diff line number Diff line Loading @@ -29,9 +29,6 @@ endif() configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) option(WEBEDIT_ENABLE_EMBEDDED_NODE "Install an embedded Node.js binary for editor widgets" OFF) set(WEBEDIT_EMBEDDED_NODE_BINARY "" CACHE FILEPATH "Path to Node.js binary used for embedded runtime") include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/../src ${CMAKE_CURRENT_BINARY_DIR} Loading Loading @@ -98,20 +95,3 @@ install(DIRECTORY html/ DESTINATION ${CMAKE_INSTALL_DATADIR}/blogi-editor/html) install(DIRECTORY node/ DESTINATION ${CMAKE_INSTALL_DATADIR}/blogi-editor/node PATTERN "node_widget_runner.js" EXCLUDE) install(FILES config.yaml DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/blogi-editor) if(WEBEDIT_ENABLE_EMBEDDED_NODE) set(_embedded_node_candidate "${WEBEDIT_EMBEDDED_NODE_BINARY}") if(NOT _embedded_node_candidate OR NOT EXISTS "${_embedded_node_candidate}") find_program(_embedded_node_candidate NAMES node nodejs) if(_embedded_node_candidate) message(STATUS "Using discovered Node.js binary for embedded runtime: ${_embedded_node_candidate}") endif() endif() if(_embedded_node_candidate AND EXISTS "${_embedded_node_candidate}") install(PROGRAMS "${_embedded_node_candidate}" DESTINATION ${CMAKE_INSTALL_LIBDIR}/blogi-editor/node/bin RENAME node) else() message(WARNING "WEBEDIT_ENABLE_EMBEDDED_NODE is ON but no valid Node.js binary was found (WEBEDIT_EMBEDDED_NODE_BINARY / node / nodejs). Continuing without embedded Node.js.") endif() endif()
editor/src/node_bridge.h +14 −17 Original line number Diff line number Diff line Loading @@ -20,19 +20,6 @@ inline std::string getEnvOrDefault(const char *key, const char *fallback) { return std::string(fallback); } inline std::string quoteShell(const std::string &value) { std::string out = "'"; for (char c : value) { if (c == '\'') { out += "'\\''"; } else { out += c; } } out += "'"; return out; } inline int runNodeRunner(const std::string &reqPath, const std::string &resPath) { static const std::string bridgeScript = Loading Loading @@ -83,10 +70,20 @@ inline int runNodeRunner(const std::string &reqPath, "process.exitCode=1;" "});"; const std::string nodeBin = getEnvOrDefault("BLOGI_WEBEDIT_NODE_BIN", "node"); const std::string cmd = quoteShell(nodeBin) + " -e " + quoteShell(bridgeScript) + " " + quoteShell(reqPath) + " " + quoteShell(resPath); return std::system(cmd.c_str()); std::vector<std::string> args; args.emplace_back("blogi-editor-node"); args.emplace_back("-e"); args.emplace_back(bridgeScript); args.emplace_back(reqPath); args.emplace_back(resPath); std::vector<char*> argv; argv.reserve(args.size()); for (auto &arg : args) { argv.push_back(arg.data()); } return node::Start(static_cast<int>(argv.size()), argv.data()); } } // namespace blogi::webedit::nodebridge