mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-19 14:53:50 +02:00
Fix uploading world images
This commit is contained in:
33
Dotnet/AppApi/Cef/ImageUploading.cs
Normal file
33
Dotnet/AppApi/Cef/ImageUploading.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
using librsync.net;
|
||||
|
||||
namespace VRCX;
|
||||
|
||||
public partial class AppApi
|
||||
{
|
||||
public string MD5File(string blob)
|
||||
{
|
||||
var fileData = Convert.FromBase64CharArray(blob.ToCharArray(), 0, blob.Length);
|
||||
using var md5 = MD5.Create();
|
||||
var md5Hash = md5.ComputeHash(fileData);
|
||||
return Convert.ToBase64String(md5Hash);
|
||||
}
|
||||
|
||||
public string SignFile(string blob)
|
||||
{
|
||||
var fileData = Convert.FromBase64String(blob);
|
||||
using var sig = Librsync.ComputeSignature(new MemoryStream(fileData));
|
||||
using var memoryStream = new MemoryStream();
|
||||
sig.CopyTo(memoryStream);
|
||||
var sigBytes = memoryStream.ToArray();
|
||||
return Convert.ToBase64String(sigBytes);
|
||||
}
|
||||
|
||||
public string FileLength(string blob)
|
||||
{
|
||||
var fileData = Convert.FromBase64String(blob);
|
||||
return fileData.Length.ToString();
|
||||
}
|
||||
}
|
||||
@@ -28,14 +28,6 @@ namespace VRCX
|
||||
}
|
||||
};
|
||||
|
||||
public string MD5File(string blob)
|
||||
{
|
||||
var fileData = Convert.FromBase64CharArray(blob.ToCharArray(), 0, blob.Length);
|
||||
using var md5 = MD5.Create();
|
||||
var md5Hash = md5.ComputeHash(fileData);
|
||||
return Convert.ToBase64String(md5Hash);
|
||||
}
|
||||
|
||||
public int GetColourFromUserID(string userId)
|
||||
{
|
||||
var hash = _hasher.ComputeHash(Encoding.UTF8.GetBytes(userId));
|
||||
|
||||
@@ -61,6 +61,14 @@
|
||||
<EmbeddedResource Remove="DBMerger\**" />
|
||||
<None Remove="DBMerger\**" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Blake2Sharp">
|
||||
<HintPath>libs\Blake2Sharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="librsync.net">
|
||||
<HintPath>libs\librsync.net.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.manifest" />
|
||||
<None Include="..\Version">
|
||||
|
||||
BIN
Dotnet/libs/Blake2Sharp.dll
Normal file
BIN
Dotnet/libs/Blake2Sharp.dll
Normal file
Binary file not shown.
@@ -1,3 +1,11 @@
|
||||
### librsync.net.dll
|
||||
|
||||
- [https://github.com/braddodson/librsync.net](https://github.com/braddodson/librsync.net)
|
||||
|
||||
### Blake2Sharp.dll
|
||||
|
||||
- [https://github.com/BLAKE2/BLAKE2/tree/master/csharp](https://github.com/BLAKE2/BLAKE2/tree/master/csharp)
|
||||
|
||||
### openvr_api.dll
|
||||
|
||||
- [https://github.com/ValveSoftware/openvr](https://github.com/ValveSoftware/openvr)
|
||||
|
||||
BIN
Dotnet/libs/librsync.net.dll
Normal file
BIN
Dotnet/libs/librsync.net.dll
Normal file
Binary file not shown.
Reference in New Issue
Block a user