diff --git a/Website/apiConnector.js b/Website/apiConnector.js index 8e96c0a..580b821 100644 --- a/Website/apiConnector.js +++ b/Website/apiConnector.js @@ -198,6 +198,11 @@ function UpdateNtfy(ntfyEndpoint, ntfyAuth){ PostData(uri); } +function UpdateUserAgent(userAgent){ + var uri = `${apiUri}/Settings/userAgent?userAgent=${userAgent}`; + PostData(uri); +} + function RemoveJob(jobId){ var uri = `${apiUri}/Jobs?jobId=${jobId}`; DeleteData(uri); diff --git a/Website/index.html b/Website/index.html index dacecad..e757319 100644 --- a/Website/index.html +++ b/Website/index.html @@ -97,6 +97,10 @@ +
+ UserAgent
+ +

diff --git a/Website/interaction.js b/Website/interaction.js index e523692..2d8bdb5 100644 --- a/Website/interaction.js +++ b/Website/interaction.js @@ -39,6 +39,7 @@ const settingKavitaConfigured = document.querySelector("#kavitaConfigured"); const settingGotifyConfigured = document.querySelector("#gotifyConfigured"); const settingLunaseaConfigured = document.querySelector("#lunaseaConfigured"); const settingNtfyConfigured = document.querySelector("#ntfyConfigured"); +const settingUserAgent = document.querySelector("#userAgent"); const settingApiUri = document.querySelector("#settingApiUri"); const settingMangaHoverCheckbox = document.querySelector("#mangaHoverCheckbox"); 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(); }); settingNtfyEndpoint.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(); }); function OpenSettings(){ @@ -352,6 +354,7 @@ function OpenSettings(){ settingLunaseaWebhook.value = ""; settingNtfyAuth.value = ""; settingNtfyEndpoint.value = ""; + settingUserAgent.value = ""; settingApiUri.value = ""; settingMangaHoverCheckbox.checked = false; @@ -359,6 +362,7 @@ function OpenSettings(){ //console.log(json); settingDownloadLocation.innerText = json.downloadLocation; settingApiUri.placeholder = apiUri; + settingUserAgent.placeholder = json.userAgent; //console.log(json.styleSheet); if (json.styleSheet == 'hover') { settingMangaHoverCheckbox.checked = true; @@ -451,8 +455,14 @@ function UpdateSettings(){ UpdateNtfy(settingNtfyEndpoint.value, settingNtfyAuth.value); } - OpenSettings(); - Setup(); + if(settingUserAgent.value != ""){ + UpdateUserAgent(settingUserAgent.value); + } + + setTimeout(() => { + OpenSettings(); + Setup(); + }, 100) } function utf8_to_b64(str) {