icons and logos

This commit is contained in:
Mateusz Gruszczyński
2026-07-31 14:15:44 +02:00
parent 618e5ae0fb
commit c6e9a3dd43
16 changed files with 182 additions and 17 deletions
Generated
+1 -1
View File
@@ -2581,7 +2581,7 @@ dependencies = [
[[package]]
name = "rustpad"
version = "0.2.10"
version = "0.2.11"
dependencies = [
"argon2",
"aws-config",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "rustpad"
version = "0.2.10"
version = "0.2.11"
edition = "2024"
rust-version = "1.94"
description = "Collaborative Markdown notepad built with Axum, WebSockets and SQLite, PostgreSQL and MySQL"
+10 -4
View File
@@ -46,10 +46,9 @@ pub fn router(
}
});
let asset_cache_control = HeaderValue::from_str(&crate::cache::cache_control(
asset_cache_max_age_seconds,
))
.expect("valid asset cache-control header");
let asset_cache_control =
HeaderValue::from_str(&crate::cache::cache_control(asset_cache_max_age_seconds))
.expect("valid asset cache-control header");
Router::new()
.route("/", get(home))
@@ -63,6 +62,13 @@ pub fn router(
.route("/health", get(health))
.route("/robots.txt", get(robots_txt))
.route("/favicon.ico", get(favicon))
.route("/favicon.svg", get(favicon_svg))
.route("/favicon-32.png", get(favicon_png))
.route("/apple-touch-icon.png", get(apple_touch_icon))
.route("/icons/favicon.ico", get(favicon))
.route("/icons/favicon.svg", get(favicon_svg))
.route("/icons/favicon-32.png", get(favicon_png))
.route("/icons/apple-touch-icon.png", get(apple_touch_icon))
.route("/f/{token}/{filename}", get(api::download_file))
.route(
"/files/{directory}/{filename}",
+76 -4
View File
@@ -28,6 +28,7 @@ fn render_editor_page(
) -> Response {
let html = include_str!("../../static/editor.html")
.replace("__RESOURCE_KIND__", resource_kind)
.replace("__RESOURCE_LABEL__", "Note")
.replace("__DOCUMENT_TITLE__", &escape_html(document_title))
.replace("__PARENT_TITLE__", &escape_html(parent_title))
.replace("__PARENT_URL__", &escape_html(parent_url))
@@ -49,8 +50,71 @@ pub(super) async fn health() -> &'static str {
"ok"
}
pub(super) async fn favicon() -> StatusCode {
StatusCode::NO_CONTENT
pub(super) async fn favicon() -> Response {
static FAVICON: &[u8] = include_bytes!("../../static/icons/favicon.ico");
(
[
(
header::CONTENT_TYPE,
HeaderValue::from_static("image/x-icon"),
),
(
header::CACHE_CONTROL,
HeaderValue::from_static("public, max-age=604800"),
),
],
FAVICON,
)
.into_response()
}
pub(super) async fn favicon_svg() -> Response {
static FAVICON: &str = include_str!("../../static/icons/favicon.svg");
(
[
(
header::CONTENT_TYPE,
HeaderValue::from_static("image/svg+xml; charset=utf-8"),
),
(
header::CACHE_CONTROL,
HeaderValue::from_static("public, max-age=604800"),
),
],
FAVICON,
)
.into_response()
}
pub(super) async fn favicon_png() -> Response {
static FAVICON: &[u8] = include_bytes!("../../static/icons/favicon-32.png");
(
[
(header::CONTENT_TYPE, HeaderValue::from_static("image/png")),
(
header::CACHE_CONTROL,
HeaderValue::from_static("public, max-age=604800"),
),
],
FAVICON,
)
.into_response()
}
pub(super) async fn apple_touch_icon() -> Response {
static ICON: &[u8] = include_bytes!("../../static/icons/apple-touch-icon.png");
(
[
(header::CONTENT_TYPE, HeaderValue::from_static("image/png")),
(
header::CACHE_CONTROL,
HeaderValue::from_static("public, max-age=604800"),
),
],
ICON,
)
.into_response()
}
pub(super) async fn robots_txt() -> Response {
@@ -201,8 +265,16 @@ pub(super) async fn note(
&state,
"note",
"note",
if workspace.is_private != 0 { "Note" } else { &note.title },
if workspace.is_private != 0 { "Workspace" } else { &workspace.title },
if workspace.is_private != 0 {
"Note"
} else {
&note.title
},
if workspace.is_private != 0 {
"Workspace"
} else {
&workspace.title
},
&format!("/w/{workspace_slug}"),
"",
"workspace",
+6 -1
View File
@@ -60,7 +60,12 @@ pub fn render_html(
"false"
},
)
.replace("</head>", &format!("{frontend_config}</head>"));
.replace(
"</head>",
&format!(
r#"<link rel="icon" href="/favicon.svg" type="image/svg+xml"><link rel="icon" href="/favicon.ico" sizes="any"><link rel="icon" href="/favicon-32.png" type="image/png" sizes="32x32"><link rel="apple-touch-icon" href="/apple-touch-icon.png">{frontend_config}</head>"#
),
);
let mut response = Html(html).into_response();
response.headers_mut().insert(
+51 -1
View File
@@ -2586,7 +2586,7 @@ dialog::backdrop {
}
.hide-preview-line-numbers .preview {
padding-left: 24px;
padding-left: 0;
}
.hide-preview-line-numbers .preview-source-line::before {
@@ -6149,3 +6149,53 @@ dialog::backdrop {
.pad-page .participant-badges:empty {
display: none;
}
/* Unified RustPad resource identity used by notes and workspaces. */
.resource-brand {
display: grid;
flex: 0 0 auto;
gap: 2px;
min-width: 82px;
line-height: 1;
}
.resource-brand__logo {
display: inline-block;
width: fit-content;
font-size: .78rem;
font-weight: 800;
letter-spacing: -.02em;
text-decoration: none;
}
.resource-brand__kind {
width: fit-content;
padding-left: 0;
color: var(--text-heading);
font-size: .72rem;
font-weight: 650;
letter-spacing: .01em;
text-decoration: none;
}
.resource-brand__kind:hover,
.resource-brand__kind:focus-visible,
.resource-brand__logo:hover,
.resource-brand__logo:focus-visible {
color: var(--link-hover);
}
@media (max-width: 520px) {
.resource-brand {
min-width: 70px;
}
.resource-brand__logo {
font-size: .72rem;
}
.resource-brand__kind {
padding-left: 0;
font-size: .68rem;
}
}
+6 -2
View File
@@ -14,8 +14,12 @@
<body class="pad-page" data-resource-kind="__RESOURCE_KIND__" data-registration-enabled="__REGISTRATION_ENABLED__">
<header class="app-header">
<div class="app-header__main"><a id="resource-parent-link" class="brand __PARENT_CLASS__"
href="__PARENT_URL__">__PARENT_TITLE__</a><span class="header-divider"></span>
<div class="app-header__main">
<div class="resource-brand" aria-label="RustPad __RESOURCE_LABEL__">
<a class="resource-brand__logo home-brand" href="/" aria-label="RustPad home">RustPad</a>
<a id="resource-parent-link" class="resource-brand__kind __PARENT_CLASS__" href="__PARENT_URL__">__RESOURCE_LABEL__</a>
</div>
<span class="header-divider"></span>
<div id="document-link-copy" class="document-heading document-heading--copy" role="button" tabindex="0"
title="Copy this link" aria-label="Copy this link">
<h1 id="document-title">__DOCUMENT_TITLE__</h1>
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 321 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

+12
View File
@@ -0,0 +1,12 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
<defs>
<linearGradient id="g" x1="10" y1="8" x2="54" y2="58" gradientUnits="userSpaceOnUse">
<stop stop-color="#f0aa74"/>
<stop offset=".55" stop-color="#cf633d"/>
<stop offset="1" stop-color="#8f3827"/>
</linearGradient>
</defs>
<rect x="4" y="4" width="56" height="56" rx="15" fill="#11141a"/>
<path d="M19 16h17.5C44 16 49 20.4 49 27c0 4.7-2.6 8.2-7 9.9L51 48H39.5l-7.3-9.5H29V48H19V16Zm10 8v7h6.5c2.3 0 3.5-1.2 3.5-3.5S37.8 24 35.5 24H29Z" fill="url(#g)"/>
<rect x="4.75" y="4.75" width="54.5" height="54.5" rx="14.25" fill="none" stroke="#ffffff" stroke-opacity=".12" stroke-width="1.5"/>
</svg>

After

Width:  |  Height:  |  Size: 698 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 321 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

+12
View File
@@ -0,0 +1,12 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
<defs>
<linearGradient id="g" x1="10" y1="8" x2="54" y2="58" gradientUnits="userSpaceOnUse">
<stop stop-color="#f0aa74"/>
<stop offset=".55" stop-color="#cf633d"/>
<stop offset="1" stop-color="#8f3827"/>
</linearGradient>
</defs>
<rect x="4" y="4" width="56" height="56" rx="15" fill="#11141a"/>
<path d="M19 16h17.5C44 16 49 20.4 49 27c0 4.7-2.6 8.2-7 9.9L51 48H39.5l-7.3-9.5H29V48H19V16Zm10 8v7h6.5c2.3 0 3.5-1.2 3.5-3.5S37.8 24 35.5 24H29Z" fill="url(#g)"/>
<rect x="4.75" y="4.75" width="54.5" height="54.5" rx="14.25" fill="none" stroke="#ffffff" stroke-opacity=".12" stroke-width="1.5"/>
</svg>

After

Width:  |  Height:  |  Size: 698 B

+6 -2
View File
@@ -14,8 +14,12 @@
<body data-registration-enabled="__REGISTRATION_ENABLED__">
<header class="app-header">
<div class="app-header__main"><a class="brand home-brand" href="/">RustPad</a><span
class="header-divider"></span>
<div class="app-header__main">
<div class="resource-brand" aria-label="RustPad Workspace">
<a class="resource-brand__logo home-brand" href="/" aria-label="RustPad home">RustPad</a>
<span class="resource-brand__kind">Workspace</span>
</div>
<span class="header-divider"></span>
<div class="document-heading">
<h1 id="workspace-title">__WORKSPACE_TITLE__</h1>
<p id="workspace-url" class="document-url"></p>