Prepare for web ui
This commit is contained in:
parent
94e3d03762
commit
b5e47900a0
@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
|
||||
<HasSharedItems>true</HasSharedItems>
|
||||
<SharedGUID>29FAECCD-4C19-44F3-963F-6535BE962E2E</SharedGUID>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration">
|
||||
<Import_RootNamespace>Shared</Import_RootNamespace>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="$(MSBuildThisFileDirectory)Models" />
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{739247D2-9B9B-45DE-A97F-216E0D97930C}</ProjectGuid>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" />
|
||||
<Import Project="Shared.projitems" Label="Shared" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" />
|
||||
</Project>
|
@ -1,4 +1,4 @@
|
||||
namespace TaikoLocalServer.Common.Enums;
|
||||
namespace SharedProject.Enums;
|
||||
|
||||
public enum CrownType
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
namespace TaikoLocalServer.Common.Enums;
|
||||
namespace SharedProject.Enums;
|
||||
|
||||
public enum DanClearState
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
namespace TaikoLocalServer.Common.Enums;
|
||||
namespace SharedProject.Enums;
|
||||
|
||||
public enum Difficulty : uint
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
namespace TaikoLocalServer.Common.Enums;
|
||||
namespace SharedProject.Enums;
|
||||
|
||||
public enum PlayMode
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
namespace TaikoLocalServer.Common.Enums;
|
||||
namespace SharedProject.Enums;
|
||||
|
||||
public enum ScoreRank
|
||||
{
|
6
SharedProject/Models/Responses/DashboardResponse.cs
Normal file
6
SharedProject/Models/Responses/DashboardResponse.cs
Normal file
@ -0,0 +1,6 @@
|
||||
namespace SharedProject.Models.Responses;
|
||||
|
||||
public class DashboardResponse
|
||||
{
|
||||
public List<User> Users { get; set; } = new();
|
||||
}
|
8
SharedProject/Models/User.cs
Normal file
8
SharedProject/Models/User.cs
Normal file
@ -0,0 +1,8 @@
|
||||
namespace SharedProject.Models;
|
||||
|
||||
public class User
|
||||
{
|
||||
public string AccessCode { get; set; } = string.Empty;
|
||||
|
||||
public uint Baid { get; set; }
|
||||
}
|
13
SharedProject/SharedProject.csproj
Normal file
13
SharedProject/SharedProject.csproj
Normal file
@ -0,0 +1,13 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Models\Requests" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -5,7 +5,7 @@ VisualStudioVersion = 17.0.32112.339
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TaikoLocalServer", "TaikoLocalServer\TaikoLocalServer.csproj", "{98FDA12C-CD3C-42D0-BEBE-4E809E6E41AC}"
|
||||
EndProject
|
||||
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Shared", "Shared\Shared.shproj", "{739247D2-9B9B-45DE-A97F-216E0D97930C}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharedProject", "SharedProject\SharedProject.csproj", "{34BAE5CA-D46B-489B-8617-3CEB2C0C614F}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@ -17,6 +17,10 @@ Global
|
||||
{98FDA12C-CD3C-42D0-BEBE-4E809E6E41AC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{98FDA12C-CD3C-42D0-BEBE-4E809E6E41AC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{98FDA12C-CD3C-42D0-BEBE-4E809E6E41AC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{34BAE5CA-D46B-489B-8617-3CEB2C0C614F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{34BAE5CA-D46B-489B-8617-3CEB2C0C614F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{34BAE5CA-D46B-489B-8617-3CEB2C0C614F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{34BAE5CA-D46B-489B-8617-3CEB2C0C614F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -18,7 +18,7 @@ public static class Constants
|
||||
|
||||
public const int MIYABI_CORE_RANK_ARRAY_SIZE = MUSIC_ID_MAX + 1;
|
||||
|
||||
public const string DB_NAME = "taiko.db3";
|
||||
public const string DEFAULT_DB_NAME = "taiko.db3";
|
||||
|
||||
public const string MUSIC_ATTRIBUTE_FILE_NAME = "music_attribute.json";
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System.Collections.Specialized;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace TaikoLocalServer.Common;
|
||||
namespace TaikoLocalServer.Common.Utils;
|
||||
|
||||
public static class FlagCalculator
|
||||
{
|
||||
|
@ -22,7 +22,7 @@
|
||||
{
|
||||
return;
|
||||
}
|
||||
var path = Path.Combine(PathHelper.GetDataPath(), Constants.DB_NAME);
|
||||
var path = Path.Combine(PathHelper.GetDataPath(), Constants.DEFAULT_DB_NAME);
|
||||
optionsBuilder.UseSqlite($"Data Source={path}");
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,18 @@
|
||||
namespace TaikoLocalServer.Controllers.AmAuth;
|
||||
using Microsoft.Extensions.Options;
|
||||
using TaikoLocalServer.Settings;
|
||||
|
||||
namespace TaikoLocalServer.Controllers.AmAuth;
|
||||
|
||||
[ApiController]
|
||||
[Route("/sys/servlet/PowerOn")]
|
||||
public class PowerOnController : BaseController<PowerOnController>
|
||||
{
|
||||
private const string HOST_STARTUP = "vsapi.taiko-p.jp";
|
||||
private readonly UrlSettings settings;
|
||||
|
||||
public PowerOnController(IOptions<UrlSettings> settings)
|
||||
{
|
||||
this.settings = settings.Value;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ContentResult PowerOn([FromForm] PowerOnRequest request)
|
||||
@ -14,8 +22,8 @@ public class PowerOnController : BaseController<PowerOnController>
|
||||
var response = new Dictionary<string, string>
|
||||
{
|
||||
{"stat", "1"},
|
||||
{"uri", HOST_STARTUP},
|
||||
{"host", HOST_STARTUP},
|
||||
{"uri", settings.GameUrl},
|
||||
{"host", settings.GameUrl},
|
||||
{"place_id", "JPN0123"},
|
||||
{"name", "NAMCO"},
|
||||
{"nickname", "NAMCO"},
|
||||
|
@ -1,8 +1,16 @@
|
||||
namespace TaikoLocalServer.Controllers.AmUpdater;
|
||||
using Microsoft.Extensions.Options;
|
||||
using TaikoLocalServer.Settings;
|
||||
|
||||
namespace TaikoLocalServer.Controllers.AmUpdater;
|
||||
|
||||
public class MuchaController : BaseController<MuchaController>
|
||||
{
|
||||
private const string URL_BASE = "https://v402-front.mucha-prd.nbgi-amnet.jp:10122";
|
||||
private readonly UrlSettings settings;
|
||||
|
||||
public MuchaController(IOptions<UrlSettings> settings)
|
||||
{
|
||||
this.settings = settings.Value;
|
||||
}
|
||||
|
||||
[HttpPost("/mucha_front/boardauth.do")]
|
||||
|
||||
@ -31,12 +39,12 @@ public class MuchaController : BaseController<MuchaController>
|
||||
{ "AREA_FULL_3", "" },
|
||||
{ "AREA_FULL_3_EN", "" },
|
||||
{ "AUTH_INTERVAL", "86400" },
|
||||
{ "CHARGE_URL", $"{URL_BASE}/charge/" },
|
||||
{ "CHARGE_URL", $"{settings.MuchaUrl}/charge/" },
|
||||
{ "CONSUME_TOKEN", "0" },
|
||||
{ "COUNTRY_CD", "JPN" },
|
||||
{ "DONGLE_FLG", "1" },
|
||||
{ "EXPIRATION_DATE", "null" },
|
||||
{ "FILE_URL", $"{URL_BASE}/file/" },
|
||||
{ "FILE_URL", $"{settings.MuchaUrl}/file/" },
|
||||
{ "FORCE_BOOT", "0" },
|
||||
{ "PLACE_ID", request.PlaceId ?? "" },
|
||||
{ "PREFECTURE_ID", "14" },
|
||||
@ -46,9 +54,9 @@ public class MuchaController : BaseController<MuchaController>
|
||||
{ "SHOP_NAME_EN", "NAMCO" },
|
||||
{ "SHOP_NICKNAME", "W" },
|
||||
{ "SHOP_NICKNAME_EN", "W" },
|
||||
{ "URL_1", $"{URL_BASE}/url1/" },
|
||||
{ "URL_2", $"{URL_BASE}/url2/" },
|
||||
{ "URL_3", $"{URL_BASE}/url3/" },
|
||||
{ "URL_1", $"{settings.MuchaUrl}/url1/" },
|
||||
{ "URL_2", $"{settings.MuchaUrl}/url2/" },
|
||||
{ "URL_3", $"{settings.MuchaUrl}/url3/" },
|
||||
{ "USE_TOKEN", "0" }
|
||||
};
|
||||
var formOutput = FormOutputUtil.ToFormOutput(response);
|
||||
@ -63,10 +71,10 @@ public class MuchaController : BaseController<MuchaController>
|
||||
{
|
||||
{ "RESULTS", "001" },
|
||||
{ "UPDATE_VER_1", request.GameVersion ?? "S1210JPN08.18" },
|
||||
{ "UPDATE_URL_1", $"{URL_BASE}/updUrl1/" },
|
||||
{ "UPDATE_URL_1", $"{settings.MuchaUrl}/updUrl1/" },
|
||||
{ "UPDATE_SIZE_1", "0" },
|
||||
{ "UPDATE_CRC_1", "0000000000000000" },
|
||||
{ "CHECK_URL_1", $"{URL_BASE}/checkUrl/" },
|
||||
{ "CHECK_URL_1", $"{settings.MuchaUrl}/checkUrl/" },
|
||||
{ "EXE_VER_1", request.GameVersion ?? "S1210JPN08.18" },
|
||||
{ "INFO_SIZE_1", "0" },
|
||||
{ "COM_SIZE_1", "0" },
|
||||
|
@ -1,8 +1,29 @@
|
||||
namespace TaikoLocalServer.Controllers.Api;
|
||||
using SharedProject.Models;
|
||||
using SharedProject.Models.Responses;
|
||||
using Swan.Mapping;
|
||||
|
||||
namespace TaikoLocalServer.Controllers.Api;
|
||||
|
||||
[ApiController]
|
||||
[Route("/api/[controller]")]
|
||||
public class DashboardController : BaseController<DashboardController>
|
||||
{
|
||||
private readonly TaikoDbContext context;
|
||||
|
||||
public DashboardController(TaikoDbContext context)
|
||||
{
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public DashboardResponse GetDashboard()
|
||||
{
|
||||
var cards = context.Cards.AsEnumerable();
|
||||
var users = cards.Select(card => card.CopyPropertiesToNew<User>()).ToList();
|
||||
return new DashboardResponse
|
||||
{
|
||||
Users = users
|
||||
};
|
||||
}
|
||||
|
||||
}
|
@ -3,9 +3,9 @@ global using Microsoft.AspNetCore.Mvc;
|
||||
global using Microsoft.EntityFrameworkCore;
|
||||
global using ProtoBuf;
|
||||
global using Swan.Formatters;
|
||||
global using SharedProject.Enums;
|
||||
global using taiko.game;
|
||||
global using TaikoLocalServer.Common;
|
||||
global using TaikoLocalServer.Common.Enums;
|
||||
global using TaikoLocalServer.Common.Utils;
|
||||
global using TaikoLocalServer.Context;
|
||||
global using TaikoLocalServer.Entities;
|
||||
|
@ -2,6 +2,7 @@ using System.Security.Authentication;
|
||||
using Microsoft.AspNetCore.HttpLogging;
|
||||
using Microsoft.AspNetCore.HttpOverrides;
|
||||
using TaikoLocalServer.Middlewares;
|
||||
using TaikoLocalServer.Settings;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
// Manually enable tls 1.0
|
||||
@ -14,11 +15,17 @@ builder.WebHost.UseKestrel(kestrelOptions =>
|
||||
});
|
||||
|
||||
// Add services to the container.
|
||||
|
||||
builder.Services.AddOptions();
|
||||
builder.Services.Configure<UrlSettings>(builder.Configuration.GetSection(nameof(UrlSettings)));
|
||||
builder.Services.AddControllers().AddProtoBufNet();
|
||||
builder.Services.AddDbContext<TaikoDbContext>(option =>
|
||||
{
|
||||
var path = Path.Combine(PathHelper.GetDataPath(), Constants.DB_NAME);
|
||||
var dbName = builder.Configuration["DbFileName"];
|
||||
if (string.IsNullOrEmpty(dbName))
|
||||
{
|
||||
dbName = Constants.DEFAULT_DB_NAME;
|
||||
}
|
||||
var path = Path.Combine(PathHelper.GetDataPath(), dbName);
|
||||
option.UseSqlite($"Data Source={path}");
|
||||
});
|
||||
builder.Services.AddHttpLogging(options =>
|
||||
|
8
TaikoLocalServer/Settings/UrlSettings.cs
Normal file
8
TaikoLocalServer/Settings/UrlSettings.cs
Normal file
@ -0,0 +1,8 @@
|
||||
namespace TaikoLocalServer.Settings;
|
||||
|
||||
public class UrlSettings
|
||||
{
|
||||
public string MuchaUrl { get; set; } = string.Empty;
|
||||
|
||||
public string GameUrl { get; set; } = string.Empty;
|
||||
}
|
@ -42,4 +42,8 @@
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SharedProject\SharedProject.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -1,4 +1,9 @@
|
||||
{
|
||||
"UrlSettings": {
|
||||
"MuchaUrl": "https://v402-front.mucha-prd.nbgi-amnet.jp:10122",
|
||||
"GameUrl": "vsapi.taiko-p.jp"
|
||||
},
|
||||
"DbFileName" : "taiko.db3",
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
|
Loading…
Reference in New Issue
Block a user