we can actually store a token from a username and password login now, could be a good idea to store it more securely than the config file though..
This commit is contained in:
parent
db4165437d
commit
4cf87623e4
9 changed files with 10 additions and 10 deletions
Binary file not shown.
|
@ -254,11 +254,10 @@ namespace JellyfinRPC
|
|||
}
|
||||
|
||||
}
|
||||
private static ConfigForm configForm = new ConfigForm();
|
||||
public static async Task GetTokenFromUsernameAndPassword(string Username, string Password)
|
||||
{
|
||||
using var httpClient = new HttpClient();
|
||||
httpClient.DefaultRequestHeaders.Add("Authorization", $"MediaBrowser Client=\"JellyfinRPC {AssemblyVersion},\", Device=\"{System.Net.Dns.GetHostName()}\", DeviceId=\"{ConfigManager.GetEntry("DeviceID")}\", Version=\"running on {Environment.OSVersion}\"");
|
||||
httpClient.DefaultRequestHeaders.Add("Authorization", $"MediaBrowser Client=\"JellyfinRPC {AssemblyVersion}, \", Device=\"{System.Net.Dns.GetHostName()}\", DeviceId=\"{ConfigManager.GetEntry("DeviceID")}\", Version=\"running on {Environment.OSVersion}\"");
|
||||
if (ConfigManager.GetEntry("ServerURL") != "")
|
||||
{
|
||||
|
||||
|
@ -278,12 +277,14 @@ namespace JellyfinRPC
|
|||
response.EnsureSuccessStatusCode();
|
||||
|
||||
var jsonResponse = await response.Content.ReadAsStringAsync();
|
||||
|
||||
var jsonShit = JObject.Parse(jsonResponse);
|
||||
|
||||
var getThatToken = JArray.Parse(jsonResponse);
|
||||
|
||||
foreach (var item in getThatToken)
|
||||
string thatToken = jsonShit.Value<string>("AccessToken");
|
||||
|
||||
if (thatToken != null && thatToken != " ")
|
||||
{
|
||||
ConfigManager.SetEntry("JellyfinToken", item["AccessToken"].ToString());
|
||||
ConfigManager.SetEntry("JellyfinToken", thatToken);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,7 +1,10 @@
|
|||
C:\Users\random()\Documents\Visual Studio 2010\Projects\WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\discord_game_sdk.dll
|
||||
C:\Users\random()\Documents\Visual Studio 2010\Projects\WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\discord_game_sdk.dll.lib
|
||||
C:\Users\random()\Documents\Visual Studio 2010\Projects\WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\Jellyfin Rich Presence.exe.config
|
||||
C:\Users\random()\Documents\Visual Studio 2010\Projects\WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\Jellyfin Rich Presence.exe
|
||||
C:\Users\random()\Documents\Visual Studio 2010\Projects\WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\Jellyfin Rich Presence.pdb
|
||||
C:\Users\random()\Documents\Visual Studio 2010\Projects\WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\AsyncBridge.NET40.dll
|
||||
C:\Users\random()\Documents\Visual Studio 2010\Projects\WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\MakarovDev.ExpandCollapsePanel.dll
|
||||
C:\Users\random()\Documents\Visual Studio 2010\Projects\WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\Microsoft.Threading.Tasks.dll
|
||||
C:\Users\random()\Documents\Visual Studio 2010\Projects\WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\Microsoft.Threading.Tasks.Extensions.Desktop.dll
|
||||
C:\Users\random()\Documents\Visual Studio 2010\Projects\WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\Microsoft.Threading.Tasks.Extensions.dll
|
||||
|
@ -36,7 +39,3 @@ C:\Users\random()\Documents\Visual Studio 2010\Projects\WindowsFormsApplication2
|
|||
C:\Users\random()\Documents\Visual Studio 2010\Projects\WindowsFormsApplication2\WindowsFormsApplication2\obj\x86\Debug\JellyfinRPCGUI.csproj.CopyComplete
|
||||
C:\Users\random()\Documents\Visual Studio 2010\Projects\WindowsFormsApplication2\WindowsFormsApplication2\obj\x86\Debug\Jellyfin Rich Presence.exe
|
||||
C:\Users\random()\Documents\Visual Studio 2010\Projects\WindowsFormsApplication2\WindowsFormsApplication2\obj\x86\Debug\Jellyfin Rich Presence.pdb
|
||||
C:\Users\random()\Documents\Visual Studio 2010\Projects\WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\discord_game_sdk.dll
|
||||
C:\Users\random()\Documents\Visual Studio 2010\Projects\WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\discord_game_sdk.dll.lib
|
||||
C:\Users\random()\Documents\Visual Studio 2010\Projects\WindowsFormsApplication2\WindowsFormsApplication2\obj\x86\Debug\JellyfinRPCGUI.csproj.AssemblyReference.cache
|
||||
C:\Users\random()\Documents\Visual Studio 2010\Projects\WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\MakarovDev.ExpandCollapsePanel.dll
|
||||
|
|
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue