Skip to content

Commit 78297c1

Browse files
author
gauffininteractive
committed
small fixes
1 parent f6eeb7b commit 78297c1

File tree

7 files changed

+36
-26
lines changed

7 files changed

+36
-26
lines changed

src/Server/OneTrueError.App/Modules/Geolocation/EventHandlers/StorePositionFromNewReport.cs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Globalization;
23
using System.IO;
34
using System.Net;
45
using System.Threading.Tasks;
@@ -48,34 +49,36 @@ public async Task HandleAsync(ReportAddedToIncident e)
4849
return;
4950

5051
var request = WebRequest.CreateHttp("http://freegeoip.net/json/" + e.Report.RemoteAddress);
52+
string json = "";
5153
try
5254
{
5355
var response = await request.GetResponseAsync();
5456
var stream = response.GetResponseStream();
5557
var reader = new StreamReader(stream);
56-
var json = await reader.ReadToEndAsync();
58+
json = await reader.ReadToEndAsync();
5759
var jsonObj = JObject.Parse(json);
5860

5961
/* /*{"ip":"94.254.21.175","country_code":"SE","country_name":"Sweden","region_code":"10","region_name":"Dalarnas Lan","city":"Falun","zipcode":"",
6062
* "latitude":60.6,"longitude":15.6333,
6163
* "metro_code":"","areacode":""}*/
6264

63-
var lat = double.Parse(jsonObj["latitude"].Value<string>());
64-
var lon = double.Parse(jsonObj["longitude"].Value<string>());
65-
var cmd = new ErrorOrigin(e.Report.RemoteAddress, lon, lat);
66-
cmd.City = jsonObj["city"].ToString();
67-
cmd.CountryName = jsonObj["city"].ToString();
68-
cmd.CountryCode = jsonObj["country_code"].ToString();
69-
cmd.CountryName = jsonObj["country_name"].ToString();
70-
cmd.RegionCode = jsonObj["region_code"].ToString();
71-
cmd.RegionName = jsonObj["region_name"].ToString();
72-
cmd.ZipCode = jsonObj["zip_code"].ToString();
65+
var lat = double.Parse(jsonObj["latitude"].Value<string>(), CultureInfo.InvariantCulture);
66+
var lon = double.Parse(jsonObj["longitude"].Value<string>(), CultureInfo.InvariantCulture);
67+
var cmd = new ErrorOrigin(e.Report.RemoteAddress, lon, lat)
68+
{
69+
City = jsonObj["city"].ToString(),
70+
CountryCode = jsonObj["country_code"].ToString(),
71+
CountryName = jsonObj["country_name"].ToString(),
72+
RegionCode = jsonObj["region_code"].ToString(),
73+
RegionName = jsonObj["region_name"].ToString(),
74+
ZipCode = jsonObj["zip_code"].ToString()
75+
};
7376

7477
await _repository.CreateAsync(cmd, e.Incident.ApplicationId, e.Incident.Id, e.Report.Id);
7578
}
7679
catch (Exception exception)
7780
{
78-
_logger.Error("Failed to store location.", exception);
81+
_logger.Error("Failed to store location: " + json, exception);
7982
}
8083
}
8184
}

src/Server/OneTrueError.Web/Areas/Admin/Views/Application/Deleted.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010
<div class="panel panel-body panel-success">The application has been deleted.</div>
1111
</div>
1212
</div>
13-
</div>
13+
</div>

src/Server/OneTrueError.Web/Areas/Installation/InstallationAreaRegistration.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.Web.Mvc;
1+
using System.Configuration;
2+
using System.Web.Mvc;
23

