mirror of
https://github.com/C9Glax/tranga-website.git
synced 2025-06-14 07:47:54 +02:00
@mui/joy
This commit is contained in:
@ -4,9 +4,10 @@ import Search from "./modules/Search";
|
||||
import Header from "./modules/Header";
|
||||
import MonitorJobsList from "./modules/MonitorJobsList";
|
||||
import './styles/index.css'
|
||||
import IFrontendSettings, {LoadFrontendSettings} from "./modules/interfaces/IFrontendSettings";
|
||||
import {useCookies} from "react-cookie";
|
||||
import Loader from "./modules/Loader";
|
||||
import IFrontendSettings from "./modules/types/IFrontendSettings";
|
||||
import {LoadFrontendSettings} from "./modules/api/FrontendSettings";
|
||||
|
||||
export default function App(){
|
||||
const [, setCookie] = useCookies(['apiUri', 'jobInterval']);
|
||||
|
@ -1,18 +1,14 @@
|
||||
import React, {ReactElement, useEffect} from "react";
|
||||
import {getData} from "../../App";
|
||||
import IAuthor from "../types/IAuthor";
|
||||
|
||||
export default interface IAuthor {
|
||||
authorId: string;
|
||||
authorName: string;
|
||||
}
|
||||
|
||||
export function AuthorElement({apiUri, authorId} : {apiUri: string, authorId: string | null}) : ReactElement{
|
||||
export default function AuthorElement({apiUri, authorId} : {apiUri: string, authorId: string | null}) : ReactElement{
|
||||
let [author, setAuthor] = React.useState<IAuthor | null>(null);
|
||||
|
||||
useEffect(()=> {
|
||||
if(authorId === null)
|
||||
return;
|
||||
getData(`${apiUri}/v2/Query/Author/${authorId}`)
|
||||
getData(`${apiUri}/v2/Query/AuthorTag/${authorId}`)
|
||||
.then((json) => {
|
||||
let ret = json as IAuthor;
|
||||
setAuthor(ret);
|
@ -1,20 +1,10 @@
|
||||
import React, {ReactElement, ReactEventHandler, useEffect, useState} from "react";
|
||||
import MangaFunctions from "../MangaFunctions";
|
||||
import IManga from "./IManga";
|
||||
import ChapterFunctions from "../ChapterFunctions";
|
||||
import Manga from "../api/Manga";
|
||||
import Chapter from "../api/Chapter";
|
||||
import IChapter from "../types/IChapter";
|
||||
import IManga from "../types/IManga";
|
||||
|
||||
export default interface IChapter{
|
||||
chapterId: string;
|
||||
volumeNumber: number;
|
||||
chapterNumber: string;
|
||||
url: string;
|
||||
title: string | undefined;
|
||||
archiveFileName: string;
|
||||
downloaded: boolean;
|
||||
parentMangaId: string;
|
||||
}
|
||||
|
||||
export function ChapterItem({apiUri, chapterId} : {apiUri: string, chapterId: string}) : ReactElement {
|
||||
export default function ChapterItem({apiUri, chapterId} : {apiUri: string, chapterId: string}) : ReactElement {
|
||||
const setCoverItem : ReactEventHandler<HTMLImageElement> = (e) => {
|
||||
setMangaCoverHtmlImageItem(e.currentTarget);
|
||||
}
|
||||
@ -24,25 +14,25 @@ export function ChapterItem({apiUri, chapterId} : {apiUri: string, chapterId: st
|
||||
let [mangaCoverUrl, setMangaCoverUrl] = useState<string>("../../media/blahaj.png");
|
||||
let [mangaCoverHtmlImageItem, setMangaCoverHtmlImageItem] = useState<HTMLImageElement | null>(null);
|
||||
useEffect(() => {
|
||||
ChapterFunctions.GetChapterFromId(apiUri, chapterId).then(setChapter);
|
||||
Chapter.GetChapterFromId(apiUri, chapterId).then(setChapter);
|
||||
}, []);
|
||||
useEffect(() => {
|
||||
if(chapter === null)
|
||||
manga = null;
|
||||
else
|
||||
MangaFunctions.GetMangaById(apiUri, chapter.parentMangaId).then(setManga);
|
||||
Manga.GetMangaById(apiUri, chapter.parentMangaId).then(setManga);
|
||||
}, [chapter]);
|
||||
useEffect(() => {
|
||||
if(chapter != null && mangaCoverHtmlImageItem != null)
|
||||
setMangaCoverUrl(MangaFunctions.GetMangaCoverImageUrl(apiUri, chapter.parentMangaId, mangaCoverHtmlImageItem));
|
||||
setMangaCoverUrl(Manga.GetMangaCoverImageUrl(apiUri, chapter.parentMangaId, mangaCoverHtmlImageItem));
|
||||
}, [chapter, mangaCoverHtmlImageItem]);
|
||||
|
||||
let [clicked, setClicked] = useState<boolean>(false);
|
||||
|
||||
return (<div className="ChapterItem" key={chapterId} is-clicked={clicked ? "clicked" : "not-clicked"} onClick={() => setClicked(!clicked)}>
|
||||
<img className="ChapterItem-Cover" src={mangaCoverUrl} alt="MangaFunctions Cover" onLoad={setCoverItem} onResize={setCoverItem}></img>
|
||||
<p className="ChapterItem-MangaName">{manga ? manga.name : "MangaFunctions-Name"}</p>
|
||||
<p className="ChapterItem-ChapterName">{chapter ? chapter.title : "ChapterFunctions-Title"}</p>
|
||||
<img className="ChapterItem-Cover" src={mangaCoverUrl} alt="Manga Cover" onLoad={setCoverItem} onResize={setCoverItem}></img>
|
||||
<p className="ChapterItem-MangaName">{manga ? manga.name : "Manga-Name"}</p>
|
||||
<p className="ChapterItem-ChapterName">{chapter ? chapter.title : "Chapter-Title"}</p>
|
||||
<p className="ChapterItem-Volume">Vol.{chapter ? chapter.volumeNumber : "VolNum"}</p>
|
||||
<p className="ChapterItem-Chapter">Ch.{chapter ? chapter.chapterNumber : "ChNum"}</p>
|
||||
<p className="ChapterItem-VolumeChapter">Vol.{chapter ? chapter.volumeNumber : "VolNum"} Ch.{chapter ? chapter.chapterNumber : "ChNum"}</p>
|
@ -1,24 +1,8 @@
|
||||
import {ReactElement, useState} from "react";
|
||||
import NotificationConnectorFunctions from "../../NotificationConnectorFunctions";
|
||||
import Loader from "../../Loader";
|
||||
import "../../../styles/notificationConnector.css";
|
||||
import {isValidUri} from "../../../App";
|
||||
|
||||
export default interface IGotifyRecord {
|
||||
endpoint: string;
|
||||
appToken: string;
|
||||
priority: number;
|
||||
}
|
||||
|
||||
function Validate(record: IGotifyRecord) : boolean {
|
||||
if(!isValidUri(record.endpoint))
|
||||
return false;
|
||||
if(record.appToken.length < 1)
|
||||
return false;
|
||||
if(record.priority < 1 || record.priority > 5)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
import NotificationConnector from "../api/NotificationConnector";
|
||||
import Loader from "../Loader";
|
||||
import IGotifyRecord from "../types/records/IGotifyRecord";
|
||||
import {isValidUri} from "../../App";
|
||||
|
||||
export function GotifyItem ({apiUri} : {apiUri: string}) : ReactElement{
|
||||
const [record, setRecord] = useState<IGotifyRecord>({
|
||||
@ -42,10 +26,20 @@ export function GotifyItem ({apiUri} : {apiUri: string}) : ReactElement{
|
||||
if(record === null || Validate(record) === false)
|
||||
return;
|
||||
setLoading(true);
|
||||
NotificationConnectorFunctions.CreateGotify(apiUri, record)
|
||||
NotificationConnector.CreateGotify(apiUri, record)
|
||||
.finally(() => setLoading(false));
|
||||
}}>Add</button>
|
||||
<Loader loading={loading} style={{width:"40px",height:"40px"}}/>
|
||||
</>
|
||||
</div>;
|
||||
}
|
||||
|
||||
function Validate(record: IGotifyRecord) : boolean {
|
||||
if(!isValidUri(record.endpoint))
|
||||
return false;
|
||||
if(record.appToken.length < 1)
|
||||
return false;
|
||||
if(record.priority < 1 || record.priority > 5)
|
||||
return false;
|
||||
return true;
|
||||
}
|
@ -1,13 +1,8 @@
|
||||
import React, {ReactElement, useEffect} from "react";
|
||||
import {getData} from "../../App";
|
||||
import ILink from "../types/ILink";
|
||||
|
||||
export default interface ILink {
|
||||
linkId: string;
|
||||
linkProvider: string;
|
||||
linkUrl: string;
|
||||
}
|
||||
|
||||
export function LinkElement({apiUri, linkId} : {apiUri: string, linkId: string | null}) : ReactElement{
|
||||
export default function LinkElement({apiUri, linkId} : {apiUri: string, linkId: string | null}) : ReactElement{
|
||||
let [link, setLink] = React.useState<ILink | null>(null);
|
||||
|
||||
useEffect(()=> {
|
@ -1,16 +1,11 @@
|
||||
import {ReactElement, useState} from "react";
|
||||
import INewLibraryRecord, {Validate} from "./records/INewLibraryRecord";
|
||||
import INewLibraryRecord, {Validate} from "../types/records/INewLibraryRecord";
|
||||
import Loader from "../Loader";
|
||||
import LocalLibraryFunctions from "../LocalLibraryFunctions";
|
||||
import LocalLibrary from "../api/LocalLibrary";
|
||||
import "../../styles/localLibrary.css";
|
||||
import ILocalLibrary from "../types/ILocalLibrary";
|
||||
|
||||
export default interface ILocalLibrary {
|
||||
localLibraryId: string;
|
||||
basePath: string;
|
||||
libraryName: string;
|
||||
}
|
||||
|
||||
export function LocalLibraryItem({apiUri, library} : {apiUri: string, library: ILocalLibrary | null}) : ReactElement {
|
||||
export default function LocalLibraryItem({apiUri, library} : {apiUri: string, library: ILocalLibrary | null}) : ReactElement {
|
||||
const [loading, setLoading] = useState<boolean>(false);
|
||||
const [record, setRecord] = useState<INewLibraryRecord>({
|
||||
path: library?.basePath ?? "",
|
||||
@ -29,14 +24,14 @@ export function LocalLibraryItem({apiUri, library} : {apiUri: string, library: I
|
||||
if(record === null || Validate(record) === false)
|
||||
return;
|
||||
setLoading(true);
|
||||
LocalLibraryFunctions.UpdateLibrary(apiUri, library.localLibraryId, record)
|
||||
LocalLibrary.UpdateLibrary(apiUri, library.localLibraryId, record)
|
||||
.finally(() => setLoading(false));
|
||||
}}>Edit</button>
|
||||
: <button className="LocalLibraryFunctions-Action" onClick={() => {
|
||||
if(record === null || Validate(record) === false)
|
||||
return;
|
||||
setLoading(true);
|
||||
LocalLibraryFunctions.CreateLibrary(apiUri, record)
|
||||
LocalLibrary.CreateLibrary(apiUri, record)
|
||||
.finally(() => setLoading(false));
|
||||
}}>Add</button>
|
||||
}
|
@ -1,16 +1,7 @@
|
||||
import {ReactElement, useState} from "react";
|
||||
import NotificationConnectorFunctions from "../../NotificationConnectorFunctions";
|
||||
import Loader from "../../Loader";
|
||||
import "../../../styles/notificationConnector.css";
|
||||
|
||||
export default interface ILunaseaRecord {
|
||||
id: string;
|
||||
}
|
||||
|
||||
const regex = new RegExp("(?:device|user)\/[0-9a-zA-Z\-]+");
|
||||
function Validate(record: ILunaseaRecord) : boolean {
|
||||
return regex.test(record.id);
|
||||
}
|
||||
import NotificationConnector from "../api/NotificationConnector";
|
||||
import Loader from "../Loader";
|
||||
import ILunaseaRecord from "../types/records/ILunaseaRecord";
|
||||
|
||||
export function LunaseaItem ({apiUri} : {apiUri: string}) : ReactElement{
|
||||
const [record, setRecord] = useState<ILunaseaRecord>({
|
||||
@ -27,10 +18,15 @@ export function LunaseaItem ({apiUri} : {apiUri: string}) : ReactElement{
|
||||
if(record === null || Validate(record) === false)
|
||||
return;
|
||||
setLoading(true);
|
||||
NotificationConnectorFunctions.CreateLunasea(apiUri, record)
|
||||
NotificationConnector.CreateLunasea(apiUri, record)
|
||||
.finally(() => setLoading(false));
|
||||
}}>Add</button>
|
||||
<Loader loading={loading} style={{width:"40px",height:"40px",margin:"25vh calc(sin(70)*(50% - 40px))"}}/>
|
||||
</>
|
||||
</div>;
|
||||
}
|
||||
|
||||
const regex = new RegExp("(?:device|user)\/[0-9a-zA-Z\-]+");
|
||||
function Validate(record: ILunaseaRecord) : boolean {
|
||||
return regex.test(record.id);
|
||||
}
|
@ -1,43 +1,18 @@
|
||||
import MangaFunctions from "../MangaFunctions";
|
||||
import Manga from "../api/Manga";
|
||||
import React, {Children, ReactElement, ReactEventHandler, useEffect, useState} from "react";
|
||||
import Icon from '@mdi/react';
|
||||
import { mdiTagTextOutline, mdiAccountEdit, mdiLinkVariant } from '@mdi/js';
|
||||
import MarkdownPreview from '@uiw/react-markdown-preview';
|
||||
import {AuthorElement} from "./IAuthor";
|
||||
import {LinkElement} from "./ILink";
|
||||
import IChapter from "./IChapter";
|
||||
import Loader from "../Loader";
|
||||
import IManga from "../types/IManga";
|
||||
import IChapter from "../types/IChapter";
|
||||
import AuthorElement from "./Author";
|
||||
import LinkElement from "./Link";
|
||||
|
||||
export default interface IManga{
|
||||
mangaId: string;
|
||||
idOnConnectorSite: string;
|
||||
name: string;
|
||||
description: string;
|
||||
websiteUrl: string;
|
||||
year: number;
|
||||
originalLanguage: string;
|
||||
releaseStatus: MangaReleaseStatus;
|
||||
folderName: string;
|
||||
ignoreChapterBefore: number;
|
||||
mangaConnectorId: string;
|
||||
authorIds: string[];
|
||||
tags: string[];
|
||||
linkIds: string[];
|
||||
altTitleIds: string[];
|
||||
}
|
||||
|
||||
export enum MangaReleaseStatus {
|
||||
Continuing = "Continuing",
|
||||
Completed = "Completed",
|
||||
OnHiatus = "OnHiatus",
|
||||
Cancelled = "Cancelled",
|
||||
Unreleased = "Unreleased",
|
||||
}
|
||||
|
||||
export function MangaItem({apiUri, mangaId, children} : {apiUri: string, mangaId: string, children?: (string | ReactElement)[]}) : ReactElement {
|
||||
export default function MangaItem({apiUri, mangaId, children} : {apiUri: string, mangaId: string, children?: (string | ReactElement)[]}) : ReactElement {
|
||||
const LoadMangaCover : ReactEventHandler<HTMLImageElement> = (e) => {
|
||||
if(e.currentTarget.src != MangaFunctions.GetMangaCoverImageUrl(apiUri, mangaId, e.currentTarget))
|
||||
e.currentTarget.src = MangaFunctions.GetMangaCoverImageUrl(apiUri, mangaId, e.currentTarget);
|
||||
if(e.currentTarget.src != Manga.GetMangaCoverImageUrl(apiUri, mangaId, e.currentTarget))
|
||||
e.currentTarget.src = Manga.GetMangaCoverImageUrl(apiUri, mangaId, e.currentTarget);
|
||||
}
|
||||
|
||||
let [manga, setManga] = useState<IManga | null>(null);
|
||||
@ -48,14 +23,14 @@ export function MangaItem({apiUri, mangaId, children} : {apiUri: string, mangaId
|
||||
let [settingThreshold, setSettingThreshold] = useState<boolean>(false);
|
||||
const invalidTargets = ["input", "textarea", "button", "select", "a"];
|
||||
useEffect(() => {
|
||||
MangaFunctions.GetMangaById(apiUri, mangaId).then(setManga);
|
||||
MangaFunctions.GetLatestChapterDownloaded(apiUri, mangaId)
|
||||
Manga.GetMangaById(apiUri, mangaId).then(setManga);
|
||||
Manga.GetLatestChapterDownloaded(apiUri, mangaId)
|
||||
.then(setLatestChapterDownloaded)
|
||||
.finally(() => {
|
||||
if(latestChapterDownloaded && latestChapterAvailable)
|
||||
setLoadingChapterStats(false);
|
||||
});
|
||||
MangaFunctions.GetLatestChapterAvailable(apiUri, mangaId)
|
||||
Manga.GetLatestChapterAvailable(apiUri, mangaId)
|
||||
.then(setLatestChapterAvailable)
|
||||
.finally(() => {
|
||||
if(latestChapterDownloaded && latestChapterAvailable)
|
||||
@ -69,7 +44,7 @@ export function MangaItem({apiUri, mangaId, children} : {apiUri: string, mangaId
|
||||
if(invalidTargets.find(x => x == target.localName) === undefined )
|
||||
setClicked(!clicked)
|
||||
}}>
|
||||
<img className="MangaItem-Cover" src="../../media/blahaj.png" alt="MangaFunctions Cover" onLoad={LoadMangaCover} onResize={LoadMangaCover}></img>
|
||||
<img className="MangaItem-Cover" src="../../media/blahaj.png" alt="Manga Cover" onLoad={LoadMangaCover} onResize={LoadMangaCover}></img>
|
||||
<div className="MangaItem-Connector">{manga ? manga.mangaConnectorId : "Connector"}</div>
|
||||
<div className="MangaItem-Status" release-status={manga?.releaseStatus}></div>
|
||||
<div className="MangaItem-Name">{manga ? manga.name : "Name"}</div>
|
||||
@ -81,7 +56,7 @@ export function MangaItem({apiUri, mangaId, children} : {apiUri: string, mangaId
|
||||
<AuthorElement apiUri={apiUri} authorId={authorId}></AuthorElement>
|
||||
</div>)
|
||||
:
|
||||
<div className="MangaItem-Author" key="null-Author">
|
||||
<div className="MangaItem-Author" key="null-AuthorTag">
|
||||
<Icon path={mdiAccountEdit} size={0.5} />
|
||||
<AuthorElement apiUri={apiUri} authorId={null}></AuthorElement>
|
||||
</div>}
|
||||
@ -113,7 +88,7 @@ export function MangaItem({apiUri, mangaId, children} : {apiUri: string, mangaId
|
||||
Start at Chapter
|
||||
<input type="text" defaultValue={latestChapterDownloaded ? latestChapterDownloaded.chapterNumber : ""} disabled={settingThreshold} onChange={(e) => {
|
||||
setSettingThreshold(true);
|
||||
MangaFunctions.SetIgnoreThreshold(apiUri, mangaId, e.currentTarget.valueAsNumber).finally(()=>setSettingThreshold(false));
|
||||
Manga.SetIgnoreThreshold(apiUri, mangaId, e.currentTarget.valueAsNumber).finally(()=>setSettingThreshold(false));
|
||||
}} />
|
||||
<Loader loading={settingThreshold} style={{margin: "-10px -45px"}}/>
|
||||
out of <span className="MangaItem-Props-Threshold-Available">{latestChapterAvailable ? latestChapterAvailable.chapterNumber : <Loader loading={loadingChapterStats} style={{margin: "-10px -35px"}} />}</span>
|
@ -1,14 +1,8 @@
|
||||
import React, {ReactElement, useEffect} from "react";
|
||||
import {getData} from "../../App";
|
||||
import IAuthor from "./IAuthor";
|
||||
import IMangaAltTitle from "../types/IMangaAltTitle";
|
||||
|
||||
export default interface IMangaAltTitle {
|
||||
altTitleId: string;
|
||||
language: string;
|
||||
title: string;
|
||||
}
|
||||
|
||||
export function AltTitleElement({apiUri, altTitleId} : {apiUri: string, altTitleId: string | null}) : ReactElement{
|
||||
export default function AltTitleElement({apiUri, altTitleId} : {apiUri: string, altTitleId: string | null}) : ReactElement{
|
||||
let [altTitle, setAltTitle] = React.useState<IMangaAltTitle | null>(null);
|
||||
|
||||
useEffect(()=> {
|
@ -1,21 +1,14 @@
|
||||
import {ReactElement, ReactEventHandler, useState} from "react";
|
||||
import "../../styles/notificationConnector.css";
|
||||
import Loader from "../Loader";
|
||||
import NotificationConnectorFunctions from "../NotificationConnectorFunctions";
|
||||
import {LunaseaItem} from "./records/ILunaseaRecord";
|
||||
import {GotifyItem} from "./records/IGotifyRecord";
|
||||
import {NtfyItem} from "./records/INtfyRecord";
|
||||
import {PushoverItem} from "./records/IPushoverRecord";
|
||||
import NotificationConnector from "../api/NotificationConnector";
|
||||
import INotificationConnector from "../types/INotificationConnector";
|
||||
import {GotifyItem} from "./Gotify";
|
||||
import {NtfyItem} from "./Ntfy";
|
||||
import {LunaseaItem} from "./Lunasea";
|
||||
import {PushoverItem} from "./Pushover";
|
||||
|
||||
export default interface INotificationConnector {
|
||||
name: string;
|
||||
url: string;
|
||||
headers: Record<string, string>[];
|
||||
httpMethod: string;
|
||||
body: string;
|
||||
}
|
||||
|
||||
export function NotificationConnectorItem({apiUri, notificationConnector} : {apiUri: string, notificationConnector: INotificationConnector | null}) : ReactElement {
|
||||
export default function NotificationConnectorItem({apiUri, notificationConnector} : {apiUri: string, notificationConnector: INotificationConnector | null}) : ReactElement {
|
||||
if(notificationConnector != null)
|
||||
return <DefaultItem apiUri={apiUri} notificationConnector={notificationConnector} />
|
||||
|
||||
@ -93,7 +86,7 @@ function DefaultItem({apiUri, notificationConnector}:{apiUri: string, notificati
|
||||
<>
|
||||
<button className="NotificationConnectorItem-Save" onClick={(e) => {
|
||||
setLoading(true);
|
||||
NotificationConnectorFunctions.CreateNotificationConnector(apiUri, info)
|
||||
NotificationConnector.CreateNotificationConnector(apiUri, info)
|
||||
.finally(() => setLoading(false));
|
||||
}}>Add</button>
|
||||
<Loader loading={loading} style={{width:"40px",height:"40px",margin:"25vh calc(sin(70)*(50% - 40px))"}}/>
|
@ -1,30 +1,8 @@
|
||||
import {isValidUri} from "../../App";
|
||||
import {ReactElement, useState} from "react";
|
||||
import NotificationConnectorFunctions from "../../NotificationConnectorFunctions";
|
||||
import Loader from "../../Loader";
|
||||
import "../../../styles/notificationConnector.css";
|
||||
import {isValidUri} from "../../../App";
|
||||
|
||||
export default interface INtfyRecord {
|
||||
endpoint: string;
|
||||
username: string;
|
||||
password: string;
|
||||
topic: string;
|
||||
priority: number;
|
||||
}
|
||||
|
||||
function Validate(record: INtfyRecord) : boolean {
|
||||
if(!isValidUri(record.endpoint))
|
||||
return false;
|
||||
if(record.username.length < 1)
|
||||
return false;
|
||||
if(record.password.length < 1)
|
||||
return false;
|
||||
if(record.topic.length < 1)
|
||||
return false;
|
||||
if(record.priority < 1 || record.priority > 5)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
import NotificationConnector from "../api/NotificationConnector";
|
||||
import Loader from "../Loader";
|
||||
import INtfyRecord from "../types/records/INtfyRecord";
|
||||
|
||||
export function NtfyItem ({apiUri} : {apiUri: string}) : ReactElement{
|
||||
const [info, setInfo] = useState<INtfyRecord>({
|
||||
@ -49,14 +27,28 @@ export function NtfyItem ({apiUri} : {apiUri: string}) : ReactElement{
|
||||
<label htmlFor="NotificationConnectorItem-Priority">Priority</label>
|
||||
<input id="NotificationConnectorItem-Priority-Value" type="number" className="NotificationConnectorItem-Priority-Value" min={1} max={5} defaultValue={3} onChange={(e) => setInfo({...info, priority: e.currentTarget.valueAsNumber})} />
|
||||
</div><>
|
||||
<button className="NotificationConnectorItem-Save" onClick={(e) => {
|
||||
if(info === null || Validate(info) === false)
|
||||
return;
|
||||
setLoading(true);
|
||||
NotificationConnectorFunctions.CreateNtfy(apiUri, info)
|
||||
.finally(() => setLoading(false));
|
||||
}}>Add</button>
|
||||
<Loader loading={loading} style={{width:"40px",height:"40px",margin:"25vh calc(sin(70)*(50% - 40px))"}}/>
|
||||
</>
|
||||
<button className="NotificationConnectorItem-Save" onClick={(e) => {
|
||||
if(info === null || Validate(info) === false)
|
||||
return;
|
||||
setLoading(true);
|
||||
NotificationConnector.CreateNtfy(apiUri, info)
|
||||
.finally(() => setLoading(false));
|
||||
}}>Add</button>
|
||||
<Loader loading={loading} style={{width:"40px",height:"40px",margin:"25vh calc(sin(70)*(50% - 40px))"}}/>
|
||||
</>
|
||||
</div>;
|
||||
}
|
||||
|
||||
function Validate(record: INtfyRecord) : boolean {
|
||||
if(!isValidUri(record.endpoint))
|
||||
return false;
|
||||
if(record.username.length < 1)
|
||||
return false;
|
||||
if(record.password.length < 1)
|
||||
return false;
|
||||
if(record.topic.length < 1)
|
||||
return false;
|
||||
if(record.priority < 1 || record.priority > 5)
|
||||
return false;
|
||||
return true;
|
||||
}
|
@ -1,21 +1,7 @@
|
||||
import {ReactElement, useState} from "react";
|
||||
import NotificationConnectorFunctions from "../../NotificationConnectorFunctions";
|
||||
import Loader from "../../Loader";
|
||||
import "../../../styles/notificationConnector.css";
|
||||
import {isValidUri} from "../../../App";
|
||||
|
||||
export default interface IPushoverRecord {
|
||||
apptoken: string;
|
||||
user: string;
|
||||
}
|
||||
|
||||
function Validate(record: IPushoverRecord) : boolean {
|
||||
if(record.apptoken.length < 1)
|
||||
return false;
|
||||
if(record.user.length < 1)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
import NotificationConnector from "../api/NotificationConnector";
|
||||
import Loader from "../Loader";
|
||||
import IPushoverRecord from "../types/records/IPushoverRecord";
|
||||
|
||||
export function PushoverItem ({apiUri} : {apiUri: string}) : ReactElement{
|
||||
const [info, setInfo] = useState<IPushoverRecord>({
|
||||
@ -34,10 +20,18 @@ export function PushoverItem ({apiUri} : {apiUri: string}) : ReactElement{
|
||||
if(info === null || Validate(info) === false)
|
||||
return;
|
||||
setLoading(true);
|
||||
NotificationConnectorFunctions.CreatePushover(apiUri, info)
|
||||
NotificationConnector.CreatePushover(apiUri, info)
|
||||
.finally(() => setLoading(false));
|
||||
}}>Add</button>
|
||||
<Loader loading={loading} style={{width:"40px",height:"40px",margin:"25vh calc(sin(70)*(50% - 40px))"}}/>
|
||||
</>
|
||||
</div>;
|
||||
}
|
||||
|
||||
function Validate(record: IPushoverRecord) : boolean {
|
||||
if(record.apptoken.length < 1)
|
||||
return false;
|
||||
if(record.user.length < 1)
|
||||
return false;
|
||||
return true;
|
||||
}
|
@ -1,10 +1,10 @@
|
||||
import React, {useEffect} from 'react';
|
||||
import '../styles/footer.css';
|
||||
import JobFunctions from './JobFunctions';
|
||||
import Job from './api/Job';
|
||||
import Icon from '@mdi/react';
|
||||
import {mdiCounter, mdiEyeCheck, mdiRun, mdiTrayFull} from '@mdi/js';
|
||||
import QueuePopUp from "./QueuePopUp";
|
||||
import {JobState, JobType} from "./interfaces/Jobs/IJob";
|
||||
import {JobState, JobType} from "./types/Jobs/IJob";
|
||||
|
||||
export default function Footer({connectedToBackend, apiUri, checkConnectedInterval} : {connectedToBackend: boolean, apiUri: string, checkConnectedInterval: number}) {
|
||||
const [MonitoringJobsCount, setMonitoringJobsCount] = React.useState(0);
|
||||
@ -14,10 +14,10 @@ export default function Footer({connectedToBackend, apiUri, checkConnectedInterv
|
||||
const [countUpdateInterval, setCountUpdateInterval] = React.useState<number | undefined>(undefined);
|
||||
|
||||
function UpdateBackendState(){
|
||||
JobFunctions.GetJobsWithType(apiUri, JobType.DownloadAvailableChaptersJob).then((jobs) => setMonitoringJobsCount(jobs.length));
|
||||
JobFunctions.GetAllJobs(apiUri).then((jobs) => setAllJobsCount(jobs.length));
|
||||
JobFunctions.GetJobsInState(apiUri, JobState.Running).then((jobs) => setRunningJobsCount(jobs.length));
|
||||
JobFunctions.GetJobsInState(apiUri, JobState.Waiting).then((jobs) => setWaitingJobs(jobs.length));
|
||||
Job.GetJobsWithType(apiUri, JobType.DownloadAvailableChaptersJob).then((jobs) => setMonitoringJobsCount(jobs.length));
|
||||
Job.GetAllJobs(apiUri).then((jobs) => setAllJobsCount(jobs.length));
|
||||
Job.GetJobsInState(apiUri, JobState.Running).then((jobs) => setRunningJobsCount(jobs.length));
|
||||
Job.GetJobsInState(apiUri, JobState.Waiting).then((jobs) => setWaitingJobs(jobs.length));
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import '../styles/header.css'
|
||||
import IFrontendSettings from "./interfaces/IFrontendSettings";
|
||||
import Settings from "./Settings";
|
||||
import IFrontendSettings from "./types/IFrontendSettings";
|
||||
|
||||
export default function Header({backendConnected, apiUri, settings, setFrontendSettings} : {backendConnected: boolean, apiUri: string, settings: IFrontendSettings, setFrontendSettings: (settings: IFrontendSettings) => void}){
|
||||
return (
|
||||
|
@ -1,11 +1,11 @@
|
||||
import React, {ReactElement, useEffect, useState} from 'react';
|
||||
import JobFunctions from './JobFunctions';
|
||||
import Job from './api/Job';
|
||||
import '../styles/monitorMangaList.css';
|
||||
import {JobType} from "./interfaces/Jobs/IJob";
|
||||
import {JobType} from "./types/Jobs/IJob";
|
||||
import '../styles/mangaCover.css'
|
||||
import IDownloadAvailableChaptersJob from "./interfaces/Jobs/IDownloadAvailableChaptersJob";
|
||||
import {MangaItem} from "./interfaces/IManga";
|
||||
import MangaFunctions from "./MangaFunctions";
|
||||
import IDownloadAvailableChaptersJob from "./types/Jobs/IDownloadAvailableChaptersJob";
|
||||
import Manga from "./api/Manga";
|
||||
import MangaItem from "./Elements/Manga";
|
||||
|
||||
export default function MonitorJobsList({onStartSearch, connectedToBackend, apiUri, checkConnectedInterval} : {onStartSearch() : void, connectedToBackend: boolean, apiUri: string, checkConnectedInterval: number}) {
|
||||
const [MonitoringJobs, setMonitoringJobs] = useState<IDownloadAvailableChaptersJob[]>([]);
|
||||
@ -29,7 +29,7 @@ export default function MonitorJobsList({onStartSearch, connectedToBackend, apiU
|
||||
if(!connectedToBackend)
|
||||
return;
|
||||
//console.debug("Updating MonitoringJobsList");
|
||||
JobFunctions.GetJobsWithType(apiUri, JobType.DownloadAvailableChaptersJob)
|
||||
Job.GetJobsWithType(apiUri, JobType.DownloadAvailableChaptersJob)
|
||||
.then((jobs) => jobs as IDownloadAvailableChaptersJob[])
|
||||
.then((jobs) => {
|
||||
if(jobs.length != MonitoringJobs.length ||
|
||||
@ -57,7 +57,7 @@ export default function MonitorJobsList({onStartSearch, connectedToBackend, apiU
|
||||
<MangaItem apiUri={apiUri} mangaId={MonitoringJob.mangaId} key={MonitoringJob.mangaId}>
|
||||
<></>
|
||||
<button className="Manga-DeleteButton" onClick={() => {
|
||||
MangaFunctions.DeleteManga(apiUri, MonitoringJob.mangaId);
|
||||
Manga.DeleteManga(apiUri, MonitoringJob.mangaId);
|
||||
}}>Delete</button>
|
||||
</MangaItem>
|
||||
)}
|
||||
|
@ -1,10 +1,10 @@
|
||||
import React, {ReactElement, useEffect, useState} from 'react';
|
||||
import IJob, {JobState, JobType} from "./interfaces/Jobs/IJob";
|
||||
import IJob, {JobState, JobType} from "./types/Jobs/IJob";
|
||||
import '../styles/queuePopUp.css';
|
||||
import '../styles/popup.css';
|
||||
import JobFunctions from "./JobFunctions";
|
||||
import IDownloadSingleChapterJob from "./interfaces/Jobs/IDownloadSingleChapterJob";
|
||||
import {ChapterItem} from "./interfaces/IChapter";
|
||||
import Job from "./api/Job";
|
||||
import IDownloadSingleChapterJob from "./types/Jobs/IDownloadSingleChapterJob";
|
||||
import ChapterItem from "./Elements/Chapter";
|
||||
|
||||
export default function QueuePopUp({connectedToBackend, children, apiUri, checkConnectedInterval} : {connectedToBackend: boolean, children: ReactElement[], apiUri: string, checkConnectedInterval: number}) {
|
||||
|
||||
@ -28,13 +28,13 @@ export default function QueuePopUp({connectedToBackend, children, apiUri, checkC
|
||||
}, [connectedToBackend, showQueuePopup]);
|
||||
|
||||
function UpdateMonitoringJobsList(){
|
||||
JobFunctions.GetJobsInState(apiUri, JobState.Waiting)
|
||||
Job.GetJobsInState(apiUri, JobState.Waiting)
|
||||
.then((jobs: IJob[]) => {
|
||||
//console.log(jobs);
|
||||
return jobs;
|
||||
})
|
||||
.then(setWaitingJobs);
|
||||
JobFunctions.GetJobsInState(apiUri, JobState.Running)
|
||||
Job.GetJobsInState(apiUri, JobState.Running)
|
||||
.then((jobs: IJob[]) => {
|
||||
//console.log(jobs);
|
||||
return jobs;
|
||||
|
@ -1,14 +1,15 @@
|
||||
import React, {ChangeEventHandler, EventHandler, useEffect, useState} from 'react';
|
||||
import {MangaConnectorFunctions} from "./MangaConnectorFunctions";
|
||||
import IMangaConnector from "./interfaces/IMangaConnector";
|
||||
import {MangaConnector} from "./api/MangaConnector";
|
||||
import IMangaConnector from "./types/IMangaConnector";
|
||||
import {isValidUri} from "../App";
|
||||
import IManga, {MangaItem} from "./interfaces/IManga";
|
||||
import '../styles/search.css';
|
||||
import SearchFunctions from "./SearchFunctions";
|
||||
import JobFunctions from "./JobFunctions";
|
||||
import ILocalLibrary from "./interfaces/ILocalLibrary";
|
||||
import LocalLibraryFunctions from "./LocalLibraryFunctions";
|
||||
import Job from "./api/Job";
|
||||
import LocalLibrary from "./api/LocalLibrary";
|
||||
import Loader from "./Loader";
|
||||
import IManga from "./types/IManga";
|
||||
import SearchFunctions from "./api/Search";
|
||||
import ILocalLibrary from "./types/ILocalLibrary";
|
||||
import MangaItem from "./Elements/Manga";
|
||||
|
||||
export default function Search({apiUri, jobInterval, closeSearch} : {apiUri: string, jobInterval: Date, closeSearch(): void}) {
|
||||
let [loading, setLoading] = useState<boolean>(true);
|
||||
@ -21,7 +22,7 @@ export default function Search({apiUri, jobInterval, closeSearch} : {apiUri: str
|
||||
const pattern = /https:\/\/([a-z0-9.]+\.[a-z0-9]{2,})(?:\/.*)?/i
|
||||
|
||||
useEffect(() => {
|
||||
MangaConnectorFunctions.GetAllConnectors(apiUri).then((connectors)=> {
|
||||
MangaConnector.GetAllConnectors(apiUri).then((connectors)=> {
|
||||
return connectors.filter(c => c.enabled);
|
||||
}).then(setConnectors).then(() => setLoading(false));
|
||||
}, []);
|
||||
@ -99,7 +100,7 @@ export default function Search({apiUri, jobInterval, closeSearch} : {apiUri: str
|
||||
let [selectedLibrary, setSelectedLibrary] = useState<ILocalLibrary | null>(null);
|
||||
let [libraries, setLibraries] = useState<ILocalLibrary[] | null>(null);
|
||||
useEffect(() => {
|
||||
LocalLibraryFunctions.GetLibraries(apiUri).then(setLibraries);
|
||||
LocalLibrary.GetLibraries(apiUri).then(setLibraries);
|
||||
}, []);
|
||||
useEffect(() => {
|
||||
if(libraries === null || libraries.length < 1)
|
||||
@ -147,7 +148,7 @@ export default function Search({apiUri, jobInterval, closeSearch} : {apiUri: str
|
||||
: libraries.map(library => <option key={library.localLibraryId} value={library.localLibraryId}>{library.libraryName} ({library.basePath})</option>)}
|
||||
</select>
|
||||
<button className="Manga-AddButton" onClick={() => {
|
||||
JobFunctions.CreateDownloadAvailableChaptersJob(apiUri, result.mangaId, {recurrenceTimeMs: new Date(jobInterval).getTime(), localLibraryId: selectedLibrary!.localLibraryId});
|
||||
Job.CreateDownloadAvailableChaptersJob(apiUri, result.mangaId, {recurrenceTimeMs: new Date(jobInterval).getTime(), localLibraryId: selectedLibrary!.localLibraryId});
|
||||
}}>Monitor</button>
|
||||
</MangaItem>
|
||||
})
|
||||
|
@ -1,18 +1,20 @@
|
||||
import IFrontendSettings from "./interfaces/IFrontendSettings";
|
||||
import '../styles/settings.css';
|
||||
import '../styles/react-toggle.css';
|
||||
import React, {useEffect, useRef, useState} from "react";
|
||||
import INotificationConnector, {NotificationConnectorItem} from "./interfaces/INotificationConnector";
|
||||
import NotificationConnectorFunctions from "./NotificationConnectorFunctions";
|
||||
import ILocalLibrary, {LocalLibraryItem} from "./interfaces/ILocalLibrary";
|
||||
import LocalLibraryFunctions from "./LocalLibraryFunctions";
|
||||
import IBackendSettings from "./interfaces/IBackendSettings";
|
||||
import BackendSettings from "./BackendSettingsFunctions";
|
||||
import NotificationConnector from "./api/NotificationConnector";
|
||||
import IBackendSettings from "./types/IBackendSettings";
|
||||
import BackendSettings from "./api/BackendSettings";
|
||||
import Toggle from "react-toggle";
|
||||
import Loader from "./Loader";
|
||||
import {RequestType} from "./interfaces/IRequestLimits";
|
||||
import IMangaConnector from "./interfaces/IMangaConnector";
|
||||
import {MangaConnectorFunctions} from "./MangaConnectorFunctions";
|
||||
import IMangaConnector from "./types/IMangaConnector";
|
||||
import {MangaConnector} from "./api/MangaConnector";
|
||||
import IFrontendSettings from "./types/IFrontendSettings";
|
||||
import INotificationConnector from "./types/INotificationConnector";
|
||||
import ILocalLibrary from "./types/ILocalLibrary";
|
||||
import LocalLibrary from "./api/LocalLibrary";
|
||||
import {RequestLimitType} from "./types/EnumRequestLimitType";
|
||||
import NotificationConnectorItem from "./Elements/NotificationConnector";
|
||||
import LocalLibraryItem from "./Elements/LocalLibrary";
|
||||
|
||||
export default function Settings({ backendConnected, apiUri, frontendSettings, setFrontendSettings } : {
|
||||
backendConnected: boolean,
|
||||
@ -31,10 +33,10 @@ export default function Settings({ backendConnected, apiUri, frontendSettings, s
|
||||
useEffect(() => {
|
||||
if(!backendConnected)
|
||||
return;
|
||||
NotificationConnectorFunctions.GetNotificationConnectors(apiUri).then(setNotificationConnectors);
|
||||
LocalLibraryFunctions.GetLibraries(apiUri).then(setLocalLibraries);
|
||||
NotificationConnector.GetNotificationConnectors(apiUri).then(setNotificationConnectors);
|
||||
LocalLibrary.GetLibraries(apiUri).then(setLocalLibraries);
|
||||
BackendSettings.GetSettings(apiUri).then(setBackendSettings);
|
||||
MangaConnectorFunctions.GetAllConnectors(apiUri).then(setMangaConnectors);
|
||||
MangaConnector.GetAllConnectors(apiUri).then(setMangaConnectors);
|
||||
}, [backendConnected, showSettings]);
|
||||
|
||||
const dateToStr = (x: Date) => {
|
||||
@ -44,7 +46,7 @@ export default function Settings({ backendConnected, apiUri, frontendSettings, s
|
||||
return ret;
|
||||
}
|
||||
|
||||
const ChangeRequestLimit = (requestType: RequestType, limit: number) => {
|
||||
const ChangeRequestLimit = (requestType: RequestLimitType, limit: number) => {
|
||||
if(backendSettings === null)
|
||||
return;
|
||||
setLoadingBackend(true);
|
||||
@ -150,22 +152,22 @@ export default function Settings({ backendConnected, apiUri, frontendSettings, s
|
||||
<h3>Request Limits:</h3>
|
||||
<label htmlFor="Default">Default</label>
|
||||
<input id="Default" type="number" defaultValue={backendSettings ? backendSettings.requestLimits.Default : 0} disabled={backendSettings ? false : !loadingBackend}
|
||||
onChange={(e) => ChangeRequestLimit(RequestType.Default, e.currentTarget.valueAsNumber)} />
|
||||
onChange={(e) => ChangeRequestLimit(RequestLimitType.Default, e.currentTarget.valueAsNumber)} />
|
||||
<label htmlFor="MangaInfo">MangaInfo</label>
|
||||
<input id="MangaInfo" type="number" defaultValue={backendSettings ? backendSettings.requestLimits.MangaInfo : 0} disabled={backendSettings ? false : !loadingBackend}
|
||||
onChange={(e) => ChangeRequestLimit(RequestType.MangaInfo, e.currentTarget.valueAsNumber)} />
|
||||
onChange={(e) => ChangeRequestLimit(RequestLimitType.MangaInfo, e.currentTarget.valueAsNumber)} />
|
||||
<label htmlFor="MangaDexFeed">MangaDexFeed</label>
|
||||
<input id="MangaDexFeed" type="number" defaultValue={backendSettings ? backendSettings.requestLimits.MangaDexFeed : 0} disabled={backendSettings ? false : !loadingBackend}
|
||||
onChange={(e) => ChangeRequestLimit(RequestType.MangaDexFeed, e.currentTarget.valueAsNumber)} />
|
||||
onChange={(e) => ChangeRequestLimit(RequestLimitType.MangaDexFeed, e.currentTarget.valueAsNumber)} />
|
||||
<label htmlFor="MangaDexImage">MangaDexImage</label>
|
||||
<input id="MangaDexImage" type="number" defaultValue={backendSettings ? backendSettings.requestLimits.MangaDexImage : 0} disabled={backendSettings ? false : !loadingBackend}
|
||||
onChange={(e) => ChangeRequestLimit(RequestType.MangaDexImage, e.currentTarget.valueAsNumber)} />
|
||||
onChange={(e) => ChangeRequestLimit(RequestLimitType.MangaDexImage, e.currentTarget.valueAsNumber)} />
|
||||
<label htmlFor="MangaImage">MangaImage</label>
|
||||
<input id="MangaImage" type="number" defaultValue={backendSettings ? backendSettings.requestLimits.MangaImage : 0} disabled={backendSettings ? false : !loadingBackend}
|
||||
onChange={(e) => ChangeRequestLimit(RequestType.MangaImage, e.currentTarget.valueAsNumber)} />
|
||||
onChange={(e) => ChangeRequestLimit(RequestLimitType.MangaImage, e.currentTarget.valueAsNumber)} />
|
||||
<label htmlFor="MangaCover">MangaCover</label>
|
||||
<input id="MangaCover" type="number" defaultValue={backendSettings ? backendSettings.requestLimits.MangaCover : 0} disabled={backendSettings ? false : !loadingBackend}
|
||||
onChange={(e) => ChangeRequestLimit(RequestType.MangaCover, e.currentTarget.valueAsNumber)} />
|
||||
onChange={(e) => ChangeRequestLimit(RequestLimitType.MangaCover, e.currentTarget.valueAsNumber)} />
|
||||
</div>
|
||||
<div className={"settings-mangaConnectors"}>
|
||||
{mangaConnectors.map(mc => {
|
||||
@ -173,7 +175,7 @@ export default function Settings({ backendConnected, apiUri, frontendSettings, s
|
||||
<div key={mc.name}>
|
||||
<span>{mc.name}</span>
|
||||
<Toggle defaultChecked={mc.enabled} onChange={(e) => {
|
||||
MangaConnectorFunctions.SetConnectorEnabled(apiUri, mc.name, e.currentTarget.checked);
|
||||
MangaConnector.SetConnectorEnabled(apiUri, mc.name, e.currentTarget.checked);
|
||||
}} />
|
||||
</div>);
|
||||
})}
|
||||
|
@ -1,6 +1,7 @@
|
||||
import {deleteData, getData, patchData} from "../App";
|
||||
import IRequestLimits, {RequestType} from "./interfaces/IRequestLimits";
|
||||
import IBackendSettings from "./interfaces/IBackendSettings";
|
||||
import {deleteData, getData, patchData} from "../../App";
|
||||
import IRequestLimits from "../types/IRequestLimits";
|
||||
import IBackendSettings from "../types/IBackendSettings";
|
||||
import {RequestLimitType} from "../types/EnumRequestLimitType";
|
||||
|
||||
export default class BackendSettings {
|
||||
static async GetSettings(apiUri: string) : Promise<IBackendSettings> {
|
||||
@ -27,11 +28,11 @@ export default class BackendSettings {
|
||||
return deleteData(`${apiUri}/v2/Settings/RequestLimits`);
|
||||
}
|
||||
|
||||
static async UpdateRequestLimit(apiUri: string, requestType: RequestType, value: number) {
|
||||
static async UpdateRequestLimit(apiUri: string, requestType: RequestLimitType, value: number) {
|
||||
return patchData(`${apiUri}/v2/Settings/RequestLimits/${requestType}`, value);
|
||||
}
|
||||
|
||||
static async ResetRequestLimit(apiUri: string, requestType: RequestType) {
|
||||
static async ResetRequestLimit(apiUri: string, requestType: RequestLimitType) {
|
||||
return deleteData(`${apiUri}/v2/Settings/RequestLimits/${requestType}`);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import {getData} from "../App";
|
||||
import IChapter from "./interfaces/IChapter";
|
||||
import {getData} from "../../App";
|
||||
import IChapter from "../types/IChapter";
|
||||
|
||||
export default class ChapterFunctions {
|
||||
export default class Chapter {
|
||||
|
||||
static async GetChapterFromId(apiUri: string, chapterId: string): Promise<IChapter> {
|
||||
if(chapterId === undefined || chapterId === null) {
|
||||
@ -10,7 +10,7 @@ export default class ChapterFunctions {
|
||||
}
|
||||
return getData(`${apiUri}/v2/Query/Chapter/${chapterId}`)
|
||||
.then((json) => {
|
||||
//console.info("Got all MangaFunctions");
|
||||
//console.info("Got all Manga");
|
||||
const ret = json as IChapter;
|
||||
//console.debug(ret);
|
||||
return (ret);
|
@ -1,9 +1,5 @@
|
||||
import {Cookies} from "react-cookie";
|
||||
|
||||
export default interface IFrontendSettings {
|
||||
jobInterval: Date;
|
||||
apiUri: string;
|
||||
}
|
||||
import IFrontendSettings from "../types/IFrontendSettings";
|
||||
|
||||
export function LoadFrontendSettings(): IFrontendSettings {
|
||||
const cookies = new Cookies();
|
@ -1,9 +1,9 @@
|
||||
import {deleteData, getData, patchData, postData, putData} from '../App';
|
||||
import IJob, {JobState, JobType} from "./interfaces/Jobs/IJob";
|
||||
import IModifyJobRecord from "./interfaces/records/IModifyJobRecord";
|
||||
import IDownloadAvailableJobsRecord from "./interfaces/records/IDownloadAvailableJobsRecord";
|
||||
import {deleteData, getData, patchData, postData, putData} from '../../App';
|
||||
import IJob, {JobState, JobType} from "../types/Jobs/IJob";
|
||||
import IModifyJobRecord from "../types/records/IModifyJobRecord";
|
||||
import IDownloadAvailableJobsRecord from "../types/records/IDownloadAvailableJobsRecord";
|
||||
|
||||
export default class JobFunctions
|
||||
export default class Job
|
||||
{
|
||||
static IntervalStringFromDate(date: Date) : string {
|
||||
let x = new Date(date);
|
||||
@ -82,10 +82,10 @@ export default class JobFunctions
|
||||
console.error(`JobId was not provided`);
|
||||
return Promise.reject();
|
||||
}
|
||||
//console.info(`Getting JobFunctions ${jobId}`);
|
||||
//console.info(`Getting Job ${jobId}`);
|
||||
return getData(`${apiUri}/v2/Job/${jobId}`)
|
||||
.then((json) => {
|
||||
//console.info(`Got JobFunctions ${jobId}`);
|
||||
//console.info(`Got Job ${jobId}`);
|
||||
const ret = json as IJob;
|
||||
//console.debug(ret);
|
||||
return (ret);
|
||||
@ -111,7 +111,7 @@ export default class JobFunctions
|
||||
}
|
||||
return patchData(`${apiUri}/v2/Job/${jobId}`, modifyData)
|
||||
.then((json) => {
|
||||
//console.info(`Got JobFunctions ${jobId}`);
|
||||
//console.info(`Got Job ${jobId}`);
|
||||
const ret = json as IJob;
|
||||
//console.debug(ret);
|
||||
return (ret);
|
||||
@ -129,7 +129,7 @@ export default class JobFunctions
|
||||
}
|
||||
return putData(`${apiUri}/v2/Job/DownloadAvailableChaptersJob/${mangaId}`, data)
|
||||
.then((json) => {
|
||||
//console.info(`Got JobFunctions ${jobId}`);
|
||||
//console.info(`Got Job ${jobId}`);
|
||||
const ret = json as string[];
|
||||
//console.debug(ret);
|
||||
return (ret);
|
||||
@ -143,7 +143,7 @@ export default class JobFunctions
|
||||
}
|
||||
return putData(`${apiUri}/v2/Job/DownloadSingleChapterJob/${chapterId}`, {})
|
||||
.then((json) => {
|
||||
//console.info(`Got JobFunctions ${jobId}`);
|
||||
//console.info(`Got Job ${jobId}`);
|
||||
const ret = json as string[];
|
||||
//console.debug(ret);
|
||||
return (ret);
|
||||
@ -157,7 +157,7 @@ export default class JobFunctions
|
||||
}
|
||||
return putData(`${apiUri}/v2/Job/UpdateFilesJob/${mangaId}`, {})
|
||||
.then((json) => {
|
||||
//console.info(`Got JobFunctions ${jobId}`);
|
||||
//console.info(`Got Job ${jobId}`);
|
||||
const ret = json as string[];
|
||||
//console.debug(ret);
|
||||
return (ret);
|
||||
@ -167,7 +167,7 @@ export default class JobFunctions
|
||||
static async CreateUpdateAllFilesJob(apiUri: string): Promise<string[]> {
|
||||
return putData(`${apiUri}/v2/Job/UpdateAllFilesJob`, {})
|
||||
.then((json) => {
|
||||
//console.info(`Got JobFunctions ${jobId}`);
|
||||
//console.info(`Got Job ${jobId}`);
|
||||
const ret = json as string[];
|
||||
//console.debug(ret);
|
||||
return (ret);
|
||||
@ -181,7 +181,7 @@ export default class JobFunctions
|
||||
}
|
||||
return putData(`${apiUri}/v2/Job/UpdateMetadataJob/${mangaId}`, {})
|
||||
.then((json) => {
|
||||
//console.info(`Got JobFunctions ${jobId}`);
|
||||
//console.info(`Got Job ${jobId}`);
|
||||
const ret = json as string[];
|
||||
//console.debug(ret);
|
||||
return (ret);
|
||||
@ -191,7 +191,7 @@ export default class JobFunctions
|
||||
static async CreateUpdateAllMetadataJob(apiUri: string): Promise<string[]> {
|
||||
return putData(`${apiUri}/v2/Job/UpdateAllMetadataJob`, {})
|
||||
.then((json) => {
|
||||
//console.info(`Got JobFunctions ${jobId}`);
|
||||
//console.info(`Got Job ${jobId}`);
|
||||
const ret = json as string[];
|
||||
//console.debug(ret);
|
||||
return (ret);
|
@ -1,8 +1,8 @@
|
||||
import ILocalLibrary from "./interfaces/ILocalLibrary";
|
||||
import {deleteData, getData, patchData, putData} from "../App";
|
||||
import INewLibraryRecord from "./interfaces/records/INewLibraryRecord";
|
||||
import {deleteData, getData, patchData, putData} from "../../App";
|
||||
import INewLibraryRecord from "../types/records/INewLibraryRecord";
|
||||
import ILocalLibrary from "../types/ILocalLibrary";
|
||||
|
||||
export default class LocalLibraryFunctions
|
||||
export default class LocalLibrary
|
||||
{
|
||||
static async GetLibraries(apiUri: string): Promise<ILocalLibrary[]> {
|
||||
return getData(`${apiUri}/v2/LocalLibraries`)
|
@ -1,14 +1,14 @@
|
||||
import IManga from './interfaces/IManga';
|
||||
import {deleteData, getData, patchData, postData} from '../App';
|
||||
import IChapter from "./interfaces/IChapter";
|
||||
import {deleteData, getData, patchData, postData} from '../../App';
|
||||
import IManga from "../types/IManga";
|
||||
import IChapter from "../types/IChapter";
|
||||
|
||||
export default class MangaFunctions
|
||||
export default class Manga
|
||||
{
|
||||
static async GetAllManga(apiUri: string): Promise<IManga[]> {
|
||||
//console.info("Getting all MangaFunctions");
|
||||
//console.info("Getting all Manga");
|
||||
return getData(`${apiUri}/v2/Manga`)
|
||||
.then((json) => {
|
||||
//console.info("Got all MangaFunctions");
|
||||
//console.info("Got all Manga");
|
||||
const ret = json as IManga[];
|
||||
//console.debug(ret);
|
||||
return (ret);
|
||||
@ -23,7 +23,7 @@ export default class MangaFunctions
|
||||
//console.debug(`Getting Mangas ${internalIds.join(",")}`);
|
||||
return await postData(`${apiUri}/v2/Manga/WithIds`, mangaIds)
|
||||
.then((json) => {
|
||||
//console.debug(`Got MangaFunctions ${internalIds.join(",")}`);
|
||||
//console.debug(`Got Manga ${internalIds.join(",")}`);
|
||||
const ret = json as IManga[];
|
||||
//console.debug(ret);
|
||||
return (ret);
|
||||
@ -35,10 +35,10 @@ export default class MangaFunctions
|
||||
console.error(`mangaId was not provided`);
|
||||
return Promise.reject();
|
||||
}
|
||||
//console.info(`Getting MangaFunctions ${internalId}`);
|
||||
//console.info(`Getting Manga ${internalId}`);
|
||||
return await getData(`${apiUri}/v2/Manga/${mangaId}`)
|
||||
.then((json) => {
|
||||
//console.info(`Got MangaFunctions ${internalId}`);
|
||||
//console.info(`Got Manga ${internalId}`);
|
||||
const ret = json as IManga;
|
||||
//console.debug(ret);
|
||||
return (ret);
|
||||
@ -54,7 +54,7 @@ export default class MangaFunctions
|
||||
}
|
||||
|
||||
static GetMangaCoverImageUrl(apiUri: string, mangaId: string, ref: HTMLImageElement | undefined): string {
|
||||
//console.debug(`Getting MangaFunctions Cover-Url ${internalId}`);
|
||||
//console.debug(`Getting Manga Cover-Url ${internalId}`);
|
||||
if(ref == null || ref == undefined)
|
||||
return `${apiUri}/v2/Manga/${mangaId}/Cover?width=64&height=64`;
|
||||
return `${apiUri}/v2/Manga/${mangaId}/Cover?width=${ref.clientWidth}&height=${ref.clientHeight}`;
|
||||
@ -67,7 +67,7 @@ export default class MangaFunctions
|
||||
}
|
||||
return getData(`${apiUri}/v2/Manga/${mangaId}/Chapters`)
|
||||
.then((json) => {
|
||||
//console.info(`Got MangaFunctions ${internalId}`);
|
||||
//console.info(`Got Manga ${internalId}`);
|
||||
const ret = json as IChapter[];
|
||||
//console.debug(ret);
|
||||
return (ret);
|
||||
@ -81,7 +81,7 @@ export default class MangaFunctions
|
||||
}
|
||||
return getData(`${apiUri}/v2/Manga/${mangaId}/Chapters/Downloaded`)
|
||||
.then((json) => {
|
||||
//console.info(`Got MangaFunctions ${internalId}`);
|
||||
//console.info(`Got Manga ${internalId}`);
|
||||
const ret = json as IChapter[];
|
||||
//console.debug(ret);
|
||||
return (ret);
|
||||
@ -95,7 +95,7 @@ export default class MangaFunctions
|
||||
}
|
||||
return getData(`${apiUri}/v2/Manga/${mangaId}/Chapters/NotDownloaded`)
|
||||
.then((json) => {
|
||||
//console.info(`Got MangaFunctions ${internalId}`);
|
||||
//console.info(`Got Manga ${internalId}`);
|
||||
const ret = json as IChapter[];
|
||||
//console.debug(ret);
|
||||
return (ret);
|
||||
@ -109,7 +109,7 @@ export default class MangaFunctions
|
||||
}
|
||||
return getData(`${apiUri}/v2/Manga/${mangaId}/Chapter/LatestAvailable`)
|
||||
.then((json) => {
|
||||
//console.info(`Got MangaFunctions ${internalId}`);
|
||||
//console.info(`Got Manga ${internalId}`);
|
||||
const ret = json as IChapter;
|
||||
//console.debug(ret);
|
||||
return (ret);
|
||||
@ -123,7 +123,7 @@ export default class MangaFunctions
|
||||
}
|
||||
return getData(`${apiUri}/v2/Manga/${mangaId}/Chapter/LatestDownloaded`)
|
||||
.then((json) => {
|
||||
//console.info(`Got MangaFunctions ${internalId}`);
|
||||
//console.info(`Got Manga ${internalId}`);
|
||||
const ret = json as IChapter;
|
||||
//console.debug(ret);
|
||||
return (ret);
|
@ -1,7 +1,7 @@
|
||||
import IMangaConnector from './interfaces/IMangaConnector';
|
||||
import {getData, patchData} from '../App';
|
||||
import IMangaConnector from '../types/IMangaConnector';
|
||||
import {getData, patchData} from '../../App';
|
||||
|
||||
export class MangaConnectorFunctions
|
||||
export class MangaConnector
|
||||
{
|
||||
static async GetAllConnectors(apiUri: string): Promise<IMangaConnector[]> {
|
||||
//console.info("Getting all MangaConnectors");
|
@ -1,11 +1,11 @@
|
||||
import INotificationConnector from "./interfaces/INotificationConnector";
|
||||
import {deleteData, getData, putData} from "../App";
|
||||
import IGotifyRecord from "./interfaces/records/IGotifyRecord";
|
||||
import INtfyRecord from "./interfaces/records/INtfyRecord";
|
||||
import ILunaseaRecord from "./interfaces/records/ILunaseaRecord";
|
||||
import IPushoverRecord from "./interfaces/records/IPushoverRecord";
|
||||
import {deleteData, getData, putData} from "../../App";
|
||||
import IGotifyRecord from "../types/records/IGotifyRecord";
|
||||
import INtfyRecord from "../types/records/INtfyRecord";
|
||||
import ILunaseaRecord from "../types/records/ILunaseaRecord";
|
||||
import IPushoverRecord from "../types/records/IPushoverRecord";
|
||||
import INotificationConnector from "../types/INotificationConnector";
|
||||
|
||||
export default class NotificationConnectorFunctions {
|
||||
export default class NotificationConnector {
|
||||
|
||||
static async GetNotificationConnectors(apiUri: string) : Promise<INotificationConnector[]> {
|
||||
//console.info("Getting Notification Connectors");
|
@ -1,5 +1,5 @@
|
||||
import IManga from "./interfaces/IManga";
|
||||
import {postData} from "../App";
|
||||
import {postData} from "../../App";
|
||||
import IManga from "../types/IManga";
|
||||
|
||||
export default class SearchFunctions {
|
||||
|
@ -1,17 +0,0 @@
|
||||
export default interface IRequestLimits {
|
||||
Default: number;
|
||||
MangaDexFeed: number;
|
||||
MangaImage: number;
|
||||
MangaCover: number;
|
||||
MangaDexImage: number;
|
||||
MangaInfo: number;
|
||||
}
|
||||
|
||||
export enum RequestType {
|
||||
Default = "Default",
|
||||
MangaDexFeed = "MangaDexFeed",
|
||||
MangaImage = "MangaImage",
|
||||
MangaCover = "MangaCover",
|
||||
MangaDexImage = "MangaDexImage",
|
||||
MangaInfo = "MangaInfo"
|
||||
}
|
4
Website/modules/types/EnumLibraryType.ts
Normal file
4
Website/modules/types/EnumLibraryType.ts
Normal file
@ -0,0 +1,4 @@
|
||||
export enum LibraryType {
|
||||
Komga = "Komga",
|
||||
Kavita = "Kavita"
|
||||
}
|
7
Website/modules/types/EnumMangaReleaseStatus.ts
Normal file
7
Website/modules/types/EnumMangaReleaseStatus.ts
Normal file
@ -0,0 +1,7 @@
|
||||
export enum MangaReleaseStatus {
|
||||
Continuing = "Continuing",
|
||||
Completed = "Completed",
|
||||
OnHiatus = "OnHiatus",
|
||||
Cancelled = "Cancelled",
|
||||
Unreleased = "Unreleased",
|
||||
}
|
8
Website/modules/types/EnumRequestLimitType.ts
Normal file
8
Website/modules/types/EnumRequestLimitType.ts
Normal file
@ -0,0 +1,8 @@
|
||||
export enum RequestLimitType {
|
||||
Default = "Default",
|
||||
MangaDexFeed = "MangaDexFeed",
|
||||
MangaImage = "MangaImage",
|
||||
MangaCover = "MangaCover",
|
||||
MangaDexImage = "MangaDexImage",
|
||||
MangaInfo = "MangaInfo"
|
||||
}
|
4
Website/modules/types/IAuthor.ts
Normal file
4
Website/modules/types/IAuthor.ts
Normal file
@ -0,0 +1,4 @@
|
||||
export default interface IAuthor {
|
||||
authorId: string;
|
||||
authorName: string;
|
||||
}
|
10
Website/modules/types/IChapter.ts
Normal file
10
Website/modules/types/IChapter.ts
Normal file
@ -0,0 +1,10 @@
|
||||
export default interface IChapter{
|
||||
chapterId: string;
|
||||
volumeNumber: number;
|
||||
chapterNumber: string;
|
||||
url: string;
|
||||
title: string | undefined;
|
||||
archiveFileName: string;
|
||||
downloaded: boolean;
|
||||
parentMangaId: string;
|
||||
}
|
4
Website/modules/types/IFrontendSettings.ts
Normal file
4
Website/modules/types/IFrontendSettings.ts
Normal file
@ -0,0 +1,4 @@
|
||||
export default interface IFrontendSettings {
|
||||
jobInterval: Date;
|
||||
apiUri: string;
|
||||
}
|
@ -1,11 +1,8 @@
|
||||
import {LibraryType} from "./EnumLibraryType";
|
||||
|
||||
export default interface ILibraryConnector {
|
||||
libraryConnectorId: string;
|
||||
libraryType: LibraryType;
|
||||
baseUrl: string;
|
||||
auth: string;
|
||||
}
|
||||
|
||||
export enum LibraryType {
|
||||
Komga = "Komga",
|
||||
Kavita = "Kavita"
|
||||
}
|
5
Website/modules/types/ILink.ts
Normal file
5
Website/modules/types/ILink.ts
Normal file
@ -0,0 +1,5 @@
|
||||
export default interface ILink {
|
||||
linkId: string;
|
||||
linkProvider: string;
|
||||
linkUrl: string;
|
||||
}
|
5
Website/modules/types/ILocalLibrary.ts
Normal file
5
Website/modules/types/ILocalLibrary.ts
Normal file
@ -0,0 +1,5 @@
|
||||
export default interface ILocalLibrary {
|
||||
localLibraryId: string;
|
||||
basePath: string;
|
||||
libraryName: string;
|
||||
}
|
19
Website/modules/types/IManga.ts
Normal file
19
Website/modules/types/IManga.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import {MangaReleaseStatus} from "./EnumMangaReleaseStatus";
|
||||
|
||||
export default interface IManga{
|
||||
mangaId: string;
|
||||
idOnConnectorSite: string;
|
||||
name: string;
|
||||
description: string;
|
||||
websiteUrl: string;
|
||||
year: number;
|
||||
originalLanguage: string;
|
||||
releaseStatus: MangaReleaseStatus;
|
||||
folderName: string;
|
||||
ignoreChapterBefore: number;
|
||||
mangaConnectorId: string;
|
||||
authorIds: string[];
|
||||
tags: string[];
|
||||
linkIds: string[];
|
||||
altTitleIds: string[];
|
||||
}
|
5
Website/modules/types/IMangaAltTitle.ts
Normal file
5
Website/modules/types/IMangaAltTitle.ts
Normal file
@ -0,0 +1,5 @@
|
||||
export default interface IMangaAltTitle {
|
||||
altTitleId: string;
|
||||
language: string;
|
||||
title: string;
|
||||
}
|
7
Website/modules/types/INotificationConnector.ts
Normal file
7
Website/modules/types/INotificationConnector.ts
Normal file
@ -0,0 +1,7 @@
|
||||
export default interface INotificationConnector {
|
||||
name: string;
|
||||
url: string;
|
||||
headers: Record<string, string>[];
|
||||
httpMethod: string;
|
||||
body: string;
|
||||
}
|
8
Website/modules/types/IRequestLimits.ts
Normal file
8
Website/modules/types/IRequestLimits.ts
Normal file
@ -0,0 +1,8 @@
|
||||
export default interface IRequestLimits {
|
||||
Default: number;
|
||||
MangaDexFeed: number;
|
||||
MangaImage: number;
|
||||
MangaCover: number;
|
||||
MangaDexImage: number;
|
||||
MangaInfo: number;
|
||||
}
|
8
Website/modules/types/records/IGotifyRecord.ts
Normal file
8
Website/modules/types/records/IGotifyRecord.ts
Normal file
@ -0,0 +1,8 @@
|
||||
import "../../../styles/notificationConnector.css";
|
||||
import {isValidUri} from "../../../App";
|
||||
|
||||
export default interface IGotifyRecord {
|
||||
endpoint: string;
|
||||
appToken: string;
|
||||
priority: number;
|
||||
}
|
8
Website/modules/types/records/ILunaseaRecord.ts
Normal file
8
Website/modules/types/records/ILunaseaRecord.ts
Normal file
@ -0,0 +1,8 @@
|
||||
import {ReactElement, useState} from "react";
|
||||
import NotificationConnector from "../../api/NotificationConnector";
|
||||
import Loader from "../../Loader";
|
||||
import "../../../styles/notificationConnector.css";
|
||||
|
||||
export default interface ILunaseaRecord {
|
||||
id: string;
|
||||
}
|
9
Website/modules/types/records/INtfyRecord.ts
Normal file
9
Website/modules/types/records/INtfyRecord.ts
Normal file
@ -0,0 +1,9 @@
|
||||
import "../../../styles/notificationConnector.css";
|
||||
|
||||
export default interface INtfyRecord {
|
||||
endpoint: string;
|
||||
username: string;
|
||||
password: string;
|
||||
topic: string;
|
||||
priority: number;
|
||||
}
|
6
Website/modules/types/records/IPushoverRecord.tsx
Normal file
6
Website/modules/types/records/IPushoverRecord.tsx
Normal file
@ -0,0 +1,6 @@
|
||||
import "../../../styles/notificationConnector.css";
|
||||
|
||||
export default interface IPushoverRecord {
|
||||
apptoken: string;
|
||||
user: string;
|
||||
}
|
Reference in New Issue
Block a user