left menu links with current date

master
const an teen 2021-12-05 05:57:56 -05:00
parent a07b95fe92
commit b5c5dce78b
1 changed files with 17 additions and 10 deletions

View File

@ -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(' ', "&nbsp;"); // 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;