Updates to match API
This commit is contained in:
parent
1ee17360e5
commit
4c418add81
7
.gitignore
vendored
7
.gitignore
vendored
@ -18,4 +18,9 @@ riderModule.iml
|
|||||||
/dataSources.local.xml
|
/dataSources.local.xml
|
||||||
/.idea
|
/.idea
|
||||||
cover.jpg
|
cover.jpg
|
||||||
cover.png
|
cover.png
|
||||||
|
.vs/slnx.sqlite
|
||||||
|
.vs/tranga-website/config/applicationhost.config
|
||||||
|
.vs/tranga-website/FileContentIndex/91a465d3-1190-42e0-95eb-fa3694744e58.vsidx
|
||||||
|
.vs/tranga-website/v17/.wsuo
|
||||||
|
.vs/VSWorkspaceState.json
|
||||||
|
@ -39,10 +39,11 @@ async function GetData(uri){
|
|||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
function PostData(uri){
|
async function PostData(uri){
|
||||||
fetch(uri, {
|
let request = await fetch(uri, {
|
||||||
method: 'POST'
|
method: 'POST'
|
||||||
});
|
});
|
||||||
|
console.log(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
function DeleteData(uri){
|
function DeleteData(uri){
|
||||||
@ -143,6 +144,12 @@ async function GetLibraryConnectors(){
|
|||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function GetRateLimits() {
|
||||||
|
var uri = `${apiUri}/Settings/customRequestLimit`
|
||||||
|
let json = await GetData(uri);
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
|
||||||
function CreateMonitorJob(connector, internalId, language){
|
function CreateMonitorJob(connector, internalId, language){
|
||||||
var uri = `${apiUri}/Jobs/MonitorManga?connector=${connector}&internalId=${internalId}&interval=03:00:00&translatedLanguage=${language}`;
|
var uri = `${apiUri}/Jobs/MonitorManga?connector=${connector}&internalId=${internalId}&interval=03:00:00&translatedLanguage=${language}`;
|
||||||
PostData(uri);
|
PostData(uri);
|
||||||
@ -171,6 +178,7 @@ function RefreshLibraryMetadata() {
|
|||||||
async function DownloadLogs() {
|
async function DownloadLogs() {
|
||||||
var uri = `${apiUri}/LogFile`;
|
var uri = `${apiUri}/LogFile`;
|
||||||
let response = await GetData(uri);
|
let response = await GetData(uri);
|
||||||
|
console.log(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Komga
|
//Komga
|
||||||
@ -213,7 +221,7 @@ function UpdateGotify(gotifyUrl, gotifyAppToken){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function ResetGotify(){
|
function ResetGotify(){
|
||||||
var uri = `${apiUri}/NotificationConnectors/Reset?libraryConnector=Gotify`;
|
var uri = `${apiUri}/NotificationConnectors/Reset?notificationConnector=Gotify`;
|
||||||
PostData(uri);
|
PostData(uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,7 +237,7 @@ function UpdateLunaSea(lunaseaWebhook){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function ResetLunaSea(){
|
function ResetLunaSea(){
|
||||||
var uri = `${apiUri}/NotificationConnectors/Reset?libraryConnector=LunaSea`;
|
var uri = `${apiUri}/NotificationConnectors/Reset?notificationConnector=LunaSea`;
|
||||||
PostData(uri);
|
PostData(uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -245,7 +253,7 @@ function UpdateNtfy(ntfyEndpoint, ntfyAuth){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function ResetNtfy(){
|
function ResetNtfy(){
|
||||||
var uri = `${apiUri}/NotificationConnectors/Reset?libraryConnector=Ntfy`;
|
var uri = `${apiUri}/NotificationConnectors/Reset?notificationConnector=Ntfy`;
|
||||||
PostData(uri);
|
PostData(uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -259,8 +267,8 @@ function UpdateUserAgent(userAgent){
|
|||||||
PostData(uri);
|
PostData(uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
function UpdateRateLimit(connector, byteValue, rateLimit) {
|
function UpdateRateLimit(byteValue, rateLimit) {
|
||||||
var uri = `${apiUri}/Settings/customRequestLimit?requestType=${byteValue}&requestsPerMinute=${rateLimit}&connector=${connector}`;
|
var uri = `${apiUri}/Settings/customRequestLimit?requestType=${byteValue}&requestsPerMinute=${rateLimit}`;
|
||||||
PostData(uri);
|
PostData(uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,6 +101,13 @@
|
|||||||
<border-bar-button class="section" onclick="DownloadLogs()">Download Logs</border-bar-button>
|
<border-bar-button class="section" onclick="DownloadLogs()">Download Logs</border-bar-button>
|
||||||
</row>
|
</row>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="section-item dyn-height">
|
||||||
|
<span class="title">Rate Limits</span>
|
||||||
|
<row><label for="DefaultRL">Default:</label><input id="defaultRL" type="text" ></row>
|
||||||
|
<row><label for="CoverRL">Manga Covers:</label><input id="coverRL" type="text"></row>
|
||||||
|
<row><label for="ImageRL">Manga Images:</label><input id="imageRL" type="text"></row>
|
||||||
|
<row><label for="InfoRL">Manga Info:</label><input id="infoRL" type="text"></row>
|
||||||
|
</div>
|
||||||
<div class="section-item dyn-height">
|
<div class="section-item dyn-height">
|
||||||
<span class="title">Appearance</span>
|
<span class="title">Appearance</span>
|
||||||
<row><label for="cssStyle">Library Style:</label><select id="cssStyle">
|
<row><label for="cssStyle">Library Style:</label><select id="cssStyle">
|
||||||
@ -114,34 +121,36 @@
|
|||||||
<div class="popup-section">
|
<div class="popup-section">
|
||||||
MANGA SOURCES
|
MANGA SOURCES
|
||||||
<div class="section-content">
|
<div class="section-content">
|
||||||
<div class="section-item dyn-height">
|
<!-- <div class="section-item dyn-height">
|
||||||
<span class="title"><img src="connector-icons/manganato.png"><a href="https://manganato.com">MangaNato</a></span>
|
<span class="title"><img src="connector-icons/manganato.png"><a href="https://manganato.com">MangaNato</a></span>
|
||||||
<row><label for="manganatoRL">Rate Limit: </label><input placeholder="60 Requests/Minute" id="manganatoRL" type="text"></row>
|
|
||||||
</div>
|
</div> -->
|
||||||
<div class="section-item dyn-height">
|
<!-- <div class="section-item dyn-height">
|
||||||
<span class="title"><img src="connector-icons/mangasee.png"><a href="https://mangasee123.com">MangaSee</a></span>
|
<span class="title"><img src="connector-icons/mangasee.png"><a href="https://mangasee123.com">MangaSee</a></span>
|
||||||
<row><label for="mangaseeRL">Rate Limit: </label><input placeholder="60 Requests/Minute" id="mangaseeRL" type="text"></row>
|
|
||||||
</div>
|
</div> -->
|
||||||
<div class="section-item dyn-height">
|
<div class="section-item dyn-height">
|
||||||
<span class="title"><img src="connector-icons/mangadex-logo.svg"><a href="https://mangadex.org">MangaDex</a></span>
|
<span class="title"><img src="connector-icons/mangadex-logo.svg"><a href="https://mangadex.org">MangaDex</a></span>
|
||||||
<row><label for="mDexRL">Rate Limit: </label><input placeholder="60 Requests/Minute" id="mDexRL" type="text"></row>
|
<row><label for="mDexAuthorRL">Author Rate Limit:</label><input id="mDexAuthorRL" type="text"></row>
|
||||||
|
<row><label for="mDexFeedRL">Feed Rate Limit:</label><input id="mDexFeedRL" type="text"></row>
|
||||||
|
<row><label for="mDexImageRL">Image Rate Limit:</label><input id="mDexImageRL" type="text"></row>
|
||||||
</div>
|
</div>
|
||||||
<div class="section-item dyn-height">
|
<!-- <div class="section-item dyn-height">
|
||||||
<span class="title"><img src="connector-icons/mangakatana.png"><a href="https://mangakatana.com">MangaKatana</a></span>
|
<span class="title"><img src="connector-icons/mangakatana.png"><a href="https://mangakatana.com">MangaKatana</a></span>
|
||||||
<row><label for="mKatanaRL">Rate Limit: </label><input placeholder="60 Requests/Minute" id="mKatanaRL" type="text"></row>
|
|
||||||
</div>
|
</div> -->
|
||||||
<div class="section-item dyn-height">
|
<!-- <div class="section-item dyn-height">
|
||||||
<span class="title"><img src="connector-icons/mangaworld.png"><a href="https://www.mangaworld.ac">MangaWorld</a></span>
|
<span class="title"><img src="connector-icons/mangaworld.png"><a href="https://www.mangaworld.ac">MangaWorld</a></span>
|
||||||
<row><label for="mWorldRL">Rate Limit: </label><input placeholder="60 Requests/Minute" id="mWorldRL" type="text"></row>
|
|
||||||
</div>
|
</div> -->
|
||||||
<div class="section-item dyn-height">
|
<!-- <div class="section-item dyn-height">
|
||||||
<span class="title"><img src="connector-icons/bato.ico"><a href="https://bato.to">Bato</a></span>
|
<span class="title"><img src="connector-icons/bato.ico"><a href="https://bato.to">Bato</a></span>
|
||||||
<row><label for="batoRL">Rate Limit: </label><input placeholder="60 Requests/Minute" id="batoRL" type="text"></row>
|
|
||||||
</div>
|
</div> -->
|
||||||
<div class="section-item dyn-height">
|
<!-- <div class="section-item dyn-height">
|
||||||
<span class="title"><img src="connector-icons/mangalife.png"><a href="https://www.manga4life.com">MangaLife</a></span>
|
<span class="title"><img src="connector-icons/mangalife.png"><a href="https://www.manga4life.com">MangaLife</a></span>
|
||||||
<row><label for="mLifeRL">Rate Limit: </label><input placeholder="60 Requests/Minute" id="mLifeRL" type="text"></row>
|
|
||||||
</div>
|
</div> -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -33,14 +33,16 @@ const mangaViewerTags = document.querySelector("#publicationViewerTags");
|
|||||||
const mangaViewerAuthor = document.querySelector("#publicationViewerAuthor");
|
const mangaViewerAuthor = document.querySelector("#publicationViewerAuthor");
|
||||||
const mangaViewCover = document.querySelector("#pubviewcover");
|
const mangaViewCover = document.querySelector("#pubviewcover");
|
||||||
|
|
||||||
//Rate Limits
|
//General Rate Limits
|
||||||
const manganatoRateLimit = document.querySelector('#manganatoRL');
|
const defaultRL = document.querySelector("#defaultRL");
|
||||||
const mangaseeRateLimit = document.querySelector('#mangaseeRL');
|
const coverRL = document.querySelector("#coverRL");
|
||||||
const mangadexRateLimit = document.querySelector('#mDexRL');
|
const imageRL = document.querySelector("#imageRL");
|
||||||
const mangakatanaRateLimit = document.querySelector('#mKatanaRL');
|
const infoRL = document.querySelector("#infoRL");
|
||||||
const mangaworldRateLimit = document.querySelector('#mWorldRL');
|
|
||||||
const batoRateLimit = document.querySelector('#batoRL');
|
//MangaDex Rate Limits
|
||||||
const mangalifeRateLimit = document.querySelector('#mLifeRL');
|
const mDexAuthorRL = document.querySelector("#mDexAuthorRL");
|
||||||
|
const mDexFeedRL = document.querySelector("#mDexFeedRL");
|
||||||
|
const mDexImageRL = document.querySelector("#mDexImageRL");
|
||||||
|
|
||||||
//Komga
|
//Komga
|
||||||
const settingKomgaUrl = document.querySelector("#komgaUrl");
|
const settingKomgaUrl = document.querySelector("#komgaUrl");
|
||||||
@ -151,6 +153,15 @@ function Setup(){
|
|||||||
//console.log(json);
|
//console.log(json);
|
||||||
settingApiUri.placeholder = apiUri;
|
settingApiUri.placeholder = apiUri;
|
||||||
});
|
});
|
||||||
|
GetRateLimits().then((json) => {
|
||||||
|
defaultRL.placeholder = json.Default + ' Requests/Minute';
|
||||||
|
coverRL.placeholder = json.MangaCover + ' Requests/Minute';
|
||||||
|
imageRL.placeholder = json.MangaImage + ' Requests/Minute';
|
||||||
|
infoRL.placeholder = json.MangaInfo + ' Requests/Minute';
|
||||||
|
mDexAuthorRL.placeholder = json.MangaDexAuthor + ' Requests/Minute';
|
||||||
|
mDexFeedRL.placeholder = json.MangaDexFeed + ' Requests/Minute';
|
||||||
|
mDexImageRL.placeholder = json.MangaDexImage + ' Requests/Minute';
|
||||||
|
});
|
||||||
|
|
||||||
//If the cssStyle key isn't in the local storage of the browser, then set the css style to the default and load the page
|
//If the cssStyle key isn't in the local storage of the browser, then set the css style to the default and load the page
|
||||||
//Otherwise get the style key from storage and set it.
|
//Otherwise get the style key from storage and set it.
|
||||||
@ -515,59 +526,14 @@ settingNtfyAuth.addEventListener("keypress", (event) => { if(event.key === "Ente
|
|||||||
settingUserAgent.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(); });
|
||||||
|
|
||||||
manganatoRateLimit.addEventListener("keypress", (event) => { if(event.key === "Enter") NewRateLimit(event);});
|
defaultRL.addEventListener("keypress", (event) => { if(event.key === "Enter") UpdateSettings();});
|
||||||
mangaseeRateLimit.addEventListener("keypress", (event) => { if(event.key === "Enter") NewRateLimit(event);});
|
coverRL.addEventListener("keypress", (event) => { if(event.key === "Enter") UpdateSettings();});
|
||||||
mangadexRateLimit.addEventListener("keypress", (event) => { if(event.key === "Enter") NewRateLimit(event);});
|
imageRL.addEventListener("keypress", (event) => { if(event.key === "Enter") UpdateSettings();});
|
||||||
mangakatanaRateLimit.addEventListener("keypress", (event) => { if(event.key === "Enter") NewRateLimit(event);});
|
infoRL.addEventListener("keypress", (event) => { if(event.key === "Enter") UpdateSettings();});
|
||||||
mangaworldRateLimit.addEventListener("keypress", (event) => { if(event.key === "Enter") NewRateLimit(event);});
|
mDexAuthorRL.addEventListener("keypress", (event) => { if(event.key === "Enter") UpdateSettings();});
|
||||||
batoRateLimit.addEventListener("keypress", (event) => { if(event.key === "Enter") NewRateLimit(event);});
|
mDexFeedRL.addEventListener("keypress", (event) => { if(event.key === "Enter") UpdateSettings();});
|
||||||
mangalifeRateLimit.addEventListener("keypress", (event) => { if(event.key === "Enter") NewRateLimit(event);});
|
mDexImageRL.addEventListener("keypress", (event) => { if(event.key === "Enter") UpdateSettings();});
|
||||||
|
|
||||||
function NewRateLimit(event) {
|
|
||||||
if (event.target.value.length > 0 && event.target.value != 0) {
|
|
||||||
console.log(event.target.id);
|
|
||||||
switch (event.target.id) {
|
|
||||||
case "manganatoRL":
|
|
||||||
connector = 'Manganato';
|
|
||||||
byteValue = 1;
|
|
||||||
UpdateRateLimit(connector, byteValue, event.target.value);
|
|
||||||
break;
|
|
||||||
case "mangaseeRL":
|
|
||||||
connector = 'Mangasee';
|
|
||||||
byteValue = 1;
|
|
||||||
UpdateRateLimit(connector, byteValue, event.target.value);
|
|
||||||
break;
|
|
||||||
case "mDexRL":
|
|
||||||
connector = 'MangaDex'
|
|
||||||
byteValue = 250;
|
|
||||||
UpdateRateLimit(connector, byteValue, event.target.value);
|
|
||||||
break;
|
|
||||||
case "mKatanaRL":
|
|
||||||
connector = 'MangaKatana';
|
|
||||||
byteValue = 1;
|
|
||||||
UpdateRateLimit(connector, byteValue, event.target.value);
|
|
||||||
break;
|
|
||||||
case "mWorldRL":
|
|
||||||
connector = 'Mangaworld';
|
|
||||||
byteValue = 1;
|
|
||||||
UpdateRateLimit(connector, byteValue, event.target.value);
|
|
||||||
break;
|
|
||||||
case "batoRL":
|
|
||||||
connector = 'Bato';
|
|
||||||
byteValue = 1;
|
|
||||||
UpdateRateLimit(connector, byteValue, event.target.value);
|
|
||||||
break;
|
|
||||||
case "mLifeRL":
|
|
||||||
connector = 'Manga4Life';
|
|
||||||
byteValue = 1;
|
|
||||||
UpdateRateLimit(connector, byteValue, event.target.value);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
console.log("Unknown connector:");
|
|
||||||
console.log(event.target.id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function OpenSettings(){
|
function OpenSettings(){
|
||||||
settingGotifyConfigured.setAttribute("configuration", "Not Configured");
|
settingGotifyConfigured.setAttribute("configuration", "Not Configured");
|
||||||
@ -588,6 +554,13 @@ function OpenSettings(){
|
|||||||
settingNtfyEndpoint.value = "";
|
settingNtfyEndpoint.value = "";
|
||||||
settingUserAgent.value = "";
|
settingUserAgent.value = "";
|
||||||
settingApiUri.value = "";
|
settingApiUri.value = "";
|
||||||
|
defaultRL.value = "";
|
||||||
|
coverRL.value = "";
|
||||||
|
imageRL.value = "";
|
||||||
|
infoRL.value = "";
|
||||||
|
mDexAuthorRL.value = "";
|
||||||
|
mDexFeedRL.value = "";
|
||||||
|
mDexImageRL.value = "";
|
||||||
|
|
||||||
GetSettings().then((json) => {
|
GetSettings().then((json) => {
|
||||||
//console.log(json);
|
//console.log(json);
|
||||||
@ -595,6 +568,15 @@ function OpenSettings(){
|
|||||||
settingUserAgent.value = json.userAgent;
|
settingUserAgent.value = json.userAgent;
|
||||||
//console.log(json.styleSheet);
|
//console.log(json.styleSheet);
|
||||||
});
|
});
|
||||||
|
GetRateLimits().then((json) => {
|
||||||
|
defaultRL.placeholder = json.Default + ' Requests/Minute';
|
||||||
|
coverRL.placeholder = json.MangaCover + ' Requests/Minute';
|
||||||
|
imageRL.placeholder = json.MangaImage + ' Requests/Minute';
|
||||||
|
infoRL.placeholder = json.MangaInfo + ' Requests/Minute';
|
||||||
|
mDexAuthorRL.placeholder = json.MangaDexAuthor + ' Requests/Minute';
|
||||||
|
mDexFeedRL.placeholder = json.MangaDexFeed + ' Requests/Minute';
|
||||||
|
mDexImageRL.placeholder = json.MangaDexImage + ' Requests/Minute';
|
||||||
|
});
|
||||||
GetLibraryConnectors().then((json) => {
|
GetLibraryConnectors().then((json) => {
|
||||||
//console.log(json);
|
//console.log(json);
|
||||||
json.forEach(connector => {
|
json.forEach(connector => {
|
||||||
@ -619,7 +601,6 @@ function OpenSettings(){
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
GetNotificationConnectors().then((json) => {
|
GetNotificationConnectors().then((json) => {
|
||||||
console.log(json);
|
|
||||||
json.forEach(connector => {
|
json.forEach(connector => {
|
||||||
switch(notificationConnectorTypes[connector.notificationConnectorType]){
|
switch(notificationConnectorTypes[connector.notificationConnectorType]){
|
||||||
case "Gotify":
|
case "Gotify":
|
||||||
@ -719,32 +700,32 @@ function UpdateSettings(){
|
|||||||
UpdateUserAgent(settingUserAgent.value);
|
UpdateUserAgent(settingUserAgent.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (manganatoRateLimit.value.length > 0) {
|
if (defaultRL.value != "") {
|
||||||
UpdateRateLimit('Manganato', 1, manganatoRateLimit.value);
|
UpdateRateLimit(0, defaultRL.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mangaseeRateLimit.value.length > 0) {
|
if (coverRL.value != "") {
|
||||||
UpdateRateLimit('Mangasee', 1, mangaseeRateLimit.value);
|
UpdateRateLimit(3, coverRL.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mangadexRateLimit.value.length > 0) {
|
if (imageRL.value != "") {
|
||||||
UpdateRateLimit('MangaDex', 250, mangadexRateLimit.value);
|
UpdateRateLimit(2, imageRL.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mangakatanaRateLimit.value.length > 0) {
|
if (infoRL.value != "") {
|
||||||
UpdateRateLimit('MangaKatana', 1, mangakatanaRateLimit.value);
|
UpdateRateLimit(6, infoRL.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mangaworldRateLimit.value.length > 0) {
|
if (mDexAuthorRL.value != "") {
|
||||||
UpdateRateLimit('Mangaworld', 1, mangaworldRateLimit.value);
|
UpdateRateLimit(5, mDexAuthorRL.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (batoRateLimit.value.length > 0) {
|
if (mDexFeedRL.value != "") {
|
||||||
UpdateRateLimit('Bato', 1, batoRateLimit.value);
|
UpdateRateLimit(1, mDexFeedRL.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mangalifeRateLimit.value.length > 0) {
|
if (mDexImageRL.value != "") {
|
||||||
UpdateRateLimit('Manga4Life', 1, mangalifeRateLimit.value);
|
UpdateRateLimit(5, mDexImageRL.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user