Implement NPPS4 integration

This commit is contained in:
Ethan O'Brien
2024-06-04 11:42:40 -05:00
parent a1e400c1ec
commit cb3a62caa5
4 changed files with 61 additions and 20 deletions

View File

@@ -25,7 +25,7 @@ fn unhandled(req: HttpRequest, body: String) -> Option<JsonValue> {
None
}
fn api_req(req: HttpRequest, body: String) -> HttpResponse {
async fn api_req(req: HttpRequest, body: String) -> HttpResponse {
let headers = req.headers().clone();
if !req.path().starts_with("/api") && !req.path().starts_with("/v1.0") {
return router::webui::main(req);
@@ -89,7 +89,7 @@ fn api_req(req: HttpRequest, body: String) -> HttpResponse {
"/api/card/evolve" => router::card::evolve(req, body),
"/api/shop/buy" => router::shop::buy(req, body),
"/api/user/getregisteredplatformlist" => router::user::getregisteredplatformlist(req, body),
"/api/user/sif/migrate" => router::user::sif_migrate(req, body),
"/api/user/sif/migrate" => router::user::sif_migrate(req, body).await,
"/api/user/ss/migrate" => router::user::sifas_migrate(req, body),
"/api/exchange" => router::exchange::exchange_post(req, body),
"/api/item/use" => router::items::use_item_req(req, body),
@@ -147,7 +147,7 @@ async fn request(req: HttpRequest, body: String) -> HttpResponse {
"/api/webui/import" => router::webui::import(req, body),
"/api/webui/set_time" => router::webui::set_time(req, body),
"/api/webui/admin" => router::webui::admin_post(req, body),
_ => api_req(req, body)
_ => api_req(req, body).await
}
} else {
match req.path() {
@@ -163,7 +163,7 @@ async fn request(req: HttpRequest, body: String) -> HttpResponse {
"/webui/logout" => router::webui::logout(req),
"/api/webui/admin" => router::webui::admin(req),
"/api/webui/export" => router::webui::export(req),
_ => api_req(req, body)
_ => api_req(req, body).await
}
}
}
@@ -197,8 +197,6 @@ async fn main() -> std::io::Result<()> {
rv.await
}
#[macro_export]
macro_rules! include_file {
( $s:expr ) => {