This commit is contained in:
Mateusz Gruszczyński committed 2026-10-12 12:19:33 +02:00
1 parent acfe926066
commit df403c0aa7
26 files changed
+1502 -144

No files matched your search

+5 -2
View File
@@ -125,6 +125,7 @@ pub fn router(
"/api/auth/resources/privacy",
post(auth::set_resource_privacy),
)
.route("/api/auth/resources/mentions", get(auth::resource_mentions))
.route(
"/api/auth/resources/sharing",
get(auth::resource_sharing)
@@ -261,7 +262,6 @@ pub fn router(
.with_state(state)
}
async fn language_catalog() -> Response {
let mut response = Json(crate::i18n::metadata()).into_response();
response.headers_mut().insert(
@@ -375,7 +375,10 @@ fn is_file_path(path: &str) -> bool {
}
fn is_asset_path(path: &str) -> bool {
path == "/assets" || path.starts_with("/assets/") || path == "/lang" || path.starts_with("/lang/")
path == "/assets"
|| path.starts_with("/assets/")
|| path == "/lang"
|| path.starts_with("/lang/")
}
fn is_icon_path(path: &str) -> bool {
+32 -27
View File
@@ -81,27 +81,21 @@ async fn share_session_redirect(
) -> Response {
let client_key = crate::security::client_key(headers);
let cookie = match share.map(str::trim).filter(|value| !value.is_empty()) {
Some(share) => match auth::create_share_session(
state,
kind,
slug,
share,
&client_key,
)
.await
{
Ok(Some(session)) => Some(crate::security::share_session_cookie(
kind,
slug,
&session.token,
session.max_age_seconds,
)),
Ok(None) => None,
Err(error) => {
tracing::warn!(error = %error.message, kind, slug, "failed to exchange share link for guest session");
None
Some(share) => {
match auth::create_share_session(state, kind, slug, share, &client_key).await {
Ok(Some(session)) => Some(crate::security::share_session_cookie(
kind,
slug,
&session.token,
session.max_age_seconds,
)),
Ok(None) => None,
Err(error) => {
tracing::warn!(error = %error.message, kind, slug, "failed to exchange share link for guest session");
None
}
}
},
}
None => None,
};
@@ -118,10 +112,9 @@ async fn share_session_redirect(
header::CACHE_CONTROL,
HeaderValue::from_static("no-store, max-age=0"),
);
response.headers_mut().insert(
"referrer-policy",
HeaderValue::from_static("no-referrer"),
);
response
.headers_mut()
.insert("referrer-policy", HeaderValue::from_static("no-referrer"));
response
}
@@ -383,7 +376,11 @@ pub(super) async fn workspace(
)
.replace(
"__WORKSPACE_TITLE_I18N__",
if workspace.is_private != 0 { r#"data-i18n="common.workspace""# } else { "" },
if workspace.is_private != 0 {
r#"data-i18n="common.workspace""#
} else {
""
},
);
assets::render_html(
&html,
@@ -460,7 +457,11 @@ pub(super) async fn note(
} else {
&note.title
},
if workspace.is_private != 0 { Some("common.note") } else { None },
if workspace.is_private != 0 {
Some("common.note")
} else {
None
},
if workspace.is_private != 0 {
"Workspace"
} else {
@@ -548,7 +549,11 @@ pub(super) fn error_response(
let html = include_str!("../../static/error.html")
.replace(
"__APP_THEME_BOOTSTRAP__",
&format!("{}{}", assets::theme_bootstrap(), assets::language_bootstrap()),
&format!(
"{}{}",
assets::theme_bootstrap(),
assets::language_bootstrap()
),
)
.replace(
"__APP_STYLESHEET__",