Skip to content

Commit

Permalink
mirror fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
totpero committed Mar 19, 2024
1 parent 65c5c07 commit 9b2cef6
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 12 deletions.
17 changes: 17 additions & 0 deletions DeviceDetector.NET.Tests/Parser/Client/BrowserTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,21 @@ public void TestEngineVerison()
browserResult.Name.Should().NotBeEmpty();

}

[Fact]
public void TestB()
{
BrowserParser.SetVersionTruncation(BrowserParser.VERSION_TRUNCATION_NONE);
var browsers = new BrowserParser();
browsers.SetUserAgent("Mozilla/5.0 (Macintosh; U; PPC; en-US; mimic; rv:9.3.0) Clecko/20120101 Classilla/CFM");

var result = browsers.Parse();

result.Success.Should().BeTrue("Match should be with success");

if (result.Match is not BrowserMatchResult browserResult) return;

browserResult.Name.Should().NotBeEmpty();
browserResult.Version.Should().BeEquivalentTo(string.Empty, "Version should be equal");
}
}
5 changes: 4 additions & 1 deletion DeviceDetector.NET.Tests/Parser/OperatingSystemTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,12 @@ public void OsTestParse()
public void TestX()
{
var os = new OperatingSystemParser();
os.SetUserAgent("HbbTV/1.1.1 (;;;;) Mozilla/5.0 (compatible; ANTGalio/3.0.2.1.22.43.08; Linux2.6.18-7.1/7405d0-smp)");
os.SetUserAgent("Mozilla/5.0 (Linux; Android 10; Mi Max Prime Build/QP1A.191005.007) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/74.0.3729.186 Mobile Safari/537.36");
var clientHints = ClientHints.Factory(new(){ { "http-x-requested-with", "org.lineageos.jelly" } });
os.SetClientHints(clientHints);
var r = os.Parse();
r.Should().NotBeNull();
r.Match.Name.Should().Be("Lineage OS");
}

[Fact]
Expand Down
5 changes: 3 additions & 2 deletions DeviceDetector.NET/ClientHints.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;

namespace DeviceDetectorNET
Expand Down Expand Up @@ -326,7 +327,7 @@ public static ClientHints Factory(Dictionary<string,string> headers)
break;
case "http-x-requested-with":
case "x-requested-with":
if ("xmlhttprequest" != header.Value.ToLower()) {
if (!header.Value.Equals("xmlhttprequest", StringComparison.InvariantCultureIgnoreCase)) {
app = header.Value;
}
break;
Expand Down
11 changes: 5 additions & 6 deletions DeviceDetector.NET/DeviceDetector.NET.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,24 @@
<PropertyGroup>
<TargetFrameworks>netstandard2.0;Net462;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
<RootNamespace>DeviceDetectorNET</RootNamespace>
<Version>6.3.2</Version>
<Version>6.3.3</Version>
<Authors>totpero</Authors>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<Copyright>Copyright © www.totpe.ro</Copyright>
<Description>The Universal Device Detection library for .NET that parses User Agents and detects devices (desktop, tablet, mobile, tv, cars, console, etc.), clients (browsers, feed readers, media players, PIMs, ...), operating systems, brands and models. This is a port of the popular PHP device-detector library to C#. For the most part you can just follow the documentation for device-detector with no issue.</Description>
<PackageTags>parse detection-library user-agent bot-detection mobile-detection desktop tablet mobile tv cars console standard</PackageTags>
<PackageProjectUrl>https://github.com/totpero/DeviceDetector.NET</PackageProjectUrl>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<AssemblyVersion>6.3.0.2</AssemblyVersion>
<AssemblyVersion>6.3.3.0</AssemblyVersion>
<RepositoryUrl>https://github.com/totpero/DeviceDetector.NET</RepositoryUrl>
<SignAssembly>false</SignAssembly>
<FileVersion>6.3.0.2</FileVersion>
<FileVersion>6.3.3.0</FileVersion>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageReleaseNotes>
### What's Changed:

### V6.3.2:
- refix #79
- updates
### V6.3.3:
- fix error
</PackageReleaseNotes>
<PackageIcon>logo.jpg</PackageIcon>
<RepositoryType>git</RepositoryType>
Expand Down
3 changes: 1 addition & 2 deletions DeviceDetector.NET/Parser/Client/BrowserParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -717,8 +717,7 @@ public class BrowserParser : AbstractClientParser<List<Class.Client.Browser>>
{"DuckDuckGo Privacy Browser", new [] {"DuckDuckGo"}},
{"Edge WebView", new [] {"Microsoft Edge WebView2"}},
{"Microsoft Edge", new [] {"Edge"}},
{"Norton Private Browser", new [] {"Norton Secure Browser"}},
{"Vewd Browser", new [] {"Vewd Core"}},
{"Norton Private Browser", new [] {"Norton Secure Browser"}}
};


Expand Down
2 changes: 1 addition & 1 deletion DeviceDetector.NET/Parser/OperatingSystemParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ public override ParseResult<OsMatchResult> Parse()
version = string.Empty;
}

if ("'org.lineageos.jelly" == ClientHints.GetApp() && "Lineage OS" != name)
if ("org.lineageos.jelly" == ClientHints.GetApp() && "Lineage OS" != name)
{
name = "Lineage OS";
family = "Android";
Expand Down

0 comments on commit 9b2cef6

Please sign in to comment.