include a default favicon in sqlpage

this fixes the Unable to read file "favicon.ico" error that was displayed by default in the console when opening a page in a browser
This commit is contained in:
lovasoa
2024-06-23 18:10:10 +02:00
parent fd3394f01f
commit e99e386a5f
7 changed files with 20 additions and 3 deletions
+1
View File
@@ -35,6 +35,7 @@
- New `max_pending_rows` [configuration option](https://sql.ophir.dev/configuration.md) to limit the number of messages that can be sent to the client before they are read. Usefule when sending large amounts of data to slow clients.
- Update sqlite to v3.46: https://www.sqlite.org/releaselog/3_46_0.html
- Faster initial page load. SQLPage used to wait for the first component to be rendered before sending the shell to the client. We now send the shell immediately, and the first component as soon as it is ready. This can make the initial page load faster, especially when the first component requires a long computation on the database side.
- Include a default favicon when none is specified in the shell component. This fixes the `Unable to read file "favicon.ico"` error message that would appear in the logs by default.
## 0.23.0 (2024-06-09)
+1
View File
@@ -20,6 +20,7 @@ async fn main() {
spawn(download_deps(c.clone(), "tabler-icons.svg")),
spawn(download_deps(c.clone(), "apexcharts.js")),
spawn(download_deps(c.clone(), "tomselect.js")),
spawn(download_deps(c.clone(), "favicon.svg")),
] {
h.await.unwrap();
}
+11
View File
@@ -0,0 +1,11 @@
<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="1024" fill="none" stroke="#e7f6f8" stroke-linecap="round" stroke-linejoin="round" stroke-width="75">
<defs>
<filter id="b" width="200%" height="200%" x="-50%" y="-50%">
<feGaussianBlur stdDeviation="45"/>
</filter>
<path id="a" d="M171 264a341 122 0 1 0 682 0 341 122 0 1 0-682 0m0 0v245a341 122 0 0 0 682 0V264M171 509v244a341 122 0 0 0 682 0V509"/>
</defs>
<rect width="100%" height="100%" fill="#0f3953" stroke="none" ry="64"/>
<use href="#a"/>
<use filter="url(#b)" href="#a"/>
</svg>

After

Width:  |  Height:  |  Size: 578 B

+1 -3
View File
@@ -3,9 +3,7 @@
<head>
<meta charset="utf-8"/>
<title>{{default title "SQLPage"}}</title>
{{#if favicon}}
<link rel="icon" href="{{favicon}}">
{{/if}}
<link rel="icon" href="{{#if favicon}}{{favicon}}{{else}}{{static_path 'favicon.svg'}}{{/if}}">
{{#if manifest}}
<link rel="manifest" href="{{manifest}}">
{{/if}}
+1
View File
@@ -151,6 +151,7 @@ impl CanHelp for StaticPathHelper {
"sqlpage.css" => static_filename!("sqlpage.css"),
"apexcharts.js" => static_filename!("apexcharts.js"),
"tomselect.js" => static_filename!("tomselect.js"),
"favicon.svg" => static_filename!("favicon.svg"),
other => return Err(format!("unknown static file: {other:?}")),
};
Ok(format!("{}{}", self.0, path).into())
+1
View File
@@ -525,6 +525,7 @@ pub fn create_app(
.service(static_content::tomselect_js())
.service(static_content::css())
.service(static_content::icons())
.service(static_content::favicon())
.default_service(fn_service(main_handler)),
)
// when receiving a request outside of the prefix, redirect to the prefix
+4
View File
@@ -49,3 +49,7 @@ pub fn css() -> Resource {
pub fn icons() -> Resource {
static_file_endpoint!("tabler-icons", "svg", "image/svg+xml")
}
pub fn favicon() -> Resource {
static_file_endpoint!("favicon", "svg", "image/svg+xml")
}