From c91a32967642620e40fe5135d81fc6019f0fd9b8 Mon Sep 17 00:00:00 2001 From: philipp Date: Thu, 12 Oct 2023 11:54:02 +0200 Subject: [PATCH 1/3] fix js error --- frontend/package.json | 3 ++- frontend/vite.config.js | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/frontend/package.json b/frontend/package.json index 9e1677c..8b82d1e 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -20,6 +20,7 @@ }, "dependencies": { "choices.js": "^10.2.0", - "d3": "^7.8.5" + "d3": "^7.8.5", + "terser": "^5.21.0" } } diff --git a/frontend/vite.config.js b/frontend/vite.config.js index 8ccb8a1..b3ac55c 100644 --- a/frontend/vite.config.js +++ b/frontend/vite.config.js @@ -14,6 +14,12 @@ export default defineConfig({ ], publicDir: false, // disable copy `public/` to outDir build: { + minify: 'terser', // Explicitly specify to use terser for minification + terserOptions: { + mangle: false, // Disable variable name mangling + keep_classnames: false, + keep_fnames: false, + }, rollupOptions: { input: { main: './main.ts', @@ -32,4 +38,4 @@ export default defineConfig({ css: { devSourcemap: true, // disabled by default because of performance reasons }, -}) \ No newline at end of file +}) From 3e327e98f125868657ce7e9f5985a74d71cf1d43 Mon Sep 17 00:00:00 2001 From: philipp Date: Thu, 12 Oct 2023 12:05:12 +0200 Subject: [PATCH 2/3] allow editing of boat damages --- templates/boatdamages.html.tera | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/boatdamages.html.tera b/templates/boatdamages.html.tera index 4fddd12..377e036 100644 --- a/templates/boatdamages.html.tera +++ b/templates/boatdamages.html.tera @@ -59,7 +59,7 @@ {% else %} {% if loggedin_user.is_cox %}
- + {% if loggedin_user.is_tech %} {% else %} @@ -74,7 +74,7 @@ {% else %} {% if loggedin_user.is_tech and boatdamage.fixed_at %} - +
{% endif %} From fa3ab3ec8af0d55db4d6924880576a3d4e29fabb Mon Sep 17 00:00:00 2001 From: philipp Date: Fri, 13 Oct 2023 09:43:59 +0200 Subject: [PATCH 3/3] fix proper loggedin_user cookie after setting pw --- src/tera/auth.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/tera/auth.rs b/src/tera/auth.rs index bd121db..6ff2ddc 100644 --- a/src/tera/auth.rs +++ b/src/tera/auth.rs @@ -79,7 +79,7 @@ async fn login( } }; - cookies.add_private(Cookie::new("loggedin_user", format!("{}", json!(user.id)))); + cookies.add_private(Cookie::new("loggedin_user", format!("{}", user.id))); Log::create( db, @@ -128,8 +128,7 @@ async fn updatepw( user.update_pw(db, updatepw.password).await; - let user_json: String = format!("{}", json!(user)); - let mut cookie = Cookie::new("loggedin_user", user_json); + let mut cookie = Cookie::new("loggedin_user", format!("{}", user.id)); cookie.set_expires(OffsetDateTime::now_utc() + Duration::weeks(12)); cookies.add_private(cookie);