heartranked

git clone https://git.tarina.org/heartranked
Log | Files | Refs

commit e873fe56cfe24323872673aa2273c5080a776d59
parent 6f949e64fa0ad5f330121dcf7810fe07ba0f5255
Author: rob <rob@tarina.org>
Date:   Mon, 10 Aug 2026 02:16:47 +0300

stats

Diffstat:
Mhtml/stats.html | 17++++++++---------
Mserver.py | 23++++++++++-------------
2 files changed, 18 insertions(+), 22 deletions(-)

diff --git a/html/stats.html b/html/stats.html @@ -11,8 +11,7 @@ $ count = 0 <head> <title>THE STATS</title> - -<a href="/dude">go back</a> | +<a href="/">go back</a> | <a href="?">no filter</a> | <a href="?logfilter=bots">filter bots</a> | <a href="?logfilter=botsandme">filter bots and me</a> @@ -26,38 +25,38 @@ $ filters = ['SemrushBot', 'Windows NT', 'Applebot', 'Amazonbot', 'bingbot', 'Cl $for i in visitors: $if logfilter == 'bots': $for f in filters: - $if f in i.environ: + $if f in i['environ']: $ show = False $ break $else: $ show = True $if show == True: - <img src="/static/flags/${i.countrycode}.png"> | $i.country | $i.ip | $i.referer | $i.environ | $i.time <br> + <img src="/static/flags/${i['countrycode']}.png"> | $i['country'] | $i['ip'] | $i['referer'] | $i['environ'] | $i['time'] <br> $ count = count + 1 $ show = False $elif logfilter == 'botsandme': $for f in filters: - $if f in i.environ: + $if f in i['environ']: $ show = False $ break $else: $ show = True $for ip in ip_filters: - $if ip in i.ip: + $if ip in i['ip']: $ show = False $ break $else: $ show = True $if show == True: - <img src="/static/flags/${i.countrycode}.png"> | $i.country | $i.ip | $i.referer | $i.environ | $i.time <br> + <img src="/static/flags/${i['countrycode']}.png"> | $i['country'] | $i['ip'] | $i['referer'] | $i['environ'] | $i['time'] <br> $ count = count + 1 $ show = False $else: - <img src="/static/flags/${i.countrycode}.png"> | $i.country | $i.ip | $i.referer | $i.environ | $i.time <br> + <img src="/static/flags/${i['countrycode']}.png"> | $i['country'] | $i['ip'] | $i['referer'] | $i['environ'] | $i['time'] <br> $ count = count + 1 <br> -total potential real visitors: +total potential real visitors $count </div> </head> diff --git a/server.py b/server.py @@ -834,33 +834,30 @@ def visitorlog(ip, referer, environ): return def getvisitors(): - #visitors = db.select('visitors') - #visitors = db.query('SELECT * FROM visitors ORDER BY time DESC LIMIT 10000') - visitors = get_files_by_time('r/visitors/'+ip,newest_first=True) - #total = db.query('SELECT COUNT(*) AS total_visits FROM visitors') + visitors=[] + v = get_files_by_time('r/visitors/',newest_first=True) + if v: + for i in v: + visit=loadjson('r/visitors/'+i) + visitors.append(visit) + print(visit) total=len(os.listdir(basedir+'r/visitors/')) - #unique = db.query('SELECT COUNT(DISTINCT ip) AS unique_visits FROM visitors') unique=[] for i in visitors: for p in visitors: - if i == p: + if i['ip'] == p['ip']: unique.append(i) uniquevisits=len(unique) return visitors, total, uniquevisits def getvisits(): - #limit=100 - #visits = db.query("SELECT * FROM visitors ORDER BY time DESC LIMIT " + str(limit)) visitors=[] - v=os.listdir(basedir+'r/visitors/') + #v=os.listdir(basedir+'r/visitors/') + v = get_files_by_time('r/visitors/',newest_first=True) for i in v: visit=loadjson('r/visitors/'+i) visitors.append(visit) - #visitors = db.select('visitors') - #visitors=loadjson('r/visitors/') - #total = db.query('SELECT COUNT(*) AS total_visits FROM visitors') total=len(os.listdir(basedir+'r/visitors/')) - #unique = db.query('SELECT COUNT(DISTINCT ip) AS unique_visits FROM visitors') unique=[] for i in visitors: for p in visitors: