mirror of
https://github.com/C9Glax/tranga.git
synced 2025-07-02 00:44:16 +02:00
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Runtime.InteropServices;
|
||||
using Newtonsoft.Json;
|
||||
using Tranga.LibraryConnectors;
|
||||
using Tranga.NotificationConnectors;
|
||||
@ -12,7 +13,7 @@ public class TrangaSettings
|
||||
public string workingDirectory { get; private set; }
|
||||
public int apiPortNumber { get; init; }
|
||||
public string styleSheet { get; private set; }
|
||||
public string? customUserAgent { get; set; } = null;
|
||||
public ProductInfoHeaderValue userAgent { get; set; } = new ("Tranga", "1.0");
|
||||
[JsonIgnore] public string settingsFilePath => Path.Join(workingDirectory, "settings.json");
|
||||
[JsonIgnore] public string libraryConnectorsFilePath => Path.Join(workingDirectory, "libraryConnectors.json");
|
||||
[JsonIgnore] public string notificationConnectorsFilePath => Path.Join(workingDirectory, "notificationConnectors.json");
|
||||
@ -120,6 +121,11 @@ public class TrangaSettings
|
||||
ExportSettings();
|
||||
}
|
||||
|
||||
public void UpdateUserAgent(string customUserAgent)
|
||||
{
|
||||
this.userAgent = new ProductInfoHeaderValue(ProductHeaderValue.Parse(customUserAgent));
|
||||
}
|
||||
|
||||
public void ExportSettings()
|
||||
{
|
||||
if (File.Exists(settingsFilePath))
|
||||
|
Reference in New Issue
Block a user