/*Software License Copyright(C) 2024[liuyingjie] License Terms Usage Rights Any individual or entity is free to use, copy, and distribute the binary form of this software without modification to the source code, without the need to disclose the source code. If the source code is modified, the modifications must be open - sourced under the same license.This means that the modifications must be disclosed and accompanied by a copy of this license. Future Versions Updates From this version onwards, all future releases will be governed by the terms of the latest version of the license.This license will automatically be nullified and replaced by the new version. Users must comply with the terms of the new license issued in future releases. Liability and Disclaimer This software is provided “as is”, without any express or implied warranties, including but not limited to the warranties of merchantability, fitness for a particular purpose, and non - infringement.In no event shall the author or copyright holder be liable for any claims, damages, or other liabilities, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software. Contact Information If you have any questions, please contact us: 1585346868@qq.com Or visit our website fwlua.com. */ #include "fastweb.h" #include #include "util/strutils.h" #include "util/system.h" #include "util/codec.h" #include "util/file.h" #include "util/print.h" #include "../src/utils/parseconfig.hpp" #include "net/http_client_plus.h" #include "core/entry.h" bool exsit_install_software(std::string name){ std::string command = "which " + name + " > /dev/null 2>&1"; int result = std::system(command.c_str()); return (result == 0); }; std::pair execute_command(const std::string& command){ std::array buffer; std::string result; int return_code = 0; std::unique_ptr pipe(popen((command + " 2>&1").c_str(), "r"), pclose); if (!pipe) { throw std::runtime_error("popen() failed!"); } // Read the output a line at a time - output it. while (fgets(buffer.data(), buffer.size(), pipe.get()) != nullptr) { result += buffer.data(); } // Get the return code return_code = pclose(pipe.release()); return std::make_pair(return_code, command+"\n"+result); }; fastweb::fastweb(const std::vector ¶m) { auto equals=[&](std::vector p2,int all_size)->bool{ if(param.size() < all_size) return false; if(param.size() list; if(module_infos(list) == false) return; fastweb::module_info info; for(size_t i=0;i list; if(module_infos(list) == false) return; fastweb::module_info info; for(size_t i=0;i list; if(module_infos(list) == false) return; std::cout<<"--------------------------模块列表---------------------------"<& list) { std::cout<<"正在获取最新模块列表信息..."< types = {"fastweb","lua","other"}; for(size_t i=0;i()); info.name = td[k]["name"].to(); info.name_en = td[k]["name_en"].to(); info.desc = td[k]["desc"].to(); info.doc = td[k]["doc"].to(); info.type = types[i]; info.download_win64 = td[k]["doc"].to(); info.download_linux_url = td[k]["download"]["linux"]["url"].to(); info.download_linux_type = td[k]["download"]["linux"]["type"].to(); list.push_back(info); } } return true; } void fastweb::wait() { while(true) system::sleep_msec(1000*60); } void fastweb::install_module_linux(fastweb::module_info info) { if(exsit_install_software("/opt/lua54/bin/lua") == false) { std::cout<<"LUA未安装,请重新执行fastweb一键构建脚本并确认lua编译安装部分正确执行"<