2
0
This commit is contained in:
glax 2023-05-26 13:39:42 +02:00
parent 4fd3c03804
commit c9537a9963
2 changed files with 16 additions and 12 deletions

View File

@ -141,15 +141,12 @@ public class TaskManager
TrangaTask newTask; TrangaTask newTask;
if (task == TrangaTask.Task.UpdateKomgaLibrary) if (task == TrangaTask.Task.UpdateKomgaLibrary)
{ {
newTask = new TrangaTask(task, null, null, reoccurrence, language); newTask = new TrangaTask(task, null, null, reoccurrence);
logger?.WriteLine(this.GetType().ToString(), $"Removing old {task}-Task.");
//Check if same task already exists //Only one UpdateKomgaLibrary Task
// ReSharper disable once SimplifyLinqExpressionUseAll readabilty _allTasks.RemoveWhere(trangaTask => trangaTask.task is TrangaTask.Task.UpdateKomgaLibrary);
if (!_allTasks.Any(trangaTask => trangaTask.task == task))
{
_allTasks.Add(newTask); _allTasks.Add(newTask);
} }
}
else else
{ {
if(connectorName is null) if(connectorName is null)

View File

@ -227,6 +227,7 @@ function GetSettingsClick(){
}); });
GetKomgaTask().then(json => { GetKomgaTask().then(json => {
settingKomgaTime.value = json[0].reoccurrence;
if(json.length > 0) if(json.length > 0)
settingKomgaConfigured.innerText = "✅"; settingKomgaConfigured.innerText = "✅";
else else
@ -235,11 +236,17 @@ function GetSettingsClick(){
} }
function UpdateKomgaSettings(){ function UpdateKomgaSettings(){
if(settingKomgaUser.value != "" && settingKomgaPass != ""){
var auth = utf8_to_b64(`${settingKomgaUser.value}:${settingKomgaPass.value}`); var auth = utf8_to_b64(`${settingKomgaUser.value}:${settingKomgaPass.value}`);
console.log(auth); console.log(auth);
if(settingKomgaUrl.value != "")
UpdateSettings("", settingKomgaUrl.value, auth); UpdateSettings("", settingKomgaUrl.value, auth);
else
UpdateSettings("", settingKomgaUrl.placeholder, auth);
}
CreateTask("UpdateKomgaLibrary", settingKomgaTime.value, "","",""); CreateTask("UpdateKomgaLibrary", settingKomgaTime.value, "","","");
setTimeout(() => GetSettingsClick(), 500); setTimeout(() => GetSettingsClick(), 100);
} }
function utf8_to_b64( str ) { function utf8_to_b64( str ) {