mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-14 12:46:49 +00:00
style: Reformat with nightly
This commit is contained in:
11 files changed
+56
-47
No files matched your search
+2
-1
@@ -94,7 +94,8 @@ impl IntoResponse for WebError {
|
||||
error: self,
|
||||
status,
|
||||
context: TemplateContext {
|
||||
// Statically set false to prevent error pages from being indexed.
|
||||
// Statically set false to prevent error pages from being
|
||||
// indexed.
|
||||
allow_indexing: false,
|
||||
csp_nonce: String::new(),
|
||||
},
|
||||
|
||||
@@ -48,11 +48,12 @@ pub(crate) struct FormInput<'a> {
|
||||
pub autocomplete: &'a str,
|
||||
|
||||
// This is a hack to make the form! macro's support for client-only fields
|
||||
// work properly. Client-only fields are specified in the macro without a type and aren't
|
||||
// included in the POST body or as a field in the generated struct.
|
||||
// To keep the field from being included in the POST body, its `name` property needs not to
|
||||
// be set in the template. Because of limitations of macro_rules!'s repetition feature, this
|
||||
// field needs to exist to allow the template to check if the field is client-only.
|
||||
// work properly. Client-only fields are specified in the macro without a
|
||||
// type and aren't included in the POST body or as a field in the generated
|
||||
// struct. To keep the field from being included in the POST body, its
|
||||
// `name` property needs not to be set in the template. Because of
|
||||
// limitations of macro_rules!'s repetition feature, this field needs to
|
||||
// exist to allow the template to check if the field is client-only.
|
||||
#[doc(hidden)]
|
||||
pub type_name: Option<&'static str>,
|
||||
}
|
||||
|
||||
@@ -61,9 +61,10 @@ pub(super) async fn template_context_middleware(
|
||||
response.headers_mut().insert(
|
||||
header::CONTENT_SECURITY_POLICY,
|
||||
HeaderValue::from_str(&format!(
|
||||
// TODO: `unsafe-inline` for `style-src` defeats the purpose of having it, but
|
||||
// it's necessary to set CSS variables using the `style` attribute without
|
||||
// JavaScript. Come back to this once there's a less shitty solution.
|
||||
// TODO: `unsafe-inline` for `style-src` defeats the purpose of
|
||||
// having it, but it's necessary to set CSS variables using the
|
||||
// `style` attribute without JavaScript. Come back to this once
|
||||
// there's a less shitty solution.
|
||||
"default-src 'none'; style-src 'self' 'unsafe-inline'; img-src 'self' https: data:; \
|
||||
script-src 'nonce-{csp_nonce}'; child-src {child_src};"
|
||||
))
|
||||
|
||||
Reference in new issue
Block a user