Add server sent events, change vfs structure, dark mode error pages and dark mode anonydrop
Some checks failed
Build and Deploy on Tag / build-arch (push) Failing after 8s
Build and Deploy on Tag / update-tap (push) Failing after 4s

This commit is contained in:
2026-04-23 02:23:22 -05:00
parent 3807bc5f36
commit 4cdfbc9542
12 changed files with 392 additions and 85 deletions

View File

@@ -8,6 +8,9 @@ using namespace Tesses::Framework::Http;
using namespace Tesses::Framework::Streams;
using namespace Tesses::Framework::TextStreams;
using namespace Tesses::Framework::Threading;
std::shared_ptr<ServerSentEvents> sse = std::make_shared<ServerSentEvents>();
class Johnny : public ServerContextData
{
public:
@@ -65,7 +68,7 @@ class MyWebServer : public IHttpServer {
for(size_t i=0;i<10000; i++)
{
writer.WriteLine("<li>" + std::to_string(i) + "</li>");
TF_Sleep(10);
}
writer.WriteLine("</ul>");
@@ -74,6 +77,15 @@ class MyWebServer : public IHttpServer {
writer.WriteLine("</html>");
return true;
}
else if(ctx.path == "/ssetest.html")
{
}
else if(ctx.path == "/sse")
{
ctx.SendServerSentEvents(sse);
return true;
}
else if(ctx.path == "/main.js")
{
@@ -162,6 +174,13 @@ class MyOtherWebServer : public IHttpServer
int main(int argc, char** argv)
{
TF_InitWithConsole();
int64_t timer = 0;
auto timerHDL= TF_Timer([&timer]()->void{
timer++;
sse->SendData("Timer has ticked " + std::to_string(timer) + " times now");
});
std::shared_ptr<RouteServer> routeSvr = std::make_shared<RouteServer>();
routeSvr->Get("/name/{name}/greeting",[](ServerContext& ctx)->bool{
std::string name;