First push
This commit is contained in:
80
sdkserver/src/services/auth.rs
Normal file
80
sdkserver/src/services/auth.rs
Normal file
@@ -0,0 +1,80 @@
|
||||
use axum::Json;
|
||||
use serde_json::json;
|
||||
|
||||
pub const LOGIN_WITH_PASSWORD_ENDPOINT: &str = "/:product_name/mdk/shield/api/login/";
|
||||
pub const LOGIN_WITH_SESSION_TOKEN_ENDPOINT: &str = "/:product_name/mdk/shield/api/verify";
|
||||
pub const GRANTER_LOGIN_VERIFICATION_ENDPOINT: &str = "/:product_name/combo/granter/login/v2/login";
|
||||
pub const RISKY_API_CHECK_ENDPOINT: &str = "/account/risky/api/check";
|
||||
|
||||
#[tracing::instrument]
|
||||
pub async fn login_with_password() -> Json<serde_json::Value> {
|
||||
Json(json!({
|
||||
"data": {
|
||||
"account": {
|
||||
"area_code": "**",
|
||||
"email": "ReversedRooms",
|
||||
"country": "RU",
|
||||
"is_email_verify": "1",
|
||||
"token": "mostsecuretokenever",
|
||||
"uid": "1337"
|
||||
},
|
||||
"device_grant_required": false,
|
||||
"reactivate_required": false,
|
||||
"realperson_required": false,
|
||||
"safe_mobile_required": false
|
||||
},
|
||||
"message": "OK",
|
||||
"retcode": 0
|
||||
}))
|
||||
}
|
||||
|
||||
#[tracing::instrument]
|
||||
pub async fn login_with_session_token() -> Json<serde_json::Value> {
|
||||
Json(json!({
|
||||
"data": {
|
||||
"account": {
|
||||
"area_code": "**",
|
||||
"email": "ReversedRooms",
|
||||
"country": "RU",
|
||||
"is_email_verify": "1",
|
||||
"token": "mostsecuretokenever",
|
||||
"uid": "1337"
|
||||
},
|
||||
"device_grant_required": false,
|
||||
"reactivate_required": false,
|
||||
"realperson_required": false,
|
||||
"safe_mobile_required": false
|
||||
},
|
||||
"message": "OK",
|
||||
"retcode": 0
|
||||
}))
|
||||
}
|
||||
|
||||
#[tracing::instrument]
|
||||
pub async fn granter_login_verification() -> Json<serde_json::Value> {
|
||||
Json(json!({
|
||||
"data": {
|
||||
"account_type": 1,
|
||||
"combo_id": "1337",
|
||||
"combo_token": "9065ad8507d5a1991cb6fddacac5999b780bbd92",
|
||||
"data": "{\"guest\":false}",
|
||||
"heartbeat": false,
|
||||
"open_id": "1337"
|
||||
},
|
||||
"message": "OK",
|
||||
"retcode": 0
|
||||
}))
|
||||
}
|
||||
|
||||
#[tracing::instrument]
|
||||
pub async fn risky_api_check() -> Json<serde_json::Value> {
|
||||
Json(json!({
|
||||
"data": {
|
||||
"id": "06611ed14c3131a676b19c0d34c0644b",
|
||||
"action": "ACTION_NONE",
|
||||
"geetest": null
|
||||
},
|
||||
"message": "OK",
|
||||
"retcode": 0
|
||||
}))
|
||||
}
|
||||
65
sdkserver/src/services/dispatch.rs
Normal file
65
sdkserver/src/services/dispatch.rs
Normal file
@@ -0,0 +1,65 @@
|
||||
use prost::Message;
|
||||
use proto::{Dispatch, Gateserver, RegionInfo};
|
||||
|
||||
pub const QUERY_DISPATCH_ENDPOINT: &str = "/query_dispatch";
|
||||
pub const QUERY_GATEWAY_ENDPOINT: &str = "/query_gateway";
|
||||
|
||||
#[tracing::instrument]
|
||||
pub async fn query_dispatch() -> String {
|
||||
let rsp = Dispatch {
|
||||
retcode: 0,
|
||||
region_list: vec![RegionInfo {
|
||||
name: String::from("RobinSR"),
|
||||
title: String::from("RobinSR"),
|
||||
env_type: String::from("9"),
|
||||
dispatch_url: String::from("http://127.0.0.1:21000/query_gateway"),
|
||||
..Default::default()
|
||||
}],
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let mut buff = Vec::new();
|
||||
rsp.encode(&mut buff).unwrap();
|
||||
|
||||
rbase64::encode(&buff)
|
||||
}
|
||||
|
||||
#[tracing::instrument]
|
||||
pub async fn query_gateway() -> String {
|
||||
let rsp = Gateserver {
|
||||
retcode: 0,
|
||||
ip: String::from("127.0.0.1"),
|
||||
port: 23301,
|
||||
asset_bundle_url: String::from(
|
||||
"https://autopatchcn.bhsr.com/asb/BetaLive/output_6744505_89b2f5dc973e",
|
||||
),
|
||||
lua_url: String::from(
|
||||
"https://autopatchcn.bhsr.com/lua/BetaLive/output_6755976_3c46d7c46e2c",
|
||||
),
|
||||
ex_resource_url: String::from(
|
||||
"https://autopatchcn.bhsr.com/design_data/BetaLive/output_6759713_b4e0e740f0da",
|
||||
),
|
||||
ifix_version: String::from("0"),
|
||||
lua_version: String::from("6755976"),
|
||||
jblkncaoiao: true,
|
||||
hjdjakjkdbi: true,
|
||||
ldknmcpffim: true,
|
||||
feehapamfci: true,
|
||||
eebfeohfpph: true,
|
||||
dfmjjcfhfea: true,
|
||||
najikcgjgan: true,
|
||||
giddjofkndm: true,
|
||||
fbnbbembcgn: false,
|
||||
dedgfjhbnok: false,
|
||||
use_tcp: true,
|
||||
linlaijbboh: false,
|
||||
ahmbfbkhmgh: false,
|
||||
nmdccehcdcc: false,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let mut buff = Vec::new();
|
||||
rsp.encode(&mut buff).unwrap();
|
||||
|
||||
rbase64::encode(&buff)
|
||||
}
|
||||
7
sdkserver/src/services/errors.rs
Normal file
7
sdkserver/src/services/errors.rs
Normal file
@@ -0,0 +1,7 @@
|
||||
use axum::http::{StatusCode, Uri};
|
||||
use axum::response::IntoResponse;
|
||||
|
||||
pub async fn not_found(uri: Uri) -> impl IntoResponse {
|
||||
tracing::warn!("unhandled http request: {uri}");
|
||||
StatusCode::NOT_FOUND
|
||||
}
|
||||
3
sdkserver/src/services/mod.rs
Normal file
3
sdkserver/src/services/mod.rs
Normal file
@@ -0,0 +1,3 @@
|
||||
pub mod auth;
|
||||
pub mod dispatch;
|
||||
pub mod errors;
|
||||
Reference in New Issue
Block a user