def get_authentication_provider_url(redirect_uri): if config.github_oauth_consumer_key: state = generate_shitty_random_string() session["authentication_oauth_state"] = state return "%s?%s" % (authorize_url, urllib.urlencode({ "client_id": config.github_oauth_consumer_key, "redirect_uri": redirect_uri, "state": state}))
app = Flask("ob2.web", static_url_path=("%s/static" % config.web_public_root)) if config.web_behind_proxy: app.wsgi_app = ProxyFix(app.wsgi_app) app.logger.addHandler(StreamHandler(sys.stdout)) app.debug = config.debug_mode app.config["SESSION_COOKIE_PATH"] = config.web_public_root + "/" app.config["SESSION_COOKIE_SECURE"] = config.web_https app.config["SERVER_NAME"] = config.web_public_host app.jinja_env.globals.update(JINJA_EXPORTS) # We need to tell our mailer daemon about the web application, so that we can use url_for() to # generate URL's in our email templates. We can't just import "app" from this module, because that # would create a cyclic import dependency. mailer.register_app(app) cache_buster_hash = generate_shitty_random_string(8) for blueprint in ("onboarding", "dashboard", "ta", "pushhook"): module = import_module("ob2.web.blueprints.%s" % blueprint) app.register_blueprint(module.blueprint, url_prefix=config.web_public_root) @app.url_defaults def hashed_url_for_static_file(endpoint, values): if 'static' == endpoint or endpoint.endswith('.static'): filename = values.get('filename') if filename: param_name = 'ver' while param_name in values: param_name = '_' + param_name values[param_name] = cache_buster_hash
app = Flask("ob2.web", static_url_path=("%s/static" % config.web_public_root)) if config.web_behind_proxy: app.wsgi_app = ProxyFix(app.wsgi_app) app.logger.addHandler(StreamHandler(sys.stdout)) app.debug = config.debug_mode app.config["SESSION_COOKIE_PATH"] = config.web_public_root app.config["SESSION_COOKIE_SECURE"] = config.web_https app.config["SERVER_NAME"] = config.web_public_host app.jinja_env.globals.update(JINJA_EXPORTS) # We need to tell our mailer daemon about the web application, so that we can use url_for() to # generate URL's in our email templates. We can't just import "app" from this module, because that # would create a cyclic import dependency. mailer.register_app(app) cache_buster_hash = generate_shitty_random_string(8) for blueprint in ("onboarding", "dashboard", "ta", "pushhook"): module = import_module("ob2.web.blueprints.%s" % blueprint) app.register_blueprint(module.blueprint, url_prefix=config.web_public_root) @app.url_defaults def hashed_url_for_static_file(endpoint, values): if 'static' == endpoint or endpoint.endswith('.static'): filename = values.get('filename') if filename: