From 05a799521f3e90ae08105c5f409f8a4e519aa160 Mon Sep 17 00:00:00 2001 From: glax Date: Thu, 31 Aug 2023 12:56:09 +0200 Subject: [PATCH 01/29] Added/Removed API-Functions --- Website/apiConnector.js | 115 ++++++++++++++++++---------------------- 1 file changed, 51 insertions(+), 64 deletions(-) diff --git a/Website/apiConnector.js b/Website/apiConnector.js index 560d3a5..98e7bd0 100644 --- a/Website/apiConnector.js +++ b/Website/apiConnector.js @@ -48,121 +48,108 @@ async function GetAvailableControllers(){ return json; } -async function GetPublicationFromConnector(connectorName, title){ - var uri = apiUri + `/Publications/FromConnector?connectorName=${connectorName}&title=${title}`; +async function GetPublicationFromConnector(connector, title){ + var uri = `${apiUri}/Manga/FromConnector?connector=${connector}&title=${title}`; let json = await GetData(uri); return json; } -async function GetKnownPublications(){ - var uri = apiUri + "/Publications/Known"; +async function GetChapters(connector, internalId){ + var uri = `${apiUri}/Manga/Chapters?connector=${connector}&internalId=${internalId}`; let json = await GetData(uri); return json; } -async function GetPublication(internalId){ - var uri = apiUri + `/Publications/Known?internalId=${internalId}`; +async function GetAllJobs(){ + var uri = `${apiUri}/Jobs`; + let json = await GetData(uri); + return json; +} + +async function GetRunningJobs(){ + var uri = `${apiUri}/Jobs/Running`; let json = await GetData(uri); return json; } -async function GetChapters(internalId, connectorName, onlyNew, language){ - var uri = apiUri + `/Publications/Chapters?internalId=${internalId}&connectorName=${connectorName}&onlyNew=${onlyNew}&language=${language}`; +async function GetWaitingJobs(){ + var uri = `${apiUri}/Jobs/Waiting`; let json = await GetData(uri); return json; } -async function GetTaskTypes(){ - var uri = apiUri + "/Tasks/Types"; - let json = await GetData(uri); - return json; -} -async function GetRunningTasks(){ - var uri = apiUri + "/Tasks/RunningTasks"; - let json = await GetData(uri); - return json; -} - -async function GetDownloadTasks(){ - var uri = apiUri + "/Tasks?taskType=MonitorPublication"; +async function GetProgress(jobId){ + var uri = `${apiUri}/Jobs/Progress?jobId=${jobId}`; let json = await GetData(uri); return json; } async function GetSettings(){ - var uri = apiUri + "/Settings"; + var uri = `${apiUri}/Settings`; let json = await GetData(uri); return json; } -async function GetKomgaTask(){ - var uri = apiUri + "/Tasks?taskType=UpdateLibraries"; - let json = await GetData(uri); - return json; +async function GetAvailableNotificationConnectors(){ + var uri = `${apiUri}/NotificationConnectors/Types`; + let json = await GetData(uri); + return json; } -function CreateMonitorTask(connectorName, internalId, reoccurrence, language){ - var uri = apiUri + `/Tasks/CreateMonitorTask?connectorName=${connectorName}&internalId=${internalId}&reoccurrenceTime=${reoccurrence}&language=${language}`; +async function GetNotificationConnectors(){ + var uri = `${apiUri}/NotificationConnectors`; + let json = await GetData(uri); + return json; +} + +async function GetAvailableLibraryConnectors(){ + var uri = `${apiUri}/LibraryConnectors/Types`; + let json = await GetData(uri); + return json; +} + +async function GetLibraryConnectors(){ + var uri = `${apiUri}/LibraryConnectors`; + let json = await GetData(uri); + return json; +} + +function CreateMonitorJob(connector, internalId, interval){ + var uri = `${apiUri}/Jobs/MonitorManga?connector=${connector}&internalId=${internalId}&interval=${interval}`; PostData(uri); } -function CreateDownloadChaptersTask(connectorName, internalId, chapters, language){ - var uri = apiUri + `/Tasks/CreateDownloadChaptersTask?connectorName=${connectorName}&internalId=${internalId}&chapters=${chapters}&language=${language}`; - PostData(uri); -} - -function StartTask(taskType, connectorName, internalId){ - var uri = apiUri + `/Tasks/Start?taskType=${taskType}&connectorName=${connectorName}&internalId=${internalId}`; - PostData(uri); -} - -function EnqueueTask(taskType, connectorName, publicationId){ - var uri = apiUri + `/Queue/Enqueue?taskType=${taskType}&connectorName=${connectorName}&publicationId=${publicationId}`; +function CreateDownloadNewChaptersJob(connector, internalId){ + var uri = `${apiUri}/Jobs/DownloadNewChapters?connector=${connector}&internalId=${internalId}`; PostData(uri); } function UpdateDownloadLocation(downloadLocation){ - var uri = apiUri + "/Settings/Update?" - uri += "&downloadLocation="+downloadLocation; - PostData(uri); + var uri = `${apiUri}/Settings/UpdateDownloadLocation?downloadLocation=${downloadLocation}`; + PostData(uri); } function UpdateKomga(komgaUrl, komgaAuth){ - var uri = apiUri + "/Settings/Update?" - uri += `&komgaUrl=${komgaUrl}&komgaAuth=${komgaAuth}`; + var uri = `/LibraryManagers/Update?libraryManager=Komga&komgaUrl=${komgaUrl}&komgaAuth=${komgaAuth}`; PostData(uri); } function UpdateKavita(kavitaUrl, kavitaUser, kavitaPass){ - var uri = apiUri + "/Settings/Update?" - uri += `&kavitaUrl=${kavitaUrl}&kavitaUsername=${kavitaUser}&kavitaPassword=${kavitaPass}`; + var uri = `/LibraryManagers/Update?libraryManager=Kavita&kavitaUrl=${kavitaUrl}&kavitaUser=${kavitaUser}&kavitaPass={kavitaPass}`; PostData(uri); } function UpdateGotify(gotifyUrl, gotifyAppToken){ - var uri = apiUri + "/Settings/Update?" - uri += `&gotifyUrl=${gotifyUrl}&gotifyAppToken=${gotifyAppToken}`; + var uri = `${apiUri}/NotificationConnectors/Update?notificationConnector=Gotify&gotifyUrl=${gotifyUrl}&gotifyAppToken=${gotifyAppToken}`; PostData(uri); } function UpdateLunaSea(lunaseaWebhook){ - var uri = apiUri + "/Settings/Update?" - uri += `&lunaseaWebhook=${lunaseaWebhook}`; + var uri = `${apiUri}/NotificationConnectors/Update?notificationConnector=LunaSea&lunaseaWebhook=${lunaseaWebhook}`; PostData(uri); } -function DeleteTask(taskType, connectorName, publicationId){ - var uri = apiUri + `/Tasks?taskType=${taskType}&connectorName=${connectorName}&publicationId=${publicationId}`; +function RemoveJob(jobId){ + var uri = `${apiUri}/Jobs?jobId=${jobId}`; DeleteData(uri); -} - -function DequeueTask(taskType, connectorName, publicationId){ - var uri = apiUri + `/Queue/Dequeue?taskType=${taskType}&connectorName=${connectorName}&publicationId=${publicationId}`; - DeleteData(uri); -} - -async function GetQueue(){ - var uri = apiUri + "/Queue/List"; - let json = await GetData(uri); - return json; } \ No newline at end of file From 5968dacf72c6011297025282ab473fb1a8e85bbc Mon Sep 17 00:00:00 2001 From: glax Date: Thu, 31 Aug 2023 13:03:09 +0200 Subject: [PATCH 02/29] Removed extranious tag --- Website/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Website/index.html b/Website/index.html index d6e9667..3ebf23a 100644 --- a/Website/index.html +++ b/Website/index.html @@ -45,7 +45,7 @@
- +
From 50d93d463105e9513e13045874ac3e16e5110110 Mon Sep 17 00:00:00 2001 From: glax Date: Thu, 31 Aug 2023 13:12:20 +0200 Subject: [PATCH 03/29] New API-Call: StartJobNow --- Website/apiConnector.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Website/apiConnector.js b/Website/apiConnector.js index 98e7bd0..3948aa9 100644 --- a/Website/apiConnector.js +++ b/Website/apiConnector.js @@ -124,6 +124,11 @@ function CreateDownloadNewChaptersJob(connector, internalId){ PostData(uri); } +function StartJob(jobId){ + var uri = `${apiUri}/Jobs/StartNow?jobId=${jobId}`; + PostData(uri); +} + function UpdateDownloadLocation(downloadLocation){ var uri = `${apiUri}/Settings/UpdateDownloadLocation?downloadLocation=${downloadLocation}`; PostData(uri); From 4e5be60e84098dcf8d147818e4f25f0a606aeebd Mon Sep 17 00:00:00 2001 From: glax Date: Thu, 31 Aug 2023 16:24:04 +0200 Subject: [PATCH 04/29] Corrected wrong uri on UpdateKomga UpdateKavita --- Website/apiConnector.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Website/apiConnector.js b/Website/apiConnector.js index 3948aa9..a726ef2 100644 --- a/Website/apiConnector.js +++ b/Website/apiConnector.js @@ -135,12 +135,12 @@ function UpdateDownloadLocation(downloadLocation){ } function UpdateKomga(komgaUrl, komgaAuth){ - var uri = `/LibraryManagers/Update?libraryManager=Komga&komgaUrl=${komgaUrl}&komgaAuth=${komgaAuth}`; + var uri = `${apiUri}/LibraryConnectors/Update?libraryConnector=Komga&komgaUrl=${komgaUrl}&komgaAuth=${komgaAuth}`; PostData(uri); } function UpdateKavita(kavitaUrl, kavitaUser, kavitaPass){ - var uri = `/LibraryManagers/Update?libraryManager=Kavita&kavitaUrl=${kavitaUrl}&kavitaUser=${kavitaUser}&kavitaPass={kavitaPass}`; + var uri = `${apiUri}/LibraryConnectors/Update?libraryConnector=Kavita&kavitaUrl=${kavitaUrl}&kavitaUser=${kavitaUser}&kavitaPass={kavitaPass}`; PostData(uri); } From 2fb876f1fbeef1f672c855a76c43b2415010ee67 Mon Sep 17 00:00:00 2001 From: glax Date: Thu, 31 Aug 2023 16:45:17 +0200 Subject: [PATCH 05/29] Added setCookie function --- Website/apiConnector.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/Website/apiConnector.js b/Website/apiConnector.js index a726ef2..ac76eac 100644 --- a/Website/apiConnector.js +++ b/Website/apiConnector.js @@ -3,6 +3,15 @@ if(getCookie("apiUri") != ""){ apiUri = getCookie("apiUri"); } +setCookie("apiUri", apiUri); + +function setCookie(cname, cvalue) { + const d = new Date(); + d.setTime(d.getTime() + (365*24*60*60*1000)); + let expires = "expires="+ d.toUTCString(); + document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/;samesite=strict"; +} + function getCookie(cname) { let name = cname + "="; let decodedCookie = decodeURIComponent(document.cookie); @@ -78,6 +87,12 @@ async function GetWaitingJobs(){ return json; } +async function GetMonitorJobs(){ + var uri = `${apiUri}/Jobs/MonitorJobs`; + let json = await GetData(uri); + return json; +} + async function GetProgress(jobId){ var uri = `${apiUri}/Jobs/Progress?jobId=${jobId}`; let json = await GetData(uri); @@ -139,8 +154,8 @@ function UpdateKomga(komgaUrl, komgaAuth){ PostData(uri); } -function UpdateKavita(kavitaUrl, kavitaUser, kavitaPass){ - var uri = `${apiUri}/LibraryConnectors/Update?libraryConnector=Kavita&kavitaUrl=${kavitaUrl}&kavitaUser=${kavitaUser}&kavitaPass={kavitaPass}`; +function UpdateKavita(kavitaUrl, kavitaUsername, kavitaPassword){ + var uri = `${apiUri}/LibraryConnectors/Update?libraryConnector=Kavita&kavitaUrl=${kavitaUrl}&kavitaUsername=${kavitaUsername}&kavitaPassword={kavitaPassword}`; PostData(uri); } From 91f587eb91b76adc4b94659defa1c53b3e99db73 Mon Sep 17 00:00:00 2001 From: glax Date: Thu, 31 Aug 2023 16:45:33 +0200 Subject: [PATCH 06/29] working settings Popup --- Website/index.html | 111 ++------- Website/interaction.js | 551 ++++++++++++----------------------------- 2 files changed, 179 insertions(+), 483 deletions(-) diff --git a/Website/index.html b/Website/index.html index 3ebf23a..59e123c 100644 --- a/Website/index.html +++ b/Website/index.html @@ -33,81 +33,9 @@ - - - - Select Publication - -
- - -
-
- -
- -
-
-
-
- - - - - Create Task: Monitor Publication - -
- Run every - hours - minutes - -
-
-
-
- - - - - Create Task: Download Chapter(s) - -
- -
-
- -
-
-
-
- - - - - cover - - Tensei Pandemic - - Imamura Hinata - Imamura Hinata is a high school boy with a cute appearance. - Since his trauma with the first love, he wanted to be more manly than anybody else. But one day he woke up to something different… - The total opposite of his ideal male body! - Pandemic love comedy! - - - Start Task ▶️ - Delete Task ❌ - Monitor ➕ - Download Chapter ➕ - - - - - - + Settings @@ -145,23 +73,36 @@
- - +
- - - - - Task Progress - - - - + + + + + cover + + Tensei Pandemic + + Imamura Hinata + Imamura Hinata is a high school boy with a cute appearance. + Since his trauma with the first love, he wanted to be more manly than anybody else. But one day he woke up to something different… + The total opposite of his ideal male body! + Pandemic love comedy! + + + Start Task ▶️ + Delete Task ❌ + Monitor ➕ + Download Chapter ➕ + + + +