From 5ae90eeae3debce448a18e425a5e89b1f8f3fdec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Zieli=C5=84ski?= Date: Sun, 26 Jul 2015 19:08:51 +0200 Subject: [PATCH] adjustments for fc00.atomshare.net --- web/database.sql | 4 ++-- web/graphData.py | 6 ++++-- web/templates/about.html | 3 ++- web/templates/base.html | 2 +- web/web.py | 7 +++++-- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/web/database.sql b/web/database.sql index dbe7dbd..d09fbee 100644 --- a/web/database.sql +++ b/web/database.sql @@ -1,5 +1,5 @@ -CREATE DATABASE IF NOT EXISTS `fc00`; -USE `fc00`; +CREATE DATABASE IF NOT EXISTS `cjdns`; +USE `cjdns`; -- diff --git a/web/graphData.py b/web/graphData.py index 841bc20..6dbba48 100644 --- a/web/graphData.py +++ b/web/graphData.py @@ -1,6 +1,7 @@ import json from database import NodeDB from graph import Node, Edge +import traceback def insert_graph_data(config, json_str): try: @@ -13,14 +14,14 @@ def insert_graph_data(config, json_str): try: for n in graph_data['nodes']: - try: + try: node = Node(n['ip'], version=n['version']) nodes[n['ip']] = node except Exception: pass for e in graph_data['edges']: - try: + try: edge = Edge(nodes[e['a']], nodes[e['b']]) edges.append(edge) except Exception: @@ -37,6 +38,7 @@ def insert_graph_data(config, json_str): with NodeDB(config) as db: db.insert_graph(nodes, edges) except Exception: + traceback.print_exc() return 'Database failure' return None diff --git a/web/templates/about.html b/web/templates/about.html index 0e67892..69eb7fb 100644 --- a/web/templates/about.html +++ b/web/templates/about.html @@ -11,7 +11,8 @@

The network page has a map of Hyperboria as it is now. The map is not complete since it is hard/impossible to get a full picture of the network. A rough estimate is that at least half of the nodes are pictured here, probably more. The nodes and links that are shown on the page are very likely to exist but this should not be taken as a guarantee.

Contact

-

Currently fc00 is run by randati. If you have something to say or you would like to help, contact him on HypeIRC or EFNet.

+

fc00 was orginally created by Randati. Currently fc00 is run by zielmicha. + If you have something to say or you would like to help, contact him via michal@zielinscy.org.pl.

{% endblock %} diff --git a/web/templates/base.html b/web/templates/base.html index 9165ff9..1cc7d4f 100644 --- a/web/templates/base.html +++ b/web/templates/base.html @@ -14,7 +14,7 @@ diff --git a/web/web.py b/web/web.py index 25866d2..90fdc39 100644 --- a/web/web.py +++ b/web/web.py @@ -7,7 +7,10 @@ app.config.from_pyfile('web_config.cfg') @app.context_processor def add_ip(): - return dict(ip=request.environ['REMOTE_ADDR']) + ip = request.headers['x-real-ip'] + if ip == '10.18.3.20': + ip = request.headers['x-atomshare-real-ip'] + return dict(ip=ip) @app.route('/') @@ -31,4 +34,4 @@ def page_sendGraph(): return 'Error: %s' % ret if __name__ == '__main__': - app.run(host='::') + app.run(host='localhost', port=3000)