Update temporary collection creation.

This commit is contained in:
Ottermandias 2025-08-25 10:13:31 +02:00
parent 1e07e43498
commit a14347f73a
4 changed files with 21 additions and 4 deletions

@ -1 +1 @@
Subproject commit 297941bc22300f4a8368f4d0177f62943eb69727 Subproject commit af41b1787acef9df7dc83619fe81e63a36443ee5

View file

@ -0,0 +1,7 @@
namespace Penumbra.Api.Api;
public static class IdentityChecker
{
public static bool Check(string identity)
=> true;
}

View file

@ -20,8 +20,16 @@ public class TemporaryApi(
ApiHelpers apiHelpers, ApiHelpers apiHelpers,
ModManager modManager) : IPenumbraApiTemporary, IApiService ModManager modManager) : IPenumbraApiTemporary, IApiService
{ {
public Guid CreateTemporaryCollection(string name) public (PenumbraApiEc, Guid) CreateTemporaryCollection(string identity, string name)
=> tempCollections.CreateTemporaryCollection(name); {
if (!IdentityChecker.Check(identity))
return (PenumbraApiEc.InvalidCredentials, Guid.Empty);
var collection = tempCollections.CreateTemporaryCollection(name);
if (collection == Guid.Empty)
return (PenumbraApiEc.UnknownError, collection);
return (PenumbraApiEc.Success, collection);
}
public PenumbraApiEc DeleteTemporaryCollection(Guid collectionId) public PenumbraApiEc DeleteTemporaryCollection(Guid collectionId)
=> tempCollections.RemoveTemporaryCollection(collectionId) => tempCollections.RemoveTemporaryCollection(collectionId)

View file

@ -38,6 +38,7 @@ public class TemporaryIpcTester(
private string _tempGamePath = "test/game/path.mtrl"; private string _tempGamePath = "test/game/path.mtrl";
private string _tempFilePath = "test/success.mtrl"; private string _tempFilePath = "test/success.mtrl";
private string _tempManipulation = string.Empty; private string _tempManipulation = string.Empty;
private string _identity = string.Empty;
private PenumbraApiEc _lastTempError; private PenumbraApiEc _lastTempError;
private int _tempActorIndex; private int _tempActorIndex;
private bool _forceOverwrite; private bool _forceOverwrite;
@ -48,6 +49,7 @@ public class TemporaryIpcTester(
if (!_) if (!_)
return; return;
ImGui.InputTextWithHint("##identity", "Identity...", ref _identity, 128);
ImGui.InputTextWithHint("##tempCollection", "Collection Name...", ref _tempCollectionName, 128); ImGui.InputTextWithHint("##tempCollection", "Collection Name...", ref _tempCollectionName, 128);
ImGuiUtil.GuidInput("##guid", "Collection GUID...", string.Empty, ref _tempGuid, ref _tempCollectionGuidName); ImGuiUtil.GuidInput("##guid", "Collection GUID...", string.Empty, ref _tempGuid, ref _tempCollectionGuidName);
ImGui.InputInt("##tempActorIndex", ref _tempActorIndex, 0, 0); ImGui.InputInt("##tempActorIndex", ref _tempActorIndex, 0, 0);
@ -73,7 +75,7 @@ public class TemporaryIpcTester(
IpcTester.DrawIntro(CreateTemporaryCollection.Label, "Create Temporary Collection"); IpcTester.DrawIntro(CreateTemporaryCollection.Label, "Create Temporary Collection");
if (ImGui.Button("Create##Collection")) if (ImGui.Button("Create##Collection"))
{ {
LastCreatedCollectionId = new CreateTemporaryCollection(pi).Invoke(_tempCollectionName); _lastTempError = new CreateTemporaryCollection(pi).Invoke(_identity, _tempCollectionName, out LastCreatedCollectionId);
if (_tempGuid == null) if (_tempGuid == null)
{ {
_tempGuid = LastCreatedCollectionId; _tempGuid = LastCreatedCollectionId;