mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-26 08:53:21 +00:00
b14750bb61
* lldap: rust 1.80 compatibility * lldap: remove unneeded rec Co-authored-by: Sandro <sandro.jaeckel@gmail.com> * lldap: use upstream PR to fix 1.80 build * lldap: use stable patch url * lldap: check in patch file instead of referring to GH * Clean up Co-authored-by: Sandro <sandro.jaeckel@gmail.com> * lldap: update to latest main * lldap: remove obsolete patch file * remove unused fetchpatch --------- Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
65 lines
2.8 KiB
Diff
65 lines
2.8 KiB
Diff
From a09babb0cd9dd532ad2de920a2a35aa03d740dc6 Mon Sep 17 00:00:00 2001
|
|
From: Herwig Hochleitner <herwig@bendlas.net>
|
|
Date: Thu, 8 Aug 2024 00:29:14 +0200
|
|
Subject: [PATCH] parameterize frontend location
|
|
|
|
---
|
|
server/src/infra/tcp_server.rs | 14 +++++++-------
|
|
1 file changed, 7 insertions(+), 7 deletions(-)
|
|
|
|
diff --git a/server/src/infra/tcp_server.rs b/server/src/infra/tcp_server.rs
|
|
index fa5f11f..16e64c5 100644
|
|
--- a/server/src/infra/tcp_server.rs
|
|
+++ b/server/src/infra/tcp_server.rs
|
|
@@ -25,7 +25,7 @@ use std::sync::RwLock;
|
|
use tracing::info;
|
|
|
|
async fn index<Backend>(data: web::Data<AppState<Backend>>) -> actix_web::Result<impl Responder> {
|
|
- let mut file = std::fs::read_to_string(r"./app/index.html")?;
|
|
+ let mut file = std::fs::read_to_string(r"@frontend@/index.html")?;
|
|
|
|
if data.server_url.path() != "/" {
|
|
file = file.replace(
|
|
@@ -80,7 +80,7 @@ pub(crate) fn error_to_http_response(error: TcpError) -> HttpResponse {
|
|
async fn main_js_handler<Backend>(
|
|
data: web::Data<AppState<Backend>>,
|
|
) -> actix_web::Result<impl Responder> {
|
|
- let mut file = std::fs::read_to_string(r"./app/static/main.js")?;
|
|
+ let mut file = std::fs::read_to_string(r"@frontend@/static/main.js")?;
|
|
|
|
if data.server_url.path() != "/" {
|
|
file = file.replace("/pkg/", format!("{}/pkg/", data.server_url.path()).as_str());
|
|
@@ -92,12 +92,12 @@ async fn main_js_handler<Backend>(
|
|
}
|
|
|
|
async fn wasm_handler() -> actix_web::Result<impl Responder> {
|
|
- Ok(actix_files::NamedFile::open_async("./app/pkg/lldap_app_bg.wasm").await?)
|
|
+ Ok(actix_files::NamedFile::open_async("@frontend@/pkg/lldap_app_bg.wasm").await?)
|
|
}
|
|
|
|
async fn wasm_handler_compressed() -> actix_web::Result<impl Responder> {
|
|
Ok(
|
|
- actix_files::NamedFile::open_async("./app/pkg/lldap_app_bg.wasm.gz")
|
|
+ actix_files::NamedFile::open_async("@frontend@/pkg/lldap_app_bg.wasm.gz")
|
|
.await?
|
|
.customize()
|
|
.insert_header(header::ContentEncoding::Gzip)
|
|
@@ -143,11 +143,11 @@ fn http_config<Backend>(
|
|
.service(web::resource("/pkg/lldap_app_bg.wasm").route(web::route().to(wasm_handler)))
|
|
.service(web::resource("/static/main.js").route(web::route().to(main_js_handler::<Backend>)))
|
|
// Serve the /pkg path with the compiled WASM app.
|
|
- .service(Files::new("/pkg", "./app/pkg"))
|
|
+ .service(Files::new("/pkg", "@frontend@/pkg"))
|
|
// Serve static files
|
|
- .service(Files::new("/static", "./app/static"))
|
|
+ .service(Files::new("/static", "@frontend@/static"))
|
|
// Serve static fonts
|
|
- .service(Files::new("/static/fonts", "./app/static/fonts"))
|
|
+ .service(Files::new("/static/fonts", "@frontend@/static/fonts"))
|
|
// Default to serve index.html for unknown routes, to support routing.
|
|
.default_service(web::route().guard(guard::Get()).to(index::<Backend>));
|
|
}
|
|
--
|
|
2.45.2
|
|
|