From d612a95be9ad14ac85945a31925228c27889617f Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Mon, 23 Jun 2025 21:42:30 -0400 Subject: [PATCH] Move restoring character backup to it's own page --- resources/templates/account.html | 10 +--------- resources/templates/account_base.html | 5 +++++ resources/templates/restore.html | 15 +++++++++++++++ src/bin/kawari-login.rs | 15 ++++++++++++++- 4 files changed, 35 insertions(+), 10 deletions(-) create mode 100644 resources/templates/restore.html diff --git a/resources/templates/account.html b/resources/templates/account.html index fe4348f..d714038 100644 --- a/resources/templates/account.html +++ b/resources/templates/account.html @@ -4,13 +4,5 @@ {% set current_page = "home" %} {% block accountbody %} - -

Upload Character Backup

-
-
- - -
- -
+

See sidebar

{% endblock %} diff --git a/resources/templates/account_base.html b/resources/templates/account_base.html index 28edb33..8cfa4ac 100644 --- a/resources/templates/account_base.html +++ b/resources/templates/account_base.html @@ -13,6 +13,11 @@ Home +

  • Change Password diff --git a/resources/templates/restore.html b/resources/templates/restore.html new file mode 100644 index 0000000..0e6948b --- /dev/null +++ b/resources/templates/restore.html @@ -0,0 +1,15 @@ +{% extends "account_base.html" %} + +{% block title %}Restore Backup{% endblock %} +{% set current_page = "restore" %} + +{% block accountbody %} +

    Upload Character Backup

    +
    +
    + + +
    + +
    +{% endblock %} diff --git a/src/bin/kawari-login.rs b/src/bin/kawari-login.rs index e5ca64e..c331237 100644 --- a/src/bin/kawari-login.rs +++ b/src/bin/kawari-login.rs @@ -59,6 +59,12 @@ fn setup_default_environment() -> Environment<'static> { .expect("Failed to find template!"), ) .unwrap(); + env.add_template_owned( + "restore.html", + std::fs::read_to_string("resources/templates/restore.html") + .expect("Failed to find template!"), + ) + .unwrap(); env } @@ -297,6 +303,12 @@ async fn cancel_account(jar: CookieJar) -> (CookieJar, Redirect) { (jar.remove("cis_sessid"), Redirect::to("/")) } +async fn restore_backup() -> Html { + let environment = setup_default_environment(); + let template = environment.get_template("restore.html").unwrap(); + Html(template.render(context! {}).unwrap()) +} + #[tokio::main] async fn main() { tracing_subscriber::fmt::init(); @@ -320,10 +332,11 @@ async fn main() { .route("/oauth/oa/registligt", get(register)) .route("/oauth/oa/registlist", post(do_register)) .route("/account/app/svc/manage", get(account)) - .route("/account/app/svc/manage", post(upload_character_backup)) .route("/account/app/svc/logout", get(logout)) .route("/account/app/svc/mbrPasswd", get(change_password)) .route("/account/app/svc/mbrCancel", get(cancel_account)) + .route("/account/app/svc/restore", get(restore_backup)) + .route("/account/app/svc/restore", post(upload_character_backup)) .with_state(state) .nest_service("/static", ServeDir::new("resources/static")) .layer(cors);