Merge branch 'staging' into 'main'

Staging

See merge request PhilippHofer/rot!39
This commit is contained in:
PhilippHofer 2023-10-23 06:49:07 +00:00
commit fadb65c631
4 changed files with 13 additions and 7 deletions

View File

@ -20,6 +20,7 @@
}, },
"dependencies": { "dependencies": {
"choices.js": "^10.2.0", "choices.js": "^10.2.0",
"d3": "^7.8.5" "d3": "^7.8.5",
"terser": "^5.21.0"
} }
} }

View File

@ -14,6 +14,12 @@ export default defineConfig({
], ],
publicDir: false, // disable copy `public/` to outDir publicDir: false, // disable copy `public/` to outDir
build: { build: {
minify: 'terser', // Explicitly specify to use terser for minification
terserOptions: {
mangle: false, // Disable variable name mangling
keep_classnames: false,
keep_fnames: false,
},
rollupOptions: { rollupOptions: {
input: { input: {
main: './main.ts', main: './main.ts',
@ -32,4 +38,4 @@ export default defineConfig({
css: { css: {
devSourcemap: true, // disabled by default because of performance reasons devSourcemap: true, // disabled by default because of performance reasons
}, },
}) })

View File

@ -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( Log::create(
db, db,
@ -128,8 +128,7 @@ async fn updatepw(
user.update_pw(db, updatepw.password).await; user.update_pw(db, updatepw.password).await;
let user_json: String = format!("{}", json!(user)); let mut cookie = Cookie::new("loggedin_user", format!("{}", user.id));
let mut cookie = Cookie::new("loggedin_user", user_json);
cookie.set_expires(OffsetDateTime::now_utc() + Duration::weeks(12)); cookie.set_expires(OffsetDateTime::now_utc() + Duration::weeks(12));
cookies.add_private(cookie); cookies.add_private(cookie);

View File

@ -59,7 +59,7 @@
{% else %} {% else %}
{% if loggedin_user.is_cox %} {% if loggedin_user.is_cox %}
<form action="/boatdamage/{{ boatdamage.id }}/fixed" method="post" class="mt-3"> <form action="/boatdamage/{{ boatdamage.id }}/fixed" method="post" class="mt-3">
<input type="hidden" name="desc" value="{{ boatdamage.desc }}" /> <input type="text" name="desc" value="{{ boatdamage.desc }}" />
{% if loggedin_user.is_tech %} {% if loggedin_user.is_tech %}
<input type="submit" class="btn btn-primary" value="Repariert und verifiziert" /> <input type="submit" class="btn btn-primary" value="Repariert und verifiziert" />
{% else %} {% else %}
@ -74,7 +74,7 @@
{% else %} {% else %}
{% if loggedin_user.is_tech and boatdamage.fixed_at %} {% if loggedin_user.is_tech and boatdamage.fixed_at %}
<form action="/boatdamage/{{ boatdamage.id }}/verified" method="post" class="mt-3"> <form action="/boatdamage/{{ boatdamage.id }}/verified" method="post" class="mt-3">
<input type="hidden" name="desc" value="{{ boatdamage.desc }}" /> <input type="text" name="desc" value="{{ boatdamage.desc }}" />
<input type="submit" class="btn btn-dark" value="Verifiziert" /> <input type="submit" class="btn btn-dark" value="Verifiziert" />
</form> </form>
{% endif %} {% endif %}