1
Fork 0
mirror of https://github.com/redstrate/Kawari.git synced 2025-04-20 22:57:45 +00:00

Add login server

This commit is contained in:
Joshua Goins 2023-10-05 13:09:21 -04:00
parent 1625179a74
commit 8f19352528
3 changed files with 45 additions and 1 deletions

View file

@ -14,3 +14,4 @@ tasks:
echo "StrictHostKeyChecking=no" >> ~/.ssh/config echo "StrictHostKeyChecking=no" >> ~/.ssh/config
rsync -e 'ssh -p 38901' -Wvr kawari/target/release/kawari-frontier deploy@ryne.moe:/opt/kawari/ rsync -e 'ssh -p 38901' -Wvr kawari/target/release/kawari-frontier deploy@ryne.moe:/opt/kawari/
rsync -e 'ssh -p 38901' -Wvr kawari/target/release/kawari-admin deploy@ryne.moe:/opt/kawari/ rsync -e 'ssh -p 38901' -Wvr kawari/target/release/kawari-admin deploy@ryne.moe:/opt/kawari/
rsync -e 'ssh -p 38901' -Wvr kawari/target/release/kawari-login deploy@ryne.moe:/opt/kawari/

View file

@ -9,6 +9,9 @@ name = "kawari-frontier"
[[bin]] [[bin]]
name = "kawari-admin" name = "kawari-admin"
[[bin]]
name = "kawari-login"
[profile.release] [profile.release]
lto = true lto = true
strip = true strip = true

40
src/bin/kawari-login.rs Normal file
View file

@ -0,0 +1,40 @@
use std::net::SocketAddr;
use axum::{Form, Json, Router, routing::get};
use axum::response::Html;
use axum::routing::post;
use serde::{Deserialize, Serialize};
use kawari::config::Config;
async fn top() -> Html<&'static str> {
Html("<form action=\"login.send\" method=\"post\" name=\"mainForm\">\r\n\t\r\n\t\t\r\n\t\t<input type=\"hidden\" name=\"_STORED_\" value=\"42f06e5f4194001a9ad61c8481f435e8b9eac79242f9221d463aa492ab2b3373655adadff3e72dd16a798ee8a222c519848743c97084f1af71854f06050a1f2813e5c3aaf66e5f0ef24dc18588a8cf06758992e42035f7e4f99f85c8b6082200dcabc6a37c7f76ce542eefc1f1798da5e23fd4b46ed17489de5eb8e8a222c5198487433bff5f3433c061ded661b3f33b5f2d2807f5db74747f4dfe8f1fe89f9388f717347bbea9e9ec2931bb6fdc4b11648dfa9e726cdf690d74970a36f7482c12593a5ad7b966c4cf14655e11641f0bb67b8e807377edfa81055480da52031e0ba86ec52f991eb3cb8913c8f807287f3cb5ac4143326f33a4503cf31e021c8f41a5eec01870e0004acc0d0bf2bed65da5eeae3703ae878c20bd7f1167745e96770979146463fa40235e6bba8bdac1273dcbc1256cda0caacbdaad\">\n\r\n\t\t\r\n\t\t<div class=\"form-item type-id\">\r\n\t\t\t<label class=\"item-label\" for=\"sqexid\"><span class=\"label-image-text\" title=\"Square Enix ID\"></span></label>\r\n\t\t\t<input class=\"item-input\" name=\"sqexid\" id=\"sqexid\" type=\"text\" value=\"\" tabindex=\"1\" placeholder=\"ID (Required)\" maxLength=\"16\"\r\n\t\t\t\r\n\t\t\t\t />\r\n\t\t\t\r\n\t\t</div>\r\n\r\n\t\t <div class=\"form-item type-pw\">\r\n\t\t\t<label class=\"item-label\" for=\"password\"><span class=\"label-image-text\" title=\"Square Enix Password\"></span></label>\r\n\t\t\t<input class=\"item-password\" name=\"password\" id=\"password\" type=\"password\" value=\"\" tabindex=\"2\" placeholder=\"Password (Required)\" maxLength=\"32\" autocomplete=\"off\"/>\r\n\t\t</div>\r\n\t\r\n\t\t<div class=\"form-item type-otpw\">\r\n\t\t\t<label class=\"item-label\" for=\"otppw\"><span class=\"label-image-text\" title=\"One-Time Password\"></span></label>\r\n\t\t\t<input class=\"item-otpw\" name=\"otppw\" id=\"otppw\" type=\"text\" value=\"\" tabindex=\"3\" autocomplete=\"off\" maxLength=\"6\" placeholder=\"Password (Optional)\" />\r\n\t\t</div>\r\n\r\n\t\t\r\n\t\t<div class=\"form-item type-remember-id\">\r\n\t\t\t<input name=\"saveid\" id=\"saveid\" type=\"checkbox\" value=\"1\" class=\"item-checkbox\" tabindex=\"4\" />\r\n\t\t\t<label class=\"item-checkbox-label\" for=\"saveid\"><span class=\"label-checkbox-image-text\" title=\"Remember Square Enix ID\"></span></label>\r\n\t\t</div>\r\n\t\t\r\n\r\n\t\t<div class=\"form-item type-submit\">\r\n\t\t\t<button class=\"item-button\" type=\"submit\" tabindex=\"5\" onClick=\"ctrEvent('mainForm')\" id=\"btLogin\"><span class=\"button-image-text\" title=\"Login\"></span></button>\r\n\t\t</div>\r\n\r\n\t</form>\r\n</div>\r\n</body>\r\n</html>\r\n\r\n")
}
#[derive(Deserialize, Debug)]
#[allow(dead_code)]
struct Input {
_STORED_: String,
sqexid: String,
password: String,
otppw: String
}
async fn login_send(Form(input): Form<Input>) -> Html<&'static str> {
Html("window.external.user(\"login=auth,ok,sid,5b1548e2aa30bb9ef4cc9a4a690eb900cf0c801332149eeb227df7f8,terms,1,region,2,etmadd,0,playable,1,ps3pkg,0,maxex,4,product,1\");")
}
#[tokio::main]
async fn main() {
tracing_subscriber::fmt::init();
let app = Router::new()
.route("/oauth/ffxivarr/login/top", post(top))
.route("/oauth/ffxivarr/login/login.send", post(login_send));
let addr = SocketAddr::from(([127, 0, 0, 1], 6700));
tracing::info!("Frontier server started on {}", addr);
axum::Server::bind(&addr)
.serve(app.into_make_service())
.await
.unwrap();
}