From 96819fd3ceec7e1f910be1893074cc47e72a98f6 Mon Sep 17 00:00:00 2001 From: acetone Date: Thu, 30 Dec 2021 23:48:48 -0500 Subject: [PATCH] current server is first in list --- httpserver.cpp | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/httpserver.cpp b/httpserver.cpp index 9934315..41ed6dd 100644 --- a/httpserver.cpp +++ b/httpserver.cpp @@ -617,8 +617,11 @@ void HttpServer::writeMainPage(QTcpSocket *socket, QString &urlPath, bool isHead } else { replaceTag(htmlServersSection, "ONLINE_STATUS", HTML_SERVER_OFFLINE_MARKER); } - - htmlServersSectionS += htmlServersSection; + if (s.first == originalServerName) { + htmlServersSectionS.push_front(htmlServersSection); + } else { + htmlServersSectionS += htmlServersSection; + } } replaceTag(page, "SERVERS_SECTION", htmlServersSectionS); @@ -1231,8 +1234,11 @@ void HttpServer::writeRealTimeChatPage(QTcpSocket *socket, QString &urlPath, boo } else { replaceTag(htmlServersSection, "ONLINE_STATUS", HTML_SERVER_OFFLINE_MARKER); } - - htmlServersSectionS += htmlServersSection; + if (s.first == originalServerName) { + htmlServersSectionS.push_front(htmlServersSection); + } else { + htmlServersSectionS += htmlServersSection; + } } replaceTag(page, "SERVERS_SECTION", htmlServersSectionS); @@ -1387,10 +1393,6 @@ void HttpServer::writeAboutServerPage(QTcpSocket *socket, QString &urlPath, bool } replaceTag(htmlServersSection, "ABOUT_SERVER", "/serverinformation/"+s.first); replaceTag(htmlServersSection, "SERVER_NAME", s.first); - if (s.first == originalServerName) { - htmlServersSection.replace("{{ONLINE_STATUS}}", - "{{ONLINE_STATUS}}"); - } QString htmlChannelLineS; for (const auto &c: s.second) { @@ -1419,8 +1421,11 @@ void HttpServer::writeAboutServerPage(QTcpSocket *socket, QString &urlPath, bool } else { replaceTag(htmlServersSection, "ONLINE_STATUS", HTML_SERVER_OFFLINE_MARKER); } - - htmlServersSectionS += htmlServersSection; + if (s.first == originalServerName) { + htmlServersSectionS.push_front(htmlServersSection); + } else { + htmlServersSectionS += htmlServersSection; + } } replaceTag(page, "SERVERS_SECTION", htmlServersSectionS); page.remove(QRegularExpression("
.*", QRegularExpression::DotMatchesEverythingOption));