%LOCAL_TIME% for main page

master
const an teen 2022-02-12 00:16:37 -05:00
parent bfd2acff15
commit f25f3a780a
2 changed files with 7 additions and 2 deletions

View File

@ -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"
" <img src=\"/~images/example.png\">\n"
" <p><span style=\"color: gray\">local time:</span> %LOCAL_TIME%</p>\n"
"</center>\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('#')) {

View File

@ -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: