feat: preload assets

This commit is contained in:
Per Stark
2025-01-02 23:41:46 +01:00
parent 2a0603606e
commit 69a0064250
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 queue_length = state
.rabbitmq_consumer
.get_queue_length()
.await
.map_err(|e| HtmlError::new(AppError::from(e), state.templates.clone()))?;
let queue_length = match auth.current_user.is_some() {
true => state
.rabbitmq_consumer
.get_queue_length()
.await
.map_err(|e| HtmlError::new(AppError::from(e), state.templates.clone()))?,
false => 0,
};
// let knowledge_entities = User::get_knowledge_entities(
// &auth.current_user.clone().unwrap().id,

View File

@@ -5,15 +5,26 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<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 -->
<meta name="apple-mobile-web-app-capable" content="yes">
<!-- Preload critical assets -->
<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="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">
{% block head %}{% endblock %}
</head>
{% block body %}{% endblock %}

View File

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