mirror of
https://github.com/SK-la/Ez2Lazer.git
synced 2026-03-13 11:20:28 +00:00
1. 匹配新版按钮控件的自动宽度写法 2. 统一Ez日志写入方向 3.移除历史修改:缓存启用mod列表,切换mod时保持通用mod开启状态 4.代码格式化、 5.修改文件名称表意,更直观
45 lines
1.7 KiB
C#
45 lines
1.7 KiB
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;
|
|
using osu.Game.LAsEzExtensions.Analysis;
|
|
using osu.Game.LAsEzExtensions.Configuration;
|
|
using osu.Game.LAsEzExtensions.Online;
|
|
|
|
namespace osu.Game.Online
|
|
{
|
|
public sealed class TrustedDomainOnlineStore : OnlineStore
|
|
{
|
|
protected override string GetLookupUrl(string url)
|
|
{
|
|
ServerPreset customApiUrl = GlobalConfigStore.EzConfig.Get<ServerPreset>(Ez2Setting.ServerPreset);
|
|
|
|
switch (customApiUrl)
|
|
{
|
|
case ServerPreset.Manual:
|
|
case ServerPreset.Gu:
|
|
#if DEBUG
|
|
// 任何从服务器获取资源的事件都会引发这个日志输出
|
|
if (!Uri.TryCreate(url, UriKind.Absolute, out Uri? uri1) || !uri1.Host.EndsWith(@".ppy.sh", StringComparison.OrdinalIgnoreCase))
|
|
{
|
|
Logger.Log($@"[Ez2Lazer] Using Custom ApiUrl {url}", Ez2ConfigManager.LOGGER_NAME, LogLevel.Important);
|
|
}
|
|
#endif
|
|
|
|
return url;
|
|
|
|
default:
|
|
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;
|
|
}
|
|
}
|
|
}
|
|
}
|