diff --git a/httpserver.cpp b/httpserver.cpp index 73b7b08..beadd3b 100644 --- a/httpserver.cpp +++ b/httpserver.cpp @@ -266,6 +266,16 @@ void HttpServer::writeMainPage(QTcpSocket *socket, QString &urlPath) QString channelNameForUrl {c.first}; channelNameForUrl.remove('#'); QString channelLink = "/" + global::toLowerAndNoSpaces(s.first) + "/" + channelNameForUrl; + if (not year.isEmpty()) { + channelLink += "/" + year; + if (not month.isEmpty()) { + channelLink += "/" + month; + if (not day.isEmpty()) { + channelLink += "/" + day; + } + } + } + replaceTag(htmlChannelLine, "CHANNEL_LINK", channelLink); htmlChannelLineS += htmlChannelLine; @@ -622,17 +632,14 @@ void HttpServer::writeMainPage(QTcpSocket *socket, QString &urlPath) QString text {buffer}; text.remove(QRegularExpression("^\\[.*\\]\\s")); - if (text.size() < 30) { - text.replace(' ', " "); // for long spaces (code examples, etc) - } else { - while (QRegularExpression("[^\\s]{50,10000}.*").match(text).hasMatch()) { - int pos = text.indexOf(QRegularExpression("[^\\s]{50,10000}.*")); - if (pos == -1) { - consoleLog("Bug! HttpServer.cpp while (QRegularExpression(\"[^\\s]{50,10000}.*\").match(text).hasMatch())"); - break; - } - text.insert(pos+25, ' '); + + while (QRegularExpression("[^\\s]{100,10000}.*").match(text).hasMatch()) { + int pos = text.indexOf(QRegularExpression("[^\\s]{50,10000}.*")); + if (pos == -1) { + consoleLog("Bug! HttpServer.cpp while (QRegularExpression(\"[^\\s]{50,10000}.*\").match(text).hasMatch())"); + break; } + text.insert(pos+25, ' '); } if (text.isEmpty()) continue;