Skip to content
Snippets Groups Projects
Commit 2a37bbb3 authored by Sergey Linev's avatar Sergey Linev
Browse files

webui: introduce hook to modify web page delivered by WS handler

This could be used to insert specialized information, which is related
to WS handler or display engine like CEF/Qt5
parent 3c748e3d
No related branches found
No related tags found
No related merge requests found
......@@ -58,6 +58,11 @@ protected:
CefRefPtr<CefCallback> fCallBack{nullptr};
void CheckWSPageContent(THttpWSHandler *) override
{
}
public:
explicit TCefHttpCallArg() = default;
......
......@@ -62,6 +62,10 @@ class TWebGuiCallArg : public THttpCallArg {
protected:
UrlRequestJobHolder fRequest;
void CheckWSPageContent(THttpWSHandler *) override
{
}
public:
explicit TWebGuiCallArg(QWebEngineUrlRequestJob *req = nullptr) : THttpCallArg(), fRequest(req) {}
......
......@@ -25,6 +25,7 @@ class THttpWSEngine;
class THttpWSHandler;
class THttpCallArg : public TObject {
friend class THttpServer;
friend class THttpWSEngine;
friend class THttpWSHandler;
......@@ -63,7 +64,7 @@ protected:
private:
std::shared_ptr<THttpWSEngine> fWSEngine; ///<! web-socket engine, which supplied to run created web socket
std::string fContent; ///!< content - text or binary
std::string fContent; ///<! content - text or binary
std::string fPostData; ///<! data received with post request - text - or binary
void AssignWSId();
......@@ -71,6 +72,9 @@ private:
void ReplaceAllinContent(const std::string &from, const std::string &to);
/** Method used to modify content of web page used by web socket handler */
virtual void CheckWSPageContent(THttpWSHandler *) {}
public:
explicit THttpCallArg() = default;
virtual ~THttpCallArg();
......
......@@ -751,6 +751,8 @@ void THttpServer::ProcessRequest(THttpCallArg *arg)
arg->fContent = ReadFileContent(resolve.Data());
arg->AddNoCacheHeader();
}
arg->CheckWSPageContent(handler);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment