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