From 29fb7ae21d8f85f8544ff3a7736f11b975aae4f7 Mon Sep 17 00:00:00 2001 From: BEN ABT Date: Sun, 2 Mar 2025 15:41:33 +0100 Subject: [PATCH 1/4] add mycs ci (#60) * add mycs ci * add fix --- .github/workflows/ci.yml | 84 ++-------------------------------------- 1 file changed, 4 insertions(+), 80 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fb47763..8b5eda8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,84 +10,8 @@ on: release: types: [published] -env: - BuildConfig: Release - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true - jobs: - build: - runs-on: ubuntu-latest - steps: - - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 0 # avoid shallow clone so nbgv can do its work. - - - name: Setup .NET SDK - uses: actions/setup-dotnet@v4 - with: - global-json-file: ./global.json - - - name: Restore dependencies - run: dotnet restore - - - name: Setup Git Versioning - uses: dotnet/nbgv@master - id: nbgv - - - name: Show Version Info - run: | - echo 'SemVer2: ${{ steps.nbgv.outputs.SemVer2 }}' - - - name: Build with dotnet - run: dotnet build - --no-restore --configuration ${{ env.BuildConfig }} - /p:Version=${{ steps.nbgv.outputs.AssemblyVersion }} - - - name: Test with dotnet - run: dotnet test - --no-build --configuration ${{ env.BuildConfig }} - --logger "trx;LogFileName=test-results.trx" --results-directory ./artifacts/test-results - continue-on-error: true - - - name: Pack NuGet - run: dotnet pack - --configuration ${{ env.BuildConfig }} - --output ./artifacts/nuget-packages - /p:ContinuousIntegrationBuild=true - /p:Version=${{ steps.nbgv.outputs.NuGetPackageVersion }} - - - name: Upload Artifacts - uses: actions/upload-artifact@v4 - with: - name: artifacts - path: ./artifacts/**/* - - # the deploy job runs only when the build job is successful and the event is a release - deploy: - if: github.event_name == 'release' - name: Publish Package - needs: build - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 0 # avoid shallow clone so nbgv can do its work. - - - name: Download build artifacts - uses: actions/download-artifact@v4 - - - name: Upload release asset - run: gh release upload ${{ github.event.release.tag_name }} - ${{ github.workspace }}/artifacts/nuget-packages/*.*nupkg - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Publish package - run: dotnet nuget push - ${{github.workspace}}/artifacts/nuget-packages/*.nupkg - --source https://api.nuget.org/v3/index.json - --api-key ${{ secrets.NUGET_API_KEY }} - --skip-duplicate + build: + uses: mycsharp/github-actions/.github/workflows/dotnet-nuget-build.yml@main + with: + configuration: Release From 642abba52b8d0f197655d66d2fe55b5b7b5cf5e7 Mon Sep 17 00:00:00 2001 From: Makaopior <152356597+Makaopior@users.noreply.github.com> Date: Sun, 2 Mar 2025 23:42:21 +0900 Subject: [PATCH 2/4] Added InternetMeasurement bot User-Agent (#58) * Added CensysInspect bot User-Agent * Added InternetMeasurement bot User-Agent --------- Co-authored-by: Mazov Sergey --- src/MyCSharp.HttpUserAgentParser/HttpUserAgentStatics.cs | 3 ++- .../HttpUserAgentParserTests.cs | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/MyCSharp.HttpUserAgentParser/HttpUserAgentStatics.cs b/src/MyCSharp.HttpUserAgentParser/HttpUserAgentStatics.cs index d6e2753..7cb95d7 100644 --- a/src/MyCSharp.HttpUserAgentParser/HttpUserAgentStatics.cs +++ b/src/MyCSharp.HttpUserAgentParser/HttpUserAgentStatics.cs @@ -271,7 +271,8 @@ public static readonly (string Key, string Value)[] Robots = ( "seoscanners.net", "SEO Scanners"), ( "Sistrix", "Sistrix" ), ( "WhatsApp", "WhatsApp" ), - ( "CensysInspect", "CensysInspect" ) + ( "CensysInspect", "CensysInspect" ), + ( "InternetMeasurement", "InternetMeasurement" ) ]; /// diff --git a/tests/MyCSharp.HttpUserAgentParser.UnitTests/HttpUserAgentParserTests.cs b/tests/MyCSharp.HttpUserAgentParser.UnitTests/HttpUserAgentParserTests.cs index 72f17bb..73b0a39 100644 --- a/tests/MyCSharp.HttpUserAgentParser.UnitTests/HttpUserAgentParserTests.cs +++ b/tests/MyCSharp.HttpUserAgentParser.UnitTests/HttpUserAgentParserTests.cs @@ -147,6 +147,7 @@ public void BrowserTests(string ua, string name, string version, string platform [InlineData("Mozilla/5.0 (compatible; archive.org_bot +http://archive.org/details/archive.org_bot)", "archive.org")] [InlineData("Mozilla/5.0 (compatible; MojeekBot/0.11; +mojeek.com/bot.html)", "MojeekBot")] [InlineData("Mozilla/5.0 (compatible; CensysInspect/1.1; +https://about.censys.io/)", "CensysInspect")] + [InlineData("Mozilla/5.0 (compatible; InternetMeasurement/1.0; +https://internet-measurement.com/)", "InternetMeasurement")] public void BotTests(string ua, string name) { HttpUserAgentInformation uaInfo = HttpUserAgentInformation.Parse(ua); From eec72921bcc4b5c38352ae39ae0619c9fa11574c Mon Sep 17 00:00:00 2001 From: BEN ABT Date: Sun, 2 Mar 2025 15:48:37 +0100 Subject: [PATCH 3/4] add ChromeOS (#61) * add ChromeOS * add chrome os --- .../HttpUserAgentPlatformType.cs | 6 +++++- src/MyCSharp.HttpUserAgentParser/HttpUserAgentStatics.cs | 1 + .../HttpUserAgentParserTests.cs | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/MyCSharp.HttpUserAgentParser/HttpUserAgentPlatformType.cs b/src/MyCSharp.HttpUserAgentParser/HttpUserAgentPlatformType.cs index 42deba8..de57827 100644 --- a/src/MyCSharp.HttpUserAgentParser/HttpUserAgentPlatformType.cs +++ b/src/MyCSharp.HttpUserAgentParser/HttpUserAgentPlatformType.cs @@ -46,5 +46,9 @@ public enum HttpUserAgentPlatformType : byte /// /// Symbian /// - Symbian + Symbian, + /// + /// ChromeOS + /// + ChromeOS } diff --git a/src/MyCSharp.HttpUserAgentParser/HttpUserAgentStatics.cs b/src/MyCSharp.HttpUserAgentParser/HttpUserAgentStatics.cs index 7cb95d7..38339c2 100644 --- a/src/MyCSharp.HttpUserAgentParser/HttpUserAgentStatics.cs +++ b/src/MyCSharp.HttpUserAgentParser/HttpUserAgentStatics.cs @@ -47,6 +47,7 @@ public static class HttpUserAgentStatics new(CreateDefaultPlatformRegex("iphone"), "iOS", HttpUserAgentPlatformType.IOS), new(CreateDefaultPlatformRegex("ipad"), "iOS", HttpUserAgentPlatformType.IOS), new(CreateDefaultPlatformRegex("ipod"), "iOS", HttpUserAgentPlatformType.IOS), + new(CreateDefaultPlatformRegex("cros"), "ChromeOS", HttpUserAgentPlatformType.ChromeOS), new(CreateDefaultPlatformRegex("os x"), "Mac OS X", HttpUserAgentPlatformType.MacOS), new(CreateDefaultPlatformRegex("ppc mac"), "Power PC Mac", HttpUserAgentPlatformType.MacOS), new(CreateDefaultPlatformRegex("freebsd"), "FreeBSD", HttpUserAgentPlatformType.Linux), diff --git a/tests/MyCSharp.HttpUserAgentParser.UnitTests/HttpUserAgentParserTests.cs b/tests/MyCSharp.HttpUserAgentParser.UnitTests/HttpUserAgentParserTests.cs index 73b0a39..ffd2bf3 100644 --- a/tests/MyCSharp.HttpUserAgentParser.UnitTests/HttpUserAgentParserTests.cs +++ b/tests/MyCSharp.HttpUserAgentParser.UnitTests/HttpUserAgentParserTests.cs @@ -31,6 +31,7 @@ public class HttpUserAgentParserTests [InlineData("Mozilla/5.0 (Linux; Android 10) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.210 Mobile Safari/537.36", "Chrome", "90.0.4430.210", "Android", HttpUserAgentPlatformType.Android, "Android")] [InlineData("Mozilla/5.0 (Linux; Android 10; SM-A205U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.210 Mobile Safari/537.36", "Chrome", "90.0.4430.210", "Android", HttpUserAgentPlatformType.Android, "Android")] [InlineData("Mozilla/5.0 (Linux; Android 10; LM-Q720) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.210 Mobile Safari/537.36", "Chrome", "90.0.4430.210", "Android", HttpUserAgentPlatformType.Android, "Android")] + [InlineData("Mozilla/5.0 (X11; CrOS x86_64 15917.71.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.6533.132 Safari/537.36", "Chrome", "127.0.6533.132", "ChromeOS", HttpUserAgentPlatformType.ChromeOS, null)] // Safari [InlineData("Mozilla/5.0 (Windows; U; Windows NT 10.0; en-US) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/11.0 Safari/605.1.15", "Safari", "11.0", "Windows 10", HttpUserAgentPlatformType.Windows, null)] [InlineData("Mozilla/5.0 (Macintosh; Intel Mac OS X 11_3_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1 Safari/605.1.15", "Safari", "14.1", "Mac OS X", HttpUserAgentPlatformType.MacOS, null)] From bf6637cea65132b20be4cc27152549f40e1cfb96 Mon Sep 17 00:00:00 2001 From: BEN ABT Date: Sun, 2 Mar 2025 16:06:09 +0100 Subject: [PATCH 4/4] add secret map (#62) --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8b5eda8..15b9090 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,3 +15,5 @@ jobs: uses: mycsharp/github-actions/.github/workflows/dotnet-nuget-build.yml@main with: configuration: Release + secrets: + NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}