Ejemplo n.º 1
0
 def app(self):
     return ResponseHeaderSanitiser(upstream_app, blacklist=["baz"])
Ejemplo n.º 2
0
    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/")),
        "/static/__shared/viewer/web/viewer.html": redirect_old_viewer,
Ejemplo n.º 3
0
    def client(self, upstream_app):
        app = ResponseHeaderSanitiser(upstream_app,
                                      blacklist=["blocked-header"])

        return Client(app, Response)