Esempio n. 1
0
                        mimetype="application/json")

    return response(environ, start_response)


def app(environ, start_response):
    embed_url = os.environ.get("H_EMBED_URL", "https://hypothes.is/embed.js")

    template_params = environ.get("pywb.template_params", {})
    template_params["h_embed_url"] = embed_url
    environ["pywb.template_params"] = template_params

    return pywb.apps.wayback.application(environ, start_response)


application = RequestHeaderSanitiser(app)
application = ResponseHeaderSanitiser(application)
application = Blocker(
    application,
    checkmate_host=os.environ["CHECKMATE_URL"],
    api_key=os.environ["CHECKMATE_API_KEY"],
)
application = UserAgentDecorator(application, "Hypothesis-Via")
application = ConfigExtractor(application)
application = wsgi.DispatcherMiddleware(
    application,
    {
        "/favicon.ico": static.Cling("static/favicon.ico"),
        "/robots.txt": static.Cling("static/robots.txt"),
        "/static": static.Cling("static/"),
        "/static/__pywb": static.Cling(resource_filename("pywb", "static/")),
Esempio n. 2
0
 def app(self):
     return RequestHeaderSanitiser(upstream_app, blacklist=['foo', 'bar'])
Esempio n. 3
0
 def app(self):
     return RequestHeaderSanitiser(upstream_app, blacklist=["foo", "bar"])
Esempio n. 4
0
    def client(self, upstream_app):
        app = RequestHeaderSanitiser(upstream_app,
                                     blacklist=["blocked-header"])

        return Client(app, Response)