mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 06:52:55 +08:00
Merge pull request #28892 from bdach/better-client-identifier
Send client-generated session GUID for identification purposes
This commit is contained in:
commit
99c5025de8
@ -164,6 +164,8 @@ namespace osu.Game.Online.API
|
||||
|
||||
public string AccessToken => authentication.RequestAccessToken();
|
||||
|
||||
public Guid SessionIdentifier { get; } = Guid.NewGuid();
|
||||
|
||||
/// <summary>
|
||||
/// Number of consecutive requests which failed due to network issues.
|
||||
/// </summary>
|
||||
|
@ -39,6 +39,8 @@ namespace osu.Game.Online.API
|
||||
|
||||
public string AccessToken => "token";
|
||||
|
||||
public Guid SessionIdentifier { get; } = Guid.NewGuid();
|
||||
|
||||
/// <seealso cref="APIAccess.IsLoggedIn"/>
|
||||
public bool IsLoggedIn => State.Value > APIState.Offline;
|
||||
|
||||
|
@ -44,6 +44,12 @@ namespace osu.Game.Online.API
|
||||
/// </summary>
|
||||
string AccessToken { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Used as an identifier of a single local lazer session.
|
||||
/// Sent across the wire for the purposes of concurrency control to spectator server.
|
||||
/// </summary>
|
||||
Guid SessionIdentifier { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns whether the local user is logged in.
|
||||
/// </summary>
|
||||
|
@ -19,6 +19,9 @@ namespace osu.Game.Online
|
||||
{
|
||||
public const string SERVER_SHUTDOWN_MESSAGE = "Server is shutting down.";
|
||||
|
||||
public const string VERSION_HASH_HEADER = @"X-Osu-Version-Hash";
|
||||
public const string CLIENT_SESSION_ID_HEADER = @"X-Client-Session-ID";
|
||||
|
||||
/// <summary>
|
||||
/// Invoked whenever a new hub connection is built, to configure it before it's started.
|
||||
/// </summary>
|
||||
@ -68,8 +71,11 @@ namespace osu.Game.Online
|
||||
options.Proxy.Credentials = CredentialCache.DefaultCredentials;
|
||||
}
|
||||
|
||||
options.Headers.Add("Authorization", $"Bearer {API.AccessToken}");
|
||||
options.Headers.Add("OsuVersionHash", versionHash);
|
||||
options.Headers.Add(@"Authorization", @$"Bearer {API.AccessToken}");
|
||||
// non-standard header name kept for backwards compatibility, can be removed after server side has migrated to `VERSION_HASH_HEADER`
|
||||
options.Headers.Add(@"OsuVersionHash", versionHash);
|
||||
options.Headers.Add(VERSION_HASH_HEADER, versionHash);
|
||||
options.Headers.Add(CLIENT_SESSION_ID_HEADER, API.SessionIdentifier.ToString());
|
||||
});
|
||||
|
||||
if (RuntimeFeature.IsDynamicCodeCompiled && preferMessagePack)
|
||||
|
Loading…
Reference in New Issue
Block a user