login 💀

This commit is contained in:
rafi1212122
2023-05-25 15:28:43 +07:00
parent 106ed39ebd
commit f294d9faa4
11 changed files with 675 additions and 10 deletions

View File

@@ -0,0 +1,170 @@
using Newtonsoft.Json;
using HttpServer.Models;
using Common.Database;
using Newtonsoft.Json.Linq;
namespace HttpServer.Controllers
{
public class AccountController
{
public static void AddHandlers(WebApplication app)
{
app.Map("/account/risky/api/check", (HttpContext ctx) =>
{
RiskyCheck rsp = new()
{
Retcode = 0,
Message = "",
Data = new RiskyCheck.DataScheme()
{
Id = "",
Action = "ACTION_NONE",
Geetest = null
}
};
ctx.Response.Headers.Add("Content-Type", "application/json");
return ctx.Response.WriteAsync(JsonConvert.SerializeObject(rsp));
});
#pragma warning disable CS8600, CS8602 // Converting null literal or possible null value to non-nullable type.
app.MapPost("/{game_biz}/combo/granter/login/v2/login", (ctx) =>
{
StreamReader Reader = new(ctx.Request.Body);
GranterLoginBody Data = JsonConvert.DeserializeObject<GranterLoginBody>(Reader.ReadToEndAsync().Result);
GranterLoginBody.GranterLoginBodyData GranterLoginData = JsonConvert.DeserializeObject<GranterLoginBody.GranterLoginBodyData>(Data.Data);
return ctx.Response.WriteAsJsonAsync(new
{
retcode = 0,
message = "OK",
data = new {
combo_id = "0",
open_id = GranterLoginData.Uid,
combo_token = GranterLoginData.Token,
data = JsonConvert.SerializeObject(new
{
guest = GranterLoginData.Guest
}),
heartbeat = false,
account_type = 1,
}
});
});
app.MapPost("/{game_biz}/mdk/shield/api/verify", (ctx) =>
{
StreamReader Reader = new(ctx.Request.Body);
ShieldVerifyBody Data = JsonConvert.DeserializeObject<ShieldVerifyBody>(Reader.ReadToEndAsync().Result);
User.UserScheme? user = User.FromToken(Data.Token);
ShieldLoginResponse rsp = new()
{
Retcode = 0,
Message = "OK",
Data = new()
{
Account = null
}
};
if (user != null)
{
rsp.Data = new()
{
Account = new()
{
Uid = user.Uid,
Name = user.Name,
Email = "",
Mobile = "",
IsEmailVerify = "0",
Realname = "",
IdentityCard = "",
Token = user.Token.ToString(),
SafeMobile = "",
FacebookName = "",
GoogleName = "",
TwitterName = "",
GameCenterName = "",
AppleName = "",
SonyName = "",
TapName = "",
Country = "SG",
ReactivateTicket = "",
AreaCode = "**",
DeviceGrantTicket = "",
SteamName = "",
UnmaskedEmail = "",
UnmaskedEmailType = 0
},
DeviceGrantRequired = false,
SafeMoblieRequired = false,
RealpersonRequired = false,
ReactivateRequired = false,
RealnameOperation = "None"
};
}
ctx.Response.Headers.Add("Content-Type", "application/json");
return ctx.Response.WriteAsync(JsonConvert.SerializeObject(rsp));
});
app.MapPost("/{game_biz}/mdk/shield/api/login", (ctx) =>
{
StreamReader Reader = new(ctx.Request.Body);
ShieldLoginBody Data = JsonConvert.DeserializeObject<ShieldLoginBody>(Reader.ReadToEndAsync().Result);
User.UserScheme user = User.FromName(Data.Account);
ShieldLoginResponse rsp = new()
{
Retcode = 0,
Message = "OK",
Data = new()
{
Account = new()
{
Uid = user.Uid,
Name = user.Name,
Email = "",
Mobile = "",
IsEmailVerify = "0",
Realname = "",
IdentityCard = "",
Token = user.Token.ToString(),
SafeMobile = "",
FacebookName = "",
GoogleName = "",
TwitterName = "",
GameCenterName = "",
AppleName = "",
SonyName = "",
TapName = "",
Country = "**",
ReactivateTicket = "",
AreaCode = "**",
DeviceGrantTicket = "",
SteamName = "",
UnmaskedEmail = "",
UnmaskedEmailType = 0
},
DeviceGrantRequired = false,
SafeMoblieRequired = false,
RealpersonRequired = false,
ReactivateRequired = false,
RealnameOperation = "None"
}
};
ctx.Response.Headers.Add("Content-Type", "application/json");
return ctx.Response.WriteAsync(JsonConvert.SerializeObject(rsp));
});
#pragma warning restore CS8600, CS8602 // Converting null literal or possible null value to non-nullable type.
}
}
}

