From 6bae7ef997421bb7666d30e6f1e11b5924dea751 Mon Sep 17 00:00:00 2001 From: reidlab Date: Mon, 28 Aug 2023 17:26:33 -0700 Subject: [PATCH] make append_path work, update todo --- config.example.toml | 4 ++-- readme.md | 4 ++-- src/endpoints/accounts/login_account.rs | 2 +- src/endpoints/accounts/register_account.rs | 2 +- src/main.rs | 5 +++-- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/config.example.toml b/config.example.toml index 277ab04..20e2599 100644 --- a/config.example.toml +++ b/config.example.toml @@ -9,8 +9,8 @@ # boomlings.com/database/ # example.com/aaaaaaaaaa/ # ^^^^^^^^^^^ -# leaving blank will disable this -append_path = "" +# leaving as "/" will disable this +append_path = "/" # where can your server be accessible? port = 8000 diff --git a/readme.md b/readme.md index 2fc460a..313aa4c 100644 --- a/readme.md +++ b/readme.md @@ -34,5 +34,5 @@ _these features are implemented_ ## todo -- make the `append_path` option do something (atm doesnt work) -- move authorization logic to (./src/helpers/accounts.rs)[./src/helpers/accounts.rs] + cache authorization \ No newline at end of file +- move authorization logic to (./src/helpers/accounts.rs)[./src/helpers/accounts.rs] +- make gjp2 authentication faster (bcrypt?) \ No newline at end of file diff --git a/src/endpoints/accounts/login_account.rs b/src/endpoints/accounts/login_account.rs index c8e0f01..8c52c0b 100644 --- a/src/endpoints/accounts/login_account.rs +++ b/src/endpoints/accounts/login_account.rs @@ -14,7 +14,7 @@ pub struct FromLoginAccount { password: String } -#[post("/memaddrefix/accounts/loginGJAccount.php", data = "")] +#[post("/accounts/loginGJAccount.php", data = "")] pub fn login_account(input: Form) -> status::Custom<&'static str> { let connection = &mut db::establish_connection_pg(); diff --git a/src/endpoints/accounts/register_account.rs b/src/endpoints/accounts/register_account.rs index 3623a54..583ca2a 100644 --- a/src/endpoints/accounts/register_account.rs +++ b/src/endpoints/accounts/register_account.rs @@ -16,7 +16,7 @@ pub struct FormRegisterAccount { email: String } -#[post("/memaddrefix/accounts/registerGJAccount.php", data = "")] +#[post("/accounts/registerGJAccount.php", data = "")] pub fn register_account(input: Form) -> status::Custom<&'static str> { let connection = &mut db::establish_connection_pg(); diff --git a/src/main.rs b/src/main.rs index 013d063..adcd126 100644 --- a/src/main.rs +++ b/src/main.rs @@ -25,8 +25,9 @@ fn rocket() -> _ { rocket::build() .configure(rocket::Config::figment().merge(("port", CONFIG.general.port))) .mount("/", routes![ - index, - + index, + ]) + .mount(CONFIG.general.append_path.as_str(), routes![ endpoints::accounts::login_account::login_account, endpoints::accounts::register_account::register_account ])