mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-18 21:34:28 -04:00
Create anonymous hash to detect issue duplication
This commit is contained in:
@@ -0,0 +1,21 @@
|
|||||||
|
using FluentAssertions;
|
||||||
|
using NUnit.Framework;
|
||||||
|
|
||||||
|
namespace NzbDrone.Common.Test
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class HashUtilFixture
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void should_create_anon_id()
|
||||||
|
{
|
||||||
|
HashUtil.AnonymousToken().Should().NotBeNullOrEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_create_the_same_id()
|
||||||
|
{
|
||||||
|
HashUtil.AnonymousToken().Should().Be(HashUtil.AnonymousToken());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -84,6 +84,7 @@
|
|||||||
<Compile Include="ExtensionTests\IEnumerableExtensionTests\ExceptByFixture.cs" />
|
<Compile Include="ExtensionTests\IEnumerableExtensionTests\ExceptByFixture.cs" />
|
||||||
<Compile Include="ExtensionTests\IEnumerableExtensionTests\IntersectByFixture.cs" />
|
<Compile Include="ExtensionTests\IEnumerableExtensionTests\IntersectByFixture.cs" />
|
||||||
<Compile Include="ExtensionTests\Int64ExtensionFixture.cs" />
|
<Compile Include="ExtensionTests\Int64ExtensionFixture.cs" />
|
||||||
|
<Compile Include="HashUtilFixture.cs" />
|
||||||
<Compile Include="Http\HttpClientFixture.cs" />
|
<Compile Include="Http\HttpClientFixture.cs" />
|
||||||
<Compile Include="Http\HttpHeaderFixture.cs" />
|
<Compile Include="Http\HttpHeaderFixture.cs" />
|
||||||
<Compile Include="Http\HttpRequestBuilderFixture.cs" />
|
<Compile Include="Http\HttpRequestBuilderFixture.cs" />
|
||||||
|
|||||||
@@ -24,7 +24,13 @@ namespace NzbDrone.Common
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return string.Format("{0:x8}", mCrc);
|
return $"{mCrc:x8}";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string AnonymousToken()
|
||||||
|
{
|
||||||
|
var seed = $"{Environment.ProcessorCount}_{Environment.OSVersion.Platform}_{Environment.MachineName}_{Environment.UserName}";
|
||||||
|
return HashUtil.CalculateCrc(seed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
using System;
|
|
||||||
using SharpRaven.Data;
|
using SharpRaven.Data;
|
||||||
|
|
||||||
namespace NzbDrone.Common.Instrumentation.Sentry
|
namespace NzbDrone.Common.Instrumentation.Sentry
|
||||||
@@ -7,7 +6,7 @@ namespace NzbDrone.Common.Instrumentation.Sentry
|
|||||||
{
|
{
|
||||||
public SentryUser Create()
|
public SentryUser Create()
|
||||||
{
|
{
|
||||||
return new SentryUser(Environment.MachineName);
|
return new SentryUser(HashUtil.AnonymousToken());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user