View File

@@ -0,0 +1,226 @@
using Common;
using HttpServer.Models;
using Newtonsoft.Json;
namespace HttpServer.Controllers
{
public class ConfigController
{
public static void AddHandlers(WebApplication app)
{
app.Map("/{game_biz}/mdk/agreement/api/getAgreementInfos", (HttpContext ctx) =>
{
return ctx.Response.WriteAsJsonAsync(new { retcode = 0, message = "OK", data = new { marketing_agreements = Array.Empty<object>() } });
});
app.Map("/data_abtest_api/config/experiment/list", (ctx) =>
{
return ctx.Response.WriteAsJsonAsync(new
{
retcode = 0,
success = true,
message = "",
data = Array.Empty<object>()
});
});
app.Map("/account/device/api/listNewerDevices", (ctx) =>
{
return ctx.Response.WriteAsJsonAsync(new
{
data = new {
devices = Array.Empty<object>(),
latest_id = "0"
},
message = "OK",
retcode = 0
});
});
app.Map("/{game_biz}/combo/granter/api/getConfig", (HttpContext ctx) =>
{
return ctx.Response.WriteAsJsonAsync(new
{
retcode = 0,
message = "OK",
data = new {
protocol = true,
qr_enabled = false,
log_level = "DEBUG",
announce_url = $"https://{Global.config.Gameserver.Host}/bh3/announcement/",
push_alias_type = 2,
disable_ysdk_guard = false,
enable_announce_pic_popup = false,
app_name = "崩坏3-东南亚",
qr_enabled_apps = new { bbs = false, cloud = false },
qr_app_icons = new { app = "", bbs = "", cloud = "" },
qr_cloud_display_name = ""
}
});
});
app.Map("/bh3_os/mdk/shield/api/loadConfig", (HttpContext ctx) =>
{
return ctx.Response.WriteAsJsonAsync(new
{
retcode = 0,
message = "OK",
data = new
{
id = 16,
game_key = ctx.Request.Query["game_key"],
client = "PC",
identity = "I_IDENTITY",
guest = false,
ignore_versions = "",
scene = "S_NORMAL",
name = "崩坏3rd-东南亚",
disable_regist = false,
enable_email_captcha = false,
thirdparty = Array.Empty<string>(),
disable_mmt = false,
server_guest = false,
thirdparty_ignore = new { },
enable_ps_bind_account = false,
thirdparty_login_configs = new { },
initialize_firebase = false
}
});
});
app.Map("/combo/box/api/config/sdk/combo", (HttpContext ctx) =>
{
return ctx.Response.WriteAsJsonAsync(new
{
retcode = 0,
message = "OK",
data = new
{
vals = new
{
list_price_tierv2_enable = "false",
network_report_config = new
{
enable = 0,
status_codes = new int[] { 206 },
url_paths = new string[] { "dataUpload", "red_dot" },
},
kibana_pc_config = new
{
enable = 1,
level = "Debug",
modules = new string[] { "download" }
},
},
},
});
});
app.Map("/device-fp/api/getExtList", (ctx) =>
{
return ctx.Response.WriteAsJsonAsync(new
{
retcode = 0,
message = "OK",
data = new
{
code = 200,
msg = "ok",
ext_list = new string[] {
"cpuName",
"deviceModel",
"deviceName",
"deviceType",
"deviceUID",
"gpuID",
"gpuName",
"gpuAPI",
"gpuVendor",
"gpuVersion",
"gpuMemory",
"osVersion",
"cpuCores",
"cpuFrequency",
"gpuVendorID",
"isGpuMultiTread",
"memorySize",
"screenSize",
"engineName",
"addressMAC"
},
pkg_list = Array.Empty<object>(),
pkg_str = "/vK5WTh5SS3SAj8Zm0qPWg=="
},
});
});
app.Map("/device-fp/api/getFp", (ctx) =>
{
return ctx.Response.WriteAsJsonAsync(new
{
data = new
{
code = 200,
device_fp = ctx.Request.Query["device_fp"],
msg = "ok",
},
message = "OK",
retcode = 0,
});
});
app.Map("/report", (ctx) =>
{
return ctx.Response.WriteAsync("GET LOG");
});
app.Map("/admin/mi18n/{*remainder}", (ctx) =>
{
return ctx.Response.WriteAsJsonAsync(new
{
version = 74
});
});
app.Map("/sdk/dataUpload", (ctx) =>
{
return ctx.Response.WriteAsJsonAsync(new
{
code = 0
});
});
#pragma warning disable CS8600, CS8602 // Converting null literal or possible null value to non-nullable type.
app.MapPost("/{game_biz}/combo/granter/api/compareProtocolVersion", (ctx) =>
{
StreamReader Reader = new(ctx.Request.Body);
CompareProtocolVersionBody Data = JsonConvert.DeserializeObject<CompareProtocolVersionBody>(Reader.ReadToEndAsync().Result);
return ctx.Response.WriteAsJsonAsync(new
{
retcode = 0,
message = "OK",
data = new
{
modified = true,
protocol = new
{
id = 0,
app_id = Data.AppId,
language = Data.Language,
user_proto = "",
priv_proto = "",
major = 0,
minimum = 3,
create_time = "0",
teenager_proto = "",
third_proto = ""
}
}
});
});
#pragma warning restore CS8600, CS8602 // Converting null literal or possible null value to non-nullable type.
}
}
}

