Files
SPT-Server-Build/Libraries/SPTarkov.Server.Core/Callbacks/BundleCallbacks.cs
T
Jesse fc7660b6c8 Slight bundle & fileutil refactor: (#524)
- Actually load the bundle cache file now
- Don't read file as string with StreamReader, instead read with ReadAllTextAsync
- Slight refactor to bundle hashing

Co-authored-by: Chomp <27521899+chompDev@users.noreply.github.com>
2025-07-30 22:23:29 +00:00

32 lines
1.0 KiB
C#

using SPTarkov.DI.Annotations;
using SPTarkov.Server.Core.Loaders;
using SPTarkov.Server.Core.Models.Common;
using SPTarkov.Server.Core.Models.Eft.Common;
using SPTarkov.Server.Core.Routers.Serializers;
using SPTarkov.Server.Core.Utils;
namespace SPTarkov.Server.Core.Callbacks;
[Injectable]
public class BundleCallbacks(HttpResponseUtil httpResponseUtil, BundleLoader bundleLoader)
{
/// <summary>
/// Handle singleplayer/bundles
/// </summary>
/// <returns></returns>
public ValueTask<string> GetBundles(string url, EmptyRequestData _, MongoId sessionID)
{
return new ValueTask<string>(httpResponseUtil.NoBody(bundleLoader.GetBundles()));
}
/// <summary>
/// Handle requests to /files/bundle <br/>
/// <br/>
/// Makes sure the output is set to BUNDLE so that the BundleSerializer's <see cref="BundleSerializer.CanHandle"/> can handle it.
/// </summary>
public ValueTask<string> GetBundle(string url, object info, MongoId sessionID)
{
return new ValueTask<string>("BUNDLE");
}
}