mirror of
https://github.com/ppy/osu.git
synced 2024-11-14 14:27:25 +08:00
Bypass external link dialog for links on the trusted osu! domain
This commit is contained in:
parent
87a331fdde
commit
ed64bfff8d
@ -485,10 +485,19 @@ namespace osu.Game
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
public void OpenUrlExternally(string url, bool bypassExternalUrlWarning = false) => waitForReady(() => externalLinkOpener, _ =>
|
public void OpenUrlExternally(string url, bool forceBypassExternalUrlWarning = false) => waitForReady(() => externalLinkOpener, _ =>
|
||||||
{
|
{
|
||||||
|
bool isTrustedDomain;
|
||||||
|
|
||||||
if (url.StartsWith('/'))
|
if (url.StartsWith('/'))
|
||||||
url = $"{API.APIEndpointUrl}{url}";
|
{
|
||||||
|
url = $"{API.WebsiteRootUrl}{url}";
|
||||||
|
isTrustedDomain = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
isTrustedDomain = url.StartsWith(API.APIEndpointUrl, StringComparison.Ordinal);
|
||||||
|
}
|
||||||
|
|
||||||
if (!url.CheckIsValidUrl())
|
if (!url.CheckIsValidUrl())
|
||||||
{
|
{
|
||||||
@ -500,7 +509,7 @@ namespace osu.Game
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
externalLinkOpener.OpenUrlExternally(url, bypassExternalUrlWarning);
|
externalLinkOpener.OpenUrlExternally(url, forceBypassExternalUrlWarning || isTrustedDomain);
|
||||||
});
|
});
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user