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

View File

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