Skip to content

Commit

Permalink
Recursive Inscriptions (ordinals#2167)
Browse files Browse the repository at this point in the history
  • Loading branch information
casey authored and gmart7t2 committed Jun 14, 2023
1 parent 08780c3 commit 1dafc34
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/subcommand/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,11 @@ impl Server {
);
headers.insert(
header::CONTENT_SECURITY_POLICY,
HeaderValue::from_static("default-src 'unsafe-eval' 'unsafe-inline' data:"),
HeaderValue::from_static("default-src 'self' 'unsafe-eval' 'unsafe-inline' data:"),
);
headers.append(
header::CONTENT_SECURITY_POLICY,
HeaderValue::from_static("default-src *:*/content/ 'unsafe-eval' 'unsafe-inline' data:"),
);
headers.insert(
header::CACHE_CONTROL,
Expand Down Expand Up @@ -2202,7 +2206,7 @@ mod tests {
server.assert_response_csp(
format!("/preview/{}", InscriptionId::from(txid)),
StatusCode::OK,
"default-src 'unsafe-eval' 'unsafe-inline' data:",
"default-src 'self' 'unsafe-eval' 'unsafe-inline' data:",
"hello",
);
}
Expand Down
11 changes: 9 additions & 2 deletions tests/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,15 @@ fn inscription_content() {
"text/plain;charset=utf-8"
);
assert_eq!(
response.headers().get("content-security-policy").unwrap(),
"default-src 'unsafe-eval' 'unsafe-inline' data:"
response
.headers()
.get_all("content-security-policy")
.into_iter()
.collect::<Vec<&http::HeaderValue>>(),
&[
"default-src 'self' 'unsafe-eval' 'unsafe-inline' data:",
"default-src *:*/content/ 'unsafe-eval' 'unsafe-inline' data:"
]
);
assert_eq!(response.bytes().unwrap(), "FOO");
}
Expand Down

0 comments on commit 1dafc34

Please sign in to comment.