From f25f3a780acf544fb6849fe81139950632a12de1 Mon Sep 17 00:00:00 2001 From: acetone Date: Sat, 12 Feb 2022 00:16:37 -0500 Subject: [PATCH] %LOCAL_TIME% for main page --- httpserver.cpp | 5 ++++- httpserver.h | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/httpserver.cpp b/httpserver.cpp index 1403ee9..b63c62d 100644 --- a/httpserver.cpp +++ b/httpserver.cpp @@ -44,6 +44,7 @@ HttpServer::HttpServer(const QString &address, quint16 port, const QString& data "# Your images from \"" + m_dataFolder.toUtf8() + "custom_images\" must have URL \"/~images/\"\n" " \n" + "

local time: %LOCAL_TIME%

\n" "\n"); mp.close(); } @@ -557,6 +558,7 @@ void HttpServer::writeMainPage(QTcpSocket *socket, bool isHeadRequest) } rbuffer = mp.readLine(); } + aboutBlock.replace("%LOCAL_TIME%", QTime::currentTime().toString(Qt::DateFormat::ISODate)); } else { aboutBlock = "No information provided"; @@ -1960,7 +1962,8 @@ void HttpServer::writeAboutServerPage(QTcpSocket *socket, QString &server, bool QString aboutBlock; QFile about(m_dataFolder+server+global::slash+"about_server.txt"); - if (about.open(QIODevice::ReadOnly)) { + if (about.open(QIODevice::ReadOnly)) + { QString rbuffer = about.readLine(); while (not rbuffer.isEmpty()) { if (rbuffer.startsWith('#')) { diff --git a/httpserver.h b/httpserver.h index 1f8ab56..260bb9c 100644 --- a/httpserver.h +++ b/httpserver.h @@ -12,14 +12,16 @@ constexpr int MSECS_TO_AUTOREMOVE_MESSAGES_FROM_BUFFER {15000}; // 15 secs constexpr int MAX_MESSAGE_LENGTH_WITHOUT_WBR = 30; constexpr int MAX_NICKNAME_LENGTH_WITHOUT_WBR = 20; constexpr int BUFFER_SIZE = 2048; + const QString HTTP_ACTUAL_ETAG {__DATE__ __TIME__}; const QString ANCHOR_SUFFIX {"msg"}; - const QString RED_1 {"#753d08"}; const QString RED_2 {"#b83e3e"}; const QString GREEN_1 {"#60940c"}; const QString GREEN_2 {"#27940c"}; +const QString LOCAL_TIME_MARKER_FOR_ABOUT_SERVER_PAGE {"%LOCAL_TIME%"}; + class NickColorist { public: