diff --git a/script/_nginx_configure b/script/_nginx_configure deleted file mode 100644 index f7605032223..00000000000 --- a/script/_nginx_configure +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash -# -# Copyright (c) 2020, The OpenThread Authors. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# 3. Neither the name of the copyright holder nor the -# names of its contributors may be used to endorse or promote products -# derived from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# - -nginx_configure() -{ - if command -v nginx; then - - top_dir="$(pwd)" - - nginx_conf_file=$(nginx -V 2>&1 | grep -o "\-\-conf-path=\(.*conf\)" | cut -d "=" -f2) - - sudo rm "${nginx_conf_file}" - - sudo cp "${top_dir}"/etc/rest/nginx.conf "${nginx_conf_file}" - - sudo sed -i.bak "s:to be set:${top_dir}/src/rest/frontend:" "${nginx_conf_file}" - - else - - echo >&2 ' *** WARNING: nginx not found, please install nginx manually and run setup again' - - fi - -} diff --git a/script/_nginx_server_install b/script/_nginx_server_install index f7605032223..eaf850f4721 100644 --- a/script/_nginx_server_install +++ b/script/_nginx_server_install @@ -27,7 +27,7 @@ # POSSIBILITY OF SUCH DAMAGE. # -nginx_configure() +nginx_server_install() { if command -v nginx; then diff --git a/script/setup b/script/setup index 28b53a4df7e..9ed68caf16e 100755 --- a/script/setup +++ b/script/setup @@ -41,7 +41,7 @@ . script/_swapfile . script/_sudo_extend . script/_disable_services -. script/_nginx_configure +. script/_nginx_server_install main() { diff --git a/src/rest/json.cpp b/src/rest/json.cpp index 84a45c7ccf5..0c080842fc9 100644 --- a/src/rest/json.cpp +++ b/src/rest/json.cpp @@ -673,7 +673,7 @@ bool JsonString2NetworkConfiguration(std::string &aString, NetworkConfiguration exit: cJSON_Delete(jsonOut); - + return ret; } @@ -720,7 +720,7 @@ bool JsonString2Bool(std::string aString, std::string aKey, bool &aValue) exit: cJSON_Delete(jsonOut); - + return ret; } diff --git a/src/rest/json.hpp b/src/rest/json.hpp index b13acdfe616..b80ef6ff7b2 100644 --- a/src/rest/json.hpp +++ b/src/rest/json.hpp @@ -104,7 +104,7 @@ std::string Node2JsonString(const NodeInfo &aNode); /** * This method formats a vector including serveral Diagnostic object to a Json array and serialize it to a string. * - * @param[in] aDiagSet A vector including serveral Diagnostic object. + * @param[in] aDiagSet A vector including serveral Diagnostic object. * * @returns A string serlialized by a Json array. * @@ -124,7 +124,7 @@ std::string IpAddr2JsonString(const otIp6Address &aAddress); /** * This method formats extracts prefixes from a list of config object and format them as Json Array. * - * @param[in] aConfig an array of config object. + * @param[in] aConfig An array of config object. * * @returns A string serlialized by a Json Array. * @@ -224,7 +224,7 @@ std::string Network2JsonString(const otOperationalDataset &aDataset); /** * This method formats an error code and an error message to a Json object and serialize it to a string. * - * @param[in] aErrorCode Error code such as '404'. + * @param[in] aErrorCode An enum HttpStatusCode such as '404'. * @param[in] aErrorMessage Error message such as '404 Not Found'. * @param[in] aDescription Detailed error information. * @@ -236,20 +236,20 @@ std::string Error2JsonString(HttpStatusCode aErrorCode, std::string aErrorMessag /** * This method decodes a json object to a NetworkConfiguration object . * - * @param[in] aString a string contains Json object. + * @param[in] aString A string contains Json object. * @param[out] aNetwork A reference to a NetworkConfiguration instance that could be set within this method. * * @returns A bool value that indicates whether the string could be decoded to the NetworkConfiguration object * */ -bool JsonString2NetworkConfiguration(std::string aString, NetworkConfiguration &aNetwork); +bool JsonString2NetworkConfiguration(std::string &aString, NetworkConfiguration &aNetwork); /** * This method decodes a json object to a NetworkConfiguration object . * - * @param[in] aString a string contains Json object. + * @param[in] aString A string contains Json object. * @param[in] aKey The key that may exist in the Json object. - * @param[inout] aValue the string that is the value of the key in this Json object. + * @param[inout] aValue The string that is the value of the key in this Json object. * * @returns A bool value that indicates whether the key exist in this Json object. * @@ -259,9 +259,9 @@ bool JsonString2String(std::string aString, std::string aKey, std::string &aValu /** * This method decodes a json object to a bool value . * - * @param[in] aString a string contains Json object. + * @param[in] aString A string contains Json object. * @param[in] aKey The key that may exist in the Json object. - * @param[inout] aValue the bool value that is the value of the key in this Json object. + * @param[inout] aValue The bool value that is the value of the key in this Json object. * * @returns A bool value that indicates whether the key exist in this Json object. * @@ -271,11 +271,11 @@ bool JsonString2Bool(std::string aString, std::string aKey, bool &aValue); /** * This method decodes a json object to a bool value . * - * @param[in] aString a string contains Json object. + * @param[in] aString A string contains Json object. * @param[in] aKey The key that may exist in the Json object. - * @param[inout] aValue the integer value that is the value of the key in this Json object. + * @param[inout] aValue The integer value that is the value of the key in this Json object. * - * @returns An bool value that indicates whether the key exist in this Json object. + * @returns A bool value that indicates whether the key exist in this Json object. * */ bool JsonString2Int(std::string aString, std::string aKey, int32_t &aValue); diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index 829b11e4eb3..8e8aaf77a23 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -27,7 +27,7 @@ # add_subdirectory(openthread) -if(OTBR_WEB) +if(OTBR_REST) add_subdirectory(cJSON) add_subdirectory(http-parser) endif()