mirror of
https://github.com/real-zony/ZonyLrcToolsX.git
synced 2025-07-01 20:30:41 +00:00
refactor: Removed the local server project.
This commit is contained in:
parent
be538eb650
commit
14812bceb7
@ -11,8 +11,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZonyLrcTools.Cli", "src\Zon
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZonyLrcTools.Tests", "tests\ZonyLrcTools.Tests\ZonyLrcTools.Tests.csproj", "{FFBD3200-568F-455B-8390-5E76C51D522C}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZonyLrcTools.Tests", "tests\ZonyLrcTools.Tests\ZonyLrcTools.Tests.csproj", "{FFBD3200-568F-455B-8390-5E76C51D522C}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZonyLrcTools.LocalServer", "src\ZonyLrcTools.LocalServer\ZonyLrcTools.LocalServer.csproj", "{2875A08A-FFD6-4863-B815-5384DCFE88FC}"
|
|
||||||
EndProject
|
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZonyLrcTools.Common", "src\ZonyLrcTools.Common\ZonyLrcTools.Common.csproj", "{9B42E4CA-61AA-4798-8D2B-2D8A7035EB67}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZonyLrcTools.Common", "src\ZonyLrcTools.Common\ZonyLrcTools.Common.csproj", "{9B42E4CA-61AA-4798-8D2B-2D8A7035EB67}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZonyLrcTools.Desktop", "src\ZonyLrcTools.Desktop\ZonyLrcTools.Desktop.csproj", "{DC92902B-4303-4E43-AFB3-3F93FD3986AD}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZonyLrcTools.Desktop", "src\ZonyLrcTools.Desktop\ZonyLrcTools.Desktop.csproj", "{DC92902B-4303-4E43-AFB3-3F93FD3986AD}"
|
||||||
@ -31,10 +29,6 @@ Global
|
|||||||
{FFBD3200-568F-455B-8390-5E76C51D522C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{FFBD3200-568F-455B-8390-5E76C51D522C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{FFBD3200-568F-455B-8390-5E76C51D522C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{FFBD3200-568F-455B-8390-5E76C51D522C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{FFBD3200-568F-455B-8390-5E76C51D522C}.Release|Any CPU.Build.0 = Release|Any CPU
|
{FFBD3200-568F-455B-8390-5E76C51D522C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{2875A08A-FFD6-4863-B815-5384DCFE88FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{2875A08A-FFD6-4863-B815-5384DCFE88FC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{2875A08A-FFD6-4863-B815-5384DCFE88FC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{2875A08A-FFD6-4863-B815-5384DCFE88FC}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{9B42E4CA-61AA-4798-8D2B-2D8A7035EB67}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{9B42E4CA-61AA-4798-8D2B-2D8A7035EB67}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{9B42E4CA-61AA-4798-8D2B-2D8A7035EB67}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{9B42E4CA-61AA-4798-8D2B-2D8A7035EB67}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{9B42E4CA-61AA-4798-8D2B-2D8A7035EB67}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{9B42E4CA-61AA-4798-8D2B-2D8A7035EB67}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
@ -53,7 +47,6 @@ Global
|
|||||||
GlobalSection(NestedProjects) = preSolution
|
GlobalSection(NestedProjects) = preSolution
|
||||||
{55D74323-ABFA-4A73-A3BF-F3E8D5DE6DE8} = {C29FB05C-54B1-4020-94D2-87E192EB2F98}
|
{55D74323-ABFA-4A73-A3BF-F3E8D5DE6DE8} = {C29FB05C-54B1-4020-94D2-87E192EB2F98}
|
||||||
{FFBD3200-568F-455B-8390-5E76C51D522C} = {AF8ADB2F-E46C-4DEE-8316-652D9FE1A69B}
|
{FFBD3200-568F-455B-8390-5E76C51D522C} = {AF8ADB2F-E46C-4DEE-8316-652D9FE1A69B}
|
||||||
{2875A08A-FFD6-4863-B815-5384DCFE88FC} = {C29FB05C-54B1-4020-94D2-87E192EB2F98}
|
|
||||||
{9B42E4CA-61AA-4798-8D2B-2D8A7035EB67} = {C29FB05C-54B1-4020-94D2-87E192EB2F98}
|
{9B42E4CA-61AA-4798-8D2B-2D8A7035EB67} = {C29FB05C-54B1-4020-94D2-87E192EB2F98}
|
||||||
{DC92902B-4303-4E43-AFB3-3F93FD3986AD} = {C29FB05C-54B1-4020-94D2-87E192EB2F98}
|
{DC92902B-4303-4E43-AFB3-3F93FD3986AD} = {C29FB05C-54B1-4020-94D2-87E192EB2F98}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
namespace ZonyLrcTools.LocalServer.Contract.Dtos;
|
|
||||||
|
|
||||||
public class PagedListRequestDto
|
|
||||||
{
|
|
||||||
public int PageIndex { get; set; }
|
|
||||||
public int PageSize { get; set; }
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
namespace ZonyLrcTools.LocalServer.Contract.Dtos;
|
|
||||||
|
|
||||||
public class PagedListResultDto<T>
|
|
||||||
{
|
|
||||||
public int TotalCount { get; set; }
|
|
||||||
public int PageIndex { get; set; }
|
|
||||||
public int PageSize { get; set; }
|
|
||||||
public List<T> Items { get; set; } = new List<T>();
|
|
||||||
}
|
|
@ -1,24 +0,0 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using ZonyLrcTools.Common.Infrastructure.DependencyInject;
|
|
||||||
using ZonyLrcTools.LocalServer.Contract.Dtos;
|
|
||||||
using ZonyLrcTools.LocalServer.Services.MusicInfo;
|
|
||||||
using ZonyLrcTools.LocalServer.Services.MusicInfo.Dtos;
|
|
||||||
|
|
||||||
namespace ZonyLrcTools.LocalServer.Controllers;
|
|
||||||
|
|
||||||
[Route("api/music-infos")]
|
|
||||||
public class MusicInfoController : Controller, IMusicInfoService, ITransientDependency
|
|
||||||
{
|
|
||||||
private readonly IMusicInfoService _musicInfoService;
|
|
||||||
|
|
||||||
public MusicInfoController(IMusicInfoService musicInfoService)
|
|
||||||
{
|
|
||||||
_musicInfoService = musicInfoService;
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet]
|
|
||||||
public Task<PagedListResultDto<MusicInfoListItemDto>> GetMusicInfoListAsync(MusicInfoListInput input)
|
|
||||||
{
|
|
||||||
return _musicInfoService.GetMusicInfoListAsync(input);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
using SuperSocket.WebSocket.Server;
|
|
||||||
|
|
||||||
namespace ZonyLrcTools.LocalServer.EventBus;
|
|
||||||
|
|
||||||
public class SuperSocketListener
|
|
||||||
{
|
|
||||||
public async Task ListenAsync()
|
|
||||||
{
|
|
||||||
var host = WebSocketHostBuilder.Create()
|
|
||||||
.UseWebSocketMessageHandler(async (session, message) => { await session.SendAsync(message); })
|
|
||||||
.Build();
|
|
||||||
|
|
||||||
await host.StartAsync();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,66 +0,0 @@
|
|||||||
using System.Diagnostics;
|
|
||||||
using System.Reflection;
|
|
||||||
using ZonyLrcTools.Common.Infrastructure.DependencyInject;
|
|
||||||
using ZonyLrcTools.LocalServer.EventBus;
|
|
||||||
|
|
||||||
#region Main Flow
|
|
||||||
|
|
||||||
var app = RegisterAndConfigureServices();
|
|
||||||
await ListenServices();
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Configure Services
|
|
||||||
|
|
||||||
async Task ListenServices()
|
|
||||||
{
|
|
||||||
await new SuperSocketListener().ListenAsync();
|
|
||||||
await app?.RunAsync()!;
|
|
||||||
}
|
|
||||||
|
|
||||||
WebApplication? RegisterAndConfigureServices()
|
|
||||||
{
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
|
||||||
builder.WebHost.ConfigureKestrel(k => k.ListenAnyIP(50002));
|
|
||||||
|
|
||||||
builder.Services.AddControllers();
|
|
||||||
builder.Services.AddEndpointsApiExplorer();
|
|
||||||
builder.Services.BeginAutoDependencyInject<Program>();
|
|
||||||
|
|
||||||
var insideApp = builder.Build();
|
|
||||||
insideApp.UseSpaStaticFiles(new StaticFileOptions
|
|
||||||
{
|
|
||||||
RequestPath = "",
|
|
||||||
FileProvider = new Microsoft.Extensions.FileProviders
|
|
||||||
.ManifestEmbeddedFileProvider(
|
|
||||||
Assembly.GetExecutingAssembly(), "UiStaticResources"
|
|
||||||
)
|
|
||||||
});
|
|
||||||
|
|
||||||
insideApp.MapControllers();
|
|
||||||
#if !DEBUG
|
|
||||||
insideApp.Lifetime.ApplicationStarted.Register(OpenBrowser);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return insideApp;
|
|
||||||
}
|
|
||||||
|
|
||||||
void OpenBrowser()
|
|
||||||
{
|
|
||||||
const string url = "http://localhost:50002/index.html";
|
|
||||||
|
|
||||||
if (OperatingSystem.IsWindows())
|
|
||||||
{
|
|
||||||
Process.Start("explorer.exe", url);
|
|
||||||
}
|
|
||||||
else if (OperatingSystem.IsMacOS())
|
|
||||||
{
|
|
||||||
Process.Start("open", url);
|
|
||||||
}
|
|
||||||
else if (OperatingSystem.IsLinux())
|
|
||||||
{
|
|
||||||
Process.Start("xdg-open", url);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
@ -1,14 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "https://json.schemastore.org/launchsettings.json",
|
|
||||||
"profiles": {
|
|
||||||
"ZonyLrcTools.LocalServer": {
|
|
||||||
"commandName": "Project",
|
|
||||||
"dotnetRunMessages": true,
|
|
||||||
"launchBrowser": true,
|
|
||||||
"applicationUrl": "http://localhost:50002",
|
|
||||||
"environmentVariables": {
|
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
using ZonyLrcTools.LocalServer.Contract.Dtos;
|
|
||||||
|
|
||||||
namespace ZonyLrcTools.LocalServer.Services.MusicInfo.Dtos;
|
|
||||||
|
|
||||||
public class MusicInfoListItemDto
|
|
||||||
{
|
|
||||||
public string Name { get; set; }
|
|
||||||
|
|
||||||
public int Size { get; set; }
|
|
||||||
|
|
||||||
public int Status { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class MusicInfoListInput : PagedListRequestDto
|
|
||||||
{
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
using ZonyLrcTools.LocalServer.Contract.Dtos;
|
|
||||||
using ZonyLrcTools.LocalServer.Services.MusicInfo.Dtos;
|
|
||||||
|
|
||||||
namespace ZonyLrcTools.LocalServer.Services.MusicInfo;
|
|
||||||
|
|
||||||
public interface IMusicInfoService
|
|
||||||
{
|
|
||||||
Task<PagedListResultDto<MusicInfoListItemDto>> GetMusicInfoListAsync(MusicInfoListInput input);
|
|
||||||
}
|
|
@ -1,38 +0,0 @@
|
|||||||
using ZonyLrcTools.Common.Infrastructure.DependencyInject;
|
|
||||||
using ZonyLrcTools.LocalServer.Contract.Dtos;
|
|
||||||
using ZonyLrcTools.LocalServer.Services.MusicInfo.Dtos;
|
|
||||||
|
|
||||||
namespace ZonyLrcTools.LocalServer.Services.MusicInfo;
|
|
||||||
|
|
||||||
public class MusicInfoService : ITransientDependency, IMusicInfoService
|
|
||||||
{
|
|
||||||
public async Task<PagedListResultDto<MusicInfoListItemDto>> GetMusicInfoListAsync(MusicInfoListInput input)
|
|
||||||
{
|
|
||||||
await Task.CompletedTask;
|
|
||||||
|
|
||||||
return new PagedListResultDto<MusicInfoListItemDto>
|
|
||||||
{
|
|
||||||
Items = new List<MusicInfoListItemDto>
|
|
||||||
{
|
|
||||||
new MusicInfoListItemDto
|
|
||||||
{
|
|
||||||
Name = "测试歌曲",
|
|
||||||
Size = 1024,
|
|
||||||
Status = 1
|
|
||||||
},
|
|
||||||
new MusicInfoListItemDto
|
|
||||||
{
|
|
||||||
Name = "测试歌曲2",
|
|
||||||
Size = 1024,
|
|
||||||
Status = 1
|
|
||||||
},
|
|
||||||
new MusicInfoListItemDto
|
|
||||||
{
|
|
||||||
Name = "测试歌曲3",
|
|
||||||
Size = 1024,
|
|
||||||
Status = 1
|
|
||||||
},
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,36 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<GenerateEmbeddedFilesManifest>true</GenerateEmbeddedFilesManifest>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="AutoMapper"/>
|
|
||||||
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection"/>
|
|
||||||
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions"/>
|
|
||||||
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded"/>
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting"/>
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions"/>
|
|
||||||
<PackageReference Include="Serilog.Extensions.Hosting"/>
|
|
||||||
<PackageReference Include="Serilog.Sinks.Console"/>
|
|
||||||
<PackageReference Include="Serilog.Sinks.File"/>
|
|
||||||
<PackageReference Include="SuperSocket.WebSocket"/>
|
|
||||||
<PackageReference Include="SuperSocket.WebSocket.Server"/>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<EmbeddedResource Include="UiStaticResources\**"/>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\ZonyLrcTools.Common\ZonyLrcTools.Common.csproj"/>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<!-- <ItemGroup>-->
|
|
||||||
<!-- <ProjectReference Include="..\ZonyLrcTools.Cli\ZonyLrcTools.Cli.csproj" />-->
|
|
||||||
<!-- </ItemGroup>-->
|
|
||||||
|
|
||||||
</Project>
|
|
@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"Logging": {
|
|
||||||
"LogLevel": {
|
|
||||||
"Default": "Debug",
|
|
||||||
"Microsoft.AspNetCore": "Warning"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
{
|
|
||||||
"Logging": {
|
|
||||||
"LogLevel": {
|
|
||||||
"Default": "Information",
|
|
||||||
"Microsoft.AspNetCore": "Warning"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"AllowedHosts": "*",
|
|
||||||
"serverOptions": {
|
|
||||||
"name": "ZonyLRcToolsServer",
|
|
||||||
"listeners": [
|
|
||||||
{
|
|
||||||
"ip": "Any",
|
|
||||||
"port": 50001
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user