Website: Added gotify config
This commit is contained in:
parent
25c90782dc
commit
d9ced11cd1
@ -126,17 +126,27 @@ function EnqueueTask(taskType, connectorName, publicationId){
|
||||
PostData(uri);
|
||||
}
|
||||
|
||||
function UpdateSettings(downloadLocation, komgaUrl, komgaAuth, kavitaUrl, kavitaUser, kavitaPass){
|
||||
function UpdateDownloadLocation(downloadLocation){
|
||||
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}`;
|
||||
}
|
||||
uri += "&downloadLocation="+downloadLocation;
|
||||
PostData(uri);
|
||||
}
|
||||
|
||||
function UpdateKomga(komgaUrl, komgaAuth){
|
||||
var uri = apiUri + "/Settings/Update?"
|
||||
uri += `&komgaUrl=${komgaUrl}&komgaAuth=${komgaAuth}`;
|
||||
PostData(uri);
|
||||
}
|
||||
|
||||
function UpdateKavita(kavitaUrl, kavitaUser, kavitaPass){
|
||||
var uri = apiUri + "/Settings/Update?"
|
||||
uri += `&kavitaUrl=${kavitaUrl}&kavitaUsername=${kavitaUser}&kavitaPassword=${kavitaPass}`;
|
||||
PostData(uri);
|
||||
}
|
||||
|
||||
function UpdateGotify(gotifyUrl, gotifyAppToken){
|
||||
var uri = apiUri + "/Settings/Update?"
|
||||
uri += `&gotifyUrl=${gotifyUrl}&gotifyAppToken=${gotifyAppToken}`;
|
||||
PostData(uri);
|
||||
}
|
||||
|
||||
|
@ -133,6 +133,12 @@
|
||||
<label for="kavitaUsername"></label><input placeholder="Username" id="kavitaUsername" type="text">
|
||||
<label for="kavitaPassword"></label><input placeholder="Password" id="kavitaPassword" type="password">
|
||||
</div>
|
||||
<div>
|
||||
<span class="title">Gotify</span>
|
||||
<div>Configured: <span id="gotifyConfigured">✅❌</span></div>
|
||||
<label for="gotifyUrl"></label><input placeholder="URL" id="gotifyUrl" type="text">
|
||||
<label for="gotifyAppToken"></label><input placeholder="App-Token" id="gotifyAppToken" type="text">
|
||||
</div>
|
||||
<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()">
|
||||
|
@ -33,9 +33,12 @@ const settingKomgaPass = document.querySelector("#komgaPassword");
|
||||
const settingKavitaUrl = document.querySelector("#kavitaUrl");
|
||||
const settingKavitaUser = document.querySelector("#kavitaUsername");
|
||||
const settingKavitaPass = document.querySelector("#kavitaPassword");
|
||||
const settingGotifyUrl = document.querySelector("#gotifyUrl");
|
||||
const settingGotifyAppToken = document.querySelector("#gotifyAppToken");
|
||||
const libraryUpdateTime = document.querySelector("#libraryUpdateTime");
|
||||
const settingKomgaConfigured = document.querySelector("#komgaConfigured");
|
||||
const settingKavitaConfigured = document.querySelector("#kavitaConfigured");
|
||||
const settingGotifyConfigured = document.querySelector("#gotifyConfigured");
|
||||
const settingApiUri = document.querySelector("#settingApiUri");
|
||||
const tagTasksRunning = document.querySelector("#tasksRunningTag");
|
||||
const tagTasksQueued = document.querySelector("#tasksQueuedTag");
|
||||
@ -284,15 +287,19 @@ function GetSettingsClick(){
|
||||
settingKomgaUrl.value = "";
|
||||
settingKomgaUser.value = "";
|
||||
settingKomgaPass.value = "";
|
||||
settingKomgaConfigured.innerText = "❌";
|
||||
settingKavitaUrl.value = "";
|
||||
settingKavitaUser.value = "";
|
||||
settingKavitaPass.value = "";
|
||||
settingKomgaConfigured.innerText = "❌";
|
||||
settingKavitaConfigured.innerText = "❌";
|
||||
settingGotifyUrl.value = "";
|
||||
settingGotifyAppToken.value = "";
|
||||
settingGotifyConfigured.innerText = "❌";
|
||||
|
||||
settingApiUri.placeholder = apiUri;
|
||||
|
||||
GetSettings().then(json => {
|
||||
console.log(json);
|
||||
settingDownloadLocation.innerText = json.downloadLocation;
|
||||
json.libraryManagers.forEach(lm => {
|
||||
if(lm.libraryType == 0){
|
||||
@ -307,6 +314,11 @@ function GetSettingsClick(){
|
||||
settingKavitaConfigured.innerText = "✅";
|
||||
}
|
||||
});
|
||||
json.notificationManagers.forEach(nm => {
|
||||
if(nm.notificationManagerType == 0){
|
||||
settingGotifyConfigured.innerText = "✅";
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
GetKomgaTask().then(json => {
|
||||
@ -316,19 +328,20 @@ function GetSettingsClick(){
|
||||
}
|
||||
|
||||
function UpdateLibrarySettings(){
|
||||
if(settingKomgaUser.value != "" && settingKomgaPass != ""){
|
||||
if(settingKomgaUrl.value != "" && 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, "", "");
|
||||
UpdateKomga(settingKomgaUrl.value, auth);
|
||||
}
|
||||
|
||||
if(settingKavitaUrl.value != "" && settingKavitaUser.value != "" && settingKavitaPass.value != ""){
|
||||
UpdateSettings("", "", "", settingKavitaUrl.value, settingKavitaUser.value, settingKavitaPass.value);
|
||||
UpdateKavita(settingKavitaUrl.value, settingKavitaUser.value, settingKavitaPass.value);
|
||||
}
|
||||
|
||||
if(settingGotifyUrl.value != "" && settingGotifyAppToken.value != ""){
|
||||
UpdateGotify(settingGotifyUrl.value, settingGotifyAppToken.value);
|
||||
}
|
||||
|
||||
CreateUpdateLibraryTask(libraryUpdateTime.value);
|
||||
setTimeout(() => GetSettingsClick(), 200);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user