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,9 +54,19 @@
|
|||
}
|
||||
}]);
|
||||
</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>
|
||||
<script>
|
||||
(function (i, s, o, g, r, a, m) {
|
||||
i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
|
||||
(i[r].q = i[r].q || []).push(arguments);
|
||||
|
@ -75,8 +78,8 @@
|
|||
ga('require', 'displayfeatures');
|
||||
ga('require', 'linkid', 'linkid.js');
|
||||
ga('send', 'pageview');
|
||||
</script>
|
||||
<header id="page-header">
|
||||
</script>
|
||||
<header id="page-header">
|
||||
<div class="container">
|
||||
<h1>
|
||||
@Html.ActionLink(InvariantTerms.SiteName, nameof(FrontController.Index), new
|
||||
|
@ -86,8 +89,8 @@
|
|||
})
|
||||
</h1>
|
||||
</div>
|
||||
</header>
|
||||
<nav id="page-navigation" role="navigation">
|
||||
</header>
|
||||
<nav id="page-navigation" role="navigation">
|
||||
<div class="container">
|
||||
<button id="page-navigation-toggle">
|
||||
<i class="fa fa-bars"></i> @VariantTerms.Common_ToggleNavigation
|
||||
|
@ -191,13 +194,13 @@
|
|||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
<article id="page-content">
|
||||
</nav>
|
||||
<article id="page-content">
|
||||
<div class="container">
|
||||
@RenderBody()
|
||||
</div>
|
||||
</article>
|
||||
<footer id="page-footer">
|
||||
</article>
|
||||
<footer id="page-footer">
|
||||
<div class="container">
|
||||
<div class="footer-flex">
|
||||
<div class="footer-flex-item">
|
||||
|
@ -234,9 +237,9 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</footer>
|
||||
|
||||
<div id="modal-search-overlay">
|
||||
<div id="modal-search-overlay">
|
||||
<div id="modal-search">
|
||||
<h3>@VariantTerms.Search_BuildFeed</h3>
|
||||
<div id="modal-search-box">
|
||||
|
@ -247,18 +250,18 @@
|
|||
</div>
|
||||
<div id="modal-search-result"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="menu-open-overlay"></div>
|
||||
</div>
|
||||
<div id="menu-open-overlay"></div>
|
||||
|
||||
<script type="text/javascript" t src="https://cdnjs.cloudflare.com/ajax/libs/jsrender/1.0.0-rc.70/jsrender.min.js" integrity="sha256-3UBtL0tzgKVuJU8ZZiWLXEWGEjXEr6Z023rpauMnBUE=" crossorigin="anonymous"></script>
|
||||
<script type="text/javascript" src="/res/ts/bfs.js"></script>
|
||||
@RenderSection("scripts", false)
|
||||
<script id="result-template" type="text/x-jsrender">
|
||||
<script type="text/javascript" t src="https://cdnjs.cloudflare.com/ajax/libs/jsrender/1.0.0-rc.70/jsrender.min.js" integrity="sha256-3UBtL0tzgKVuJU8ZZiWLXEWGEjXEr6Z023rpauMnBUE=" crossorigin="anonymous"></script>
|
||||
<script type="text/javascript" src="/res/ts/bfs.js"></script>
|
||||
@RenderSection("scripts", false)
|
||||
<script id="result-template" type="text/x-jsrender">
|
||||
<a href="{{:Url}}" class="search-result-item" title="{{:Title}}">
|
||||
<h4 class="search-result-heading no-wrapping">{{:Label}}</h4>
|
||||
<p class="search-result-text">{{:Group}}</p>
|
||||
</a>
|
||||
</script>
|
||||
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-5431719a661cbfd0" async="async"></script>
|
||||
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-5431719a661cbfd0" async="async"></script>
|
||||
</body>
|
||||
</html>
|
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