Giter Club home page Giter Club logo

wangkanai / wangkanai Goto Github PK

View Code? Open in Web Editor NEW
553.0 553.0 81.0 32.8 MB

Wangkanai is a collection of ASP.NET Core libraries that was developed internally over time and share common usage that would benefit everyone in the open source community as a whole.

Home Page: https://www.wangkanai.com

License: Apache License 2.0

C# 22.97% CSS 1.10% HTML 74.70% JavaScript 0.16% PowerShell 1.00% SCSS 0.06% Shell 0.01% Batchfile 0.01%
analytics detection responsive solver

wangkanai's Introduction

Files Logo

Twitter Twitter Twitter Twitter

Hello, fellow developers! πŸ‘‹

Welcome to my repository, where you'll find a vast collection of projects that I have been passionately developing and maintaining over the past 20 years. With over 10 million downloads on NuGet and a growing community of over 500 stargazers on GitHub, I am dedicated to creating and providing high-quality tools and resources for the community.

I am a seasoned solution architect, mentor, trainer, and full-stack developer with a rich professional experience under my belt. I am currently employed at Wangkanai Sugar, where I specialize in building enterprise applications and teaching .NET, Blazor, and Azure. I am always up for a challenge, and I take pride in transforming simple proposals into robust, well-defined, and thoroughly tested solutions.

NuGet Build status Quality Gate Status

Open Collective Patreon GitHub

What's Inside?

This repository features a broad range of projects, all designed with the aim of helping you navigate the ever-evolving world of technology. Here's a quick snapshot of what you can expect to find:

  • Detection: A library to help you detect a client's device, browser, engine, platform, & crawler.
  • Responsive: A library to help you make your application responsive and adaptable to different screen sizes.
  • Blazor: Custom UI components for Blazor applications to enhance user experience and productivity.
  • Tabler: A library to help you build a modern dashboard or admin panel for your application.
  • Markdown: A library to help you parse and render Markdown content in your application.
  • Identity: A library to help you manage user authentication and authorization in your application.
  • Federation: A library to help you federate your application with other identity providers.

And much more! Feel free to explore, use, and contribute to these projects.

What is our progress?

Types Status
Epics Board Status
Features Board Status
Stories Board Status

Let's Connect!

I appreciate every star ⭐ that my projects receive, and your support means a lot to me! If you find my projects useful or enjoyable, please consider giving them a star.

For inquiries, suggestions, or contributions, feel free to open an issue or a pull request. You can also reach out to me directly via LinkedIn.

Thank you for your interest in my work, and happy coding!

Wangkanai's GitHub Stats Wangkanai's Top Languages

Alt

wangkanai's People

Contributors

apolontorq avatar frankhaugen avatar jphiliphunt avatar kostavlev avatar monkeywithacupcake avatar multiarc avatar rachit43 avatar rynowak avatar thedarkcode avatar vovikdrg avatar wangkanai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wangkanai's Issues

Add collections of user agents for future testing

In order to increase the coverage of the unit test on move devices. Their should database collection of most commonly known user agents with following separation.

  • Device
  • Browser
  • Engine
  • Platform

User agent null not work

When user agent is null, the application not work.

public AccountsController(ApiDbContext dbContext, IDetection detection)
{
    _dbContext = dbContext;
    _detection = detection;
}
{System.NullReferenceException: Object reference not set to an instance of an object.
   at Wangkanai.Detection.Collections.InternetExplorer..ctor(String agent)
   at Wangkanai.Detection.BrowserResolver.GetBrowser()
   at Wangkanai.Detection.BrowserResolver..ctor(IUserAgentService service)
   at lambda_method(Closure , ServiceProvider )
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType)
   at Microsoft.Extensions.Internal.ActivatorUtilities.GetService(IServiceProvider sp, Type type, Type requiredBy, Boolean isDefaultParameterRequired)
   at lambda_method(Closure , IServiceProvider , Object[] )
   at Microsoft.AspNetCore.Mvc.Controllers.ControllerActivatorProvider.<>c__DisplayClass4_0.<CreateActivator>b__0(ControllerContext controllerContext)
   at Microsoft.AspNetCore.Mvc.Controllers.ControllerFactoryProvider.<>c__DisplayClass5_0.<CreateControllerFactory>g__CreateController|0(ControllerContext controllerContext)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeInnerFilterAsync>d__14.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeNextExceptionFilterAsync>d__23.MoveNext()}

