1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-30 06:12:58 +08:00
osu-lazer/osu.Game/Online/OsuOnlineStore.cs
Salman Alshamrani 9a4c419c56 Remove unnecessary usage of link proxying in OsuOnlineStore
Links are checked to be in the ppy.sh domain here.
2024-11-30 22:37:50 -05:00

32 lines
1004 B
C#

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.IO.Stores;
using osu.Framework.Logging;
namespace osu.Game.Online
{
public class OsuOnlineStore : OnlineStore
{
private readonly string apiEndpointUrl;
public OsuOnlineStore(string apiEndpointUrl)
{
this.apiEndpointUrl = apiEndpointUrl;
}
protected override string GetLookupUrl(string url)
{
// add leading dot to avoid matching hosts named "<anything>ppy.sh"
if (!Uri.TryCreate(url, UriKind.Absolute, out Uri? uri) || !uri.Host.EndsWith(@".ppy.sh", StringComparison.OrdinalIgnoreCase))
{
Logger.Log($@"Blocking resource lookup from external website: {url}", LoggingTarget.Network, LogLevel.Important);
return string.Empty;
}
return url;
}
}
}