1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-18 05:42:56 +08:00

Enable sentry caching to avoid sentry writing outside of game directory

See https://github.com/ppy/osu/discussions/31412. Probably safe enough.
This commit is contained in:
Dean Herbert 2025-01-04 14:27:48 +09:00
parent 614243fef4
commit 0b21f49223
No known key found for this signature in database
2 changed files with 9 additions and 3 deletions

View File

@ -231,8 +231,6 @@ namespace osu.Game
forwardGeneralLogsToNotifications();
forwardTabletLogsToNotifications();
SentryLogger = new SentryLogger(this);
}
#region IOverlayManager
@ -318,6 +316,12 @@ namespace osu.Game
private readonly List<string> dragDropFiles = new List<string>();
private ScheduledDelegate dragDropImportSchedule;
public override void SetupLogging(Storage gameStorage, Storage cacheStorage)
{
base.SetupLogging(gameStorage, cacheStorage);
SentryLogger = new SentryLogger(this, cacheStorage);
}
public override void SetHost(GameHost host)
{
base.SetHost(host);

View File

@ -11,6 +11,7 @@ using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Configuration;
using osu.Framework.Logging;
using osu.Framework.Platform;
using osu.Framework.Statistics;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
@ -36,7 +37,7 @@ namespace osu.Game.Utils
private readonly OsuGame game;
public SentryLogger(OsuGame game)
public SentryLogger(OsuGame game, Storage? storage = null)
{
this.game = game;
@ -49,6 +50,7 @@ namespace osu.Game.Utils
options.AutoSessionTracking = true;
options.IsEnvironmentUser = false;
options.IsGlobalModeEnabled = true;
options.CacheDirectoryPath = storage?.GetFullPath(string.Empty);
// The reported release needs to match version as reported to Sentry in .github/workflows/sentry-release.yml
options.Release = $"osu@{game.Version.Replace($@"-{OsuGameBase.BUILD_SUFFIX}", string.Empty)}";
});