mirror of
https://github.com/asdlokj1qpi233/subconverter.git
synced 2026-11-04 10:42:04 +00:00
Enhancements
Add support for specifying node rename pattern in URL argument. Optimize codes.
This commit is contained in:
3 files changed
+9
-3
No files matched your search
@@ -1131,6 +1131,7 @@ std::string subconverter(RESPONSE_CALLBACK_ARGS)
|
|||||||
std::string include = UrlDecode(getUrlArg(argument, "include")), exclude = UrlDecode(getUrlArg(argument, "exclude"));
|
std::string include = UrlDecode(getUrlArg(argument, "include")), exclude = UrlDecode(getUrlArg(argument, "exclude"));
|
||||||
std::string groups = urlsafe_base64_decode(getUrlArg(argument, "groups")), ruleset = urlsafe_base64_decode(getUrlArg(argument, "ruleset")), config = UrlDecode(getUrlArg(argument, "config"));
|
std::string groups = urlsafe_base64_decode(getUrlArg(argument, "groups")), ruleset = urlsafe_base64_decode(getUrlArg(argument, "ruleset")), config = UrlDecode(getUrlArg(argument, "config"));
|
||||||
std::string dev_id = getUrlArg(argument, "dev_id"), filename = getUrlArg(argument, "filename"), interval_str = getUrlArg(argument, "interval"), strict_str = getUrlArg(argument, "strict");
|
std::string dev_id = getUrlArg(argument, "dev_id"), filename = getUrlArg(argument, "filename"), interval_str = getUrlArg(argument, "interval"), strict_str = getUrlArg(argument, "strict");
|
||||||
|
std::string ext_rename = UrlDecode(getUrlArg(argument, "rename"));
|
||||||
|
|
||||||
/// switches with default value
|
/// switches with default value
|
||||||
tribool upload = getUrlArg(argument, "upload"), emoji = getUrlArg(argument, "emoji");
|
tribool upload = getUrlArg(argument, "upload"), emoji = getUrlArg(argument, "emoji");
|
||||||
@@ -1188,6 +1189,9 @@ std::string subconverter(RESPONSE_CALLBACK_ARGS)
|
|||||||
std::string proxy = parseProxy(proxy_subscription);
|
std::string proxy = parseProxy(proxy_subscription);
|
||||||
|
|
||||||
ext.emoji_array = safe_get_emojis();
|
ext.emoji_array = safe_get_emojis();
|
||||||
|
if(ext_rename.size())
|
||||||
|
ext.rename_array = split(ext_rename, "`");
|
||||||
|
else
|
||||||
ext.rename_array = safe_get_renames();
|
ext.rename_array = safe_get_renames();
|
||||||
|
|
||||||
//check other flags
|
//check other flags
|
||||||
|
|||||||
@@ -2125,14 +2125,16 @@ static inline unsigned long long streamToInt(const std::string &stream)
|
|||||||
return 0;
|
return 0;
|
||||||
double streamval = 1.0;
|
double streamval = 1.0;
|
||||||
std::vector<std::string> units = {"B", "KB", "MB", "GB", "TB", "PB", "EB"};
|
std::vector<std::string> units = {"B", "KB", "MB", "GB", "TB", "PB", "EB"};
|
||||||
for(size_t index = units.size() - 1; index >= 0; index--)
|
size_t index = units.size();
|
||||||
|
do
|
||||||
{
|
{
|
||||||
|
index--;
|
||||||
if(endsWith(stream, units[index]))
|
if(endsWith(stream, units[index]))
|
||||||
{
|
{
|
||||||
streamval = std::pow(1024, index) * to_number<float>(stream.substr(0, stream.size() - units[index].size()), 0.0);
|
streamval = std::pow(1024, index) * to_number<float>(stream.substr(0, stream.size() - units[index].size()), 0.0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
} while(index != 0);
|
||||||
return (unsigned long long)streamval;
|
return (unsigned long long)streamval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ static inline int process_request(const char *method_str, std::string uri, std::
|
|||||||
|
|
||||||
for(responseRoute &x : responses)
|
for(responseRoute &x : responses)
|
||||||
{
|
{
|
||||||
if(strcmp(method_str, "OPTIONS") == 0 && x.method == postdata && x.path == path)
|
if(strcmp(method_str, "OPTIONS") == 0 && postdata.find(x.method) != 0 && x.path == path)
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user