#33 Update Website
This commit is contained in:
parent
ed1402b5ec
commit
7612411917
@ -84,7 +84,7 @@ async function GetSettings(){
|
||||
}
|
||||
|
||||
async function GetKomgaTask(){
|
||||
var uri = apiUri + "/Tasks/Get?taskType=UpdateKomgaLibrary";
|
||||
var uri = apiUri + "/Tasks/Get?taskType=UpdateLibraries";
|
||||
let json = await GetData(uri);
|
||||
return json;
|
||||
}
|
||||
|
@ -94,9 +94,17 @@
|
||||
<label for="komgaUrl"></label><input placeholder="URL" id="komgaUrl" type="text">
|
||||
<label for="komgaUsername"></label><input placeholder="Username" id="komgaUsername" type="text">
|
||||
<label for="komgaPassword"></label><input placeholder="Password" id="komgaPassword" type="password">
|
||||
<label for="komgaUpdateTime" style="margin-right: 5px;">Update Time</label><input id="komgaUpdateTime" type="time" value="00:01:00" step="10">
|
||||
<input type="submit" value="Update" onclick="UpdateKomgaSettings()">
|
||||
</komga-settings>
|
||||
<kavita-settings>
|
||||
<span class="title">Kavita</span>
|
||||
<div>Configured: <span id="kavitaConfigured">✅❌</span></div>
|
||||
<label for="kavitaUrl"></label><input placeholder="URL" id="kavitaUrl" type="text">
|
||||
<label for="kavitaApiKey"></label><input placeholder="API-Key" id="kavitaApiKey" type="text">
|
||||
</kavita-settings>
|
||||
<div>
|
||||
<label for="libraryUpdateTime" style="margin-right: 5px;">Update Time</label><input id="libraryUpdateTime" type="time" value="00:01:00" step="10">
|
||||
<input type="submit" value="Update" onclick="UpdateLibrarySettings()">
|
||||
</div>
|
||||
</settings>
|
||||
</popup>
|
||||
</viewport>
|
||||
|
@ -26,8 +26,11 @@ const settingDownloadLocation = document.querySelector("#downloadLocation");
|
||||
const settingKomgaUrl = document.querySelector("#komgaUrl");
|
||||
const settingKomgaUser = document.querySelector("#komgaUsername");
|
||||
const settingKomgaPass = document.querySelector("#komgaPassword");
|
||||
const settingKomgaTime = document.querySelector("#komgaUpdateTime");
|
||||
const settingKavitaUrl = document.querySelector("#kavitaUrl");
|
||||
const settingKavitaApi = document.querySelector("#kavitaApiKey");
|
||||
const libraryUpdateTime = document.querySelector("#libraryUpdateTime");
|
||||
const settingKomgaConfigured = document.querySelector("#komgaConfigured");
|
||||
const settingKavitaConfigured = document.querySelector("#kavitaConfigured");
|
||||
const settingApiUri = document.querySelector("#settingApiUri");
|
||||
const tagTasksRunning = document.querySelector("#tasksRunningTag");
|
||||
const tagTasksQueued = document.querySelector("#tasksQueuedTag");
|
||||
@ -239,38 +242,50 @@ function GetSettingsClick(){
|
||||
settingKomgaUrl.value = "";
|
||||
settingKomgaUser.value = "";
|
||||
settingKomgaPass.value = "";
|
||||
settingKavitaUrl.value = "";
|
||||
settingKavitaApi.value = "";
|
||||
settingKomgaConfigured.innerText = "❌";
|
||||
settingKavitaConfigured.innerText = "❌";
|
||||
|
||||
settingApiUri.placeholder = apiUri;
|
||||
|
||||
GetSettings().then(json => {
|
||||
settingDownloadLocation.innerText = json.downloadLocation;
|
||||
if(json.komga != null) {
|
||||
settingKomgaUrl.placeholder = json.komga.baseUrl;
|
||||
json.libraryManagers.forEach(lm => {
|
||||
if(lm.libraryType == 0){
|
||||
settingKomgaUrl.placeholder = lm.baseUrl;
|
||||
settingKomgaUser.placeholder = "Configured";
|
||||
settingKomgaPass.placeholder = "***";
|
||||
settingKomgaConfigured.innerText = "✅";
|
||||
} else if(libraryType == 1){
|
||||
settingKavitaUrl.placeholder = lm.baseUrl;
|
||||
settingKavitaApi.placeholder = "***";
|
||||
settingKavitaConfigured.innerText = "✅";
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
GetKomgaTask().then(json => {
|
||||
settingKomgaTime.value = json[0].reoccurrence;
|
||||
if(json.length > 0)
|
||||
settingKomgaConfigured.innerText = "✅";
|
||||
else
|
||||
settingKomgaConfigured.innerText = "❌";
|
||||
libraryUpdateTime.value = json[0].reoccurrence;
|
||||
});
|
||||
}
|
||||
|
||||
function UpdateKomgaSettings(){
|
||||
function UpdateLibrarySettings(){
|
||||
if(settingKomgaUser.value != "" && settingKomgaPass != ""){
|
||||
var auth = utf8_to_b64(`${settingKomgaUser.value}:${settingKomgaPass.value}`);
|
||||
console.log(auth);
|
||||
|
||||
if(settingKomgaUrl.value != "")
|
||||
UpdateSettings("", settingKomgaUrl.value, auth);
|
||||
UpdateSettings("", settingKomgaUrl.value, auth, "", "");
|
||||
else
|
||||
UpdateSettings("", settingKomgaUrl.placeholder, auth);
|
||||
UpdateSettings("", settingKomgaUrl.placeholder, auth, "", "");
|
||||
}
|
||||
CreateTask("UpdateKomgaLibrary", settingKomgaTime.value, "","","");
|
||||
|
||||
if(settingKavitaUrl.value != "" && settingKavitaApi != ""){
|
||||
UpdateSettings("", "", "", settingKavitaUrl.value, settingKavitaApi.value);
|
||||
}
|
||||
CreateTask("UpdateLibraries", libraryUpdateTime.value, "","","");
|
||||
setTimeout(() => GetSettingsClick(), 100);
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ settings {
|
||||
z-index: 10;
|
||||
position: absolute;
|
||||
left: 25%;
|
||||
top: 25%;
|
||||
top: 100px;
|
||||
border-radius: 5px;
|
||||
padding: 10px 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user