mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-01 22:20:52 +00:00
Closes #373
This commit is contained in:
@@ -102,7 +102,7 @@ namespace ArchiSteamFarm {
|
||||
internal readonly ushort WCFPort = DefaultWCFPort;
|
||||
|
||||
[JsonProperty]
|
||||
internal string WCFHostname { get; set; } = "localhost";
|
||||
internal string WCFHost { get; set; } = "127.0.0.1";
|
||||
|
||||
// This constructor is used only by deserializer
|
||||
private GlobalConfig() { }
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace ArchiSteamFarm {
|
||||
Console.Write("<" + botName + "> Please enter your 2 factor auth code from your authenticator app: ");
|
||||
break;
|
||||
case ASF.EUserInputType.WCFHostname:
|
||||
Console.Write("<" + botName + "> Please enter your WCF hostname: ");
|
||||
Console.Write("<" + botName + "> Please enter your WCF host: ");
|
||||
break;
|
||||
default:
|
||||
Console.Write("<" + botName + "> Please enter not documented yet value of \"" + userInputType + "\": ");
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
|
||||
internal sealed class WCF : IWCF, IDisposable {
|
||||
private static string URL = "http://localhost:1242/ASF";
|
||||
private static string URL = "net.tcp://127.0.0.1:1242/ASF";
|
||||
|
||||
internal bool IsServerRunning => ServiceHost != null;
|
||||
|
||||
@@ -76,14 +76,14 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
|
||||
internal static void Init() {
|
||||
if (string.IsNullOrEmpty(Program.GlobalConfig.WCFHostname)) {
|
||||
Program.GlobalConfig.WCFHostname = Program.GetUserInput(ASF.EUserInputType.WCFHostname);
|
||||
if (string.IsNullOrEmpty(Program.GlobalConfig.WCFHostname)) {
|
||||
if (string.IsNullOrEmpty(Program.GlobalConfig.WCFHost)) {
|
||||
Program.GlobalConfig.WCFHost = Program.GetUserInput(ASF.EUserInputType.WCFHostname);
|
||||
if (string.IsNullOrEmpty(Program.GlobalConfig.WCFHost)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
URL = "http://" + Program.GlobalConfig.WCFHostname + ":" + Program.GlobalConfig.WCFPort + "/ASF";
|
||||
URL = "net.tcp://" + Program.GlobalConfig.WCFHost + ":" + Program.GlobalConfig.WCFPort + "/ASF";
|
||||
}
|
||||
|
||||
internal string SendCommand(string input) {
|
||||
@@ -93,7 +93,7 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
|
||||
if (Client == null) {
|
||||
Client = new Client(new BasicHttpBinding(), new EndpointAddress(URL));
|
||||
Client = new Client(new NetTcpBinding(), new EndpointAddress(URL));
|
||||
}
|
||||
|
||||
return Client.HandleCommand(input);
|
||||
@@ -104,15 +104,15 @@ namespace ArchiSteamFarm {
|
||||
return;
|
||||
}
|
||||
|
||||
ASF.ArchiLogger.LogGenericInfo("Starting WCF server...");
|
||||
ASF.ArchiLogger.LogGenericInfo("Starting WCF server on " + URL + " ...");
|
||||
|
||||
try {
|
||||
ServiceHost = new ServiceHost(typeof(WCF), new Uri(URL));
|
||||
|
||||
ServiceHost.Description.Behaviors.Add(new ServiceMetadataBehavior { HttpGetEnabled = true });
|
||||
ServiceHost.Description.Behaviors.Add(new ServiceMetadataBehavior());
|
||||
|
||||
ServiceHost.AddServiceEndpoint(ServiceMetadataBehavior.MexContractName, MetadataExchangeBindings.CreateMexHttpBinding(), "mex");
|
||||
ServiceHost.AddServiceEndpoint(typeof(IWCF), new BasicHttpBinding(), string.Empty);
|
||||
ServiceHost.AddServiceEndpoint(ServiceMetadataBehavior.MexContractName, MetadataExchangeBindings.CreateMexTcpBinding(), "mex");
|
||||
ServiceHost.AddServiceEndpoint(typeof(IWCF), new NetTcpBinding(), string.Empty);
|
||||
|
||||
ServiceHost.Open();
|
||||
ASF.ArchiLogger.LogGenericInfo("WCF server ready!");
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
"MaxTradeHoldDuration": 15,
|
||||
"ForceHttp": false,
|
||||
"HttpTimeout": 60,
|
||||
"WCFHostname": "localhost",
|
||||
"WCFHost": "127.0.0.1",
|
||||
"WCFPort": 1242,
|
||||
"Statistics": true,
|
||||
"Blacklist": [
|
||||
|
||||
Reference in New Issue
Block a user