m/cup
1
0
mirror of https://github.com/sergi0g/cup.git synced 2025-11-08 13:13:49 -05:00

refactor: use Bytes to store constant blobs in the server

Might also improve performance.
This commit is contained in:
Sergio
2025-03-19 13:56:47 +02:00
parent e26f941c59
commit ccf825df24

View File

@@ -8,6 +8,7 @@ use tokio::sync::Mutex;
use tokio_cron_scheduler::{Job, JobScheduler}; use tokio_cron_scheduler::{Job, JobScheduler};
use xitca_web::{ use xitca_web::{
body::ResponseBody, body::ResponseBody,
bytes::Bytes,
error::Error, error::Error,
handler::{handler_service, path::PathRef, state::StateRef}, handler::{handler_service, path::PathRef, state::StateRef},
http::{StatusCode, WebResponse}, http::{StatusCode, WebResponse},
@@ -32,9 +33,9 @@ use crate::{
const HTML: &str = include_str!("static/index.html"); const HTML: &str = include_str!("static/index.html");
const JS: &str = include_str!("static/assets/index.js"); const JS: &str = include_str!("static/assets/index.js");
const CSS: &str = include_str!("static/assets/index.css"); const CSS: &str = include_str!("static/assets/index.css");
const FAVICON_ICO: &[u8] = include_bytes!("static/favicon.ico"); const FAVICON_ICO: Bytes = Bytes::from_static(include_bytes!("static/favicon.ico"));
const FAVICON_SVG: &[u8] = include_bytes!("static/favicon.svg"); const FAVICON_SVG: Bytes = Bytes::from_static(include_bytes!("static/favicon.svg"));
const APPLE_TOUCH_ICON: &[u8] = include_bytes!("static/apple-touch-icon.png"); const APPLE_TOUCH_ICON: Bytes = Bytes::from_static(include_bytes!("static/apple-touch-icon.png"));
const SORT_ORDER: [&str; 8] = [ const SORT_ORDER: [&str; 8] = [
"monitored_images", "monitored_images",