glax 2024-01-31 19:12:05 +01:00
parent 0bc3147bb3
commit 18d3a09d93
3 changed files with 21 additions and 2 deletions

View File

@ -198,6 +198,11 @@ function UpdateNtfy(ntfyEndpoint, ntfyAuth){
PostData(uri); PostData(uri);
} }
function UpdateUserAgent(userAgent){
var uri = `${apiUri}/Settings/userAgent?userAgent=${userAgent}`;
PostData(uri);
}
function RemoveJob(jobId){ function RemoveJob(jobId){
var uri = `${apiUri}/Jobs?jobId=${jobId}`; var uri = `${apiUri}/Jobs?jobId=${jobId}`;
DeleteData(uri); DeleteData(uri);

View File

@ -97,6 +97,10 @@
<label for="ntfyEndpoint"></label><input placeholder="URL" id="ntfyEndpoint" type="text"> <label for="ntfyEndpoint"></label><input placeholder="URL" id="ntfyEndpoint" type="text">
<label for="ntfyAuth"></label><input placeholder="Auth" id="ntfyAuth" type="text"> <label for="ntfyAuth"></label><input placeholder="Auth" id="ntfyAuth" type="text">
</div> </div>
<div>
<span class="title">UserAgent</span><br />
<label for="userAgent"></label><input style="width: 400px" placeholder="UserAgent" id="userAgent" type="text">
</div>
<div> <div>
<input type="checkbox" id="mangaHoverCheckbox" name="css-style" value="style_mangahover.css" onclick="updateCSS()"> <input type="checkbox" id="mangaHoverCheckbox" name="css-style" value="style_mangahover.css" onclick="updateCSS()">
<label for="css-style"> Show manga titles and sources on hover</label><br> <label for="css-style"> Show manga titles and sources on hover</label><br>

View File

@ -39,6 +39,7 @@ const settingKavitaConfigured = document.querySelector("#kavitaConfigured");
const settingGotifyConfigured = document.querySelector("#gotifyConfigured"); const settingGotifyConfigured = document.querySelector("#gotifyConfigured");
const settingLunaseaConfigured = document.querySelector("#lunaseaConfigured"); const settingLunaseaConfigured = document.querySelector("#lunaseaConfigured");
const settingNtfyConfigured = document.querySelector("#ntfyConfigured"); const settingNtfyConfigured = document.querySelector("#ntfyConfigured");
const settingUserAgent = document.querySelector("#userAgent");
const settingApiUri = document.querySelector("#settingApiUri"); const settingApiUri = document.querySelector("#settingApiUri");
const settingMangaHoverCheckbox = document.querySelector("#mangaHoverCheckbox"); const settingMangaHoverCheckbox = document.querySelector("#mangaHoverCheckbox");
const newMangaPopup = document.querySelector("#newMangaPopup"); const newMangaPopup = document.querySelector("#newMangaPopup");
@ -333,6 +334,7 @@ settingGotifyAppToken.addEventListener("keypress", (event) => { if(event.key ===
settingLunaseaWebhook.addEventListener("keypress", (event) => { if(event.key === "Enter") UpdateSettings(); }); settingLunaseaWebhook.addEventListener("keypress", (event) => { if(event.key === "Enter") UpdateSettings(); });
settingNtfyEndpoint.addEventListener("keypress", (event) => { if(event.key === "Enter") UpdateSettings(); }); settingNtfyEndpoint.addEventListener("keypress", (event) => { if(event.key === "Enter") UpdateSettings(); });
settingNtfyAuth.addEventListener("keypress", (event) => { if(event.key === "Enter") UpdateSettings(); }); settingNtfyAuth.addEventListener("keypress", (event) => { if(event.key === "Enter") UpdateSettings(); });
settingUserAgent.addEventListener("keypress", (event) => { if(event.key === "Enter") UpdateSettings(); });
settingApiUri.addEventListener("keypress", (event) => { if(event.key === "Enter") UpdateSettings(); }); settingApiUri.addEventListener("keypress", (event) => { if(event.key === "Enter") UpdateSettings(); });
function OpenSettings(){ function OpenSettings(){
@ -352,6 +354,7 @@ function OpenSettings(){
settingLunaseaWebhook.value = ""; settingLunaseaWebhook.value = "";
settingNtfyAuth.value = ""; settingNtfyAuth.value = "";
settingNtfyEndpoint.value = ""; settingNtfyEndpoint.value = "";
settingUserAgent.value = "";
settingApiUri.value = ""; settingApiUri.value = "";
settingMangaHoverCheckbox.checked = false; settingMangaHoverCheckbox.checked = false;
@ -359,6 +362,7 @@ function OpenSettings(){
//console.log(json); //console.log(json);
settingDownloadLocation.innerText = json.downloadLocation; settingDownloadLocation.innerText = json.downloadLocation;
settingApiUri.placeholder = apiUri; settingApiUri.placeholder = apiUri;
settingUserAgent.placeholder = json.userAgent;
//console.log(json.styleSheet); //console.log(json.styleSheet);
if (json.styleSheet == 'hover') { if (json.styleSheet == 'hover') {
settingMangaHoverCheckbox.checked = true; settingMangaHoverCheckbox.checked = true;
@ -451,8 +455,14 @@ function UpdateSettings(){
UpdateNtfy(settingNtfyEndpoint.value, settingNtfyAuth.value); UpdateNtfy(settingNtfyEndpoint.value, settingNtfyAuth.value);
} }
if(settingUserAgent.value != ""){
UpdateUserAgent(settingUserAgent.value);
}
setTimeout(() => {
OpenSettings(); OpenSettings();
Setup(); Setup();
}, 100)
} }
function utf8_to_b64(str) { function utf8_to_b64(str) {