don't check for request->is_htmx_request for sending frames, check only "frame" url paremeter
added config parameter: request_frame_parameter, default: "frame"
This commit is contained in:
parent
3f5eabeaa1
commit
c4b5565995
|
@ -780,13 +780,16 @@ pt::WTextStream * App::CreateFrameAnswer()
|
||||||
{
|
{
|
||||||
Request & req = *cur.request;
|
Request & req = *cur.request;
|
||||||
auto i = req.out_streams.streams_map.begin();
|
auto i = req.out_streams.streams_map.begin();
|
||||||
const std::wstring * frame = cur.request->ParamValuep(L"frame");
|
const std::wstring * frame = cur.request->ParamValuep(config.request_frame_parameter);
|
||||||
|
|
||||||
for( ; i != req.out_streams.streams_map.end() ; ++i)
|
if( frame )
|
||||||
{
|
{
|
||||||
if( (frame && i->first == *frame) || (!frame && i->first == L"content") )
|
for( ; i != req.out_streams.streams_map.end() ; ++i)
|
||||||
{
|
{
|
||||||
return &i->second->get_buffer();
|
if( i->first == *frame )
|
||||||
|
{
|
||||||
|
return &i->second->get_buffer();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1904,6 +1907,16 @@ return header;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool App::IsRequestedFrame()
|
||||||
|
{
|
||||||
|
if( !config.request_frame_parameter.empty() )
|
||||||
|
{
|
||||||
|
return cur.request->ParamValuep(config.request_frame_parameter);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void App::SendTextAnswer()
|
void App::SendTextAnswer()
|
||||||
{
|
{
|
||||||
|
@ -1923,12 +1936,13 @@ size_t output_size = 0;
|
||||||
*/
|
*/
|
||||||
FilterContent();
|
FilterContent();
|
||||||
|
|
||||||
|
// cur.request->return_json is depracated, we will create json from models/space registered through request->models object
|
||||||
if( cur.request->return_json )
|
if( cur.request->return_json )
|
||||||
{
|
{
|
||||||
source = CreateJSONAnswer();
|
source = CreateJSONAnswer();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if( cur.request->is_htmx_request )
|
if( IsRequestedFrame() )
|
||||||
{
|
{
|
||||||
source = CreateFrameAnswer();
|
source = CreateFrameAnswer();
|
||||||
|
|
||||||
|
|
|
@ -226,6 +226,7 @@ private:
|
||||||
void CheckHtmx();
|
void CheckHtmx();
|
||||||
void SetSubdomain();
|
void SetSubdomain();
|
||||||
|
|
||||||
|
bool IsRequestedFrame();
|
||||||
|
|
||||||
Header GetHTTPStatusCode();
|
Header GetHTTPStatusCode();
|
||||||
void PrepareSessionCookie();
|
void PrepareSessionCookie();
|
||||||
|
|
|
@ -284,6 +284,7 @@ void Config::AssignValues(bool stdout_is_closed)
|
||||||
ezc_max_elements = Size(L"ezc_max_elements", 50000);
|
ezc_max_elements = Size(L"ezc_max_elements", 50000);
|
||||||
ezc_max_loop_elements = Size(L"ezc_max_loop_elements", 5000);
|
ezc_max_loop_elements = Size(L"ezc_max_loop_elements", 5000);
|
||||||
ezc_out_streams_size = Size(L"ezc_out_streams_size", 128);
|
ezc_out_streams_size = Size(L"ezc_out_streams_size", 128);
|
||||||
|
request_frame_parameter = Text(L"request_frame_parameter", L"frame");
|
||||||
|
|
||||||
account_need_email_verification = Bool(L"account_need_email_verification", true);
|
account_need_email_verification = Bool(L"account_need_email_verification", true);
|
||||||
reset_password_code_expiration_time = Long(L"reset_password_code_expiration_time", 86400);
|
reset_password_code_expiration_time = Long(L"reset_password_code_expiration_time", 86400);
|
||||||
|
|
|
@ -672,6 +672,10 @@ public:
|
||||||
// default: 128
|
// default: 128
|
||||||
size_t ezc_out_streams_size;
|
size_t ezc_out_streams_size;
|
||||||
|
|
||||||
|
// the name of the url parameter for returning a frame, e.g. https://domain.tld/mydir/myfunction/frame:foo
|
||||||
|
// default: frame
|
||||||
|
std::wstring request_frame_parameter;
|
||||||
|
|
||||||
// when true then when a user want to create a new account
|
// when true then when a user want to create a new account
|
||||||
// he has to provide his email and a message will be sent back to him
|
// he has to provide his email and a message will be sent back to him
|
||||||
// with a link to activate the account
|
// with a link to activate the account
|
||||||
|
|
Loading…
Reference in New Issue