View File

@@ -24,6 +24,7 @@ namespace HttpServer.Controllers
}
}
};
ctx.Response.Headers.Add("Content-Type", "application/json");
return ctx.Response.WriteAsync(JsonConvert.SerializeObject(rsp));
});
@@ -59,6 +60,7 @@ namespace HttpServer.Controllers
MihoyoSdkEnv = "2"
}
};
ctx.Response.Headers.Add("Content-Type", "application/json");
return ctx.Response.WriteAsync(JsonConvert.SerializeObject(rsp));
});
}
@@ -89,7 +91,7 @@ namespace HttpServer.Controllers
BlockErrorDialog = "1",
ElevatorModelPath = "GameEntry/EVA/StartLoading_Model",
ExResBuffSize = "10485760",
IsXxxx = "1",
IsXxxx = "0",
MtpSwitch = "0",
NetworkFeedbackEnable = "0",
ShowBulletinButton = "0",
@@ -188,7 +190,15 @@ namespace HttpServer.Controllers
switch (type)
{
case "os":
return new string[] { };
return Global.config.UseLocalCache ? new string[]
{
$"{Global.config.Gameserver.Host}/com.miHoYo.bh3oversea",
$"{Global.config.Gameserver.Host}/com.miHoYo.bh3oversea"
} : new string[]
{
"hk-bigfile-os-mihayo.akamaized.net/com.miHoYo.bh3oversea",
"bigfile-aliyun-os.honkaiimpact3.com/com.miHoYo.bh3oversea"
};
case "gf":
if (version.Contains("beta"))
{