summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPiotr Dobrowolski <admin@tastycode.pl>2016-11-26 12:38:19 +0100
committerPiotr Dobrowolski <admin@tastycode.pl>2016-11-26 12:38:19 +0100
commit007b880dc5dd27fd1d53c3429541120c8c3b682c (patch)
treee4e27d16ef6c455a7ac0bdff26f35da7f1d49c00
parentec6cf1afd2184ff03ad257fa7b4b6908311af423 (diff)
downloadcheckinator-007b880dc5dd27fd1d53c3429541120c8c3b682c.tar.gz
checkinator-007b880dc5dd27fd1d53c3429541120c8c3b682c.tar.bz2
checkinator-007b880dc5dd27fd1d53c3429541120c8c3b682c.zip
Add ESPs. Because we can.
-rw-r--r--at.py11
-rw-r--r--templates/main.html5
2 files changed, 13 insertions, 3 deletions
diff --git a/at.py b/at.py
index 06b0fd5..54f1747 100644
--- a/at.py
+++ b/at.py
@@ -42,9 +42,9 @@ def restrict_ip(prefix='', exclude=[]):
def func(*a, **kw):
r_addr = v4addr()
if not r_addr.startswith(prefix) or r_addr in exclude:
- app.logger.info('got IP %s, rejecting',r_addr)
-
+ app.logger.info('got IP %s, rejecting', r_addr)
abort(403)
+
return f(*a, **kw)
return func
return decorator
@@ -244,6 +244,7 @@ def list_all():
result['users'] = map(prettify_user, result['users'])
result['unknown'] = len(result['unknown'])
result['kektops'] = len(result['kektops'])
+ result['esps'] = len(result['esps'])
res = make_response(json.dumps(result), 200)
res.headers['Access-Control-Allow-Origin'] = '*'
return res
@@ -257,9 +258,12 @@ def now_at():
# das kektop sorting maschine
kektops = set()
unknown = set()
+ esps = set()
for u in all_unknown:
if u.startswith('90:e6:ba:84'):
kektops.add(u)
+ elif u.startswith('5c:cf:7f'):
+ esps.add(u)
else:
unknown.add(u)
@@ -269,7 +273,8 @@ def now_at():
users[info.owner] = devices[info.hwaddr][0]
users_sorted = sorted(users.items(), key=lambda (u, a): a, reverse=True)
- return dict(users=users_sorted, unknown=unknown, kektops=kektops)
+ return dict(users=users_sorted, unknown=unknown, kektops=kektops,
+ esps=esps)
restrict_to_hs = restrict_ip(prefix=app.config['CLAIMABLE_PREFIX'],
diff --git a/templates/main.html b/templates/main.html
index f49d90b..3ac5c50 100644
--- a/templates/main.html
+++ b/templates/main.html
@@ -24,6 +24,11 @@ Now at hackerspace
{% pluralize %}
There are {{ n_kek }} unknown kektops operating.
{% endtrans %}
+ {% trans n_esp=esps|length %}
+ There is {{ n_esp }} unknown ESP operating.
+ {% pluralize %}
+ There are {{ n_esp }} unknown ESPs operating.
+ {% endtrans %}
<hr>
<a href="claim">Claim this device!</a>
{% endblock %}