CookieManager is return Desktop for all Device

Describe the bug

The CookieManager is resolving DeviceType as Desktop Only.

public DeviceType Device => _options.Default(Get());
public DeviceType Get()
{
    var value = _context.Request.Cookies[ResponsiveContextKey];
    DeviceType result;
    Console.Write(value);
    Enum.TryParse<DeviceType>(value, out result);

    return result;
}

Crawler Resolver

Search engine bot are getting complicated to track and it would be good idea to develop this module.

Device TagHelper include & exclude render view

To helper with use the detection service in render view. TagHelper is easy to make this happen.

<device include="mobile">
    <h3>Detection on Home give mobile result</h3>
</device>
<device exclude="mobile">
    <h3>Detection on Home give anything not mobile as the result</h3>
</device>

Opening in mobile will render the following

<h3>Detection on Home give mobile result</h3>

Opening on tablet or desktop will render the following

<h3>Detection on Home give anything not mobile as the result</h3>

Engine Resolver

This is to track the progress of developing the Engine Resolver module in Detection Service.

nuget version- update to beta 10

Hi.
Can you please update the specific nuget packges to version beta 10.
in Wangkanai.Detection.Crawler - beta 9 there is an issue with user agent Mozilla/5.0 (compatible; MJ12bot/v1.4.8; http://mj12bot.com/) which got fixes in beta 10.
Can you ship this update as well?

Global Resolver

The global will come along with the global reference. This resolver is single resolver that would get all results in this library.

platform detection not working

hello
i test your service with many of user agents , but service just detect the Device , not any other ,like platform .

i added services.AddDetection(); in startup.

Extract modular to load only what is needed

The idea from as modular design come into good use when our project has only implemented the DeviceResolver. So we will refactor the main client service into the core of the library and add the individual resolver to the service. This design is like what EntityFrameworkCore has implemented with SqlServer, InMemory, and Sqlite.

  • Nuget
PM> install-package Wangkanai.Detection.Device 
PM> install-package Wangkanai.Detection.Browser 
PM> install-package Wangkanai.Detection.Engine
PM> install-package Wangkanai.Detection.Platform
  • project,json
{
  "dependencies": {
    "Wangkanai.Detection.Device": "1.0.0-*",
    "Wangkanai.Detection.Browser": "1.0.0-*",   // feature waiting for implementation
    "Wangkanai.Detection.Engine": "1.0.0-*",    // feature waiting for implementation
    "Wangkanai.Detection.Platform": "1.0.0-*",  // feature waiting for implementation
  }
}
  • Configuring
    Configuring the startup.cs the adding the Detection Service in the ConfigureServices method. The extension will only show up if the package has been loaded into the project.
public void ConfigureServices(IServiceCollection services)
{
    // Add detection services.
    services.AddDetection()
        .AddDevice()    // if load the `Wangkanai.Detection.Device` nuget
        .AddBrowser()   // if load the `Wangkanai.Detection.Browser` nuget
        .AddEngine()    // if load the `Wangkanai.Detection.Engine` nuget
        .AddPlatform(); // if load the `Wangkanai.Detection.Platform` nuget

    // Add framework services.
    services.AddMvc();
}

Non Beta Version

Nice project!

Just a question - why are all the releases BETA versions.

Do you plan to release a non-beta version that can be easily searched in nuget packages without "include prerelease" being checked?

Responsive Option with Action<>

Is your feature request related to a problem? Please describe.

app.UseResponsive(new ResponsiveOptions {
    TabletDefault = DeviceType.Desktop
});

Describe the solution you'd like

Option 1

app.UseResponsive(options => {
    options.MapView(
        target: DeviceType.Tablet,
        prefer: DeviceType.Desktop);
});

Options 2

app.UseResponsive(options => {
    options.DefaultTablet(DeviceType.Tablet);
    options.DefaultMobile(DeviceType.Mobile);
    options.DefaultDesktop(DeviceType.Desktop);
});

I would like comment of the community

NullReferenceException error when trying to use in Middleware

I think this is similar to #83 but there was no detail of the resolution there.

I am trying to use Detection in Middleware which gets files from data and writes them to the Response. Detection is being used to correctly generate the Content-Disposition header to get it right for different browsers/platforms.

My middleware is:
`public class ImageHandlerMiddleware
{
private readonly RequestDelegate _next;
private readonly IMediaService _mediaService;
private readonly IBrowserResolver _browserResolver;
private readonly IPlatformResolver _platformResolver;
private readonly IImageProcessorService _imageProcessor;

public ImageHandlerMiddleware(
    RequestDelegate next
    , IMediaService mediaService
    , IBrowserResolver browserResolver
    , IPlatformResolver platformResolver
    , IImageProcessorService imageProcessor
  )
{
  _next = next;
  _mediaService = mediaService;
  _browserResolver = browserResolver;
  _platformResolver = platformResolver;
  _imageProcessor = imageProcessor;
}

public async Task Invoke( HttpContext context )
{
  var pathSegments = context.Request.Path.ToSegments();

  var width = context.Request.Query[ "w" ].FirstOrDefault()?.ToInt32();
  var height = context.Request.Query[ "h" ].FirstOrDefault()?.ToInt32();

  var media = await _mediaService.GetMediaAsync( pathSegments.Last() );

  if ( media != null )
  {
    if ( width != null || height != null )
    {
      media.FileData = _imageProcessor.Resize( media.FileData, width, height );
    }
  }
  else
  {

    // TODO: get standard missing image graphic
  }

        context.Response.Clear();
        context.Response.ContentType = media.MimeType;
        context.Response.Headers.Add( HeaderNames.CacheControl, "no-store,no-cache" );
        context.Response.Headers.Add( HeaderNames.Pragma, "no-cache" );
        context.Response.Headers.Add(
            HeaderNames.ContentDisposition,
            media.FileName.ToInlineHeader(
                _browserResolver, _platformResolver, media.FileExtension
              )
          );
        await context.Response.Body.WriteAsync( media.FileData, 0, media.FileData.Length );
}

}`

This is being mapped using:

app.MapWhen( context => context.Request.Path.StartsWithSegments( "/image" ), imageApp => { imageApp.UseMiddleware<ImageHandlerMiddleware>(); } );

The full error message is:

Stopped program because of exception System.ArgumentNullException: Value cannot be null.
Parameter name: Context
at Wangkanai.Detection.UserAgentService.CreateUserAgent(HttpContext context)
at Wangkanai.Detection.UserAgentService..ctor(IServiceProvider services)
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitTransient(TransientCallSite transientCallSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitTransient(TransientCallSite transientCallSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.b__0(ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType)
at Microsoft.Extensions.Internal.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider provider)
at Microsoft.Extensions.Internal.ActivatorUtilities.CreateInstance(IServiceProvider provider, Type instanceType, Object[] parameters)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass4_0.b__0(RequestDelegate next)
at Microsoft.AspNetCore.Builder.Internal.ApplicationBuilder.Build()
at Microsoft.AspNetCore.Builder.MapWhenExtensions.MapWhen(IApplicationBuilder app, Func2 predicate, Action1 configuration)
at D*****.Module.Core.Middleware.ImageHandlerMiddlewareExtensions.UseImageHandler(IApplicationBuilder app) in D:_Websites\D*****\D*****_core\D*****\src\Modules\D*****.Module.Core\Middleware\ImageHandlerMiddlewareExtensions.cs:line 17
at D*****.Module.Core.ModuleInitializer.Configure(IApplicationBuilder app, IHostingEnvironment env) in D:_Websites\D*****\D*****_core\D*****\src\Modules\D*****.Module.Core\ModuleInitializer.cs:line 31
at D*****.WebHost.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env) in D:_Websites\D*****\D*****_core\D*****\src\D*****.WebHost\Startup.cs:line 239
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)
at Microsoft.AspNetCore.Mvc.Internal.MiddlewareFilterBuilderStartupFilter.<>c__DisplayClass0_0.g__MiddlewareFilterBuilder|0(IApplicationBuilder builder)
at Microsoft.AspNetCore.HostFilteringStartupFilter.<>c__DisplayClass0_0.b__0(IApplicationBuilder app)
at Microsoft.AspNetCore.Hosting.Internal.AutoRequestServicesStartupFilter.<>c__DisplayClass0_0.b__0(IApplicationBuilder builder)
at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
at Microsoft.AspNetCore.Hosting.Internal.WebHost.StartAsync(CancellationToken cancellationToken)
at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token, String shutdownMessage)
at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token)
at Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost host)
at D*****.WebHost.Program.Main(String[] args) in D:_Websites\D*****\D*****_core\D*****\src\D*****.WebHost\Program.cs:line 22

