Skip to content

Commit 8ec65a5

Browse files
committed
Proper cloud auth impl
1 parent 9a0d98f commit 8ec65a5

File tree

7 files changed

+14
-31
lines changed

7 files changed

+14
-31
lines changed

api/AltV.Net.Async/Elements/Entities/AsyncConnectionInfo.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Threading.Tasks;
23
using AltV.Net.Elements.Entities;
34

45
namespace AltV.Net.Async.Elements.Entities;
@@ -216,7 +217,7 @@ public Task<string> RequestCloudId()
216217
lock (ConnectionInfo)
217218
{
218219
if (!AsyncContext.CheckIfExistsNullable(ConnectionInfo)) return Task.FromResult<string>(default);
219-
return Task.FromResult(ConnectionInfo.RequestCloudId().Result);
220+
return ConnectionInfo.RequestCloudId();
220221
}
221222
}
222223

api/AltV.Net.Async/Elements/Entities/AsyncPlayer.cs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,18 +1281,6 @@ public string SocialClubName
12811281
}
12821282
}
12831283

1284-
public string CloudAuthHash
1285-
{
1286-
get
1287-
{
1288-
lock (Player)
1289-
{
1290-
if (!AsyncContext.CheckIfExistsOrCachedNullable(Player)) return default;
1291-
return Player.CloudAuthHash;
1292-
}
1293-
}
1294-
}
1295-
12961284
public void SetAmmo(uint ammoHash, ushort ammo)
12971285
{
12981286
lock (Player)
@@ -1469,7 +1457,7 @@ public Task<string> RequestCloudId()
14691457
lock (Player)
14701458
{
14711459
if (!AsyncContext.CheckIfExistsNullable(Player)) return Task.FromResult<string>(default);
1472-
return Task.FromResult(Player.RequestCloudId().Result);
1460+
return Player.RequestCloudId();
14731461
}
14741462
}
14751463

api/AltV.Net.Mock/MockConnectionInfo.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Threading.Tasks;
23
using AltV.Net.Elements.Args;
34
using AltV.Net.Elements.Entities;
45
using AltV.Net.Shared.Elements.Entities;
@@ -26,7 +27,6 @@ public MockConnectionInfo(ICore core, IntPtr nativePointer, uint id) : base(core
2627
public string Ip { get; }
2728
public long DiscordUserId { get; }
2829
public string SocialName { get; }
29-
public string CloudAuthHash { get; }
3030
public string Text { get; set; }
3131
public bool IsAccepted { get; }
3232

@@ -39,5 +39,10 @@ public void Decline(string reason)
3939
{
4040
throw new NotImplementedException();
4141
}
42+
43+
public Task<string> RequestCloudId()
44+
{
45+
throw new NotImplementedException();
46+
}
4247
}
4348
}

api/AltV.Net/Elements/Entities/ConnectionInfo.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
using System;
22
using System.Runtime.InteropServices;
3+
using System.Threading;
4+
using System.Threading.Tasks;
5+
using AltV.Net.CApi.ServerEvents;
36
using AltV.Net.Native;
47

58
namespace AltV.Net.Elements.Entities;

api/AltV.Net/Elements/Entities/IConnectionInfo.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Threading.Tasks;
23
using AltV.Net.Elements.Entities;
34

45
namespace AltV.Net.Elements.Entities;

api/AltV.Net/Elements/Entities/IPlayer.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,6 @@ void PlayAnimation(string animDict, string animName, float blendInSpeed, float b
434434
void ClearTasks();
435435

436436
string SocialClubName { get; }
437-
string CloudAuthHash { get; }
438437
void SetAmmo(uint ammoHash, ushort ammo);
439438
ushort GetAmmo(uint ammoHash);
440439
void SetWeaponAmmo(uint weaponHash, ushort ammo);

api/AltV.Net/Elements/Entities/Player.cs

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -192,21 +192,7 @@ public string SocialClubName
192192
}
193193
}
194194
}
195-
196-
public string CloudAuthHash
197-
{
198-
get
199-
{
200-
unsafe
201-
{
202-
CheckIfEntityExistsOrCached();
203-
var size = 0;
204-
return Core.PtrToStringUtf8AndFree(
205-
Core.Library.Server.Player_GetCloudAuthHash(PlayerNativePointer, &size), size);
206-
}
207-
}
208-
}
209-
195+
210196
public void SetAmmo(uint ammoHash, ushort ammo)
211197
{
212198
unsafe

0 commit comments

Comments
 (0)