2
0

Reset UserAgent

This commit is contained in:
Glax 2024-02-28 02:32:36 +01:00
parent abfe42b7c1
commit 6c9071b22b
2 changed files with 6 additions and 2 deletions

View File

@ -423,6 +423,10 @@ public class Server : GlobalBase
settings.UpdateUserAgent(customUserAgent); settings.UpdateUserAgent(customUserAgent);
SendResponse(HttpStatusCode.Accepted, response); SendResponse(HttpStatusCode.Accepted, response);
break; break;
case "Settings/userAgent/Reset":
settings.UpdateUserAgent(null);
SendResponse(HttpStatusCode.Accepted, response);
break;
case "Settings/customRequestLimit": case "Settings/customRequestLimit":
if (!requestVariables.TryGetValue("requestType", out string? requestTypeStr) || if (!requestVariables.TryGetValue("requestType", out string? requestTypeStr) ||
!requestVariables.TryGetValue("requestsPerMinute", out string? requestsPerMinuteStr) || !requestVariables.TryGetValue("requestsPerMinute", out string? requestsPerMinuteStr) ||

View File

@ -129,9 +129,9 @@ public class TrangaSettings
ExportSettings(); ExportSettings();
} }
public void UpdateUserAgent(string customUserAgent) public void UpdateUserAgent(string? customUserAgent)
{ {
this.userAgent = customUserAgent.Length < 1 ? DefaultUserAgent : customUserAgent; this.userAgent = customUserAgent ?? DefaultUserAgent;
ExportSettings(); ExportSettings();
} }