mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2024-12-23 22:56:25 +00:00
Made UserAgent configurable and docs
This commit is contained in:
parent
1cae73b1c1
commit
6763d3cccc
@ -52,6 +52,18 @@ _spotify = new SpotifyLocalAPI(new SpotifyLocalAPIConfig
|
||||
});
|
||||
```
|
||||
|
||||
it's also possible to change the current `UserAgent` string, which is needed if the library wasn't updated for some time. In this case, you should first make an unauthenticated call with `spotify.GetStatus()`, receive the current spotify version, and update the config afterwards:
|
||||
|
||||
```cs
|
||||
var config = new SpotifyLocalAPIConfig { Port = 4371, HostUrl = "https://127.0.0.1" });
|
||||
_spotify = new SpotifyLocalAPI(config);
|
||||
|
||||
var status = _spotify.GetStatus();
|
||||
config.UserAgent = status.ClientVersion;
|
||||
|
||||
// Now you should call auth stuff, like "_spotify.Connect()"
|
||||
```
|
||||
|
||||
## Proxy Settings
|
||||
|
||||
You can forward your proxy settings to the local api by using a field in the `SpotifyLocalAPIConfig`.
|
||||
|
@ -186,7 +186,7 @@ namespace SpotifyAPI.Local
|
||||
{
|
||||
Proxy = _config?.ProxyConfig?.CreateWebProxy()
|
||||
};
|
||||
wc.Headers.Add(HttpRequestHeader.UserAgent, "Spotify (1.0.85.257.g0f8531bd)");
|
||||
wc.Headers.Add(HttpRequestHeader.UserAgent, _config?.UserAgent);
|
||||
|
||||
return wc;
|
||||
}
|
||||
|
@ -10,5 +10,7 @@
|
||||
public int Port { get; set; } = 4381;
|
||||
|
||||
public ProxyConfig ProxyConfig { get; set; }
|
||||
|
||||
public string UserAgent { get; set; } = "Spotify (1.0.85.257.g0f8531bd)";
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user