1
0
mirror of https://git.teknik.io/Teknikode/Teknik.git synced 2023-08-02 14:16:22 +02:00

Added .net core piwik tracking api to most entry points

This commit is contained in:
Uncled1023 2019-01-31 23:43:23 -08:00
parent 0597455180
commit 7945ade961
27 changed files with 81 additions and 10 deletions

View File

@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Teknik.Configuration; using Teknik.Configuration;
using Teknik.Data; using Teknik.Data;
using Teknik.Filters;
using Teknik.Logging; using Teknik.Logging;
namespace Teknik.Areas.API.V1.Controllers namespace Teknik.Areas.API.V1.Controllers
@ -18,6 +19,7 @@ namespace Teknik.Areas.API.V1.Controllers
public AccountAPIv1Controller(ILogger<Logger> logger, Config config, TeknikEntities dbContext) : base(logger, config, dbContext) { } public AccountAPIv1Controller(ILogger<Logger> logger, Config config, TeknikEntities dbContext) : base(logger, config, dbContext) { }
[HttpGet] [HttpGet]
[ServiceFilter(typeof(TrackPageView))]
public IActionResult GetClaims() public IActionResult GetClaims()
{ {
return new JsonResult(from c in User.Claims select new { c.Type, c.Value }); return new JsonResult(from c in User.Claims select new { c.Type, c.Value });

View File

@ -12,6 +12,7 @@ using Teknik.Areas.Users.Models;
using Teknik.Areas.Users.Utility; using Teknik.Areas.Users.Utility;
using Teknik.Configuration; using Teknik.Configuration;
using Teknik.Data; using Teknik.Data;
using Teknik.Filters;
using Teknik.Logging; using Teknik.Logging;
using Teknik.Utilities; using Teknik.Utilities;
@ -24,6 +25,7 @@ namespace Teknik.Areas.API.V1.Controllers
[HttpPost] [HttpPost]
[AllowAnonymous] [AllowAnonymous]
[ServiceFilter(typeof(TrackPageView))]
public IActionResult Paste(PasteAPIv1Model model) public IActionResult Paste(PasteAPIv1Model model)
{ {
try try

View File

@ -13,6 +13,7 @@ using Teknik.Areas.Users.Models;
using Teknik.Areas.Users.Utility; using Teknik.Areas.Users.Utility;
using Teknik.Configuration; using Teknik.Configuration;
using Teknik.Data; using Teknik.Data;
using Teknik.Filters;
using Teknik.Logging; using Teknik.Logging;
using Teknik.Utilities; using Teknik.Utilities;
@ -25,6 +26,7 @@ namespace Teknik.Areas.API.V1.Controllers
[HttpPost] [HttpPost]
[AllowAnonymous] [AllowAnonymous]
[ServiceFilter(typeof(TrackPageView))]
public IActionResult Shorten(ShortenAPIv1Model model) public IActionResult Shorten(ShortenAPIv1Model model)
{ {
try try

View File

@ -17,6 +17,7 @@ using Teknik.Areas.Users.Models;
using Teknik.Areas.Users.Utility; using Teknik.Areas.Users.Utility;
using Teknik.Configuration; using Teknik.Configuration;
using Teknik.Data; using Teknik.Data;
using Teknik.Filters;
using Teknik.Logging; using Teknik.Logging;
using Teknik.Utilities; using Teknik.Utilities;
@ -29,6 +30,7 @@ namespace Teknik.Areas.API.V1.Controllers
[HttpPost] [HttpPost]
[AllowAnonymous] [AllowAnonymous]
[ServiceFilter(typeof(TrackPageView))]
public async Task<IActionResult> Upload(UploadAPIv1Model model) public async Task<IActionResult> Upload(UploadAPIv1Model model)
{ {
try try

View File

@ -22,6 +22,7 @@ namespace Teknik.Areas.About.Controllers
public AboutController(ILogger<Logger> logger, Config config, TeknikEntities dbContext) : base(logger, config, dbContext) { } public AboutController(ILogger<Logger> logger, Config config, TeknikEntities dbContext) : base(logger, config, dbContext) { }
[AllowAnonymous] [AllowAnonymous]
[ServiceFilter(typeof(TrackPageView))]
public IActionResult Index([FromServices] Config config) public IActionResult Index([FromServices] Config config)
{ {
ViewBag.Title = "About"; ViewBag.Title = "About";

View File

@ -22,6 +22,7 @@ namespace Teknik.Areas.Abuse.Controllers
public AbuseController(ILogger<Logger> logger, Config config, TeknikEntities dbContext) : base(logger, config, dbContext) { } public AbuseController(ILogger<Logger> logger, Config config, TeknikEntities dbContext) : base(logger, config, dbContext) { }
[AllowAnonymous] [AllowAnonymous]
[ServiceFilter(typeof(TrackPageView))]
public IActionResult Index() public IActionResult Index()
{ {
ViewBag.Title = "Abuse Reporting"; ViewBag.Title = "Abuse Reporting";

View File

@ -29,6 +29,7 @@ namespace Teknik.Areas.Admin.Controllers
public AdminController(ILogger<Logger> logger, Config config, TeknikEntities dbContext) : base (logger, config, dbContext) { } public AdminController(ILogger<Logger> logger, Config config, TeknikEntities dbContext) : base (logger, config, dbContext) { }
[HttpGet] [HttpGet]
[ServiceFilter(typeof(TrackPageView))]
public IActionResult Dashboard() public IActionResult Dashboard()
{ {
DashboardViewModel model = new DashboardViewModel(); DashboardViewModel model = new DashboardViewModel();
@ -36,6 +37,7 @@ namespace Teknik.Areas.Admin.Controllers
} }
[HttpGet] [HttpGet]
[ServiceFilter(typeof(TrackPageView))]
public IActionResult UserSearch() public IActionResult UserSearch()
{ {
UserSearchViewModel model = new UserSearchViewModel(); UserSearchViewModel model = new UserSearchViewModel();
@ -43,6 +45,7 @@ namespace Teknik.Areas.Admin.Controllers
} }
[HttpGet] [HttpGet]
[ServiceFilter(typeof(TrackPageView))]
public async Task<IActionResult> UserInfo(string username) public async Task<IActionResult> UserInfo(string username)
{ {
if (UserHelper.UserExists(_dbContext, username)) if (UserHelper.UserExists(_dbContext, username))
@ -63,6 +66,7 @@ namespace Teknik.Areas.Admin.Controllers
} }
[HttpGet] [HttpGet]
[ServiceFilter(typeof(TrackPageView))]
public IActionResult UploadSearch() public IActionResult UploadSearch()
{ {
UploadSearchViewModel model = new UploadSearchViewModel(); UploadSearchViewModel model = new UploadSearchViewModel();

View File

@ -30,6 +30,7 @@ namespace Teknik.Areas.Blog.Controllers
public BlogController(ILogger<Logger> logger, Config config, TeknikEntities dbContext) : base(logger, config, dbContext) { } public BlogController(ILogger<Logger> logger, Config config, TeknikEntities dbContext) : base(logger, config, dbContext) { }
[AllowAnonymous] [AllowAnonymous]
[ServiceFilter(typeof(TrackPageView))]
public IActionResult Blog(string username) public IActionResult Blog(string username)
{ {
BlogViewModel model = new BlogViewModel(); BlogViewModel model = new BlogViewModel();
@ -119,6 +120,7 @@ namespace Teknik.Areas.Blog.Controllers
#region Posts #region Posts
[AllowAnonymous] [AllowAnonymous]
[ServiceFilter(typeof(TrackPageView))]
public IActionResult Post(string username, int id) public IActionResult Post(string username, int id)
{ {
if (string.IsNullOrEmpty(username)) if (string.IsNullOrEmpty(username))
@ -160,7 +162,8 @@ namespace Teknik.Areas.Blog.Controllers
model.ErrorMessage = "Blog Post does not exist."; model.ErrorMessage = "Blog Post does not exist.";
return View("~/Areas/Blog/Views/Blog/ViewPost.cshtml", model); return View("~/Areas/Blog/Views/Blog/ViewPost.cshtml", model);
} }
[ServiceFilter(typeof(TrackPageView))]
public IActionResult NewPost(string username, int blogID) public IActionResult NewPost(string username, int blogID)
{ {
if (string.IsNullOrEmpty(username)) if (string.IsNullOrEmpty(username))
@ -200,6 +203,7 @@ namespace Teknik.Areas.Blog.Controllers
return View("~/Areas/Blog/Views/Blog/Blog.cshtml", model); return View("~/Areas/Blog/Views/Blog/Blog.cshtml", model);
} }
[ServiceFilter(typeof(TrackPageView))]
public IActionResult EditPost(string username, int id) public IActionResult EditPost(string username, int id)
{ {
if (string.IsNullOrEmpty(username)) if (string.IsNullOrEmpty(username))

View File

@ -26,6 +26,7 @@ namespace Teknik.Areas.Contact.Controllers
public ContactController(ILogger<Logger> logger, Config config, TeknikEntities dbContext) : base(logger, config, dbContext) { } public ContactController(ILogger<Logger> logger, Config config, TeknikEntities dbContext) : base(logger, config, dbContext) { }
[AllowAnonymous] [AllowAnonymous]
[ServiceFilter(typeof(TrackPageView))]
public IActionResult Index() public IActionResult Index()
{ {
ViewBag.Title = "Contact Us"; ViewBag.Title = "Contact Us";

View File

@ -28,6 +28,7 @@ namespace Teknik.Areas.Error.Controllers
public ErrorController(ILogger<Logger> logger, Config config, TeknikEntities dbContext) : base(logger, config, dbContext) { } public ErrorController(ILogger<Logger> logger, Config config, TeknikEntities dbContext) : base(logger, config, dbContext) { }
[AllowAnonymous] [AllowAnonymous]
[ServiceFilter(typeof(TrackPageView))]
public IActionResult HttpError(int statusCode) public IActionResult HttpError(int statusCode)
{ {
switch (statusCode) switch (statusCode)
@ -44,6 +45,7 @@ namespace Teknik.Areas.Error.Controllers
} }
[AllowAnonymous] [AllowAnonymous]
[ServiceFilter(typeof(TrackPageView))]
public IActionResult HttpGeneral(int statusCode) public IActionResult HttpGeneral(int statusCode)
{ {
ViewBag.Title = statusCode; ViewBag.Title = statusCode;
@ -57,6 +59,7 @@ namespace Teknik.Areas.Error.Controllers
} }
[AllowAnonymous] [AllowAnonymous]
[ServiceFilter(typeof(TrackPageView))]
public IActionResult Http401() public IActionResult Http401()
{ {
Response.StatusCode = StatusCodes.Status401Unauthorized; Response.StatusCode = StatusCodes.Status401Unauthorized;
@ -73,6 +76,7 @@ namespace Teknik.Areas.Error.Controllers
} }
[AllowAnonymous] [AllowAnonymous]
[ServiceFilter(typeof(TrackPageView))]
public IActionResult Http403() public IActionResult Http403()
{ {
Response.StatusCode = StatusCodes.Status403Forbidden; Response.StatusCode = StatusCodes.Status403Forbidden;
@ -89,6 +93,7 @@ namespace Teknik.Areas.Error.Controllers
} }
[AllowAnonymous] [AllowAnonymous]
[ServiceFilter(typeof(TrackPageView))]
public IActionResult Http404() public IActionResult Http404()
{ {
Response.StatusCode = StatusCodes.Status404NotFound; Response.StatusCode = StatusCodes.Status404NotFound;
@ -105,6 +110,7 @@ namespace Teknik.Areas.Error.Controllers
} }
[AllowAnonymous] [AllowAnonymous]
[ServiceFilter(typeof(TrackPageView))]
public IActionResult Http500(Exception exception) public IActionResult Http500(Exception exception)
{ {
try try

View File

@ -18,6 +18,7 @@ namespace Teknik.Areas.FAQ.Controllers
public FAQController(ILogger<Logger> logger, Config config, TeknikEntities dbContext) : base(logger, config, dbContext) { } public FAQController(ILogger<Logger> logger, Config config, TeknikEntities dbContext) : base(logger, config, dbContext) { }
[AllowAnonymous] [AllowAnonymous]
[ServiceFilter(typeof(TrackPageView))]
public IActionResult Index() public IActionResult Index()
{ {
ViewBag.Title = "Frequently Asked Questions"; ViewBag.Title = "Frequently Asked Questions";

View File

@ -14,6 +14,7 @@ namespace Teknik.Areas.Help.Controllers
{ {
[Authorize] [Authorize]
[Area("Help")] [Area("Help")]
[ServiceFilter(typeof(TrackPageView))]
public class HelpController : DefaultController public class HelpController : DefaultController
{ {
public HelpController(ILogger<Logger> logger, Config config, TeknikEntities dbContext) : base(logger, config, dbContext) { } public HelpController(ILogger<Logger> logger, Config config, TeknikEntities dbContext) : base(logger, config, dbContext) { }

View File

@ -23,6 +23,7 @@ namespace Teknik.Areas.Home.Controllers
public HomeController(ILogger<Logger> logger, Config config, TeknikEntities dbContext) : base(logger, config, dbContext) { } public HomeController(ILogger<Logger> logger, Config config, TeknikEntities dbContext) : base(logger, config, dbContext) { }
[AllowAnonymous] [AllowAnonymous]
[ServiceFilter(typeof(TrackPageView))]
public IActionResult Index() public IActionResult Index()
{ {
HomeViewModel model = new HomeViewModel(); HomeViewModel model = new HomeViewModel();

View File

@ -31,6 +31,7 @@ namespace Teknik.Areas.Paste.Controllers
public PasteController(ILogger<Logger> logger, Config config, TeknikEntities dbContext) : base(logger, config, dbContext) { } public PasteController(ILogger<Logger> logger, Config config, TeknikEntities dbContext) : base(logger, config, dbContext) { }
[AllowAnonymous] [AllowAnonymous]
[ServiceFilter(typeof(TrackPageView))]
public IActionResult Index() public IActionResult Index()
{ {
ViewBag.Title = "Pastebin"; ViewBag.Title = "Pastebin";
@ -40,6 +41,7 @@ namespace Teknik.Areas.Paste.Controllers
} }
[AllowAnonymous] [AllowAnonymous]
[ServiceFilter(typeof(TrackPageView))]
public async Task<IActionResult> ViewPaste(string type, string url, string password) public async Task<IActionResult> ViewPaste(string type, string url, string password)
{ {
Models.Paste paste = _dbContext.Pastes.Where(p => p.Url == url).FirstOrDefault(); Models.Paste paste = _dbContext.Pastes.Where(p => p.Url == url).FirstOrDefault();
@ -202,7 +204,8 @@ namespace Teknik.Areas.Paste.Controllers
} }
return View("~/Areas/Paste/Views/Paste/Index.cshtml", model); return View("~/Areas/Paste/Views/Paste/Index.cshtml", model);
} }
[ServiceFilter(typeof(TrackPageView))]
public async Task<IActionResult> Edit(string url, string password) public async Task<IActionResult> Edit(string url, string password)
{ {
Models.Paste paste = _dbContext.Pastes.Where(p => p.Url == url).FirstOrDefault(); Models.Paste paste = _dbContext.Pastes.Where(p => p.Url == url).FirstOrDefault();

View File

@ -29,6 +29,7 @@ namespace Teknik.Areas.Podcast.Controllers
public PodcastController(ILogger<Logger> logger, Config config, TeknikEntities dbContext) : base(logger, config, dbContext) { } public PodcastController(ILogger<Logger> logger, Config config, TeknikEntities dbContext) : base(logger, config, dbContext) { }
[AllowAnonymous] [AllowAnonymous]
[ServiceFilter(typeof(TrackPageView))]
public IActionResult Index() public IActionResult Index()
{ {
MainViewModel model = new MainViewModel(); MainViewModel model = new MainViewModel();
@ -63,6 +64,7 @@ namespace Teknik.Areas.Podcast.Controllers
#region Podcasts #region Podcasts
[AllowAnonymous] [AllowAnonymous]
[ServiceFilter(typeof(TrackPageView))]
public IActionResult View(int episode) public IActionResult View(int episode)
{ {
PodcastViewModel model = new PodcastViewModel(); PodcastViewModel model = new PodcastViewModel();
@ -84,6 +86,7 @@ namespace Teknik.Areas.Podcast.Controllers
[HttpGet] [HttpGet]
[AllowAnonymous] [AllowAnonymous]
[ResponseCache(Duration = 31536000, Location = ResponseCacheLocation.Any)] [ResponseCache(Duration = 31536000, Location = ResponseCacheLocation.Any)]
[ServiceFilter(typeof(TrackDownload))]
public IActionResult Download(int episode, string fileName) public IActionResult Download(int episode, string fileName)
{ {
string path = string.Empty; string path = string.Empty;

View File

@ -18,6 +18,7 @@ namespace Teknik.Areas.Privacy.Controllers
public PrivacyController(ILogger<Logger> logger, Config config, TeknikEntities dbContext) : base(logger, config, dbContext) { } public PrivacyController(ILogger<Logger> logger, Config config, TeknikEntities dbContext) : base(logger, config, dbContext) { }
[AllowAnonymous] [AllowAnonymous]
[ServiceFilter(typeof(TrackPageView))]
public IActionResult Index() public IActionResult Index()
{ {
ViewBag.Title = "Privacy Policy"; ViewBag.Title = "Privacy Policy";

View File

@ -32,6 +32,7 @@ namespace Teknik.Areas.RSS.Controllers
public RSSController(ILogger<Logger> logger, Config config, TeknikEntities dbContext) : base(logger, config, dbContext) { } public RSSController(ILogger<Logger> logger, Config config, TeknikEntities dbContext) : base(logger, config, dbContext) { }
[AllowAnonymous] [AllowAnonymous]
[ServiceFilter(typeof(TrackPageView))]
public async Task Index() public async Task Index()
{ {
Response.ContentType = "application/rss+xml"; Response.ContentType = "application/rss+xml";
@ -49,6 +50,7 @@ namespace Teknik.Areas.RSS.Controllers
} }
[AllowAnonymous] [AllowAnonymous]
[ServiceFilter(typeof(TrackPageView))]
public async Task Blog(string username) public async Task Blog(string username)
{ {
Response.ContentType = "application/rss+xml"; Response.ContentType = "application/rss+xml";
@ -154,6 +156,7 @@ namespace Teknik.Areas.RSS.Controllers
} }
[AllowAnonymous] [AllowAnonymous]
[ServiceFilter(typeof(TrackPageView))]
public async Task Podcast() public async Task Podcast()
{ {
Response.ContentType = "application/rss+xml"; Response.ContentType = "application/rss+xml";

View File

@ -24,6 +24,7 @@ namespace Teknik.Areas.Shortener.Controllers
public ShortenerController(ILogger<Logger> logger, Config config, TeknikEntities dbContext) : base(logger, config, dbContext) { } public ShortenerController(ILogger<Logger> logger, Config config, TeknikEntities dbContext) : base(logger, config, dbContext) { }
[AllowAnonymous] [AllowAnonymous]
[ServiceFilter(typeof(TrackPageView))]
public IActionResult Index() public IActionResult Index()
{ {
ViewBag.Title = "Url Shortener"; ViewBag.Title = "Url Shortener";
@ -32,6 +33,7 @@ namespace Teknik.Areas.Shortener.Controllers
} }
[AllowAnonymous] [AllowAnonymous]
[ServiceFilter(typeof(TrackPageView))]
public IActionResult RedirectToUrl(string url) public IActionResult RedirectToUrl(string url)
{ {
ShortenedUrl shortUrl = _dbContext.ShortenedUrls.Where(s => s.ShortUrl == url).FirstOrDefault(); ShortenedUrl shortUrl = _dbContext.ShortenedUrls.Where(s => s.ShortUrl == url).FirstOrDefault();

View File

@ -24,6 +24,7 @@ namespace Teknik.Areas.Stats.Controllers
public StatsController(ILogger<Logger> logger, Config config, TeknikEntities dbContext) : base(logger, config, dbContext) { } public StatsController(ILogger<Logger> logger, Config config, TeknikEntities dbContext) : base(logger, config, dbContext) { }
[AllowAnonymous] [AllowAnonymous]
[ServiceFilter(typeof(TrackPageView))]
public IActionResult Index() public IActionResult Index()
{ {
ViewBag.Title = "System Statistics"; ViewBag.Title = "System Statistics";

View File

@ -18,6 +18,7 @@ namespace Teknik.Areas.TOS.Controllers
public TOSController(ILogger<Logger> logger, Config config, TeknikEntities dbContext) : base(logger, config, dbContext) { } public TOSController(ILogger<Logger> logger, Config config, TeknikEntities dbContext) : base(logger, config, dbContext) { }
[AllowAnonymous] [AllowAnonymous]
[ServiceFilter(typeof(TrackPageView))]
public IActionResult Index() public IActionResult Index()
{ {
ViewBag.Title = "Terms of Service"; ViewBag.Title = "Terms of Service";

View File

@ -33,6 +33,7 @@ namespace Teknik.Areas.Upload.Controllers
[HttpGet] [HttpGet]
[AllowAnonymous] [AllowAnonymous]
[ServiceFilter(typeof(TrackPageView))]
public async Task<IActionResult> Index() public async Task<IActionResult> Index()
{ {
ViewBag.Title = "Upload Files"; ViewBag.Title = "Upload Files";
@ -180,6 +181,8 @@ namespace Teknik.Areas.Upload.Controllers
[HttpGet] [HttpGet]
[AllowAnonymous] [AllowAnonymous]
[ServiceFilter(typeof(TrackDownload))]
[ServiceFilter(typeof(TrackPageView))]
[ResponseCache(Duration = 31536000, Location = ResponseCacheLocation.Any)] [ResponseCache(Duration = 31536000, Location = ResponseCacheLocation.Any)]
public async Task<IActionResult> Download(string file) public async Task<IActionResult> Download(string file)
{ {

View File

@ -62,6 +62,7 @@ namespace Teknik.Areas.Users.Controllers
} }
[HttpGet] [HttpGet]
[ServiceFilter(typeof(TrackPageView))]
public IActionResult Login(string returnUrl) public IActionResult Login(string returnUrl)
{ {
// Let's double check their email and git accounts to make sure they exist // Let's double check their email and git accounts to make sure they exist
@ -85,6 +86,7 @@ namespace Teknik.Areas.Users.Controllers
} }
[HttpGet] [HttpGet]
[ServiceFilter(typeof(TrackPageView))]
public async Task Logout() public async Task Logout()
{ {
// these are the sub & sid to signout // these are the sub & sid to signout
@ -98,6 +100,7 @@ namespace Teknik.Areas.Users.Controllers
} }
[AllowAnonymous] [AllowAnonymous]
[ServiceFilter(typeof(TrackPageView))]
public IActionResult GetPremium() public IActionResult GetPremium()
{ {
ViewBag.Title = "Get a Premium Account"; ViewBag.Title = "Get a Premium Account";
@ -109,6 +112,7 @@ namespace Teknik.Areas.Users.Controllers
[HttpGet] [HttpGet]
[AllowAnonymous] [AllowAnonymous]
[ServiceFilter(typeof(TrackPageView))]
public IActionResult Register(string inviteCode, string ReturnUrl) public IActionResult Register(string inviteCode, string ReturnUrl)
{ {
RegisterViewModel model = new RegisterViewModel(); RegisterViewModel model = new RegisterViewModel();
@ -202,6 +206,7 @@ namespace Teknik.Areas.Users.Controllers
// GET: Profile/Profile // GET: Profile/Profile
[AllowAnonymous] [AllowAnonymous]
[ServiceFilter(typeof(TrackPageView))]
public async Task<IActionResult> ViewProfile(string username) public async Task<IActionResult> ViewProfile(string username)
{ {
if (string.IsNullOrEmpty(username)) if (string.IsNullOrEmpty(username))
@ -259,6 +264,7 @@ namespace Teknik.Areas.Users.Controllers
return View(model); return View(model);
} }
[ServiceFilter(typeof(TrackPageView))]
public IActionResult ViewServiceData() public IActionResult ViewServiceData()
{ {
string username = User.Identity.Name; string username = User.Identity.Name;
@ -297,11 +303,13 @@ namespace Teknik.Areas.Users.Controllers
return View(model); return View(model);
} }
[ServiceFilter(typeof(TrackPageView))]
public IActionResult Settings() public IActionResult Settings()
{ {
return Redirect(Url.SubRouteUrl("account", "User.ProfileSettings")); return Redirect(Url.SubRouteUrl("account", "User.ProfileSettings"));
} }
[ServiceFilter(typeof(TrackPageView))]
public IActionResult ProfileSettings() public IActionResult ProfileSettings()
{ {
string username = User.Identity.Name; string username = User.Identity.Name;
@ -326,6 +334,7 @@ namespace Teknik.Areas.Users.Controllers
return new StatusCodeResult(StatusCodes.Status403Forbidden); return new StatusCodeResult(StatusCodes.Status403Forbidden);
} }
[ServiceFilter(typeof(TrackPageView))]
public IActionResult AccountSettings() public IActionResult AccountSettings()
{ {
string username = User.Identity.Name; string username = User.Identity.Name;
@ -347,6 +356,7 @@ namespace Teknik.Areas.Users.Controllers
return new StatusCodeResult(StatusCodes.Status403Forbidden); return new StatusCodeResult(StatusCodes.Status403Forbidden);
} }
[ServiceFilter(typeof(TrackPageView))]
public async Task<IActionResult> SecuritySettings() public async Task<IActionResult> SecuritySettings()
{ {
string username = User.Identity.Name; string username = User.Identity.Name;
@ -389,6 +399,7 @@ namespace Teknik.Areas.Users.Controllers
return new StatusCodeResult(StatusCodes.Status403Forbidden); return new StatusCodeResult(StatusCodes.Status403Forbidden);
} }
[ServiceFilter(typeof(TrackPageView))]
public async Task<IActionResult> DeveloperSettings() public async Task<IActionResult> DeveloperSettings()
{ {
string username = User.Identity.Name; string username = User.Identity.Name;
@ -436,6 +447,7 @@ namespace Teknik.Areas.Users.Controllers
return new StatusCodeResult(StatusCodes.Status403Forbidden); return new StatusCodeResult(StatusCodes.Status403Forbidden);
} }
[ServiceFilter(typeof(TrackPageView))]
public IActionResult InviteSettings() public IActionResult InviteSettings()
{ {
string username = User.Identity.Name; string username = User.Identity.Name;
@ -480,7 +492,8 @@ namespace Teknik.Areas.Users.Controllers
return new StatusCodeResult(StatusCodes.Status403Forbidden); return new StatusCodeResult(StatusCodes.Status403Forbidden);
} }
[ServiceFilter(typeof(TrackPageView))]
public IActionResult BlogSettings() public IActionResult BlogSettings()
{ {
string username = User.Identity.Name; string username = User.Identity.Name;
@ -503,7 +516,8 @@ namespace Teknik.Areas.Users.Controllers
return new StatusCodeResult(StatusCodes.Status403Forbidden); return new StatusCodeResult(StatusCodes.Status403Forbidden);
} }
[ServiceFilter(typeof(TrackPageView))]
public IActionResult UploadSettings() public IActionResult UploadSettings()
{ {
string username = User.Identity.Name; string username = User.Identity.Name;
@ -530,6 +544,7 @@ namespace Teknik.Areas.Users.Controllers
[HttpGet] [HttpGet]
[AllowAnonymous] [AllowAnonymous]
[ServiceFilter(typeof(TrackPageView))]
public async Task<IActionResult> ViewRawPGP(string username) public async Task<IActionResult> ViewRawPGP(string username)
{ {
ViewBag.Title = username + "'s Public Key"; ViewBag.Title = username + "'s Public Key";
@ -824,6 +839,7 @@ namespace Teknik.Areas.Users.Controllers
[HttpGet] [HttpGet]
[AllowAnonymous] [AllowAnonymous]
[ServiceFilter(typeof(TrackPageView))]
public IActionResult ResetPassword(string username) public IActionResult ResetPassword(string username)
{ {
ResetPasswordViewModel model = new ResetPasswordViewModel(); ResetPasswordViewModel model = new ResetPasswordViewModel();
@ -867,6 +883,7 @@ namespace Teknik.Areas.Users.Controllers
[HttpGet] [HttpGet]
[AllowAnonymous] [AllowAnonymous]
[ServiceFilter(typeof(TrackPageView))]
public async Task<IActionResult> VerifyResetPassword(string username, string code) public async Task<IActionResult> VerifyResetPassword(string username, string code)
{ {
bool verified = true; bool verified = true;

View File

@ -34,6 +34,7 @@ namespace Teknik.Areas.Vault.Controllers
public VaultController(ILogger<Logger> logger, Config config, TeknikEntities dbContext) : base(logger, config, dbContext) { } public VaultController(ILogger<Logger> logger, Config config, TeknikEntities dbContext) : base(logger, config, dbContext) { }
[AllowAnonymous] [AllowAnonymous]
[ServiceFilter(typeof(TrackPageView))]
public async Task<IActionResult> ViewVault(string id) public async Task<IActionResult> ViewVault(string id)
{ {
Models.Vault foundVault = _dbContext.Vaults.Where(v => v.Url == id).FirstOrDefault(); Models.Vault foundVault = _dbContext.Vaults.Where(v => v.Url == id).FirstOrDefault();
@ -135,6 +136,7 @@ namespace Teknik.Areas.Vault.Controllers
[HttpGet] [HttpGet]
[AllowAnonymous] [AllowAnonymous]
[ServiceFilter(typeof(TrackPageView))]
public IActionResult NewVault() public IActionResult NewVault()
{ {
ViewBag.Title = "Create Vault"; ViewBag.Title = "Create Vault";
@ -145,6 +147,7 @@ namespace Teknik.Areas.Vault.Controllers
[HttpGet] [HttpGet]
[AllowAnonymous] [AllowAnonymous]
[ServiceFilter(typeof(TrackPageView))]
public IActionResult NewVaultFromService(string type, string items) public IActionResult NewVaultFromService(string type, string items)
{ {
ViewBag.Title = "Create Vault"; ViewBag.Title = "Create Vault";
@ -181,6 +184,7 @@ namespace Teknik.Areas.Vault.Controllers
} }
[HttpGet] [HttpGet]
[ServiceFilter(typeof(TrackPageView))]
public IActionResult EditVault(string url, string type, string items) public IActionResult EditVault(string url, string type, string items)
{ {
ViewBag.Title = "Edit Vault"; ViewBag.Title = "Edit Vault";

View File

@ -24,8 +24,9 @@ using Teknik.Utilities;
namespace Teknik.Controllers namespace Teknik.Controllers
{ {
[CORSActionFilter]
[Area("Default")] [Area("Default")]
[CORSActionFilter]
[ResponseCache(Duration = 3600, Location = ResponseCacheLocation.Any)]
public class DefaultController : Controller public class DefaultController : Controller
{ {
protected string Subdomain protected string Subdomain

View File

@ -97,9 +97,9 @@ namespace Teknik
}); });
// Add Tracking Filter scopes // Add Tracking Filter scopes
//services.AddScoped<TrackDownload>(); services.AddScoped<TrackDownload>();
//services.AddScoped<TrackLink>(); //services.AddScoped<TrackLink>();
//services.AddScoped<TrackPageView>(); services.AddScoped<TrackPageView>();
// Create the Database Context // Create the Database Context
services.AddDbContext<TeknikEntities>(options => options services.AddDbContext<TeknikEntities>(options => options

View File

@ -7,13 +7,17 @@
<RuntimeIdentifiers>win-x86;win-x64;linux-x64;linux-arm;osx-x64</RuntimeIdentifiers> <RuntimeIdentifiers>win-x86;win-x64;linux-x64;linux-arm;osx-x64</RuntimeIdentifiers>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<None Remove="lib\Piwik.Tracker.NetStandard1.4.dll" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Configuration\Configuration.csproj" /> <ProjectReference Include="..\Configuration\Configuration.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Piwik.Tracker.NetStandard1.4"> <Reference Include="Piwik.Tracker">
<HintPath>lib\Piwik.Tracker.NetStandard1.4.dll</HintPath> <HintPath>lib\Piwik.Tracker.dll</HintPath>
</Reference> </Reference>
</ItemGroup> </ItemGroup>

Binary file not shown.