-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtemplate.py
98 lines (98 loc) · 3.17 KB
/
template.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
TEMPLATE = """<!doctype html>
<html>
<head>
<title>Logparser</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
html { --black: black; --whitesmoke: #f0f0f0; --black: black; }
@media (prefers-color-scheme: dark) {
html { --white: black; --whitesmoke: #202020; --black: white; }
}
* { margin: 0; padding: 0; }
body {
background-color: var(--white);
color: var(--black);
font-family: Tahoma, Ubuntu, Cantarell, Oxygen, sans-serif;
font-size: 13px;
line-height: 20px;
}
sup { line-height: 0; }
h3 sup { font-size: 11px; margin-left: 1px; }
.section {
margin: 0 auto;
max-width: 480px;
padding: 0 10px;
padding-top: 10px;
}
.section:last-child { padding-bottom: 20px; }
.section p {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.section span {
float: left;
margin-right: 10px;
text-align: right;
width: 20%;
}
.section .even {
background-color: var(--whitesmoke); border-radius: 5px;
}
</style>
</head>
<body>
<div class="section">
<h3>Days<sup>{{ days | length }}</sup></h3>
{% for day, ips in days | reverse %}
{% if ips | length > lowest %}
<p class="{{ loop.cycle('odd', 'even') }}">
<span>{{ ips | length }}</span> {{ day }}
</p>
{% endif %}
{% endfor %}
</div>
<div class="section">
<h3>Browsers<sup>{{ browsers | length }}</sup></h3>
{% for browser, ips in browsers | reverse %}
{% if ips | length > lowest %}
<p class="{{ loop.cycle('odd', 'even') }}">
<span>{{ ips | length }}</span> {{ browser }}
</p>
{% endif %}
{% endfor %}
</div>
<div class="section">
<h3>Operating Systems<sup>{{ systems | length }}</sup></h3>
{% for system, ips in systems | reverse %}
{% if ips | length > lowest %}
<p class="{{ loop.cycle('odd', 'even') }}">
<span>{{ ips | length }}</span> {{ system }}
</p>
{% endif %}
{% endfor %}
</div>
<div class="section">
<h3>Bots<sup>{{ bots | length }}</sup></h3>
{% for bot, ips in bots | reverse %}
{% if ips | length > lowest %}
<p class="{{ loop.cycle('odd', 'even') }}">
<span>{{ ips | length }}</span> {{ bot }}
</p>
{% endif %}
{% endfor %}
</div>
<div class="section">
<h3>Referrers<sup>{{ refs | length }}</sup></h3>
{% for ref, ips in refs | reverse %}
{% if ips | length > lowest %}
<p class="{{ loop.cycle('odd', 'even') }}">
<span>{{ ips | length }}</span> {{ ref }}
</p>
{% endif %}
{% endfor %}
</div>
</body>
</html>
"""