コード例 #1
0
ファイル: security_test.py プロジェクト: Albermonte/via
 def app(self):
     return ResponseHeaderSanitiser(upstream_app, blacklist=["baz"])
コード例 #2
0
ファイル: app.py プロジェクト: BEASTMODE2629/via
    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,
コード例 #3
0
ファイル: security_test.py プロジェクト: llacb47/legacyvia
    def client(self, upstream_app):
        app = ResponseHeaderSanitiser(upstream_app,
                                      blacklist=["blocked-header"])

        return Client(app, Response)