Add website root URL and update most links to use it

For what it's worth, I intentionally didn't include news / changelog /
supporter, because these should never change.
This commit is contained in:
Dean Herbert
2020-12-24 18:11:40 +09:00
parent eb795a2127
commit 323da82477
15 changed files with 57 additions and 24 deletions

View File

@ -28,7 +28,9 @@ namespace osu.Game.Online.API
private readonly Queue<APIRequest> queue = new Queue<APIRequest>();
public string Endpoint { get; }
public string APIEndpointUrl { get; }
public string WebsiteRootUrl { get; }
/// <summary>
/// The username/email provided by the user when initiating a login.
@ -57,9 +59,10 @@ namespace osu.Game.Online.API
{
this.config = config;
Endpoint = endpointConfiguration.APIEndpoint;
APIEndpointUrl = endpointConfiguration.APIEndpointUrl;
WebsiteRootUrl = endpointConfiguration.WebsiteRootUrl;
authentication = new OAuth(endpointConfiguration.APIClientID, endpointConfiguration.APIClientSecret, Endpoint);
authentication = new OAuth(endpointConfiguration.APIClientID, endpointConfiguration.APIClientSecret, APIEndpointUrl);
log = Logger.GetLogger(LoggingTarget.Network);
ProvidedUsername = config.Get<string>(OsuSetting.Username);
@ -245,7 +248,7 @@ namespace osu.Game.Online.API
var req = new RegistrationRequest
{
Url = $@"{Endpoint}/users",
Url = $@"{APIEndpointUrl}/users",
Method = HttpMethod.Post,
Username = username,
Email = email,

View File

@ -57,7 +57,7 @@ namespace osu.Game.Online.API
protected virtual WebRequest CreateWebRequest() => new OsuWebRequest(Uri);
protected virtual string Uri => $@"{API.Endpoint}/api/v2/{Target}";
protected virtual string Uri => $@"{API.APIEndpointUrl}/api/v2/{Target}";
protected APIAccess API;
protected WebRequest WebRequest;

View File

@ -28,7 +28,9 @@ namespace osu.Game.Online.API
public string ProvidedUsername => LocalUser.Value.Username;
public string Endpoint => "http://localhost";
public string APIEndpointUrl => "http://localhost";
public string WebsiteRootUrl => "http://localhost";
/// <summary>
/// Provide handling logic for an arbitrary API request.

View File

@ -46,7 +46,12 @@ namespace osu.Game.Online.API
/// <summary>
/// The URL endpoint for this API. Does not include a trailing slash.
/// </summary>
string Endpoint { get; }
string APIEndpointUrl { get; }
/// <summary>
/// The root URL of of the website, excluding the trailing slash.
/// </summary>
public string WebsiteRootUrl { get; }
/// <summary>
/// The current connection state of the API.