diff --git a/BodyshopUploader/Utils/HTTPServer.cs b/BodyshopUploader/Utils/HTTPServer.cs index 6fa76c8..5e14124 100644 --- a/BodyshopUploader/Utils/HTTPServer.cs +++ b/BodyshopUploader/Utils/HTTPServer.cs @@ -21,6 +21,7 @@ namespace BodyshopPartner.Utils { Route.Add("/qb/", (req, res, props) => { + hlog("Received a ping from ImEX.online"); res.WithCORS(); //res.AddHeader("Access-Control-Allow-Origin", "http://localhost:3000 https://localhost:3000 http://localhost:5000 https://localhost:5000 https://*.imex.online,imex.online"); res.Close(); diff --git a/BodyshopUploader/Utils/SquirrelAwareHelper.cs b/BodyshopUploader/Utils/SquirrelAwareHelper.cs index 28abbb5..047ae15 100644 --- a/BodyshopUploader/Utils/SquirrelAwareHelper.cs +++ b/BodyshopUploader/Utils/SquirrelAwareHelper.cs @@ -20,16 +20,32 @@ namespace BodyshopPartner.Utils onInitialInstall: v => { logger.Debug("Installing via Squirrel Aware Helper. ", v); + try + { + logger.Debug("Attempting to add HTTP Exclusion for web-server"); + System.Diagnostics.Process process = new System.Diagnostics.Process(); + System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(); + startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; + startInfo.FileName = "cmd.exe"; + startInfo.Arguments = "add netsh http add urlacl url=http://+:1337/ user=\"Everyone\""; + startInfo.Verb = "runas"; + process.StartInfo = startInfo; + bool successful = process.Start(); - logger.Debug("Attempting to add HTTP Exclusion for web-server"); - System.Diagnostics.Process process = new System.Diagnostics.Process(); - System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(); - startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; - startInfo.FileName = "cmd.exe"; - startInfo.Arguments = "add netsh http add urlacl url=http://+:1337/ user=\"Everyone\""; - startInfo.Verb = "runas"; - process.StartInfo = startInfo; - process.Start(); + if (successful) + { + logger.Debug("Successfully added exception."); + } + else + { + logger.Fatal("Unable to set exception for http port"); + } + + } + catch (Exception Ex) + { + logger.Fatal("Unable to set exception for http port", Ex.ToString()); + } mgr.CreateShortcutForThisExe(); }, diff --git a/BodyshopUploader/ViewModels/MainViewModel.cs b/BodyshopUploader/ViewModels/MainViewModel.cs index df8f433..d42d688 100644 --- a/BodyshopUploader/ViewModels/MainViewModel.cs +++ b/BodyshopUploader/ViewModels/MainViewModel.cs @@ -255,51 +255,33 @@ namespace BodyshopPartner.ViewModels public async Task TestGql() { - Utils.Notifications.notifier.ShowInformation("The message"); + try + { + logger.Debug("Attempting to add HTTP Exclusion for web-server"); + System.Diagnostics.Process process = new System.Diagnostics.Process(); + System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(); + startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; + startInfo.FileName = "cmd.exe"; + startInfo.Arguments = "add netsh http add urlacl url=http://+:1337/ user=\"Everyone\""; + startInfo.Verb = "runas"; + process.StartInfo = startInfo; + bool successful = process.Start(); + if (successful) + { + logger.Debug("Successfully added exception."); + } + else + { + logger.Fatal("Unable to set exception for http port"); + AddHttpStatus("Unable to add exception for the port! Please run as an administrator."); + } - //Notification _n = new Notification() - //{ - // Id = new Random().Next(), - // Title = "This is a title", - // Subtitle = "Subtitle", - // Message = "Somethin" - //}; - //Growler.AddNotification(_n); - - Console.WriteLine(al.FirebaseToken); - FirebaseAuthLink t = await al.GetFreshAuthAsync(); - Console.WriteLine(t.FirebaseToken); - AddHttpStatus(t.FirebaseToken); - //var r = new GraphQLRequest - //{ - // Query = @"query MyQuery($key: String!) { - // masterdata(where: {key: {_eq: $key}}) { - // value - // key - // } - // }", - // Variables = new - // { - // key = Utils.AppMetaData.ShopRegion + "_ciecaopcodes" - // } - //}; - //var data = await Utils.GraphQL.ExecuteQuery(r); - - ////var t = Newtonsoft.Json.JsonConvert.DeserializeObject>(data.masterdata[0].value.Value); - //Utils.AppMetaData.CiecaOpCodes = JObject.Parse(data.masterdata[0].value.Value); - - //try - //{ - // var aa = Utils.AppMetaData.CiecaOpCodes.Property("OP1").Children(); - // var cc = Utils.AppMetaData.CiecaOpCodes["OP1"]["desc"].Value; - // var ab = Utils.AppMetaData.CiecaOpCodes.Property("OP1.desc"); - - //} - //catch (Exception EX) - //{ - // logger.Warn("Err"); - //} + } + catch (Exception Ex) + { + logger.Fatal("Unable to set exception for http port", Ex.ToString()); + } } }