mirror of
https://gitlab.com/buildfeed/BuildFeed.git
synced 2024-03-22 21:10:34 +08:00
Expand out Web Manifest; App Insights Tracking
This commit is contained in:
parent
8038be53dc
commit
275478b5cc
|
@ -1,4 +1,5 @@
|
|||
using System.Web.Mvc;
|
||||
using BuildFeed.Code;
|
||||
|
||||
namespace BuildFeed
|
||||
{
|
||||
|
@ -6,7 +7,7 @@ public class FilterConfig
|
|||
{
|
||||
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
|
||||
{
|
||||
filters.Add(new HandleErrorAttribute());
|
||||
filters.Add(new AiHandleErrorAttribute());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -192,6 +192,7 @@
|
|||
<Compile Include="Areas\admin\Controllers\baseController.cs" />
|
||||
<Compile Include="Areas\admin\Controllers\metaController.cs" />
|
||||
<Compile Include="Areas\admin\Models\ViewModel\MetaListing.cs" />
|
||||
<Compile Include="Code\AiHandleErrorAttribute.cs" />
|
||||
<Compile Include="Code\CustomContentTypeAttribute.cs" />
|
||||
<Compile Include="Code\DateTimeModelBinder.cs" />
|
||||
<Compile Include="Code\DisplayHelpers.cs" />
|
||||
|
|
25
BuildFeed/Code/AiHandleErrorAttribute.cs
Normal file
25
BuildFeed/Code/AiHandleErrorAttribute.cs
Normal file
|
@ -0,0 +1,25 @@
|
|||
using System;
|
||||
using System.Web.Mvc;
|
||||
using Microsoft.ApplicationInsights;
|
||||
|
||||
namespace BuildFeed.Code
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)]
|
||||
public class AiHandleErrorAttribute : HandleErrorAttribute
|
||||
{
|
||||
public override void OnException(ExceptionContext filterContext)
|
||||
{
|
||||
if (filterContext?.HttpContext != null && filterContext.Exception != null)
|
||||
{
|
||||
//If customError is Off, then AI HTTPModule will report the exception
|
||||
if (filterContext.HttpContext.IsCustomErrorEnabled)
|
||||
{
|
||||
// Note: A single instance of telemetry client is sufficient to track multiple telemetry items.
|
||||
TelemetryClient ai = new TelemetryClient();
|
||||
ai.TrackException(filterContext.Exception);
|
||||
}
|
||||
}
|
||||
base.OnException(filterContext);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -100,7 +100,11 @@ public async Task<bool> AddWin10Builds(NewBuildPost apiModel)
|
|||
AppId = Guid.Parse(ConfigurationManager.AppSettings["push:AppId"]),
|
||||
IncludedSegments = new List<string>
|
||||
{
|
||||
#if DEBUG
|
||||
"Testers"
|
||||
#else
|
||||
"All"
|
||||
#endif
|
||||
},
|
||||
Headings =
|
||||
{
|
||||
|
@ -110,12 +114,7 @@ public async Task<bool> AddWin10Builds(NewBuildPost apiModel)
|
|||
{
|
||||
{LanguageCodes.English, build.AlternateBuildString}
|
||||
},
|
||||
Url = "https://www.buildfeed.net" + Url.Route(nameof(FrontController.ViewBuild),
|
||||
new
|
||||
{
|
||||
controller = "Front",
|
||||
id = build.Id
|
||||
})
|
||||
Url = $"https://buildfeed.net{Url.Route(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}?utm_source=notification&utm_campaign=new_build"
|
||||
});
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -422,7 +422,11 @@ public async Task<ActionResult> AddBuild(Build build)
|
|||
AppId = Guid.Parse(ConfigurationManager.AppSettings["push:AppId"]),
|
||||
IncludedSegments = new List<string>
|
||||
{
|
||||
#if DEBUG
|
||||
"Testers"
|
||||
#else
|
||||
"All"
|
||||
#endif
|
||||
},
|
||||
Headings =
|
||||
{
|
||||
|
@ -432,11 +436,7 @@ public async Task<ActionResult> AddBuild(Build build)
|
|||
{
|
||||
{LanguageCodes.English, build.AlternateBuildString}
|
||||
},
|
||||
Url = "https://www.buildfeed.net" + Url.Action(nameof(ViewBuild),
|
||||
new
|
||||
{
|
||||
id = build.Id
|
||||
})
|
||||
Url = $"https://buildfeed.net{Url.Action(nameof(ViewBuild), new { id = build.Id })}?utm_source=notification&utm_campaign=new_build"
|
||||
});
|
||||
|
||||
return RedirectToAction(nameof(ViewBuild),
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous" />
|
||||
<link rel="shortcut icon" href="~/favicon.ico" />
|
||||
<link rel="icon" href="~/favicon.ico" />
|
||||
<meta name="theme-color" content="#373736">
|
||||
<link rel="canonical" href="@Url.Action()" />
|
||||
<meta name="application-name" content="@InvariantTerms.SiteName" />
|
||||
|
||||
|
@ -37,16 +38,6 @@
|
|||
}
|
||||
<title>@ViewBag.Title</title>
|
||||
@RenderSection("head", false)
|
||||
<script type="text/javascript">
|
||||
var appInsights = window.appInsights || function (config) {
|
||||
function r(config) { t[config] = function () { var i = arguments; t.queue.push(function () { t[config].apply(t, i) }) } } var t = { config: config }, u = document, e = window, o = "script", s = u.createElement(o), i, f; for (s.src = config.url || "//az416426.vo.msecnd.net/scripts/a/ai.0.js", u.getElementsByTagName(o)[0].parentNode.appendChild(s), t.cookie = u.cookie, t.queue = [], i = ["Event", "Exception", "Metric", "PageView", "Trace"]; i.length;) r("track" + i.pop()); return r("setAuthenticatedUserContext"), r("clearAuthenticatedUserContext"), config.disableExceptionTracking || (i = "onerror", r("_" + i), f = e[i], e[i] = function (config, r, u, e, o) { var s = f && f(config, r, u, e, o); return s !== !0 && t["_" + i](config, r, u, e, o), s }), t;
|
||||
}({
|
||||
instrumentationKey: "4632419f-7a2f-4ab5-8374-34384b650f42"
|
||||
});
|
||||
|
||||
window.appInsights = appInsights;
|
||||
appInsights.trackPageView();
|
||||
</script>
|
||||
|
||||
<link rel="manifest" href="/manifest.json">
|
||||
<script src="https://cdn.onesignal.com/sdks/OneSignalSDK.js" async></script>
|
||||
|
@ -54,6 +45,8 @@
|
|||
var OneSignal = window.OneSignal || [];
|
||||
OneSignal.push(["init", {
|
||||
appId: "94384f83-dced-4d66-a88c-c2b6e3cdfbaa",
|
||||
safari_web_id: "web.onesignal.auto.4cc30974-98f9-47ba-8e02-4635d2d477f2",
|
||||
persistNotification: false,
|
||||
allowLocalhostAsSecureOrigin: true,
|
||||
autoRegister: true,
|
||||
notifyButton: {
|
||||
|
@ -61,6 +54,16 @@
|
|||
}
|
||||
}]);
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
var appInsights = window.appInsights || function (config) {
|
||||
function i(config) { t[config] = function () { var i = arguments; t.queue.push(function () { t[config].apply(t, i) }) } } var t = { config: config }, u = document, e = window, o = "script", s = "AuthenticatedUserContext", h = "start", c = "stop", l = "Track", a = l + "Event", v = l + "Page", y = u.createElement(o), r, f; y.src = config.url || "https://az416426.vo.msecnd.net/scripts/a/ai.0.js"; u.getElementsByTagName(o)[0].parentNode.appendChild(y); try { t.cookie = u.cookie } catch (p) { } for (t.queue = [], t.version = "1.0", r = ["Event", "Exception", "Metric", "PageView", "Trace", "Dependency"]; r.length;)i("track" + r.pop()); return i("set" + s), i("clear" + s), i(h + a), i(c + a), i(h + v), i(c + v), i("flush"), config.disableExceptionTracking || (r = "onerror", i("_" + r), f = e[r], e[r] = function (config, i, u, e, o) { var s = f && f(config, i, u, e, o); return s !== !0 && t["_" + r](config, i, u, e, o), s }), t
|
||||
} ({
|
||||
instrumentationKey: "4632419f-7a2f-4ab5-8374-34384b650f42"
|
||||
});
|
||||
|
||||
window.appInsights = appInsights;
|
||||
appInsights.trackPageView();
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 20 KiB |
|
@ -1,7 +1,16 @@
|
|||
{
|
||||
"name": "BuildFeed",
|
||||
"short_name": "BuildFeed",
|
||||
"start_url": "/",
|
||||
"background_color": "#373736",
|
||||
"theme_color": "#373736",
|
||||
"description": "Learn what Dona Sarkar won't tell you. Keep up to date with the latest Microsoft Windows developments with BuildFeed, the comprehensive build tracker.",
|
||||
"icons": [
|
||||
{
|
||||
"src": "https://buildfeed.net/content/tile/notify.png",
|
||||
"sizes": "any"
|
||||
}
|
||||
],
|
||||
"start_url": "https://buildfeed.net/",
|
||||
"display": "standalone",
|
||||
"gcm_sender_id": "482941778795"
|
||||
}
|
Loading…
Reference in New Issue
Block a user