Skip to content

Commit

Permalink
Fix request arguments not properly handled (#661)
Browse files Browse the repository at this point in the history
  • Loading branch information
tindy2013 committed Nov 9, 2023
1 parent 833dee1 commit c530bc5
Show file tree
Hide file tree
Showing 12 changed files with 177 additions and 543 deletions.
179 changes: 88 additions & 91 deletions src/handler/interfaces.cpp

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/script/cron.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ void refresh_schedule()

std::string list_cron_schedule(RESPONSE_CALLBACK_ARGS)
{
std::string &argument = request.argument;
auto &argument = request.argument;
std::string token = getUrlArg(argument, "token");
rapidjson::StringBuffer sb;
rapidjson::Writer<rapidjson::StringBuffer> writer(sb);
Expand Down
7 changes: 6 additions & 1 deletion src/script/script_quickjs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,11 @@ static qjs_fetch_Response qjs_fetch(qjs_fetch_Request request)
return response;
}

static std::string qjs_getUrlArg(const std::string &url, const std::string &request)
{
return getUrlArg(url, request);
}

std::string getGeoIP(const std::string &address, const std::string &proxy)
{
return fetchFile("https://api.ip.sb/geoip/" + address, parseProxy(proxy), global.cacheConfig);
Expand Down Expand Up @@ -506,7 +511,7 @@ int script_context_init(qjs::Context &context)
.add<&currentTime>("time")
.add<&sleepMs>("sleep")
.add<&ShowMsgbox>("msgbox")
.add<&getUrlArg>("getUrlArg")
.add<&qjs_getUrlArg>("getUrlArg")
.add<&fileGet>("fileGet")
.add<&fileWrite>("fileWrite");
context.eval(R"(
Expand Down
Loading

0 comments on commit c530bc5

Please sign in to comment.