I have tried the FixDetectionMiddleware on suggested in #73 but that hasn't fixed the issue.

Any further assistance would be welcome

Cheers
Greg

Browser version parser fails

System.ArgumentException: Version string portion was too short or too long.
Parameter name: input
at System.Version.ParseVersion(ReadOnlySpan`1 input, Boolean throwOnFailure)
at System.Version.Parse(String input)
at System.Version..ctor(String version)
at Wangkanai.Detection.Collections.Safari..ctor(String agent)
at Wangkanai.Detection.BrowserResolver.GetBrowser()
at Wangkanai.Detection.BrowserResolver..ctor(IUserAgentService service)

AddDetectionCore

In order to add single service to the web app, the current AddDetection() will be change to AddDetectionCore() and then AddDetection() will a new point to all if all service is required. This is due to that this library features and functions will expand to beyond what was originally planned out.

HttpRequest Extensions

Adding extensible to existing usage scenario is a key design. So I would like to propose a concept of extending the HttpRequest for developer to access the Browser, Device, Platform, Engine directly. This extension then retrieve the instance from the BrowserService.

var browser = HttpContext.Request.Browser();
var platform = HttpContext.Request.Platform();
var device = HttpContext.Request.Device();
var engine = HttpContext.Request.Engine();

I would like to hear the community regarding this concept.

Adding GetVersion() method to Wangkanai.Detection.Version.cs

It might be helpful to have method GetVersion().

Possible implementation:

public string GetVersion(Func<Version, string> format)
{
    return format(this);
}

and then used:

var version = new Version("1", "1");
var versionStrings = version.GetVersion(v => $"{v.Major}.{v.Minor}");

Console.WriteLine(versionStrings); //output: 1.1

or

var version = new Version("1", "1");
var format = "{0}.{1}"
var versionStrings = version.GetVersion(v => string.Format(format, v.Major, v.Minor));

Console.WriteLine(versionStrings); //output: 1.1

MVC Rzor PageModel .Net Core 2

Hi,

how is it possible to add IDetection to the Razor PageModel?
When I put it the e.g. IndexModel I get an error:

InvalidOperationException: Unable to resolve service for type 'Wangkanai.Detection.IDetection' while attempting to activate 'XXXXX.App.Pages.IndexModel'.

public class IndexModel : PageModel
{
        private readonly IDetection _detection;
       private AppConfiguration _appConfig;

 public IndexModel(IOptions<AppConfiguration> appConfig, IDetection detection)
        {
            _appConfig = appConfig.Value;
            _detection = detection;
     }
      public async Task OnGetAsync(){
      ...
     }
}

Cut off list

In order cover all market of client detection is impossible. Therefore, we would need cut off threshold that should be consider in our detection list. the mark is above 1% market share.

Wangkanai.Detection for all modules

Having one single package that bring in the all sub modules of Device, Browser, Platform, and Engine a good idea and was the original concept of this library when its started out with just Device Resolver. In the finding the resolving browser is not a simple issue and the detection service need to do a lot things;

  1. Resolve that type of device is the client
  2. Resolve what Browser is the client (including Name, Maker, Version)
  3. Resolve what Engine is the client
  4. Resove what Platform is the client (Windows, Mac, Linux)

All this is not simple task to take. Therefore, this library would take a lot time to get right. Helping hand would be great. Anybody would like to contribute would be much appreciated and welcome.

Failed method Wangkanai.Detection.Collections.InternetExplorer..ctor

I am getting errors with activating Objects.
I've pushed update to azure to record headers as soon as I have more info, I will provide it.

An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = Detection (ReflectionActivator), Services = [Wangkanai.Detection.IDetection], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None, Ownership = OwnedByLifetimeScope ---> An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = BrowserResolver (ReflectionActivator), Services = [Wangkanai.Detection.IBrowserResolver], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None, Ownership = OwnedByLifetimeScope ---> An exception was thrown while invoking the constructor 'Void .ctor(Wangkanai.Detection.IUserAgentService)' on type 'BrowserResolver'. ---> Object reference not set to an instance of an object. (See inner exception for details.) (See inner exception for details.) (See inner exception for details.) An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = BrowserResolver (ReflectionActivator), Services = [Wangkanai.Detection.IBrowserResolver], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None, Ownership = OwnedByLifetimeScope ---> An exception was thrown while invoking the constructor 'Void .ctor(Wangkanai.Detection.IUserAgentService)' on type 'BrowserResolver'. ---> Object reference not set to an instance of an object. (See inner exception for details.) (See inner exception for details.) An exception was thrown while invoking the constructor 'Void .ctor(Wangkanai.Detection.IUserAgentService)' on type 'BrowserResolver'. ---> Object reference not set to an instance of an object. (See inner exception for details.) Object reference not set to an instance of an object.

Autofac.Core.DependencyResolutionException:
at Autofac.Core.Resolving.InstanceLookup.Activate (Autofac, Version=4.8.1.0, Culture=neutral, PublicKeyToken=17863af14b0044da)
at Autofac.Core.Resolving.InstanceLookup.Execute (Autofac, Version=4.8.1.0, Culture=neutral, PublicKeyToken=17863af14b0044da)
at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance (Autofac, Version=4.8.1.0, Culture=neutral, PublicKeyToken=17863af14b0044da)
at Autofac.Core.Resolving.ResolveOperation.Execute (Autofac, Version=4.8.1.0, Culture=neutral, PublicKeyToken=17863af14b0044da)
at Autofac.ResolutionExtensions.TryResolveService (Autofac, Version=4.8.1.0, Culture=neutral, PublicKeyToken=17863af14b0044da)
at Autofac.ResolutionExtensions.ResolveOptionalService (Autofac, Version=4.8.1.0, Culture=neutral, PublicKeyToken=17863af14b0044da)
at Autofac.Extensions.DependencyInjection.AutofacServiceProvider.GetService (Autofac.Extensions.DependencyInjection, Version=4.3.1.0, Culture=neutral, PublicKeyToken=17863af14b0044da)
at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.GetService (Microsoft.Extensions.DependencyInjection.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60)
at lambda_method (Anonymously Hosted DynamicMethods Assembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null)
at Microsoft.AspNetCore.Mvc.Controllers.ControllerFactoryProvider+<>c__DisplayClass5_0.g__CreateController|0 (Microsoft.AspNetCore.Mvc.Core, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next (Microsoft.AspNetCore.Mvc.Core, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker+d__13.MoveNext (Microsoft.AspNetCore.Mvc.Core, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker+d__23.MoveNext (Microsoft.AspNetCore.Mvc.Core, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow (Microsoft.AspNetCore.Mvc.Core, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next (Microsoft.AspNetCore.Mvc.Core, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker+d__18.MoveNext (Microsoft.AspNetCore.Mvc.Core, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker+d__16.MoveNext (Microsoft.AspNetCore.Mvc.Core, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
at Microsoft.AspNetCore.Routing.EndpointMiddleware+d__3.MoveNext (Microsoft.AspNetCore.Routing, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
at Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware+d__6.MoveNext (Microsoft.AspNetCore.Routing, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
at Flymark.Online.Web.Startup+<>c+<b__9_4>d.MoveNext (Flymark.Online.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=nullFlymark.Online.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\Source\Web\Startup.csFlymark.Online.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: 346)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
at WebMarkupMin.AspNetCore2.WebMarkupMinMiddleware+d__5.MoveNext (WebMarkupMin.AspNetCore2, Version=2.5.0.0, Culture=neutral, PublicKeyToken=99472178d266584b)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware+d__5.MoveNext (Microsoft.AspNetCore.Localization, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
at Flymark.Online.Web.Utility.Middleware.DomainMiddleware+d__3.MoveNext (Flymark.Online.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=nullFlymark.Online.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\Source\Web\Utility\Middleware\DomainMiddleware.csFlymark.Online.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: 42)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware+d__6.MoveNext (Microsoft.AspNetCore.Authentication, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
at Flymark.Online.Web.Utility.Middleware.FlymarkExceptionMiddleware+d__3.MoveNext (Flymark.Online.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=nullFlymark.Online.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\Source\Web\Utility\Middleware\FlymarkExceptionMiddleware.csFlymark.Online.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: 31)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
at Flymark.Online.Web.Utility.Middleware.FlymarkExceptionMiddleware+d__3.MoveNext (Flymark.Online.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=nullFlymark.Online.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: D:\a\1\s\Source\Web\Utility\Middleware\FlymarkExceptionMiddleware.csFlymark.Online.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: 42)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
at Anemonis.AspNetCore.RequestDecompression.RequestDecompressionMiddleware+d__3.MoveNext (Anemonis.AspNetCore.RequestDecompression, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions+<>c__DisplayClass5_1+<b__1>d.MoveNext (Microsoft.AspNetCore.Http.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware+d__7.MoveNext (Microsoft.AspNetCore.StaticFiles, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware+d__6.MoveNext (Microsoft.AspNetCore.Diagnostics, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60)
Inner exception Autofac.Core.DependencyResolutionException handled at Autofac.Core.Resolving.InstanceLookup.Activate:
at Autofac.Core.Resolving.InstanceLookup.Activate (Autofac, Version=4.8.1.0, Culture=neutral, PublicKeyToken=17863af14b0044da)
at Autofac.Core.Resolving.InstanceLookup.Execute (Autofac, Version=4.8.1.0, Culture=neutral, PublicKeyToken=17863af14b0044da)
at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance (Autofac, Version=4.8.1.0, Culture=neutral, PublicKeyToken=17863af14b0044da)
at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate (Autofac, Version=4.8.1.0, Culture=neutral, PublicKeyToken=17863af14b0044da)
at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance (Autofac, Version=4.8.1.0, Culture=neutral, PublicKeyToken=17863af14b0044da)
at Autofac.Core.Resolving.InstanceLookup.Activate (Autofac, Version=4.8.1.0, Culture=neutral, PublicKeyToken=17863af14b0044da)
Inner exception Autofac.Core.DependencyResolutionException handled at Autofac.Core.Resolving.InstanceLookup.Activate:
at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate (Autofac, Version=4.8.1.0, Culture=neutral, PublicKeyToken=17863af14b0044da)
at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance (Autofac, Version=4.8.1.0, Culture=neutral, PublicKeyToken=17863af14b0044da)
at Autofac.Core.Resolving.InstanceLookup.Activate (Autofac, Version=4.8.1.0, Culture=neutral, PublicKeyToken=17863af14b0044da)
Inner exception System.NullReferenceException handled at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate:
at Wangkanai.Detection.Collections.InternetExplorer..ctor (Wangkanai.Detection.Browser, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null)
at Wangkanai.Detection.BrowserResolver.GetBrowser (Wangkanai.Detection.Browser, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null)
at Wangkanai.Detection.BrowserResolver..ctor (Wangkanai.Detection.Browser, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null)
at lambda_method (Anonymously Hosted DynamicMethods Assembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null)
at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate (Autofac, Version=4.8.1.0, Culture=neutral, PublicKeyToken=17863af14b0044da)

System.ArgumentOutOfRangeException: Length cannot be less than zero.

I use beta-8 version, must of my site traffic is mobile, sometime this exception throw.

System.ArgumentOutOfRangeException: Length cannot be less than zero. Parameter name: length at System.String.Substring(Int32 startIndex, Int32 length) at Wangkanai.Detection.CrawlerResolver.GetCrawler() at Wangkanai.Detection.CrawlerResolver..ctor(IUserAgentService service) at lambda_method(Closure , ServiceProviderEngineScope ) at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType) at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.GetService(IServiceProvider sp, Type type, Type requiredBy, Boolean isDefaultParameterRequired)

Separating option parser resolver out of main BrowserService

In order to have a clear responsibility service class and reduce to performance overview from unused feature of the parser. Then add what is only needed in your web application. I would like to propose having AddPlatform and AddEngine to the BrowserBuilder.

public void ConfigureServices(IServiceCollection services)
{
    services.AddBrowser()
        .AddPlatform()
        .AddEngine();
    // Add framework services.
    services.AddMvc();
}

I would to like to hear your idea on this concept idea.

AddResponsive refactor to AddResponsiveCore

The propose is simply the initial configuration and make bias default convention add you user would like to add the responsive features.

public void ConfigureServices(IServiceCollection services)
{
    // Add responsive services.
    services.AddResponsive();

    // Add framework services.
    services.AddMvc();
}

But if you would like to specify what you view location you would like to add to responsive by going to the core.

public void ConfigureServices(IServiceCollection services)
{
    // Add responsive services.
    services.AddResponsiveCore()
                .AddViewSuffix()
                .AddViewSubfolder();

    // Add framework services.
    services.AddMvc();
}

Originally you would need to specify which view location you would like to add to Responsive.

public void ConfigureServices(IServiceCollection services)
{
    // Add responsive services.
    services.AddResponsive()
                .AddViewSuffix()
                .AddViewSubfolder();

    // Add framework services.
    services.AddMvc();
}

Platform Resolver

This is to track the progress of the development of Platform Resolver in Detection Service.

Versioning of Nuget

Hello,

There are a problem with versioning in Nuget. If you release 2.0.0-beta12, nuget not recognize as higer version because nuget order of semver component are alphanumeric.

If you have 2.0.0-beta-02, then 2.0.0-beta-12 is more recent, but 2.0.0-beta-2 not function properly.

Now, you may change all packages to 2.0.1-beta-01 or 2.0.1-beta01 to correct packages.

Thanks!

Wankamai

Common User Agent Tests Collection

Create shared library for user agent tests with collection with identifier of what is that user agent client is.

example:

  • Device (Type)
  • Browser (Type, Name, Maker, Version)
  • Platform (Type, Name, Maker, Version)
  • Engine (Type, Name, Maker, Version)

Responsive demo not working?

Hi I'm trying to run your responsive demo, but it doesn't seem to be detecting the device?

Capture

Haven't changed any code, just built and run

User Tracker

This is nice concept for Detection know the current user a return user. This would required cookie implementation and while this whole different concept from our normal Resolver.

Browser Resolver

Browser resolver should be implemented in beta6

  • browser type as brand
  • browser version implementing iversion

Different detection of same device

Hi, I am using your library in ASP.NET Core MVC application. When app is open on Galaxy Tab A 2016 in firefox, device is recognized like tablet and that is OK. But when app is open in chrome or in built in browser it's recognized like desktop. Do you have some advice for that situation? Here is code example:

public class AccountController : BaseController
{
    private readonly IDevice deviceResolver;

    public AccountController(IDeviceResolver deviceResolver)
    {
        this.deviceResolver = deviceResolver.Device;
    }

     public ActionResult Login()
     {
         if (deviceResolver.Type == DeviceType.Desktop)
         {
              //some logic
         }
         else
         {
             //some logic
         }
     }
}

NullReferenceException error in debug output

I have a NullReferenceException error when I inject IBrowserResolver into a Middleware. Not on all queries.

public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
    app.UseDeveloperExceptionPage();
    app.UseMiddleware<SimpleMiddleware>();
}

internal class SimpleMiddleware
{
    private readonly RequestDelegate _next;

    public SimpleMiddleware(RequestDelegate next)
    {
        _next = next;
    }

    public Task InvokeAsync(HttpContext context, IBrowserResolver browserResolver)
    {
        return _next(context);
    }
}

Exception:
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1] An unhandled exception has occurred while executing the request. System.NullReferenceException: Object reference not set to an instance of an object. at Wangkanai.Detection.Collections.InternetExplorer..ctor(String agent) at Wangkanai.Detection.BrowserResolver.GetBrowser() at Wangkanai.Detection.BrowserResolver..ctor(IUserAgentService service) at lambda_method(Closure , ServiceProviderEngineScope ) at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType) at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.GetService(IServiceProvider sp, Type type, Type middleware) at lambda_method(Closure , Object , HttpContext , IServiceProvider ) at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass4_1.<UseMiddleware>b__2(HttpContext context) at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

Manufacturer base interface

A common interface for client resolver that have manufacturer details and the details of the product version. These that implement this interface would be Browser, Platform, & Engine. While Device is generic to category of the client access device, any manufacturer options to target that device category.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.