mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-05 04:15:03 -04:00
Add Cross-Origin-Resource-Policy header to thumbnail and download media endpoints (#12944)
This commit is contained in:
parent
3c5549e74a
commit
9b683ea80f
5 changed files with 44 additions and 2 deletions
|
@ -928,6 +928,17 @@ def set_cors_headers(request: Request) -> None:
|
|||
)
|
||||
|
||||
|
||||
def set_corp_headers(request: Request) -> None:
|
||||
"""Set the CORP headers so that javascript running in a web browsers can
|
||||
embed the resource returned from this request when their client requires
|
||||
the `Cross-Origin-Embedder-Policy: require-corp` header.
|
||||
|
||||
Args:
|
||||
request: The http request to add the CORP header to.
|
||||
"""
|
||||
request.setHeader(b"Cross-Origin-Resource-Policy", b"cross-origin")
|
||||
|
||||
|
||||
def respond_with_html(request: Request, code: int, html: str) -> None:
|
||||
"""
|
||||
Wraps `respond_with_html_bytes` by first encoding HTML from a str to UTF-8 bytes.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue