from synchrony import streams from synchrony.models import * from synchrony.views import base from synchrony.views.maps import maps from synchrony.controllers.usergroups import init_user_groups app.public = True app.config.from_object("synchrony.config") app.template_folder = os.path.join(os.path.dirname(__file__), 'templates') + os.path.sep app.default_network = "alpha" # Keep a record of how much data we've served and received app.bytes_sent = 0 app.bytes_received = 0 @app.before_request def fence_internet_hosts(): """ Relegate hosts connecting over the internet to the /v1/peers endpoint. """ if not request.path.startswith('/v1/peers') and not request.remote_addr[:3] in ['127', '10.', '192']: log("%s tried to retrieve %s" % (request.remote_addr, request.path), "warning") return make_response("Forbidden.",403) # Read/write session cookie HMAC key secret_key_path = os.path.abspath(os.path.curdir + os.path.sep + ".secret_key") if not os.path.exists(secret_key_path): try: