mirror of
https://github.com/asdlokj1qpi233/subconverter.git
synced 2026-11-03 10:12:50 +00:00
Optimize codes
This commit is contained in:
1 file changed
+8
-8
+8
-8
@@ -718,7 +718,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
append_response("GET", "/", "text/plain", [](RESPONSE_CALLBACK_ARGS) -> std::string
|
append_response("GET", "/", "text/plain", [](RESPONSE_CALLBACK_ARGS) -> std::string
|
||||||
{
|
{
|
||||||
return std::string("subconverter " VERSION " backend");
|
return std::string("subconverter " VERSION " backend\n");
|
||||||
});
|
});
|
||||||
|
|
||||||
append_response("GET", "/refreshrules", "text/plain", [](RESPONSE_CALLBACK_ARGS) -> std::string
|
append_response("GET", "/refreshrules", "text/plain", [](RESPONSE_CALLBACK_ARGS) -> std::string
|
||||||
@@ -727,11 +727,11 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
std::string token = getUrlArg(argument, "token");
|
std::string token = getUrlArg(argument, "token");
|
||||||
if(token != access_token)
|
if(token != access_token)
|
||||||
return "Unauthorized";
|
return "Unauthorized\n";
|
||||||
}
|
}
|
||||||
refreshRulesets(rulesets, ruleset_content_array);
|
refreshRulesets(rulesets, ruleset_content_array);
|
||||||
generateBase();
|
generateBase();
|
||||||
return "done";
|
return "done\n";
|
||||||
});
|
});
|
||||||
|
|
||||||
append_response("GET", "/readconf", "text/plain", [](RESPONSE_CALLBACK_ARGS) -> std::string
|
append_response("GET", "/readconf", "text/plain", [](RESPONSE_CALLBACK_ARGS) -> std::string
|
||||||
@@ -740,11 +740,11 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
std::string token = getUrlArg(argument, "token");
|
std::string token = getUrlArg(argument, "token");
|
||||||
if(token != access_token)
|
if(token != access_token)
|
||||||
return "Unauthorized";
|
return "Unauthorized\n";
|
||||||
}
|
}
|
||||||
readConf();
|
readConf();
|
||||||
generateBase();
|
generateBase();
|
||||||
return "done";
|
return "done\n";
|
||||||
});
|
});
|
||||||
|
|
||||||
append_response("POST", "/updateconf", "text/plain", [](RESPONSE_CALLBACK_ARGS) -> std::string
|
append_response("POST", "/updateconf", "text/plain", [](RESPONSE_CALLBACK_ARGS) -> std::string
|
||||||
@@ -753,7 +753,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
std::string token = getUrlArg(argument, "token");
|
std::string token = getUrlArg(argument, "token");
|
||||||
if(token != access_token)
|
if(token != access_token)
|
||||||
return "Unauthorized";
|
return "Unauthorized\n";
|
||||||
}
|
}
|
||||||
std::string type = getUrlArg(argument, "type");
|
std::string type = getUrlArg(argument, "type");
|
||||||
if(type == "form")
|
if(type == "form")
|
||||||
@@ -761,12 +761,12 @@ int main(int argc, char *argv[])
|
|||||||
else if(type == "direct")
|
else if(type == "direct")
|
||||||
fileWrite(pref_path, postdata, true);
|
fileWrite(pref_path, postdata, true);
|
||||||
else
|
else
|
||||||
return "Not implemented";
|
return "Not implemented\n";
|
||||||
readConf();
|
readConf();
|
||||||
if(!update_ruleset_on_request)
|
if(!update_ruleset_on_request)
|
||||||
refreshRulesets(rulesets, ruleset_content_array);
|
refreshRulesets(rulesets, ruleset_content_array);
|
||||||
generateBase();
|
generateBase();
|
||||||
return "done";
|
return "done\n";
|
||||||
});
|
});
|
||||||
|
|
||||||
append_response("GET", "/sub", "text/plain;charset=utf-8", subconverter);
|
append_response("GET", "/sub", "text/plain;charset=utf-8", subconverter);
|
||||||
|
|||||||
Reference in new issue
Block a user