Skip to content

Commit

Permalink
fix: 调整服务器command,设置默认端口为23333
Browse files Browse the repository at this point in the history
  • Loading branch information
gnattu committed Oct 25, 2023
1 parent f964883 commit b8d1925
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
9 changes: 5 additions & 4 deletions BBDown/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public static async Task<int> Main(params string[] args)
new[] { "--listen", "-l" },
description: "服务器监听url");
Command runAsServerCommand = new(
"server",
"serve",
"以服务器模式运行")
{ serverUrlOpt };
runAsServerCommand.SetHandler(StartServer, serverUrlOpt);
Expand Down Expand Up @@ -121,7 +121,7 @@ public static async Task<int> Main(params string[] args)
if (commandLineResult.CommandResult.Command.Name.ToLower() != Path.GetFileNameWithoutExtension(Environment.ProcessPath)!.ToLower())
{
// 服务器模式需要完整的arg列表
if (commandLineResult.CommandResult.Command.Name.ToLower() == "server")
if (commandLineResult.CommandResult.Command.Name.ToLower() == "serve")
{
return await parser.InvokeAsync(args.ToArray());
}
Expand Down Expand Up @@ -168,13 +168,14 @@ private static Task RunApp(MyOption myOption)
return DoWorkAsync(myOption);
}

private static void StartServer(string listenUrl)
private static void StartServer(string? listenUrl)
{
var defaultListenUrl = "http://0.0.0.0:23333";
//检测更新
CheckUpdateAsync();
var server = new BBDownApiServer();
server.SetUpServer();
server.Run(listenUrl);
server.Run(string.IsNullOrEmpty(listenUrl) ? defaultListenUrl : listenUrl);
}

public static (Dictionary<string, byte>? encodingPriority, Dictionary<string, int>? dfnPriority, string? firstEncoding,
Expand Down
4 changes: 1 addition & 3 deletions BBDown/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@
"profiles": {
"BBDown": {
"commandName": "Project",
"commandLineArgs": "",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:58682"
},
"BBDown.Server": {
"commandName": "Project",
"commandLineArgs": "server -l http://0.0.0.0:58682",
"launchBrowser": false,
"commandLineArgs": "serve",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
Expand Down

0 comments on commit b8d1925

Please sign in to comment.