mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-21 01:24:44 +01:00
add schedules direct error handling
This commit is contained in:
@@ -527,7 +527,7 @@ return null;
|
||||
|
||||
RegisterSingleInstance(FileSystemManager);
|
||||
|
||||
HttpClient = new HttpClientManager.HttpClientManager(ApplicationPaths, LogManager.GetLogger("HttpClient"), FileSystemManager, MemoryStreamFactory);
|
||||
HttpClient = new HttpClientManager.HttpClientManager(ApplicationPaths, LogManager.GetLogger("HttpClient"), FileSystemManager, MemoryStreamFactory, GetDefaultUserAgent);
|
||||
RegisterSingleInstance(HttpClient);
|
||||
|
||||
RegisterSingleInstance(NetworkManager);
|
||||
@@ -549,6 +549,30 @@ return null;
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
|
||||
private string GetDefaultUserAgent()
|
||||
{
|
||||
var name = FormatAttribute(Name);
|
||||
|
||||
return name + "/" + ApplicationVersion.ToString();
|
||||
}
|
||||
|
||||
private string FormatAttribute(string str)
|
||||
{
|
||||
var arr = str.ToCharArray();
|
||||
|
||||
arr = Array.FindAll<char>(arr, (c => (char.IsLetterOrDigit(c)
|
||||
|| char.IsWhiteSpace(c))));
|
||||
|
||||
var result = new string(arr);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(result))
|
||||
{
|
||||
result = "Emby";
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of types within an assembly
|
||||
/// This will handle situations that would normally throw an exception - such as a type within the assembly that depends on some other non-existant reference
|
||||
|
||||
Reference in New Issue
Block a user