diff --git a/src/g.cpp b/src/g.cpp index f79f911..3a953cc 100644 --- a/src/g.cpp +++ b/src/g.cpp @@ -57,7 +57,7 @@ namespace c { } // namespace c namespace p { - uint LAST_AND_TOP_LIST_SIZE = 5; + uint LAST_AND_TOP_LIST_SIZE = 10; QStringList IGNORED_DESTINATIONS = {"[0.0.0.0]", "0.0.0.0"}; QString WORKING_DIR = "data"; QString SERVICE_TITLE = "3proxy-eagle"; diff --git a/src/html/main.css b/src/html/main.css index aacd2ff..0267e4d 100644 --- a/src/html/main.css +++ b/src/html/main.css @@ -1 +1 @@ -*{box-sizing:border-box;outline:none;z-index:1}*:hover{outline:none}*:focus{outline:none}html{width:100%;font-size:16px;scroll-behavior:smooth}body{overflow-y:scroll;height:100%;line-height:1.42;margin:0;background-color:#fff;color:#000;height:100vh;font-family:monospace;font-size:16px}main{display:flex;flex-flow:column nowrap;align-items:stretch;justify-content:flex-start}ul,ol{padding:0;margin:0}li{list-style:none}a{text-decoration:none;color:inherit}a:hover{text-decoration:none}button{cursor:pointer;background-color:rgba(0,0,0,0);border:0px solid rgba(0,0,0,0);padding:0}button:focus,input:focus,a:focus,textarea:focus{text-decoration:none}button,input,textarea{font-family:inherit;font-size:inherit}textarea{resize:none}p{margin:0}h1,h2,h3,h4,h5{margin-top:0;margin-bottom:0;font-weight:normal;font-size:100%}img{display:block;max-width:100%;height:auto}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit}table{border-collapse:collapse}input[type=checkbox]{margin:0}.wrapper{height:100%;padding:16px 0;flex:1}.container{max-width:648px;margin:0 auto;padding:0 5px}.section{margin-bottom:35px}.section__title{margin-bottom:10px;font-size:20px;font-weight:bold}.proxyService__title{text-align:center;font-size:50px;padding:12px 0;font-weight:bold}.handledTraffic{width:100%}.handledTraffic__blocks{width:100%;display:flex;flex-flow:row nowrap;align-items:start;justify-content:center;gap:10px}.handledTraffic__block{width:calc(50% - 5px)}.handledTraffic__block_download .handledTraffic__svg{fill:#91fd91}.handledTraffic__block_upload .handledTraffic__svg{fill:#ff6f6f}.handledTraffic__title{text-transform:uppercase;font-weight:bold;background-color:#ddd;padding:3px 5px;font-size:20px}.handledTraffic__amount{display:flex;flex-flow:row nowrap;align-items:stretch;justify-content:center;background-color:#aaa;padding:10px;border-top:1px solid #000;border-bottom:1px solid #000}.handledTraffic__icon{text-align:center;display:flex;flex-flow:column nowrap;align-items:center;justify-content:center;padding:3px 8px;margin-right:8px}.handledTraffic__icon .handledTraffic__svg{height:35px}.handledTraffic__number{line-height:1;font-size:56px;font-weight:bold;text-transform:uppercase}.handledTraffic__decimal{line-height:1.3;align-self:end;font-size:28px;margin-right:12px}.handledTraffic__measure{font-size:18px;font-weight:bold;align-self:end;line-height:1.6}.handledTraffic__total{background-color:#ddd;padding:8px;font-size:16px;text-align:right}.handledTraffic__totalTitle{text-transform:uppercase;font-weight:bold}.accordeo__radio{display:none}.accordeo__radio:checked~.accordeo__dropdown{display:block}.accordeo__dropdown{display:none}.blockedDestinations__item{background-color:#ddd;overflow:hidden;white-space:nowrap;margin-bottom:5px;text-overflow:ellipsis}.blockedDestinations__url{display:block;width:100%;padding:3px 6px;cursor:pointer}.blockedDestinations__ipList{background-color:#aaa;padding-left:10px}.blockedDestinations__ipItem{padding:4px}.lastDestinations{width:100%;padding:5px 0}.lastDestinations__list{width:100%}.lastDestinations__item{width:100%;margin-bottom:5px;padding:3px 6px;overflow:hidden;text-overflow:ellipsis}.lastDestinations__item:last-child{margin-bottom:0}.lastDestinations__item_blocked{background-color:#888}.lastDestinations__item_allowed{background-color:#ddd}.topDestinations__block{margin-bottom:14px}.topDestinations__block:last-child{margin-bottom:0}.topDestinations__title{font-weight:bold;margin-bottom:10px}.topDestinations__item{padding:4px;overflow:hidden;white-space:nowrap;margin-bottom:5px;text-overflow:ellipsis;background-color:#ddd}.copyright{padding:10px 0;text-align:center;color:#888}/*# sourceMappingURL=main.min.css.map */ \ No newline at end of file +*{box-sizing:border-box;outline:none;z-index:1}*:hover{outline:none}*:focus{outline:none}html{width:100%;font-size:16px;scroll-behavior:smooth}body{line-height:1.42;margin:0;background-color:#fff;color:#000;font-family:monospace;font-size:16px}@media screen and (max-width: 480px){body{font-size:14px}}@media screen and (max-width: 380px){body{font-size:12px}}ul,ol{padding:0;margin:0}li{list-style:none}a{text-decoration:none;color:inherit}a:hover{text-decoration:none}button{cursor:pointer;background-color:rgba(0,0,0,0);border:0px solid rgba(0,0,0,0);padding:0}button:focus,input:focus,a:focus,textarea:focus{text-decoration:none}button,input,textarea{font-family:inherit;font-size:inherit}textarea{resize:none}p{margin:0}h1,h2,h3,h4,h5{margin-top:0;margin-bottom:0;font-weight:normal;font-size:100%}img{display:block;max-width:100%;height:auto}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit}table{border-collapse:collapse}input[type=checkbox]{margin:0}.wrapper{height:100%;padding:16px 0;flex:1}.container{max-width:648px;margin:0 auto;padding:0 15px}@media screen and (max-width: 480px){.container{max-width:460px;padding:0 10px}}@media screen and (max-width: 380px){.container{max-width:370px;padding:0 5px}}.section{margin-bottom:35px}@media screen and (max-width: 480px){.section{margin-bottom:25px}}@media screen and (max-width: 380px){.section{margin-bottom:25px}}.section__title{margin-bottom:10px;font-size:20px;font-weight:bold}@media screen and (max-width: 480px){.section__title{margin-bottom:8px;font-size:18px}}@media screen and (max-width: 380px){.section__title{margin-bottom:6px;font-size:16px}}.proxyService__title{text-align:center;font-size:50px;padding:12px 0;font-weight:bold}@media screen and (max-width: 480px){.proxyService__title{font-size:35px;padding:6px 0}}@media screen and (max-width: 380px){.proxyService__title{font-size:20px;padding:4px 0}}.handledTraffic{width:100%}.handledTraffic__blocks{width:100%;display:flex;flex-flow:row nowrap;align-items:start;justify-content:center;gap:10px}@media screen and (max-width: 480px){.handledTraffic__blocks{gap:5px}}.handledTraffic__block{width:calc(50% - 5px)}.handledTraffic__block_download .handledTraffic__svg{fill:lime}.handledTraffic__block_upload .handledTraffic__svg{fill:red}.handledTraffic__title{text-transform:uppercase;font-weight:bold;background-color:#ddd;padding:3px 5px;font-size:20px}@media screen and (max-width: 480px){.handledTraffic__title{font-size:16px}}@media screen and (max-width: 380px){.handledTraffic__title{font-size:14px}}.handledTraffic__amount{display:flex;flex-flow:row nowrap;align-items:stretch;justify-content:center;background-color:#aaa;padding:10px;border-top:1px solid #000;border-bottom:1px solid #000}@media screen and (max-width: 480px){.handledTraffic__amount{padding:4px}}.handledTraffic__icon{text-align:center;display:flex;flex-flow:column nowrap;align-items:center;justify-content:center;padding:3px 8px;margin-right:8px}.handledTraffic__icon .handledTraffic__svg{height:35px}@media screen and (max-width: 480px){.handledTraffic__icon .handledTraffic__svg{height:25px}}.handledTraffic__number{line-height:1;font-size:56px;font-weight:bold;text-transform:uppercase}@media screen and (max-width: 480px){.handledTraffic__number{font-size:40px}}@media screen and (max-width: 380px){.handledTraffic__number{font-size:28px}}.handledTraffic__decimal{line-height:1.3;align-self:end;font-size:28px;margin-right:12px}@media screen and (max-width: 480px){.handledTraffic__decimal{font-size:20px}}@media screen and (max-width: 380px){.handledTraffic__decimal{font-size:14px;line-height:1.7}}.handledTraffic__measure{font-size:18px;font-weight:bold;align-self:end;line-height:1.6}@media screen and (max-width: 480px){.handledTraffic__measure{font-size:16px}}@media screen and (max-width: 380px){.handledTraffic__measure{font-size:14px}}.handledTraffic__total{background-color:#ddd;padding:8px;font-size:16px;text-align:right}.handledTraffic__totalTitle{text-transform:uppercase;font-weight:bold}.accordeo__radio{display:none}.accordeo__radio:checked~.accordeo__dropdown{display:block}.accordeo__dropdown{display:none}.blockedDestinations__item{background-color:#ddd;overflow:hidden;white-space:nowrap;margin-bottom:5px;text-overflow:ellipsis}.blockedDestinations__url{display:block;width:100%;padding:3px 6px;cursor:pointer}.blockedDestinations__ipList{background-color:#aaa;padding-left:10px}.blockedDestinations__ipItem{padding:4px}.information__text{word-break:break-all}.lastDestinations{width:100%;padding:5px 0}.lastDestinations__list{width:100%}.lastDestinations__item{width:100%;margin-bottom:5px;padding:3px 6px;overflow:hidden;text-overflow:ellipsis}.lastDestinations__item:last-child{margin-bottom:0}.lastDestinations__item_blocked{background-color:#888}.lastDestinations__item_allowed{background-color:#ddd}.topDestinations__block{margin-bottom:14px}.topDestinations__block:last-child{margin-bottom:0}.topDestinations__title{font-weight:bold;margin-bottom:10px}.topDestinations__item{display:flex;justify-content:start;align-items:center;flex-flow:row nowrap;margin-bottom:5px;background-color:#ddd}.topDestinations__destination{padding:4px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;flex-grow:0}.topDestinations__counter{flex-grow:0;margin-left:auto;padding:4px;background-color:#e0e0e0;color:#888;text-align:right}.copyright{padding:10px 0;text-align:center;color:#888}/*# sourceMappingURL=main.min.css.map */ \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index e198c63..29fc872 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -54,7 +54,7 @@ void usage() " -a --bind-to-address <127.0.0.1>\n" " -p --bind-to-port <8161>\n" " -l --log-level (off, error, warn, info, debug)\n" - " -s --top-lists-size <5>\n" + " -s --top-lists-size <10>\n" " -D --reject-ip-from-statistics\n\n" "N O T E S:\n" diff --git a/src/statistics.cpp b/src/statistics.cpp index a5c33ad..018e75f 100644 --- a/src/statistics.cpp +++ b/src/statistics.cpp @@ -53,7 +53,7 @@ void Statistics::report(const LogEvent& event) m_lastDestinationsMtx.lock(); if (not m_lastDestinations.contains(event.dest)) { - if (m_lastDestinations.size() >= static_cast(g::p::LAST_AND_TOP_LIST_SIZE)) + if (m_lastDestinations.size() == 5) { m_lastDestinations.pop_back(); } diff --git a/src/webpage.cpp b/src/webpage.cpp index 13971ac..70c7f3a 100644 --- a/src/webpage.cpp +++ b/src/webpage.cpp @@ -36,14 +36,10 @@ const QString WebPage::m_lastDestinationItemBlocked ="\ {{VALUE}}\n\ \n"; -const QString WebPage::m_dailyTopDestinationItem = "\ -
  • \n\ - {{VALUE}}\n\ -
  • \n"; - -const QString WebPage::m_totalTopDestinationItem = "\ -
  • \n\ - {{VALUE}}\n\ +const QString WebPage::m_topDestinationItem = "\ +
  • \n\ + {{VALUE}}\n\ + {{COUNT}}\n\
  • \n"; const QString WebPage::m_blockedDestinationsBlock = "\ @@ -211,14 +207,14 @@ void WebPage::topDestinations(QString &document) QString dailyTopList; for (const auto& dTop: Statistics::dailyTopDestinations()) { - dailyTopList += dailyTopDestinationItem(dTop.first, dTop.second); + dailyTopList += topDestinationItem(dTop.first, dTop.second); } document.replace(g::c::HA_DAILY_TOP_DESTINATIONS_LIST, dailyTopList); QString totalTopList; for (const auto& dTop: Statistics::totalTopDestinations()) { - totalTopList += totalTopDestinationItem(dTop.first, dTop.second); + totalTopList += topDestinationItem(dTop.first, dTop.second); } document.replace(g::c::HA_TOTAL_TOP_DESTINATIONS_LIST, totalTopList); } @@ -319,17 +315,9 @@ QString WebPage::lastDestinationItemBlocked(const QString &destination) return result; } -QString WebPage::dailyTopDestinationItem(const QString &destination, quint64 count) +QString WebPage::topDestinationItem(const QString &destination, quint64 count) { - QString result {m_dailyTopDestinationItem}; - result.replace("{{VALUE}}", destination); - result.replace("{{COUNT}}", QString::number(count)); - return result; -} - -QString WebPage::totalTopDestinationItem(const QString &destination, quint64 count) -{ - QString result {m_totalTopDestinationItem}; + QString result {m_topDestinationItem}; result.replace("{{VALUE}}", destination); result.replace("{{COUNT}}", QString::number(count)); return result; diff --git a/src/webpage.h b/src/webpage.h index f7e9006..ca98c38 100644 --- a/src/webpage.h +++ b/src/webpage.h @@ -42,15 +42,13 @@ private: static QString lastDestinationItemAllowed(const QString& destination); static QString lastDestinationItemBlocked(const QString& destination); - static QString dailyTopDestinationItem(const QString& destination, quint64 count); - static QString totalTopDestinationItem(const QString& destination, quint64 count); + static QString topDestinationItem(const QString& destination, quint64 count); static QString blockedDestinationItem(const QString& destination, const QStringList& addresses); static HumanReadableValue bytesToHumanReadableString(quint64 bytes); static const QString m_lastDestinationItemAllowed; static const QString m_lastDestinationItemBlocked; - static const QString m_dailyTopDestinationItem; - static const QString m_totalTopDestinationItem; + static const QString m_topDestinationItem; static const QString m_blockedDestinationsBlock; static const QString m_blockedDestinationItemLvl1; static const QString m_blockedDestinationItemLvl2;