mirror of
https://github.com/MetaCubeX/subconverter.git
synced 2025-11-04 18:19:42 +08:00
Bugs fix
Fix build error. Fix max_allowed_download_size option has no effect (#409). Clean up codes.
This commit is contained in:
parent
08d00dd3d7
commit
4639ee483e
@ -94,6 +94,7 @@ FIND_LIBRARY(YAML_CPP_LIBRARY NAMES yaml-cpp yaml-cppd PATHS ${YAML_CPP_LIBRARY_
|
||||
LINK_DIRECTORIES(${YAML_CPP_LIBRARY_DIRS})
|
||||
INCLUDE_DIRECTORIES(${YAML_CPP_INCLUDE_DIRS})
|
||||
TARGET_LINK_LIBRARIES(subconverter ${YAML_CPP_LIBRARY})
|
||||
ADD_DEFINITIONS(-DYAML_CPP_STATIC_DEFINE)
|
||||
|
||||
#IF(USING_STD_REGEX STREQUAL "ON")
|
||||
# ADD_DEFINITIONS(-DUSE_STD_REGEX)
|
||||
|
||||
@ -53,4 +53,4 @@ cmake -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" .
|
||||
make -j4
|
||||
rm subconverter.exe
|
||||
g++ $(find CMakeFiles/subconverter.dir/src -name "*.obj") curl/lib/libcurl.a -o base/subconverter.exe -static -levent -lpcre2-8 -lquickjs -llibcron -lyaml-cpp -liphlpapi -lcrypt32 -lws2_32 -lwsock32 -lz -s
|
||||
mv base subconverter
|
||||
mv base subconverter
|
||||
|
||||
@ -1298,25 +1298,3 @@ int loadExternalConfig(std::string &path, ExternalConfig &ext)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void parseGroupTimes(const std::string &src, int *interval, int *tolerance, int *timeout)
|
||||
{
|
||||
std::vector<int*> ptrs;
|
||||
ptrs.push_back(interval);
|
||||
ptrs.push_back(timeout);
|
||||
ptrs.push_back(tolerance);
|
||||
string_size bpos = 0, epos = src.find(",");
|
||||
for(int *x : ptrs)
|
||||
{
|
||||
if(x != NULL)
|
||||
*x = to_int(src.substr(bpos, epos - bpos), 0);
|
||||
if(epos != src.npos)
|
||||
{
|
||||
bpos = epos + 1;
|
||||
epos = src.find(",", bpos);
|
||||
}
|
||||
else
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -28,8 +28,8 @@ struct Settings
|
||||
bool printDbgInfo = false, CFWChildProcess = false, appendUserinfo = true, asyncFetchRuleset = false, surgeResolveHostname = true;
|
||||
std::string accessToken, basePath = "base";
|
||||
std::string custom_group;
|
||||
int logLevel;
|
||||
long maxAllowedDownloadSize;
|
||||
int logLevel = 0;
|
||||
long maxAllowedDownloadSize = 1048576L;
|
||||
string_map aliases;
|
||||
|
||||
//global variables for template
|
||||
@ -97,6 +97,25 @@ extern Settings global;
|
||||
|
||||
int importItems(string_array &target, bool scope_limit = true);
|
||||
int loadExternalConfig(std::string &path, ExternalConfig &ext);
|
||||
void parseGroupTimes(const std::string &src, int *interval, int *tolerance, int *timeout);
|
||||
|
||||
template <class... Args>
|
||||
void parseGroupTimes(const std::string &src, Args... args)
|
||||
{
|
||||
std::array<int*, sizeof...(args)> ptrs {args...};
|
||||
string_size bpos = 0, epos = src.find(",");
|
||||
for(int *x : ptrs)
|
||||
{
|
||||
if(x != nullptr)
|
||||
*x = to_int(src.substr(bpos, epos - bpos), 0);
|
||||
if(epos != src.npos)
|
||||
{
|
||||
bpos = epos + 1;
|
||||
epos = src.find(",", bpos);
|
||||
}
|
||||
else
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
#endif // SETTINGS_H_INCLUDED
|
||||
|
||||
@ -93,8 +93,6 @@ public:
|
||||
|
||||
RWLock cache_rw_lock;
|
||||
|
||||
long gMaxAllowedDownloadSize = 1048576L;
|
||||
|
||||
//std::string user_agent_str = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36";
|
||||
static std::string user_agent_str = "subconverter/" VERSION " cURL/" LIBCURL_VERSION;
|
||||
|
||||
@ -190,7 +188,7 @@ static int curlGet(const FetchArgument &argument, FetchResult &result)
|
||||
curl_easy_setopt(curl_handle, CURLOPT_PROXY, argument.proxy.data());
|
||||
}
|
||||
curl_progress_data limit;
|
||||
limit.size_limit = gMaxAllowedDownloadSize;
|
||||
limit.size_limit = global.maxAllowedDownloadSize;
|
||||
curl_set_common_options(curl_handle, new_url.data(), &limit);
|
||||
list = curl_slist_append(list, "Content-Type: application/json;charset='utf-8'");
|
||||
if(argument.request_headers)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user