aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver/projectstore/httpprojectstore.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2023-06-16 17:02:23 +0200
committerGitHub <[email protected]>2023-06-16 17:02:23 +0200
commit86418ed57c677ffc8ce314acfcf9b9f1eab3586b (patch)
treed197ea40f2e8255338c806a27e82ae289a33bf68 /src/zenserver/projectstore/httpprojectstore.cpp
parentadded ZenServerInstance::SpawnServerAndWait (#334) (diff)
downloadzen-86418ed57c677ffc8ce314acfcf9b9f1eab3586b.tar.xz
zen-86418ed57c677ffc8ce314acfcf9b9f1eab3586b.zip
file share support (#328)
this change adds a serve command to the zen CLI. This can be used to establish links to a set of files which may be served to clients via the project store interface: ```cmd> zen serve Lyra/WindowsClient d:\temp_share\StagedBuilds\WindowsClient``` with the appropriate changes in UE you may then start an instance of the runtime and have it load all files via the remote file connection: ``` Lyra\Binaries\LyraClient.exe ../../../Lyra/Lyra.uproject -pak -basedir=D:\temp_share\StagedBuilds\WindowsClient/Lyra/Binaries/Win64 -Mount=Lyra/WindowsClient ```
Diffstat (limited to 'src/zenserver/projectstore/httpprojectstore.cpp')
-rw-r--r--src/zenserver/projectstore/httpprojectstore.cpp39
1 files changed, 24 insertions, 15 deletions
diff --git a/src/zenserver/projectstore/httpprojectstore.cpp b/src/zenserver/projectstore/httpprojectstore.cpp
index b0efb6bec..185f2783d 100644
--- a/src/zenserver/projectstore/httpprojectstore.cpp
+++ b/src/zenserver/projectstore/httpprojectstore.cpp
@@ -758,14 +758,23 @@ HttpProjectService::HttpProjectService(CidStore& Store, ProjectStore* Projects,
if (!legacy::TryLoadCbPackage(Package, Payload, &UniqueBuffer::Alloc, &Resolver))
{
- std::filesystem::path BadPackagePath =
- Oplog.TempPath() / "bad_packages"sv / fmt::format("session{}_request{}"sv, HttpReq.SessionId(), HttpReq.RequestId());
+ if (CbObject Core = LoadCompactBinaryObject(Payload))
+ {
+ Package.SetObject(Core);
+ }
+ else
+ {
+ std::filesystem::path BadPackagePath = Oplog.TempPath() / "bad_packages"sv /
+ fmt::format("session{}_request{}"sv, HttpReq.SessionId(), HttpReq.RequestId());
- ZEN_WARN("Received malformed package! Saving payload to '{}'", BadPackagePath);
+ ZEN_WARN("Received malformed package! Saving payload to '{}'", BadPackagePath);
- WriteFile(BadPackagePath, Payload);
+ WriteFile(BadPackagePath, Payload);
- return HttpReq.WriteResponse(HttpResponseCode::BadRequest, HttpContentType::kText, "Invalid package");
+ return HttpReq.WriteResponse(HttpResponseCode::BadRequest,
+ HttpContentType::kText,
+ u8"request body must be a compact binary object or package in legacy format");
+ }
}
if (!IsValid)
@@ -1056,20 +1065,20 @@ HttpProjectService::HttpProjectService(CidStore& Store, ProjectStore* Projects,
return HttpReq.WriteResponse(HttpResponseCode::InsufficientStorage);
}
- IoBuffer Payload = HttpReq.ReadPayload();
- CbObject Params = LoadCompactBinaryObject(Payload);
- std::string_view Id = Params["id"sv].AsString();
- std::string_view Root = Params["root"sv].AsString();
- std::string_view EngineRoot = Params["engine"sv].AsString();
- std::string_view ProjectRoot = Params["project"sv].AsString();
- std::string_view ProjectFilePath = Params["projectfile"sv].AsString();
+ IoBuffer Payload = HttpReq.ReadPayload();
+ CbObject Params = LoadCompactBinaryObject(Payload);
+ std::string_view Root = Params["root"sv].AsString(); // Workspace root (i.e `D:/UE5/`)
+ std::string_view EngineRoot = Params["engine"sv].AsString(); // Engine root (i.e `D:/UE5/Engine`)
+ std::string_view ProjectRoot =
+ Params["project"sv].AsString(); // Project root directory (i.e `D:/UE5/Samples/Games/Lyra`)
+ std::string_view ProjectFilePath =
+ Params["projectfile"sv].AsString(); // Project file path (i.e `D:/UE5/Samples/Games/Lyra/Lyra.uproject`)
const std::filesystem::path BasePath = m_ProjectStore->BasePath() / ProjectId;
m_ProjectStore->NewProject(BasePath, ProjectId, Root, EngineRoot, ProjectRoot, ProjectFilePath);
- ZEN_INFO("established project - {} (id: '{}', roots: '{}', '{}', '{}', '{}'{})",
+ ZEN_INFO("established project (id: '{}', roots: '{}', '{}', '{}', '{}'{})",
ProjectId,
- Id,
Root,
EngineRoot,
ProjectRoot,
@@ -1496,4 +1505,4 @@ HttpProjectService::HandleStatsRequest(HttpServerRequest& HttpReq)
return HttpReq.WriteResponse(HttpResponseCode::OK, Cbo.Save());
}
-} // namespace zen \ No newline at end of file
+} // namespace zen