34
namespace OneTrueError.Web.Areas.Installation
45
{
@@ -11,6 +12,9 @@ public override string AreaName
1112

1213
public override void RegisterArea(AreaRegistrationContext context)
1314
{
15+
if (ConfigurationManager.AppSettings["Configured"] != "false")
16+
return;
17+
1418
context.MapRoute(
1519
"Installation_default",
1620
"Installation/{controller}/{action}/{id}",

src/Server/OneTrueError.Web/Areas/Installation/Views/Setup/Support.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<h2>Free Support</h2>
99
<p>Do you want to get 30 days of free email support?</p>
10-
<p>No obligations attached, but you can purchase commercial support after that if you would like to support the project.</p>
10+
<p>No strings attached. You can optionally extend support after the 30 days.</p>
1111
<form method="post" action="@Url.Action("Support")" style="width: 100%" class="form">
1212
@Html.ValidationSummary(false)
1313
<div>

src/Server/OneTrueError.Web/OneTrueError.Web.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,7 @@
426426
<Content Include="Areas\Installation\Views\Setup\Support.cshtml" />
427427
<Content Include="Areas\Admin\Views\Application\Index.cshtml" />
428428
<Content Include="Areas\Admin\Views\Application\Edit.cshtml" />
429+
<Content Include="Areas\Admin\Views\Application\Deleted.cshtml" />
429430
<None Include="compilerconfig.json" />
430431
<None Include="compilerconfig.json.defaults">
431432
<DependentUpon>compilerconfig.json</DependentUpon>

src/Server/OneTrueError.Web/Views/Application/_create.cshtml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
<div class="modal-content">
44
<div class="modal-header">
55
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
6-
<span aria-hidden="true">&times;</span></button>
6+
<span aria-hidden="true">&times;</span>
7+
</button>
78
<h4 class="modal-title">Create application</h4>
89
</div>
910
<div class="modal-body">
@@ -37,35 +38,34 @@
3738
3839
var client = new Griffin.Net.HttpClient();
3940
client.get(window.API_URL + '/guid')
40-
.done(function(response) {
41+
.done(function (response) {
4142
var appKey = response.body;
4243
var cmd = new OneTrueError.Core.Applications.Commands.CreateApplication(name, hostType);
4344
cmd.ApplicationKey = appKey;
4445
Griffin.Cqs.CqsClient.command(cmd)
45-
.done(function() {
46+
.done(function () {
4647
var query = new OneTrueError.Core.Applications.Queries.GetApplicationIdByKey(appKey);
4748
Griffin.Cqs.CqsClient.query(query)
48-
.done(function(result) {
49+
.done(function (result) {
4950
$('#appName').val('');
50-
$('#applicationsMenu')
51-
.append('<li><a href="#/application/' + result.Id + '">' + name + '</a></li>');
52-
window.location.hash = '#/application/' + result.Id;
51+
var appUrl = '#/application/' + result.Id;
52+
window.location = window.WEB_SITE + '/account/UpdateSession?returnUrl=' + encodeURIComponent(window.WEB_ROOT + appUrl);
5353
});
54+
5455
})
55-
.fail(function(rejection) {
56+
.fail(function (rejection) {
5657
console.log(rejection.message);
5758
});
58-
$.post(window.API_URL + '/account/UpdateSession');
5959
});
6060
}
6161
6262
$('#create-application .btn-primary')
63-
.click(function(e) {
63+
.click(function (e) {
6464
e.preventDefault();
6565
$('#CreateAppForm').submit();
6666
});
6767
$('#CreateAppForm')
68-
.submit(function(e) {
68+
.submit(function (e) {
6969
e.preventDefault();
7070
createAppliction();
7171
$('#create-application').modal('hide');

src/Server/OneTrueError.Web/Views/Shared/_Layout.cshtml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@
152152
@Scripts.Render("~/bundles/app")
153153
<script type="text/javascript">
154154
var API_URL = '@ApiUrl';
155+
var WEB_SITE = '@(new Uri(Request.Url, Url.Content("~")))';
156+
var WEB_ROOT = '@Url.Content("~")';
155157
Griffin.Net.HttpClient.REDIRECT_401_TO = '@LoginUrl';
156158
</script>
157159
@RenderSection("scripts", false)

0 commit comments

Comments
 (0)