Skip to content

Commit 9b2cef6

Browse files
committed
mirror fixes
1 parent 65c5c07 commit 9b2cef6

File tree

6 files changed

+31
-12
lines changed

6 files changed

+31
-12
lines changed

DeviceDetector.NET.Tests/Parser/Client/BrowserTest.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,21 @@ public void TestEngineVerison()
9898
browserResult.Name.Should().NotBeEmpty();
9999

100100
}
101+
102+
[Fact]
103+
public void TestB()
104+
{
105+
BrowserParser.SetVersionTruncation(BrowserParser.VERSION_TRUNCATION_NONE);
106+
var browsers = new BrowserParser();
107+
browsers.SetUserAgent("Mozilla/5.0 (Macintosh; U; PPC; en-US; mimic; rv:9.3.0) Clecko/20120101 Classilla/CFM");
108+
109+
var result = browsers.Parse();
110+
111+
result.Success.Should().BeTrue("Match should be with success");
112+
113+
if (result.Match is not BrowserMatchResult browserResult) return;
114+
115+
browserResult.Name.Should().NotBeEmpty();
116+
browserResult.Version.Should().BeEquivalentTo(string.Empty, "Version should be equal");
117+
}
101118
}

DeviceDetector.NET.Tests/Parser/OperatingSystemTest.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,12 @@ public void OsTestParse()
5555
public void TestX()
5656
{
5757
var os = new OperatingSystemParser();
58-
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)");
58+
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");
59+
var clientHints = ClientHints.Factory(new(){ { "http-x-requested-with", "org.lineageos.jelly" } });
60+
os.SetClientHints(clientHints);
5961
var r = os.Parse();
6062
r.Should().NotBeNull();
63+
r.Match.Name.Should().Be("Lineage OS");
6164
}
6265

6366
[Fact]

DeviceDetector.NET/ClientHints.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.Collections.Generic;
1+
using System;
2+
using System.Collections.Generic;
23
using System.Text.RegularExpressions;
34

45
namespace DeviceDetectorNET
@@ -326,7 +327,7 @@ public static ClientHints Factory(Dictionary<string,string> headers)
326327
break;
327328
case "http-x-requested-with":
328329
case "x-requested-with":
329-
if ("xmlhttprequest" != header.Value.ToLower()) {
330+
if (!header.Value.Equals("xmlhttprequest", StringComparison.InvariantCultureIgnoreCase)) {
330331
app = header.Value;
331332
}
332333
break;

DeviceDetector.NET/DeviceDetector.NET.csproj

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,24 @@
33
<PropertyGroup>
44
<TargetFrameworks>netstandard2.0;Net462;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
55
<RootNamespace>DeviceDetectorNET</RootNamespace>
6-
<Version>6.3.2</Version>
6+
<Version>6.3.3</Version>
77
<Authors>totpero</Authors>
88
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
99
<Copyright>Copyright © www.totpe.ro</Copyright>
1010
<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>
1111
<PackageTags>parse detection-library user-agent bot-detection mobile-detection desktop tablet mobile tv cars console standard</PackageTags>
1212
<PackageProjectUrl>https://github.com/totpero/DeviceDetector.NET</PackageProjectUrl>
1313
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
14-
<AssemblyVersion>6.3.0.2</AssemblyVersion>
14+
<AssemblyVersion>6.3.3.0</AssemblyVersion>
1515
<RepositoryUrl>https://github.com/totpero/DeviceDetector.NET</RepositoryUrl>
1616
<SignAssembly>false</SignAssembly>
17-
<FileVersion>6.3.0.2</FileVersion>
17+
<FileVersion>6.3.3.0</FileVersion>
1818
<PackageReadmeFile>README.md</PackageReadmeFile>
1919
<PackageReleaseNotes>
2020
### What's Changed:
2121

22-
### V6.3.2:
23-
- refix #79
24-
- updates
22+
### V6.3.3:
23+
- fix error
2524
</PackageReleaseNotes>
2625
<PackageIcon>logo.jpg</PackageIcon>
2726
<RepositoryType>git</RepositoryType>

DeviceDetector.NET/Parser/Client/BrowserParser.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -717,8 +717,7 @@ public class BrowserParser : AbstractClientParser<List<Class.Client.Browser>>
717717
{"DuckDuckGo Privacy Browser", new [] {"DuckDuckGo"}},
718718
{"Edge WebView", new [] {"Microsoft Edge WebView2"}},
719719
{"Microsoft Edge", new [] {"Edge"}},
720-
{"Norton Private Browser", new [] {"Norton Secure Browser"}},
721-
{"Vewd Browser", new [] {"Vewd Core"}},
720+
{"Norton Private Browser", new [] {"Norton Secure Browser"}}
722721
};
723722

724723

DeviceDetector.NET/Parser/OperatingSystemParser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ public override ParseResult<OsMatchResult> Parse()
366366
version = string.Empty;
367367
}
368368

369-
if ("'org.lineageos.jelly" == ClientHints.GetApp() && "Lineage OS" != name)
369+
if ("org.lineageos.jelly" == ClientHints.GetApp() && "Lineage OS" != name)
370370
{
371371
name = "Lineage OS";
372372
family = "Android";

0 commit comments

Comments
 (0)