GetLibraries()
{
logger?.WriteLine(this.GetType().ToString(), $"Getting Libraries");
- Stream data = NetClient.MakeRequest($"{baseUrl}/api/v1/libraries", auth, logger);
+ Stream data = NetClient.MakeRequest($"{baseUrl}/api/v1/libraries", "Basic", auth, logger);
if (data == Stream.Null)
{
logger?.WriteLine(this.GetType().ToString(), $"No libraries returned");
diff --git a/Tranga/TaskManager.cs b/Tranga/TaskManager.cs
index 4fa189c..39df502 100644
--- a/Tranga/TaskManager.cs
+++ b/Tranga/TaskManager.cs
@@ -47,17 +47,17 @@ public class TaskManager
taskChecker.Start();
}
- public void UpdateSettings(string? downloadLocation, string? komgaUrl, string? komgaAuth, string? kavitaUrl, string? kavitaApiKey)
+ public void UpdateSettings(string? downloadLocation, string? komgaUrl, string? komgaAuth, string? kavitaUrl, string? kavitaUsername, string? kavitaPassword)
{
if (komgaUrl is not null && komgaAuth is not null && komgaUrl.Length > 0 && komgaAuth.Length > 0)
{
settings.libraryManagers.RemoveWhere(lm => lm.GetType() == typeof(Komga));
settings.libraryManagers.Add(new Komga(komgaUrl, komgaAuth, logger));
}
- if (kavitaUrl is not null && kavitaApiKey is not null && kavitaUrl.Length > 0 && kavitaApiKey.Length > 0)
+ if (kavitaUrl is not null && kavitaUsername is not null && kavitaPassword is not null && kavitaUrl.Length > 0 && kavitaUsername.Length > 0 && kavitaPassword.Length > 0)
{
settings.libraryManagers.RemoveWhere(lm => lm.GetType() == typeof(Kavita));
- settings.libraryManagers.Add(new Kavita(kavitaUrl, kavitaApiKey, logger));
+ settings.libraryManagers.Add(new Kavita(kavitaUrl, kavitaUsername, kavitaPassword, logger));
}
if (downloadLocation is not null && downloadLocation.Length > 0)
settings.downloadLocation = downloadLocation;
diff --git a/Website/apiConnector.js b/Website/apiConnector.js
index f7640a6..f79700f 100644
--- a/Website/apiConnector.js
+++ b/Website/apiConnector.js
@@ -104,8 +104,17 @@ function EnqueueTask(taskType, connectorName, publicationId){
PostData(uri);
}
-function UpdateSettings(downloadLocation, komgaUrl, komgaAuth){
- var uri = apiUri + `/Settings/Update?downloadLocation=${downloadLocation}&komgaUrl=${komgaUrl}&komgaAuth=${komgaAuth}`;
+function UpdateSettings(downloadLocation, komgaUrl, komgaAuth, kavitaUrl, kavitaUser, kavitaPass){
+ var uri = apiUri + "/Settings/Update?"
+ if(downloadLocation != ""){
+ uri += "&downloadLocation="+downloadLocation;
+ }
+ if(komgaUrl != "" && komgaAuth != ""){
+ uri += `&komgaUrl=${komgaUrl}&komgaAuth=${komgaAuth}`;
+ }
+ if(kavitaUrl != "" && kavitaUser != "" && kavitaPass != ""){
+ uri += `&kavitaUrl=${kavitaUrl}&kavitaUsername=${kavitaUser}&kavitaPassword=${kavitaPass}`;
+ }
PostData(uri);
}
diff --git a/Website/index.html b/Website/index.html
index 95eb751..1d6ad85 100644
--- a/Website/index.html
+++ b/Website/index.html
@@ -99,7 +99,8 @@
Kavita
Configured: ✅❌
-
+
+
diff --git a/Website/interaction.js b/Website/interaction.js
index 8662f01..66eaafc 100644
--- a/Website/interaction.js
+++ b/Website/interaction.js
@@ -27,7 +27,8 @@ const settingKomgaUrl = document.querySelector("#komgaUrl");
const settingKomgaUser = document.querySelector("#komgaUsername");
const settingKomgaPass = document.querySelector("#komgaPassword");
const settingKavitaUrl = document.querySelector("#kavitaUrl");
-const settingKavitaApi = document.querySelector("#kavitaApiKey");
+const settingKavitaUser = document.querySelector("#kavitaUsername");
+const settingKavitaPass = document.querySelector("#kavitaPassword");
const libraryUpdateTime = document.querySelector("#libraryUpdateTime");
const settingKomgaConfigured = document.querySelector("#komgaConfigured");
const settingKavitaConfigured = document.querySelector("#kavitaConfigured");
@@ -243,7 +244,8 @@ function GetSettingsClick(){
settingKomgaUser.value = "";
settingKomgaPass.value = "";
settingKavitaUrl.value = "";
- settingKavitaApi.value = "";
+ settingKavitaUser.value = "";
+ settingKavitaPass.value = "";
settingKomgaConfigured.innerText = "❌";
settingKavitaConfigured.innerText = "❌";
@@ -254,12 +256,13 @@ function GetSettingsClick(){
json.libraryManagers.forEach(lm => {
if(lm.libraryType == 0){
settingKomgaUrl.placeholder = lm.baseUrl;
- settingKomgaUser.placeholder = "Configured";
+ settingKomgaUser.placeholder = "User";
settingKomgaPass.placeholder = "***";
settingKomgaConfigured.innerText = "✅";
- } else if(libraryType == 1){
+ } else if(lm.libraryType == 1){
settingKavitaUrl.placeholder = lm.baseUrl;
- settingKavitaApi.placeholder = "***";
+ settingKavitaUser.placeholder = "User";
+ settingKavitaPass.placeholder = "***";
settingKavitaConfigured.innerText = "✅";
}
});
@@ -282,8 +285,8 @@ function UpdateLibrarySettings(){
UpdateSettings("", settingKomgaUrl.placeholder, auth, "", "");
}
- if(settingKavitaUrl.value != "" && settingKavitaApi != ""){
- UpdateSettings("", "", "", settingKavitaUrl.value, settingKavitaApi.value);
+ if(settingKavitaUrl.value != "" && settingKavitaUser.value != "" && settingKavitaPass.value != ""){
+ UpdateSettings("", "", "", settingKavitaUrl.value, settingKavitaUser.value, settingKavitaPass.value);
}
CreateTask("UpdateLibraries", libraryUpdateTime.value, "","","");
setTimeout(() => GetSettingsClick(), 100);