diff --git a/Teknik/Areas/API/V1/Controllers/APIv1Controller.cs b/Teknik/Areas/API/V1/Controllers/APIv1Controller.cs index 31f5017..edf5103 100644 --- a/Teknik/Areas/API/V1/Controllers/APIv1Controller.cs +++ b/Teknik/Areas/API/V1/Controllers/APIv1Controller.cs @@ -1,31 +1,6 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Web; -using Teknik.Areas.Upload; -using Teknik.Areas.Paste; -using Teknik.Controllers; -using Teknik.Utilities; -using Teknik.Models; -using System.Text; -using MimeDetective; -using MimeDetective.Extensions; -using Teknik.Areas.Shortener.Models; -using nClam; -using Teknik.Filters; -using Teknik.Areas.API.V1.Models; -using Teknik.Areas.Users.Models; -using Teknik.Areas.Users.Utility; -using Teknik.Attributes; -using Microsoft.AspNetCore.Authorization; using Microsoft.Extensions.Logging; using Teknik.Configuration; using Teknik.Data; -using Microsoft.AspNetCore.Mvc; -using Microsoft.EntityFrameworkCore; -using System.Threading.Tasks; -using Teknik.Areas.Shortener; using Teknik.Logging; using Teknik.Areas.API.Controllers; diff --git a/Teknik/Areas/API/V1/Controllers/AccountAPIv1Controller.cs b/Teknik/Areas/API/V1/Controllers/AccountAPIv1Controller.cs index 126d947..07da1c5 100644 --- a/Teknik/Areas/API/V1/Controllers/AccountAPIv1Controller.cs +++ b/Teknik/Areas/API/V1/Controllers/AccountAPIv1Controller.cs @@ -1,14 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Threading.Tasks; +using System.Linq; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; +using Teknik.Attributes; using Teknik.Configuration; using Teknik.Data; -using Teknik.Filters; using Teknik.Logging; namespace Teknik.Areas.API.V1.Controllers diff --git a/Teknik/Areas/API/V1/Controllers/PasteAPIv1Controller.cs b/Teknik/Areas/API/V1/Controllers/PasteAPIv1Controller.cs index 235e61a..6a30ba8 100644 --- a/Teknik/Areas/API/V1/Controllers/PasteAPIv1Controller.cs +++ b/Teknik/Areas/API/V1/Controllers/PasteAPIv1Controller.cs @@ -1,20 +1,15 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; -using Teknik.Areas.API.Controllers; using Teknik.Areas.API.V1.Models; using Teknik.Areas.Paste; using Teknik.Areas.Users.Models; using Teknik.Areas.Users.Utility; +using Teknik.Attributes; using Teknik.Configuration; using Teknik.Data; -using Teknik.Filters; using Teknik.Logging; -using Teknik.Utilities; using Teknik.Utilities.Routing; namespace Teknik.Areas.API.V1.Controllers diff --git a/Teknik/Areas/API/V1/Controllers/ShortenAPIv1Controller.cs b/Teknik/Areas/API/V1/Controllers/ShortenAPIv1Controller.cs index 32f36e6..e06988f 100644 --- a/Teknik/Areas/API/V1/Controllers/ShortenAPIv1Controller.cs +++ b/Teknik/Areas/API/V1/Controllers/ShortenAPIv1Controller.cs @@ -1,21 +1,16 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; -using Teknik.Areas.API.Controllers; using Teknik.Areas.API.V1.Models; using Teknik.Areas.Shortener; using Teknik.Areas.Shortener.Models; using Teknik.Areas.Users.Models; using Teknik.Areas.Users.Utility; +using Teknik.Attributes; using Teknik.Configuration; using Teknik.Data; -using Teknik.Filters; using Teknik.Logging; -using Teknik.Utilities; using Teknik.Utilities.Routing; namespace Teknik.Areas.API.V1.Controllers diff --git a/Teknik/Areas/API/V1/Controllers/UploadAPIv1Controller.cs b/Teknik/Areas/API/V1/Controllers/UploadAPIv1Controller.cs index 57db0b0..e884f75 100644 --- a/Teknik/Areas/API/V1/Controllers/UploadAPIv1Controller.cs +++ b/Teknik/Areas/API/V1/Controllers/UploadAPIv1Controller.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading.Tasks; @@ -9,16 +8,14 @@ using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using MimeDetective; using MimeDetective.Extensions; -using nClam; -using Teknik.Areas.API.Controllers; using Teknik.Areas.API.V1.Models; using Teknik.Areas.Upload; using Teknik.Areas.Users.Models; using Teknik.Areas.Users.Utility; +using Teknik.Attributes; using Teknik.Configuration; using Teknik.ContentScanningService; using Teknik.Data; -using Teknik.Filters; using Teknik.Logging; using Teknik.Utilities; using Teknik.Utilities.Routing; diff --git a/Teknik/Areas/About/Controllers/AboutController.cs b/Teknik/Areas/About/Controllers/AboutController.cs index 6c4f855..72ba78f 100644 --- a/Teknik/Areas/About/Controllers/AboutController.cs +++ b/Teknik/Areas/About/Controllers/AboutController.cs @@ -1,21 +1,12 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using Teknik.Areas.About.ViewModels; -using Teknik.Areas.Billing.ViewModels; -using Teknik.Areas.Users.Utility; using Teknik.Attributes; -using Teknik.BillingCore; using Teknik.Configuration; using Teknik.Controllers; using Teknik.Data; -using Teknik.Filters; using Teknik.Logging; -using Teknik.Utilities.Routing; namespace Teknik.Areas.About.Controllers { diff --git a/Teknik/Areas/Abuse/Controllers/AbuseController.cs b/Teknik/Areas/Abuse/Controllers/AbuseController.cs index 34852fb..9a97948 100644 --- a/Teknik/Areas/Abuse/Controllers/AbuseController.cs +++ b/Teknik/Areas/Abuse/Controllers/AbuseController.cs @@ -1,16 +1,11 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; using Teknik.Areas.Abuse.ViewModels; using Teknik.Attributes; using Teknik.Configuration; using Teknik.Controllers; using Teknik.Data; -using Teknik.Filters; using Teknik.Logging; namespace Teknik.Areas.Abuse.Controllers diff --git a/Teknik/Areas/Admin/Controllers/AdminController.cs b/Teknik/Areas/Admin/Controllers/AdminController.cs index e41d756..74968cb 100644 --- a/Teknik/Areas/Admin/Controllers/AdminController.cs +++ b/Teknik/Areas/Admin/Controllers/AdminController.cs @@ -12,7 +12,6 @@ using Teknik.Attributes; using Teknik.Configuration; using Teknik.Controllers; using Teknik.Data; -using Teknik.Filters; using Teknik.Models; using Teknik.Utilities; using Teknik.ViewModels; diff --git a/Teknik/Areas/Billing/Controllers/BillingController.cs b/Teknik/Areas/Billing/Controllers/BillingController.cs index 1d56cf5..071d561 100644 --- a/Teknik/Areas/Billing/Controllers/BillingController.cs +++ b/Teknik/Areas/Billing/Controllers/BillingController.cs @@ -1,20 +1,17 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Tasks; -using Teknik.Areas.Billing.Models; using Teknik.Areas.Billing.ViewModels; using Teknik.Areas.Users.Models; using Teknik.Areas.Users.Utility; +using Teknik.Attributes; using Teknik.BillingCore; using Teknik.Configuration; using Teknik.Controllers; using Teknik.Data; -using Teknik.Filters; using Teknik.Logging; using Teknik.Utilities.Routing; diff --git a/Teknik/Areas/Blog/Controllers/BlogController.cs b/Teknik/Areas/Blog/Controllers/BlogController.cs index 79d1ca4..489e29a 100644 --- a/Teknik/Areas/Blog/Controllers/BlogController.cs +++ b/Teknik/Areas/Blog/Controllers/BlogController.cs @@ -3,15 +3,12 @@ using System.Collections.Generic; using System.Data; using System.Linq; using System.Net; -using System.Web; using Teknik.Areas.Blog.Models; using Teknik.Areas.Blog.ViewModels; using Teknik.Areas.Users.Models; using Teknik.Areas.Users.Utility; using Teknik.Controllers; -using Teknik.Filters; using Teknik.Utilities; -using Teknik.Models; using Teknik.Attributes; using Microsoft.Extensions.Logging; using Teknik.Configuration; diff --git a/Teknik/Areas/Contact/Controllers/ContactController.cs b/Teknik/Areas/Contact/Controllers/ContactController.cs index 1e46850..f1d34c2 100644 --- a/Teknik/Areas/Contact/Controllers/ContactController.cs +++ b/Teknik/Areas/Contact/Controllers/ContactController.cs @@ -1,14 +1,8 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; using System.Net.Mail; using Teknik.Controllers; using Teknik.Areas.Contact.ViewModels; -using Teknik.Areas.Contact.Models; -using Teknik.Models; using System.Text; -using Teknik.Filters; using Teknik.Attributes; using Microsoft.Extensions.Logging; using Teknik.Configuration; diff --git a/Teknik/Areas/Dev/Controllers/DevController.cs b/Teknik/Areas/Dev/Controllers/DevController.cs index 5598aef..26cd264 100644 --- a/Teknik/Areas/Dev/Controllers/DevController.cs +++ b/Teknik/Areas/Dev/Controllers/DevController.cs @@ -1,12 +1,9 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; -using Teknik.Attributes; using Teknik.Configuration; using Teknik.Controllers; using Teknik.Data; -using Teknik.Filters; -using Teknik.Utilities; using Teknik.Logging; using Teknik.Utilities.Routing; diff --git a/Teknik/Areas/Error/Controllers/ErrorController.cs b/Teknik/Areas/Error/Controllers/ErrorController.cs index ada4b0e..5e801d6 100644 --- a/Teknik/Areas/Error/Controllers/ErrorController.cs +++ b/Teknik/Areas/Error/Controllers/ErrorController.cs @@ -1,18 +1,14 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Net.Mail; using System.Text; using Teknik.Areas.Error.ViewModels; using Teknik.Controllers; -using Teknik.Filters; using Teknik.Utilities; using Teknik.Attributes; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Authorization; using Microsoft.Extensions.Logging; using Teknik.Configuration; -using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Extensions; using Microsoft.AspNetCore.Diagnostics; diff --git a/Teknik/Areas/FAQ/Controllers/FAQController.cs b/Teknik/Areas/FAQ/Controllers/FAQController.cs index 03c835d..333d176 100644 --- a/Teknik/Areas/FAQ/Controllers/FAQController.cs +++ b/Teknik/Areas/FAQ/Controllers/FAQController.cs @@ -6,7 +6,6 @@ using Teknik.Attributes; using Teknik.Configuration; using Teknik.Controllers; using Teknik.Data; -using Teknik.Filters; using Teknik.Logging; namespace Teknik.Areas.FAQ.Controllers diff --git a/Teknik/Areas/Help/Controllers/HelpController.cs b/Teknik/Areas/Help/Controllers/HelpController.cs index 1613011..1877b64 100644 --- a/Teknik/Areas/Help/Controllers/HelpController.cs +++ b/Teknik/Areas/Help/Controllers/HelpController.cs @@ -10,9 +10,7 @@ using Teknik.Attributes; using Teknik.Configuration; using Teknik.Controllers; using Teknik.Data; -using Teknik.Filters; using Teknik.Logging; -using Teknik.Utilities; namespace Teknik.Areas.Help.Controllers { diff --git a/Teknik/Areas/Home/Controllers/HomeController.cs b/Teknik/Areas/Home/Controllers/HomeController.cs index 9f169c0..d25af4d 100644 --- a/Teknik/Areas/Home/Controllers/HomeController.cs +++ b/Teknik/Areas/Home/Controllers/HomeController.cs @@ -3,7 +3,6 @@ using System.Linq; using Teknik.Areas.Blog.Models; using Teknik.Areas.Home.ViewModels; using Teknik.Controllers; -using Teknik.Filters; using Teknik.Attributes; using Microsoft.Extensions.Logging; using Teknik.Configuration; @@ -12,7 +11,6 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Teknik.Logging; -using System; namespace Teknik.Areas.Home.Controllers { diff --git a/Teknik/Areas/Paste/Controllers/PasteController.cs b/Teknik/Areas/Paste/Controllers/PasteController.cs index 44b0821..41368bf 100644 --- a/Teknik/Areas/Paste/Controllers/PasteController.cs +++ b/Teknik/Areas/Paste/Controllers/PasteController.cs @@ -1,13 +1,10 @@ using System; -using System.Collections.Generic; using System.Linq; using System.Text; using Teknik.Areas.Paste.ViewModels; using Teknik.Areas.Users.Utility; using Teknik.Controllers; -using Teknik.Filters; using Teknik.Utilities; -using Teknik.Models; using Teknik.Attributes; using Teknik.Utilities.Cryptography; using Microsoft.Extensions.Logging; @@ -15,12 +12,10 @@ using Teknik.Configuration; using Teknik.Data; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using Microsoft.EntityFrameworkCore; using Microsoft.AspNetCore.Http; using Teknik.Logging; using System.IO; using System.Threading.Tasks; -using Microsoft.AspNetCore.Diagnostics; using Teknik.Utilities.Routing; using Teknik.StorageService; diff --git a/Teknik/Areas/Podcast/Controllers/PodcastController.cs b/Teknik/Areas/Podcast/Controllers/PodcastController.cs index 280ec3e..701d5de 100644 --- a/Teknik/Areas/Podcast/Controllers/PodcastController.cs +++ b/Teknik/Areas/Podcast/Controllers/PodcastController.cs @@ -15,8 +15,6 @@ using Teknik.Attributes; using Teknik.Configuration; using Teknik.Controllers; using Teknik.Data; -using Teknik.Filters; -using Teknik.Models; using Teknik.Utilities; using Teknik.Logging; diff --git a/Teknik/Areas/Privacy/Controllers/PrivacyController.cs b/Teknik/Areas/Privacy/Controllers/PrivacyController.cs index d66da40..588c403 100644 --- a/Teknik/Areas/Privacy/Controllers/PrivacyController.cs +++ b/Teknik/Areas/Privacy/Controllers/PrivacyController.cs @@ -6,7 +6,6 @@ using Teknik.Attributes; using Teknik.Configuration; using Teknik.Controllers; using Teknik.Data; -using Teknik.Filters; using Teknik.Logging; namespace Teknik.Areas.Privacy.Controllers diff --git a/Teknik/Areas/RSS/Controllers/RSSController.cs b/Teknik/Areas/RSS/Controllers/RSSController.cs index a9124ab..89f52d2 100644 --- a/Teknik/Areas/RSS/Controllers/RSSController.cs +++ b/Teknik/Areas/RSS/Controllers/RSSController.cs @@ -1,14 +1,9 @@ using System; using System.Collections.Generic; using System.Linq; -using System.ServiceModel.Syndication; -using System.Web; -using System.Xml.Linq; using Teknik.Areas.Blog.Models; using Teknik.Controllers; -using Teknik.Filters; using Teknik.Utilities; -using Teknik.Models; using Teknik.Attributes; using Teknik.Areas.Users.Utility; using Microsoft.Extensions.Logging; diff --git a/Teknik/Areas/Shortener/Controllers/ShortenerController.cs b/Teknik/Areas/Shortener/Controllers/ShortenerController.cs index 096aa26..b017680 100644 --- a/Teknik/Areas/Shortener/Controllers/ShortenerController.cs +++ b/Teknik/Areas/Shortener/Controllers/ShortenerController.cs @@ -11,9 +11,7 @@ using Teknik.Attributes; using Teknik.Configuration; using Teknik.Controllers; using Teknik.Data; -using Teknik.Filters; using Teknik.Logging; -using Teknik.Utilities; using Teknik.Utilities.Routing; namespace Teknik.Areas.Shortener.Controllers diff --git a/Teknik/Areas/Stats/Controllers/StatsController.cs b/Teknik/Areas/Stats/Controllers/StatsController.cs index 4ef9b61..870099d 100644 --- a/Teknik/Areas/Stats/Controllers/StatsController.cs +++ b/Teknik/Areas/Stats/Controllers/StatsController.cs @@ -10,10 +10,8 @@ using Teknik.Attributes; using Teknik.Configuration; using Teknik.Controllers; using Teknik.Data; -using Teknik.Filters; using Teknik.Logging; using Teknik.Tracking; -using Teknik.Utilities; namespace Teknik.Areas.Stats.Controllers { diff --git a/Teknik/Areas/TOS/Controllers/TOSController.cs b/Teknik/Areas/TOS/Controllers/TOSController.cs index f7bfed4..cd89efc 100644 --- a/Teknik/Areas/TOS/Controllers/TOSController.cs +++ b/Teknik/Areas/TOS/Controllers/TOSController.cs @@ -6,7 +6,6 @@ using Teknik.Attributes; using Teknik.Configuration; using Teknik.Controllers; using Teknik.Data; -using Teknik.Filters; using Teknik.Logging; namespace Teknik.Areas.TOS.Controllers diff --git a/Teknik/Areas/Upload/Controllers/UploadController.cs b/Teknik/Areas/Upload/Controllers/UploadController.cs index be9efbe..b6ae56d 100644 --- a/Teknik/Areas/Upload/Controllers/UploadController.cs +++ b/Teknik/Areas/Upload/Controllers/UploadController.cs @@ -1,14 +1,10 @@ -using nClam; using System; -using System.Collections.Generic; using System.IO; using System.Linq; using Teknik.Areas.Upload.ViewModels; using Teknik.Areas.Users.Utility; using Teknik.Controllers; -using Teknik.Filters; using Teknik.Utilities; -using Teknik.Models; using Teknik.Attributes; using System.Text; using Teknik.Utilities.Cryptography; diff --git a/Teknik/Areas/User/Controllers/UserController.cs b/Teknik/Areas/User/Controllers/UserController.cs index 1fc823a..a0f2baa 100644 --- a/Teknik/Areas/User/Controllers/UserController.cs +++ b/Teknik/Areas/User/Controllers/UserController.cs @@ -6,7 +6,6 @@ using Teknik.Areas.Users.ViewModels; using Teknik.Controllers; using Teknik.Utilities; using Teknik.Areas.Users.Utility; -using Teknik.Filters; using QRCoder; using TwoStepsAuthenticator; using Teknik.Attributes; @@ -16,24 +15,12 @@ using Teknik.Configuration; using Teknik.Data; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using Microsoft.EntityFrameworkCore; using System.Net; using Microsoft.AspNetCore.Mvc.ViewEngines; using System.Threading.Tasks; using Teknik.Logging; -using System.Security.Claims; -using Microsoft.AspNetCore.Authentication.Cookies; using Microsoft.AspNetCore.Authentication; -using IdentityServer4.Services; -using Microsoft.AspNetCore.Identity; -using IdentityModel.Client; -using System.Net.Http; using Newtonsoft.Json.Linq; -using Teknik.Security; -using Microsoft.IdentityModel.Tokens; -using IdentityModel; -using System.Security.Cryptography; -using System.IdentityModel.Tokens.Jwt; using Microsoft.AspNetCore.Http; using IdentityServer4.Models; using Teknik.Utilities.Routing; diff --git a/Teknik/Areas/Vault/Controllers/VaultController.cs b/Teknik/Areas/Vault/Controllers/VaultController.cs index b3c8bab..bcea101 100644 --- a/Teknik/Areas/Vault/Controllers/VaultController.cs +++ b/Teknik/Areas/Vault/Controllers/VaultController.cs @@ -20,9 +20,7 @@ using Teknik.Attributes; using Teknik.Configuration; using Teknik.Controllers; using Teknik.Data; -using Teknik.Filters; using Teknik.Logging; -using Teknik.Models; using Teknik.Utilities; using Teknik.Utilities.Cryptography; using Teknik.Utilities.Routing; diff --git a/Teknik/Filters/CORSActionFilter.cs b/Teknik/Attributes/CORSActionFilter.cs similarity index 95% rename from Teknik/Filters/CORSActionFilter.cs rename to Teknik/Attributes/CORSActionFilter.cs index d295b43..5507774 100644 --- a/Teknik/Filters/CORSActionFilter.cs +++ b/Teknik/Attributes/CORSActionFilter.cs @@ -5,7 +5,7 @@ using System.Collections.Generic; using System.Linq; using System.Web; -namespace Teknik.Filters +namespace Teknik.Attributes { public class CORSActionFilter : ActionFilterAttribute { diff --git a/Teknik/Filters/TrackDownload.cs b/Teknik/Attributes/TrackDownloadAttribute.cs similarity index 95% rename from Teknik/Filters/TrackDownload.cs rename to Teknik/Attributes/TrackDownloadAttribute.cs index b6801b1..b588e26 100644 --- a/Teknik/Filters/TrackDownload.cs +++ b/Teknik/Attributes/TrackDownloadAttribute.cs @@ -12,7 +12,7 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Extensions; using Microsoft.AspNetCore.Mvc; -namespace Teknik.Filters +namespace Teknik.Attributes { public class TrackDownloadAttribute : TypeFilterAttribute { @@ -48,7 +48,7 @@ namespace Teknik.Filters string urlReferrer = request.Headers["Referer"].ToString(); - string url = UriHelper.GetEncodedUrl(request); + string url = request.GetEncodedUrl(); // Fire and forget. Don't need to wait for it. _queue.QueueBackgroundWorkItem(async token => diff --git a/Teknik/Filters/TrackLink.cs b/Teknik/Attributes/TrackLinkAttribute.cs similarity index 93% rename from Teknik/Filters/TrackLink.cs rename to Teknik/Attributes/TrackLinkAttribute.cs index 6dec029..5c66d48 100644 --- a/Teknik/Filters/TrackLink.cs +++ b/Teknik/Attributes/TrackLinkAttribute.cs @@ -11,7 +11,7 @@ using Teknik.Configuration; using Teknik.Tracking; using Teknik.Utilities; -namespace Teknik.Filters +namespace Teknik.Attributes { public class TrackLink : ActionFilterAttribute { @@ -39,7 +39,7 @@ namespace Teknik.Filters string urlReferrer = request.Headers["Referer"].ToString(); - string url = UriHelper.GetEncodedUrl(request); + string url = request.GetEncodedUrl(); // Fire and forget. Don't need to wait for it. Tracking.Tracking.TrackLink(filterContext.HttpContext, _config, userAgent, clientIp, url, urlReferrer); diff --git a/Teknik/Filters/TrackPageView.cs b/Teknik/Attributes/TrackPageViewAttribute.cs similarity index 96% rename from Teknik/Filters/TrackPageView.cs rename to Teknik/Attributes/TrackPageViewAttribute.cs index d3a3a7c..23d279f 100644 --- a/Teknik/Filters/TrackPageView.cs +++ b/Teknik/Attributes/TrackPageViewAttribute.cs @@ -13,13 +13,14 @@ using Microsoft.AspNetCore.Http.Extensions; using Microsoft.AspNetCore.Mvc; using Teknik.Utilities.Routing; -namespace Teknik.Filters +namespace Teknik.Attributes { public class TrackPageViewAttribute : TypeFilterAttribute { public TrackPageViewAttribute() : base(typeof(TrackPageView)) { } + public class TrackPageView : ActionFilterAttribute { private readonly IBackgroundTaskQueue _queue; @@ -52,7 +53,7 @@ namespace Teknik.Filters string clientIp = request.ClientIPFromRequest(true); - string url = UriHelper.GetEncodedUrl(request); + string url = request.GetEncodedUrl(); string urlReferrer = request.Headers["Referer"].ToString(); diff --git a/Teknik/Controllers/DefaultController.cs b/Teknik/Controllers/DefaultController.cs index efefc82..b617754 100644 --- a/Teknik/Controllers/DefaultController.cs +++ b/Teknik/Controllers/DefaultController.cs @@ -1,24 +1,17 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.Mvc.ViewEngines; using Microsoft.AspNetCore.Mvc.ViewFeatures; -using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.Logging; -using Microsoft.Net.Http.Headers; using System; using System.IO; using System.Reflection; using System.Threading.Tasks; -using System.Web; -using Teknik.Areas.Error.Controllers; using Teknik.Attributes; using Teknik.Configuration; using Teknik.Data; -using Teknik.Filters; using Teknik.Logging; using Teknik.Utilities; diff --git a/Tracking/TrackingService.cs b/Teknik/Services/TaskQueueService.cs similarity index 89% rename from Tracking/TrackingService.cs rename to Teknik/Services/TaskQueueService.cs index fe81f0d..d64d4bd 100644 --- a/Tracking/TrackingService.cs +++ b/Teknik/Services/TaskQueueService.cs @@ -8,13 +8,13 @@ using System.Threading.Tasks; using Teknik.Logging; using Teknik.Utilities; -namespace Teknik.Tracking +namespace Teknik.Services { - public class TrackingService : BackgroundService + public class TaskQueueService : BackgroundService { private readonly ILogger _logger; - public TrackingService(IBackgroundTaskQueue taskQueue, + public TaskQueueService(IBackgroundTaskQueue taskQueue, ILogger logger) { TaskQueue = taskQueue; diff --git a/Teknik/Startup.cs b/Teknik/Startup.cs index 0daa36e..64ca114 100644 --- a/Teknik/Startup.cs +++ b/Teknik/Startup.cs @@ -29,6 +29,7 @@ using Teknik.Utilities.Routing; using Teknik.WebCommon.Middleware; using Teknik.WebCommon; using Teknik.Areas.Error.Controllers; +using Teknik.Services; namespace Teknik { @@ -98,7 +99,7 @@ namespace Teknik .AddControllersAsServices() .AddNewtonsoftJson(); - services.AddHostedService(); + services.AddHostedService(); services.AddSingleton(); services.AddScoped();