feat: preload assets

This commit is contained in:
Per Stark
2025-01-02 23:41:46 +01:00
parent ab23909e0f
commit 367f976173
4 changed files with 28 additions and 2863 deletions

File diff suppressed because one or more lines are too long

View File

@@ -27,11 +27,14 @@ pub async fn index_handler(
let gdpr_accepted = auth.current_user.is_some() | session.get("gdpr_accepted").unwrap_or(false); let gdpr_accepted = auth.current_user.is_some() | session.get("gdpr_accepted").unwrap_or(false);
let queue_length = state let queue_length = match auth.current_user.is_some() {
.rabbitmq_consumer true => state
.get_queue_length() .rabbitmq_consumer
.await .get_queue_length()
.map_err(|e| HtmlError::new(AppError::from(e), state.templates.clone()))?; .await
.map_err(|e| HtmlError::new(AppError::from(e), state.templates.clone()))?,
false => 0,
};
// let knowledge_entities = User::get_knowledge_entities( // let knowledge_entities = User::get_knowledge_entities(
// &auth.current_user.clone().unwrap().id, // &auth.current_user.clone().unwrap().id,

View File

@@ -5,15 +5,26 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% block title %}Minne{% endblock %}</title> <title>{% block title %}Minne{% endblock %}</title>
<script src="assets/htmx.min.js"></script>
<link rel="stylesheet" href="assets/style.css">
<link rel="manifest" href="/assets/manifest.json">
<!-- Optional but recommended for iOS support --> <!-- Preload critical assets -->
<meta name="apple-mobile-web-app-capable" content="yes"> <link rel="preload" href="assets/htmx.min.js" as="script">
<link rel="preload" href="assets/style.css" as="style">
<!-- Core styles -->
<link rel="stylesheet" href="assets/style.css">
<!-- Scripts -->
<script src="assets/htmx.min.js" defer></script>
<!-- Icons -->
<link rel="icon" href="/assets/icon/favicon.ico"> <link rel="icon" href="/assets/icon/favicon.ico">
<link rel="apple-touch-icon" href="/assets/icon/apple-touch-icon.png"> <link rel="apple-touch-icon" href="/assets/icon/apple-touch-icon.png" media="(device-width: 320px)">
<!-- PWA -->
<link rel="manifest" href="/assets/manifest.json">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"> <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
{% block head %}{% endblock %} {% block head %}{% endblock %}
</head> </head>
{% block body %}{% endblock %} {% block body %}{% endblock %}

View File

@@ -2,7 +2,8 @@
\[x\] restrict retrieval to users own objects \[x\] restrict retrieval to users own objects
\[x\] templating \[x\] templating
\[x\] redirects \[x\] redirects
\[\] hx-redirect \[x\] hx-redirect
\[x\] macro for pagedata? \[x\] macro for pagedata?
\[\] add more config structs for clarity \[\] add more config structs for clarity
\[\] user id to fileinfo and data path? \[\] user id to fileinfo and data path?
\[x\] gdpr