Compare commits
2 Commits
755167c39a
...
e2afc09c4a
Author | SHA1 | Date | |
---|---|---|---|
e2afc09c4a | |||
e9db7cfacc |
@ -135,7 +135,8 @@ app.MapGet("/TaskEnqueue", (TrangaTask.Task task, string? connectorName, string?
|
||||
});
|
||||
|
||||
app.MapGet("/TaskDequeue", (TrangaTask.Task task, string? connectorName, string? publicationInternalId) =>
|
||||
{TrangaTask[] allTasks = taskManager.GetAllTasks();
|
||||
{
|
||||
TrangaTask[] allTasks = taskManager.GetAllTasks();
|
||||
TrangaTask? taskToDequeue = allTasks.FirstOrDefault(tTask =>
|
||||
tTask.task == task && tTask.connectorName == connectorName &&
|
||||
tTask.publication?.internalId == publicationInternalId);
|
||||
@ -145,4 +146,36 @@ app.MapGet("/TaskDequeue", (TrangaTask.Task task, string? connectorName, string?
|
||||
return JsonSerializer.Serialize("Success");
|
||||
});
|
||||
|
||||
app.MapGet("/Settings", () =>
|
||||
{
|
||||
return JsonSerializer.Serialize(new Settings(taskManager.settings));
|
||||
});
|
||||
|
||||
app.Run();
|
||||
|
||||
struct Settings
|
||||
{
|
||||
public Komga? komga { get; set; }
|
||||
public string downloadLocation { get; set; }
|
||||
public string settingsFilePath { get; set; }
|
||||
public Settings(TaskManager.SettingsData data)
|
||||
{
|
||||
this.settingsFilePath = data.settingsFilePath;
|
||||
this.downloadLocation = data.downloadLocation;
|
||||
this.komga = data.komga;
|
||||
}
|
||||
|
||||
public Settings(string downloadLocation, string settingsFilePath, Komga komga)
|
||||
{
|
||||
this.downloadLocation = downloadLocation;
|
||||
this.settingsFilePath = settingsFilePath;
|
||||
this.komga = komga;
|
||||
}
|
||||
|
||||
public void Update(string? newDownloadLocation = null, string? newSettingsFilePath = null, Komga? newKomga= null)
|
||||
{
|
||||
this.downloadLocation = newDownloadLocation ?? this.downloadLocation;
|
||||
this.settingsFilePath = newSettingsFilePath ?? this.settingsFilePath;
|
||||
this.komga = newKomga ?? this.komga;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user