For now? I'm experimenting on an old concept.
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Server-side serves client revision hash now.

+44 -16
+1
.gitignore
··· 33 33 client/build/dev/javascript/lumina_client/lumina_client.ts 34 34 client/build/ 35 35 /client/priv/static/lumina_client*.css 36 + /client/priv/static/lumina_client*.hash 36 37 /client/priv/static/lumina_client*.mjs 37 38 instance.sqlite 38 39 instance.sqlite-shm
+1
Justfile
··· 22 22 build-client: build-styles 23 23 cd ./client/ &&\ 24 24 gleam build --target javascript &&\ 25 + find ./client/src/ -type f -print0 | xargs -0 sha256sum | sha256sum | awk '{print $1}' > "./priv/static/lumina_client_rev.hash" &&\ 25 26 echo 'import { main } from "./lumina_client.mjs";document.addEventListener("DOMContentLoaded", main())' > "./build/dev/javascript/lumina_client/lumina_client.ts" &&\ 26 27 bun build ./build/dev/javascript/lumina_client/lumina_client.ts --minify --outfile ./priv/static/lumina_client.min.mjs --target=browser &&\ 27 28 bun build ./build/dev/javascript/lumina_client/lumina_client.ts --outfile ./priv/static/lumina_client.mjs --target=browser
+1
server/src/main.rs
··· 325 325 staticroutes::index, 326 326 staticroutes::lumina_js, 327 327 staticroutes::lumina_d_js, 328 + staticroutes::client_rev, 328 329 staticroutes::lumina_css, 329 330 staticroutes::licence, 330 331 staticroutes::license_redirect,
+41 -16
server/src/staticroutes.rs
··· 47 47 RawHtml(format!( 48 48 r#"<!doctype html> 49 49 <html lang="en"> 50 - <head> 51 - <meta charset="UTF-8" /> 52 - <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" /> 53 - <title>Lumina</title> 54 - <link rel="preconnect" href="https://fontlay.com" corossorigin /> 55 - <link href="https://fontlay.com/css2?family=DM+Mono:ital,wght@0,300;0,400;0,500;1,300;1,400;1,500&family=Elms+Sans:ital,wght@0,100..900;1,100..900&family=Gantari:ital,wght@0,100..900;1,100..900&family=Josefin+Sans:ital,wght@0,100..700;1,100..700&family=Vend+Sans&display=swap" rel="stylesheet"> 50 + <head> 51 + <meta charset="UTF-8" /> 52 + <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" /> 53 + <title>Lumina</title> 54 + <link rel="preconnect" href="https://fontlay.com" corossorigin /> 55 + <link href="https://fontlay.com/css2?family=DM+Mono:ital,wght@0,300;0,400;0,500;1,300;1,400;1,500&family=Elms+Sans:ital,wght@0,100..900;1,100..900&family=Gantari:ital,wght@0,100..900;1,100..900&family=Josefin+Sans:ital,wght@0,100..700;1,100..700&family=Vend+Sans&display=swap" rel="stylesheet"> 56 56 57 - <link 58 - rel="stylesheet" 59 - href="/static/lumina.css" 60 - /> 61 - <script type="module" src="{}"></script> 62 - </head> 63 - 64 - <body id="app"> 65 - </body> 57 + <link 58 + rel="stylesheet" 59 + href="/static/lumina.css" 60 + /> 61 + <script> 62 + window.clientHash = "{}"; 63 + </script> 64 + <script type="module" src="{}"></script> 65 + </head> 66 + <body id="app"></body> 66 67 </html>"#, 67 - js 68 + include_str!("../../client/priv/static/lumina_client_rev.hash").trim(), 69 + js, 68 70 )) 69 71 } 70 72 ··· 88 90 http_code_elog!(ev_log, 200, "/static/lumina.mjs"); 89 91 90 92 RawJavaScript(include_str!("../../client/priv/static/lumina_client.mjs").to_string()) 93 + } 94 + 95 + /// Serves a single hash, meant to indicate what client version is expected (what client version the 96 + /// server was built with, more specifically...) 97 + /// This hash is also incorporated into the HTML loading the client as 98 + /// ```javascript 99 + /// window.clientHash 100 + /// ``` 101 + /// This allows a client to check if the hash it carries still matches the hash currently served, if 102 + /// not, it'll prompt a reload. 103 + #[get("/api/client-rev")] 104 + pub(crate) async fn client_rev(state: &State<AppState>) -> RawText<String> { 105 + let ev_log = { 106 + let appstate = state.0.clone(); 107 + appstate.event_logger.clone() 108 + }; 109 + http_code_elog!(ev_log, 200, "/client-rev"); 110 + 111 + RawText( 112 + include_str!("../../client/priv/static/lumina_client_rev.hash") 113 + .trim() 114 + .to_string(), 115 + ) 91 116 } 92 117 93 118 #[get("/static/lumina.css")]