RetroShare/libresapi/src/api/LivereloadHandler.cpp
electron128 b05ee805e4 webui:
- added better live reload. It uses the Retroshare built in server. Grunt is not required anymore.
- removed unused buttons
- started ChatHandler

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8185 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2015-04-29 11:57:56 +00:00

26 lines
696 B
C++

#include "LivereloadHandler.h"
namespace resource_api
{
LivereloadHandler::LivereloadHandler(StateTokenServer *sts):
mStateTokenServer(sts), mStateToken(sts->getNewToken())
{
addResourceHandler("*", this, &LivereloadHandler::handleWildcard);
addResourceHandler("trigger", this, &LivereloadHandler::handleTrigger);
}
void LivereloadHandler::handleWildcard(Request &/*req*/, Response &resp)
{
resp.mStateToken = mStateToken;
resp.setOk();
}
void LivereloadHandler::handleTrigger(Request &/*req*/, Response &resp)
{
mStateTokenServer->replaceToken(mStateToken);
resp.mStateToken = mStateToken;
resp.setOk();
}
} // namespace resource_api