diff --git a/README.md b/README.md index f2f3e54..7b0dc9e 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@

Tranga-Website

- Automatic Manga and Metadata downloader + Automatic MangaFunctions and Metadata downloader

This is the Website for Tranga (API) @@ -46,7 +46,7 @@ | Search | SearchResults | Default-View | |----------------------------------------------------------------------------|---------------------------------------------------------------------------------|----------------------------------------------------------------------------| | ![Image](Screenshots/Screenshot%202025-03-14%20at%2000-53-15%20Tranga.png) | ![Image](Screenshots/Screenshot%202025-03-14%20at%2000-54-59%20Tranga.png) | ![Image](Screenshots/Screenshot%202025-03-14%20at%2000-55-13%20Tranga.png) | -| Search opens with click on "Add new Manga" | When selecting different connectors, available languages automatically update | Clicking on an Item here will bring up a view with more information | +| Search opens with click on "Add new MangaFunctions" | When selecting different connectors, available languages automatically update | Clicking on an Item here will bring up a view with more information | ## About The Project diff --git a/Website/modules/Chapter.tsx b/Website/modules/ChapterFunctions.tsx similarity index 85% rename from Website/modules/Chapter.tsx rename to Website/modules/ChapterFunctions.tsx index 6f80ce9..9329497 100644 --- a/Website/modules/Chapter.tsx +++ b/Website/modules/ChapterFunctions.tsx @@ -1,7 +1,7 @@ import {getData} from "../App"; import IChapter from "./interfaces/IChapter"; -export default class Chapter{ +export default class ChapterFunctions { static async GetChapterFromId(apiUri: string, chapterId: string): Promise { if(chapterId === undefined || chapterId === null) { @@ -10,7 +10,7 @@ export default class Chapter{ } return getData(`${apiUri}/v2/Query/Chapter/${chapterId}`) .then((json) => { - //console.info("Got all Manga"); + //console.info("Got all MangaFunctions"); const ret = json as IChapter; //console.debug(ret); return (ret); diff --git a/Website/modules/Footer.tsx b/Website/modules/Footer.tsx index e565910..74955dc 100644 --- a/Website/modules/Footer.tsx +++ b/Website/modules/Footer.tsx @@ -1,6 +1,6 @@ import React, {useEffect} from 'react'; import '../styles/footer.css'; -import Job from './Job'; +import JobFunctions from './JobFunctions'; import Icon from '@mdi/react'; import {mdiCounter, mdiEyeCheck, mdiRun, mdiTrayFull} from '@mdi/js'; import QueuePopUp from "./QueuePopUp"; @@ -14,10 +14,10 @@ export default function Footer({connectedToBackend, apiUri} : {connectedToBacken const [countUpdateInterval, setCountUpdateInterval] = React.useState(); function UpdateBackendState(){ - 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)); + 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)); } useEffect(() => { diff --git a/Website/modules/Job.tsx b/Website/modules/JobFunctions.tsx similarity index 92% rename from Website/modules/Job.tsx rename to Website/modules/JobFunctions.tsx index e75f84e..7f1aecc 100644 --- a/Website/modules/Job.tsx +++ b/Website/modules/JobFunctions.tsx @@ -3,7 +3,7 @@ import IJob, {JobState, JobType} from "./interfaces/Jobs/IJob"; import IModifyJobRecord from "./interfaces/records/IModifyJobRecord"; import IDownloadAvailableJobsRecord from "./interfaces/records/IDownloadAvailableJobsRecord"; -export default class Job +export default class JobFunctions { static IntervalStringFromDate(date: Date) : string { let x = new Date(date); @@ -82,10 +82,10 @@ export default class Job console.error(`JobId was not provided`); return Promise.reject(); } - //console.info(`Getting Job ${jobId}`); + //console.info(`Getting JobFunctions ${jobId}`); return getData(`${apiUri}/v2/Job/${jobId}`) .then((json) => { - //console.info(`Got Job ${jobId}`); + //console.info(`Got JobFunctions ${jobId}`); const ret = json as IJob; //console.debug(ret); return (ret); @@ -111,7 +111,7 @@ export default class Job } return patchData(`${apiUri}/v2/Job/${jobId}`, modifyData) .then((json) => { - //console.info(`Got Job ${jobId}`); + //console.info(`Got JobFunctions ${jobId}`); const ret = json as IJob; //console.debug(ret); return (ret); @@ -129,7 +129,7 @@ export default class Job } return putData(`${apiUri}/v2/Job/DownloadAvailableChaptersJob/${mangaId}`, data) .then((json) => { - //console.info(`Got Job ${jobId}`); + //console.info(`Got JobFunctions ${jobId}`); const ret = json as string[]; //console.debug(ret); return (ret); @@ -143,7 +143,7 @@ export default class Job } return putData(`${apiUri}/v2/Job/DownloadSingleChapterJob/${chapterId}`, {}) .then((json) => { - //console.info(`Got Job ${jobId}`); + //console.info(`Got JobFunctions ${jobId}`); const ret = json as string[]; //console.debug(ret); return (ret); @@ -157,7 +157,7 @@ export default class Job } return putData(`${apiUri}/v2/Job/UpdateFilesJob/${mangaId}`, {}) .then((json) => { - //console.info(`Got Job ${jobId}`); + //console.info(`Got JobFunctions ${jobId}`); const ret = json as string[]; //console.debug(ret); return (ret); @@ -167,7 +167,7 @@ export default class Job static async CreateUpdateAllFilesJob(apiUri: string): Promise { return putData(`${apiUri}/v2/Job/UpdateAllFilesJob`, {}) .then((json) => { - //console.info(`Got Job ${jobId}`); + //console.info(`Got JobFunctions ${jobId}`); const ret = json as string[]; //console.debug(ret); return (ret); @@ -181,7 +181,7 @@ export default class Job } return putData(`${apiUri}/v2/Job/UpdateMetadataJob/${mangaId}`, {}) .then((json) => { - //console.info(`Got Job ${jobId}`); + //console.info(`Got JobFunctions ${jobId}`); const ret = json as string[]; //console.debug(ret); return (ret); @@ -191,7 +191,7 @@ export default class Job static async CreateUpdateAllMetadataJob(apiUri: string): Promise { return putData(`${apiUri}/v2/Job/UpdateAllMetadataJob`, {}) .then((json) => { - //console.info(`Got Job ${jobId}`); + //console.info(`Got JobFunctions ${jobId}`); const ret = json as string[]; //console.debug(ret); return (ret); diff --git a/Website/modules/LibraryConnector.tsx b/Website/modules/LibraryConnector.tsx index 219e48a..e69de29 100644 --- a/Website/modules/LibraryConnector.tsx +++ b/Website/modules/LibraryConnector.tsx @@ -1,135 +0,0 @@ -import {deleteData, getData, postData} from "../App"; -import ILibraryConnector from "./interfaces/ILibraryConnector"; - -export default abstract class LibraryConnector -{ - static async GetLibraryConnectors(apiUri: string) : Promise { - //console.info("Getting Library Connectors"); - return getData(`${apiUri}/v2/LibraryConnector`) - .then((json) => { - //console.info("Got Library Connectors"); - const ret = json as ILibraryConnector[]; - //console.debug(ret); - return (ret); - }) - .catch(Promise.reject); - } - public url = ""; - - protected constructor(url: string) { - this.url = url; - } - - public SetUrl(url: string){ - this.url = url; - } - - public abstract Test(apiUri: string) : Promise; - public abstract Reset(apiUri: string) : Promise; - public abstract Create(apiUri: string) : Promise; - protected abstract CheckConnector() : boolean; - - protected async TestConnector(apiUri: string, connectorType: string, data: object): Promise { - if(!this.CheckConnector()) - return Promise.reject("Connector not fully configured."); - //console.info(`Testing ${connectorType}`); - return postData(`${apiUri}/v2/LibraryConnector/${connectorType}/Test`, data) - .then((json) => { - //console.info(`Successfully tested ${connectorType}`); - return true; - }) - .catch(Promise.reject); - } - - protected async ResetConnector(apiUri: string, connectorType: string): Promise { - //console.info(`Deleting ${connectorType}`); - return deleteData(`${apiUri}/v2/LibraryConnector/${connectorType}`) - .then((json) => { - //console.info(`Successfully deleted ${connectorType}`); - return true; - }) - .catch(Promise.reject); - } - - protected async CreateConnector(apiUri: string, connectorType: string, data: object): Promise { - if(!this.CheckConnector()) - return Promise.reject("Connector not fully configured."); - //console.info(`Creating ${connectorType}`); - return postData(`${apiUri}/v2/LibraryConnector/${connectorType}`, data) - .then((json) => { - //console.info(`Successfully created ${connectorType}`); - return true; - }) - .catch(Promise.reject); - } -} - -export class Komga extends LibraryConnector -{ - private username = ""; - private password = ""; - - constructor({url, username, password} : {url: string, username: string, password: string}){ - super(url); - this.username = username; - this.password = password; - } - - public async Test(apiUri: string) : Promise { - return this.TestConnector(apiUri, "Komga", {url: this.url, username: this.username, password: this.password}).then(() => true).catch(() => false); - } - - public async Reset(apiUri: string) : Promise { - return this.ResetConnector(apiUri, "Komga").then(() => true).catch(() => false); - } - - public async Create(apiUri: string) : Promise { - return this.CreateConnector(apiUri, "Komga", {url: this.url, username: this.username, password: this.password}).then(() => true).catch(() => false); - } - - protected CheckConnector(): boolean { - try{ - new URL(this.url) - }catch{ - return false; - } - if(this.username.length < 1 || this.password.length < 1) - return false; - return true; - } -} - -export class Kavita extends LibraryConnector -{ - private username = ""; - private password = ""; - - constructor({url, username, password} : {url: string, username: string, password: string}) { - super(url); - this.username = username; - this.password = password; - } - - public async Test(apiUri: string) : Promise { - return this.TestConnector(apiUri, "Kavita", {url: this.url, username: this.username, password: this.password}).then(() => true).catch(() => false); - } - - public async Reset(apiUri: string) : Promise { - return this.ResetConnector(apiUri, "Kavita").then(() => true).catch(() => false); - } - - public async Create(apiUri: string) : Promise { - return this.CreateConnector(apiUri, "Kavita", {url: this.url, username: this.username, password: this.password}).then(() => true).catch(() => false); - } - - protected CheckConnector(): boolean { - try{ - new URL(this.url) - }catch{ - return false; - } - if(this.username.length < 1 || this.password.length < 1) - return false; - return true; - } -} \ No newline at end of file diff --git a/Website/modules/interfaces/LocalLibrary.tsx b/Website/modules/LocalLibraryFunctions.tsx similarity index 87% rename from Website/modules/interfaces/LocalLibrary.tsx rename to Website/modules/LocalLibraryFunctions.tsx index 3347e71..db22c58 100644 --- a/Website/modules/interfaces/LocalLibrary.tsx +++ b/Website/modules/LocalLibraryFunctions.tsx @@ -1,8 +1,8 @@ -import ILocalLibrary from "./ILocalLibrary"; -import {deleteData, getData, patchData, putData} from "../../App"; -import INewLibraryRecord from "./records/INewLibraryRecord"; +import ILocalLibrary from "./interfaces/ILocalLibrary"; +import {deleteData, getData, patchData, putData} from "../App"; +import INewLibraryRecord from "./interfaces/records/INewLibraryRecord"; -export default class LocalLibrary +export default class LocalLibraryFunctions { static async GetLibraries(apiUri: string): Promise { return getData(`${apiUri}/v2/LocalLibraries`) diff --git a/Website/modules/MangaConnector.tsx b/Website/modules/MangaConnectorFunctions.tsx similarity index 97% rename from Website/modules/MangaConnector.tsx rename to Website/modules/MangaConnectorFunctions.tsx index a515645..566a091 100644 --- a/Website/modules/MangaConnector.tsx +++ b/Website/modules/MangaConnectorFunctions.tsx @@ -1,7 +1,7 @@ import IMangaConnector from './interfaces/IMangaConnector'; import {getData, patchData} from '../App'; -export class MangaConnector +export class MangaConnectorFunctions { static async GetAllConnectors(apiUri: string): Promise { //console.info("Getting all MangaConnectors"); diff --git a/Website/modules/Manga.tsx b/Website/modules/MangaFunctions.tsx similarity index 88% rename from Website/modules/Manga.tsx rename to Website/modules/MangaFunctions.tsx index 1700d27..738b36c 100644 --- a/Website/modules/Manga.tsx +++ b/Website/modules/MangaFunctions.tsx @@ -2,13 +2,13 @@ import IManga from './interfaces/IManga'; import {deleteData, getData, patchData, postData} from '../App'; import IChapter from "./interfaces/IChapter"; -export default class Manga +export default class MangaFunctions { static async GetAllManga(apiUri: string): Promise { - //console.info("Getting all Manga"); + //console.info("Getting all MangaFunctions"); return getData(`${apiUri}/v2/Manga`) .then((json) => { - //console.info("Got all Manga"); + //console.info("Got all MangaFunctions"); const ret = json as IManga[]; //console.debug(ret); return (ret); @@ -23,7 +23,7 @@ export default class Manga //console.debug(`Getting Mangas ${internalIds.join(",")}`); return await postData(`${apiUri}/v2/Manga/WithIds`, mangaIds) .then((json) => { - //console.debug(`Got Manga ${internalIds.join(",")}`); + //console.debug(`Got MangaFunctions ${internalIds.join(",")}`); const ret = json as IManga[]; //console.debug(ret); return (ret); @@ -35,10 +35,10 @@ export default class Manga console.error(`mangaId was not provided`); return Promise.reject(); } - //console.info(`Getting Manga ${internalId}`); + //console.info(`Getting MangaFunctions ${internalId}`); return await getData(`${apiUri}/v2/Manga/${mangaId}`) .then((json) => { - //console.info(`Got Manga ${internalId}`); + //console.info(`Got MangaFunctions ${internalId}`); const ret = json as IManga; //console.debug(ret); return (ret); @@ -54,7 +54,7 @@ export default class Manga } static GetMangaCoverImageUrl(apiUri: string, mangaId: string, ref: HTMLImageElement | undefined): string { - //console.debug(`Getting Manga Cover-Url ${internalId}`); + //console.debug(`Getting MangaFunctions 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 Manga } return getData(`${apiUri}/v2/Manga/${mangaId}/Chapters`) .then((json) => { - //console.info(`Got Manga ${internalId}`); + //console.info(`Got MangaFunctions ${internalId}`); const ret = json as IChapter[]; //console.debug(ret); return (ret); @@ -81,7 +81,7 @@ export default class Manga } return getData(`${apiUri}/v2/Manga/${mangaId}/Chapters/Downloaded`) .then((json) => { - //console.info(`Got Manga ${internalId}`); + //console.info(`Got MangaFunctions ${internalId}`); const ret = json as IChapter[]; //console.debug(ret); return (ret); @@ -95,7 +95,7 @@ export default class Manga } return getData(`${apiUri}/v2/Manga/${mangaId}/Chapters/NotDownloaded`) .then((json) => { - //console.info(`Got Manga ${internalId}`); + //console.info(`Got MangaFunctions ${internalId}`); const ret = json as IChapter[]; //console.debug(ret); return (ret); @@ -109,7 +109,7 @@ export default class Manga } return getData(`${apiUri}/v2/Manga/${mangaId}/Chapter/LatestAvailable`) .then((json) => { - //console.info(`Got Manga ${internalId}`); + //console.info(`Got MangaFunctions ${internalId}`); const ret = json as IChapter; //console.debug(ret); return (ret); @@ -123,7 +123,7 @@ export default class Manga } return getData(`${apiUri}/v2/Manga/${mangaId}/Chapter/LatestDownloaded`) .then((json) => { - //console.info(`Got Manga ${internalId}`); + //console.info(`Got MangaFunctions ${internalId}`); const ret = json as IChapter; //console.debug(ret); return (ret); diff --git a/Website/modules/MonitorJobsList.tsx b/Website/modules/MonitorJobsList.tsx index 738d846..752d5ba 100644 --- a/Website/modules/MonitorJobsList.tsx +++ b/Website/modules/MonitorJobsList.tsx @@ -1,14 +1,14 @@ import React, {EventHandler, ReactElement, useEffect, useState} from 'react'; -import Job from './Job'; +import JobFunctions from './JobFunctions'; import '../styles/monitorMangaList.css'; import {JobType} from "./interfaces/Jobs/IJob"; -import '../styles/MangaCoverCard.css' -import DownloadAvailableChaptersJob from "./interfaces/Jobs/DownloadAvailableChaptersJob"; +import '../styles/mangaCover.css' +import IDownloadAvailableChaptersJob from "./interfaces/Jobs/IDownloadAvailableChaptersJob"; import {MangaItem} from "./interfaces/IManga"; -import Manga from "./Manga"; +import MangaFunctions from "./MangaFunctions"; export default function MonitorJobsList({onStartSearch, onJobsChanged, connectedToBackend, apiUri, updateList} : {onStartSearch() : void, onJobsChanged: EventHandler, connectedToBackend: boolean, apiUri: string, updateList: Date}) { - const [MonitoringJobs, setMonitoringJobs] = useState([]); + const [MonitoringJobs, setMonitoringJobs] = useState([]); const [joblistUpdateInterval, setJoblistUpdateInterval] = React.useState(); useEffect(() => { @@ -31,15 +31,15 @@ export default function MonitorJobsList({onStartSearch, onJobsChanged, connected if(!connectedToBackend) return; //console.debug("Updating MonitoringJobsList"); - Job.GetJobsWithType(apiUri, JobType.DownloadAvailableChaptersJob) - .then((jobs) => setMonitoringJobs(jobs as DownloadAvailableChaptersJob[])); + JobFunctions.GetJobsWithType(apiUri, JobType.DownloadAvailableChaptersJob) + .then((jobs) => setMonitoringJobs(jobs as IDownloadAvailableChaptersJob[])); } function StartSearchMangaEntry() : ReactElement { return (

Blahaj
-

Add new Manga

+

Add new MangaFunctions

+

); @@ -52,7 +52,7 @@ export default function MonitorJobsList({onStartSearch, onJobsChanged, connected <> )} diff --git a/Website/modules/NotificationConnector.tsx b/Website/modules/NotificationConnectorFunctions.tsx similarity index 95% rename from Website/modules/NotificationConnector.tsx rename to Website/modules/NotificationConnectorFunctions.tsx index f9d606e..d4c6748 100644 --- a/Website/modules/NotificationConnector.tsx +++ b/Website/modules/NotificationConnectorFunctions.tsx @@ -2,9 +2,9 @@ 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 ILunaseaRecord from "./interfaces/records/ILunaseaRecord"; -export default class NotificationConnector { +export default class NotificationConnectorFunctions { static async GetNotificationConnectors(apiUri: string) : Promise { //console.info("Getting Notification Connectors"); @@ -81,7 +81,7 @@ export default class NotificationConnector { }); } - static async CreateLunasea(apiUri: string, lunasea: IlunaseaRecord) : Promise { + static async CreateLunasea(apiUri: string, lunasea: ILunaseaRecord) : Promise { if(lunasea === undefined || lunasea === null) { console.error(`ntfy was not provided`); return Promise.reject(); diff --git a/Website/modules/QueuePopUp.tsx b/Website/modules/QueuePopUp.tsx index 994aa37..56246ad 100644 --- a/Website/modules/QueuePopUp.tsx +++ b/Website/modules/QueuePopUp.tsx @@ -2,8 +2,8 @@ import React, {useEffect, useState} from 'react'; import IJob, {JobState, JobType} from "./interfaces/Jobs/IJob"; import '../styles/queuePopUp.css'; import '../styles/popup.css'; -import Job from "./Job"; -import DownloadSingleChapterJob from "./interfaces/Jobs/DownloadSingleChapterJob"; +import JobFunctions from "./JobFunctions"; +import IDownloadSingleChapterJob from "./interfaces/Jobs/IDownloadSingleChapterJob"; import { MangaItem } from "./interfaces/IManga"; import {ChapterItem} from "./interfaces/IChapter"; @@ -33,13 +33,13 @@ export default function QueuePopUp({connectedToBackend, children, apiUri} : {con }, [connectedToBackend]); function UpdateMonitoringJobsList(){ - Job.GetJobsInState(apiUri, JobState.Waiting) + JobFunctions.GetJobsInState(apiUri, JobState.Waiting) .then((jobs: IJob[]) => { //console.log(jobs); return jobs; }) .then(setWaitingJobs); - Job.GetJobsInState(apiUri, JobState.Running) + JobFunctions.GetJobsInState(apiUri, JobState.Running) .then((jobs: IJob[]) => { //console.log(jobs); return jobs; @@ -61,13 +61,13 @@ export default function QueuePopUp({connectedToBackend, children, apiUri} : {con
{RunningJobs.filter(j => j.jobType == JobType.DownloadSingleChapterJob).map(j => { - let job = j as DownloadSingleChapterJob; + let job = j as IDownloadSingleChapterJob; return })}
{WaitingJobs.filter(j => j.jobType == JobType.DownloadSingleChapterJob).map(j =>{ - let job = j as DownloadSingleChapterJob; + let job = j as IDownloadSingleChapterJob; return })}
diff --git a/Website/modules/Search.tsx b/Website/modules/Search.tsx index b7067da..04b144d 100644 --- a/Website/modules/Search.tsx +++ b/Website/modules/Search.tsx @@ -1,13 +1,13 @@ import React, {ChangeEventHandler, EventHandler, useEffect, useState} from 'react'; -import {MangaConnector} from "./MangaConnector"; +import {MangaConnectorFunctions} from "./MangaConnectorFunctions"; import IMangaConnector from "./interfaces/IMangaConnector"; import {isValidUri} from "../App"; import IManga, {MangaItem} from "./interfaces/IManga"; import '../styles/search.css'; import SearchFunctions from "./SearchFunctions"; -import Job from "./Job"; +import JobFunctions from "./JobFunctions"; import ILocalLibrary from "./interfaces/ILocalLibrary"; -import LocalLibrary from "./interfaces/LocalLibrary"; +import LocalLibraryFunctions from "./LocalLibraryFunctions"; export default function Search({apiUri, jobInterval, onJobsChanged, closeSearch} : {apiUri: string, jobInterval: Date, onJobsChanged: (internalId: string) => void, closeSearch(): void}) { const [mangaConnectors, setConnectors] = useState(); @@ -20,7 +20,7 @@ export default function Search({apiUri, jobInterval, onJobsChanged, closeSearch} useEffect(() => { if(mangaConnectors === undefined) { - MangaConnector.GetAllConnectors(apiUri).then(setConnectors) + MangaConnectorFunctions.GetAllConnectors(apiUri).then(setConnectors) return; } }, [mangaConnectors]); @@ -90,7 +90,7 @@ export default function Search({apiUri, jobInterval, onJobsChanged, closeSearch} let [selectedLibrary, setSelectedLibrary] = useState(null); let [libraries, setLibraries] = useState(null); useEffect(() => { - LocalLibrary.GetLibraries(apiUri).then(setLibraries); + LocalLibraryFunctions.GetLibraries(apiUri).then(setLibraries); }, []); useEffect(() => { if(libraries === null || libraries.length < 1) @@ -137,7 +137,7 @@ export default function Search({apiUri, jobInterval, onJobsChanged, closeSearch} : libraries.map(library => )} ) diff --git a/Website/modules/interfaces/IChapter.tsx b/Website/modules/interfaces/IChapter.tsx index e06c242..ad0a23b 100644 --- a/Website/modules/interfaces/IChapter.tsx +++ b/Website/modules/interfaces/IChapter.tsx @@ -1,7 +1,7 @@ import React, {ReactElement, ReactEventHandler, useEffect, useState} from "react"; -import Manga from "../Manga"; +import MangaFunctions from "../MangaFunctions"; import IManga from "./IManga"; -import Chapter from "../Chapter"; +import ChapterFunctions from "../ChapterFunctions"; export default interface IChapter{ chapterId: string; @@ -24,25 +24,28 @@ export function ChapterItem({apiUri, chapterId} : {apiUri: string, chapterId: st let [mangaCoverUrl, setMangaCoverUrl] = useState("../../media/blahaj.png"); let [mangaCoverHtmlImageItem, setMangaCoverHtmlImageItem] = useState(null); useEffect(() => { - Chapter.GetChapterFromId(apiUri, chapterId).then(setChapter); + ChapterFunctions.GetChapterFromId(apiUri, chapterId).then(setChapter); }, []); useEffect(() => { if(chapter === null) manga = null; else - Manga.GetMangaById(apiUri, chapter.parentMangaId).then(setManga); + MangaFunctions.GetMangaById(apiUri, chapter.parentMangaId).then(setManga); }, [chapter]); useEffect(() => { if(chapter != null && mangaCoverHtmlImageItem != null) - setMangaCoverUrl(Manga.GetMangaCoverImageUrl(apiUri, chapter.parentMangaId, mangaCoverHtmlImageItem)); + setMangaCoverUrl(MangaFunctions.GetMangaCoverImageUrl(apiUri, chapter.parentMangaId, mangaCoverHtmlImageItem)); }, [chapter, mangaCoverHtmlImageItem]); - return (
- Manga Cover -

{manga ? manga.name : "Manga-Name"}

-

{chapter ? chapter.title : "Chapter-Title"}

+ let [clicked, setClicked] = useState(false); + + return (
setClicked(!clicked)}> + MangaFunctions Cover +

{manga ? manga.name : "MangaFunctions-Name"}

+

{chapter ? chapter.title : "ChapterFunctions-Title"}

Vol.{chapter ? chapter.volumeNumber : "VolNum"}

Ch.{chapter ? chapter.chapterNumber : "ChNum"}

+

Vol.{chapter ? chapter.volumeNumber : "VolNum"} Ch.{chapter ? chapter.chapterNumber : "ChNum"}

Link
) } \ No newline at end of file diff --git a/Website/modules/interfaces/ILocalLibrary.tsx b/Website/modules/interfaces/ILocalLibrary.tsx index 23216e5..f7aca1e 100644 --- a/Website/modules/interfaces/ILocalLibrary.tsx +++ b/Website/modules/interfaces/ILocalLibrary.tsx @@ -8,7 +8,7 @@ export default interface ILocalLibrary { export function LocalLibrary(library: ILocalLibrary) : ReactElement { return (
-

{library.libraryName}

-

{library.basePath}

+

{library.libraryName}

+

{library.basePath}

); } \ No newline at end of file diff --git a/Website/modules/interfaces/IManga.tsx b/Website/modules/interfaces/IManga.tsx index 206f698..fccd120 100644 --- a/Website/modules/interfaces/IManga.tsx +++ b/Website/modules/interfaces/IManga.tsx @@ -1,4 +1,4 @@ -import Manga from "../Manga"; +import MangaFunctions from "../MangaFunctions"; import React, {Children, ReactElement, ReactEventHandler, useEffect, useState} from "react"; import Icon from '@mdi/react'; import { mdiTagTextOutline, mdiAccountEdit, mdiLinkVariant } from '@mdi/js'; @@ -34,18 +34,18 @@ export enum MangaReleaseStatus { export function MangaItem({apiUri, mangaId, children} : {apiUri: string, mangaId: string, children?: (string | ReactElement)[]}) : ReactElement { const LoadMangaCover : ReactEventHandler = (e) => { - if(e.currentTarget.src != Manga.GetMangaCoverImageUrl(apiUri, mangaId, e.currentTarget)) - e.currentTarget.src = Manga.GetMangaCoverImageUrl(apiUri, mangaId, e.currentTarget); + if(e.currentTarget.src != MangaFunctions.GetMangaCoverImageUrl(apiUri, mangaId, e.currentTarget)) + e.currentTarget.src = MangaFunctions.GetMangaCoverImageUrl(apiUri, mangaId, e.currentTarget); } let [manga, setManga] = useState(null); let [clicked, setClicked] = useState(false); useEffect(() => { - Manga.GetMangaById(apiUri, mangaId).then(setManga); + MangaFunctions.GetMangaById(apiUri, mangaId).then(setManga); }, []); return (
setClicked(!clicked)}> - Manga Cover + MangaFunctions Cover

{manga ? manga.mangaConnectorId : "Connector"}

{manga ? manga.name : "Name"}

diff --git a/Website/modules/interfaces/Jobs/DownloadAvailableChaptersJob.ts b/Website/modules/interfaces/Jobs/DownloadAvailableChaptersJob.ts deleted file mode 100644 index 99dd3e3..0000000 --- a/Website/modules/interfaces/Jobs/DownloadAvailableChaptersJob.ts +++ /dev/null @@ -1,5 +0,0 @@ -import IJob from "./IJob"; - -export default interface DownloadAvailableChaptersJob extends IJob { - mangaId: string; -} \ No newline at end of file diff --git a/Website/modules/interfaces/Jobs/DownloadMangaCoverJob.ts b/Website/modules/interfaces/Jobs/DownloadMangaCoverJob.ts deleted file mode 100644 index 612dc15..0000000 --- a/Website/modules/interfaces/Jobs/DownloadMangaCoverJob.ts +++ /dev/null @@ -1,5 +0,0 @@ -import IJob from "./IJob"; - -export default interface DownloadMangaCoverJob extends IJob { - mangaId: string; -} \ No newline at end of file diff --git a/Website/modules/interfaces/Jobs/DownloadSingleChapterJob.ts b/Website/modules/interfaces/Jobs/DownloadSingleChapterJob.ts deleted file mode 100644 index bfecfc6..0000000 --- a/Website/modules/interfaces/Jobs/DownloadSingleChapterJob.ts +++ /dev/null @@ -1,5 +0,0 @@ -import IJob from "./IJob"; - -export default interface DownloadSingleChapterJob extends IJob { - chapterId: string; -} \ No newline at end of file diff --git a/Website/modules/interfaces/Jobs/IDownloadAvailableChaptersJob.ts b/Website/modules/interfaces/Jobs/IDownloadAvailableChaptersJob.ts new file mode 100644 index 0000000..66c5104 --- /dev/null +++ b/Website/modules/interfaces/Jobs/IDownloadAvailableChaptersJob.ts @@ -0,0 +1,5 @@ +import IJob from "./IJob"; + +export default interface IDownloadAvailableChaptersJob extends IJob { + mangaId: string; +} \ No newline at end of file diff --git a/Website/modules/interfaces/Jobs/IDownloadMangaCoverJob.ts b/Website/modules/interfaces/Jobs/IDownloadMangaCoverJob.ts new file mode 100644 index 0000000..42d4350 --- /dev/null +++ b/Website/modules/interfaces/Jobs/IDownloadMangaCoverJob.ts @@ -0,0 +1,5 @@ +import IJob from "./IJob"; + +export default interface IDownloadMangaCoverJob extends IJob { + mangaId: string; +} \ No newline at end of file diff --git a/Website/modules/interfaces/Jobs/IDownloadSingleChapterJob.ts b/Website/modules/interfaces/Jobs/IDownloadSingleChapterJob.ts new file mode 100644 index 0000000..c4b3b8b --- /dev/null +++ b/Website/modules/interfaces/Jobs/IDownloadSingleChapterJob.ts @@ -0,0 +1,5 @@ +import IJob from "./IJob"; + +export default interface IDownloadSingleChapterJob extends IJob { + chapterId: string; +} \ No newline at end of file diff --git a/Website/modules/interfaces/Jobs/IJob.ts b/Website/modules/interfaces/Jobs/IJob.ts index a9644d6..a23e08d 100644 --- a/Website/modules/interfaces/Jobs/IJob.ts +++ b/Website/modules/interfaces/Jobs/IJob.ts @@ -17,7 +17,8 @@ export enum JobType { MoveFileOrFolderJob = "MoveFileOrFolderJob", DownloadMangaCoverJob = "DownloadMangaCoverJob", RetrieveChaptersJob = "RetrieveChaptersJob", - UpdateFilesDownloadedJob = "UpdateFilesDownloadedJob" + UpdateFilesDownloadedJob = "UpdateFilesDownloadedJob", + MoveMangaLibraryJob = "MoveMangaLibraryJob" } export enum JobState { diff --git a/Website/modules/interfaces/Jobs/MoveFileOrFolderJob.ts b/Website/modules/interfaces/Jobs/IMoveFileOrFolderJob.ts similarity index 56% rename from Website/modules/interfaces/Jobs/MoveFileOrFolderJob.ts rename to Website/modules/interfaces/Jobs/IMoveFileOrFolderJob.ts index fab7b05..9daa55c 100644 --- a/Website/modules/interfaces/Jobs/MoveFileOrFolderJob.ts +++ b/Website/modules/interfaces/Jobs/IMoveFileOrFolderJob.ts @@ -1,6 +1,6 @@ import IJob from "./IJob"; -export default interface MoveFileOrFolderJob extends IJob { +export default interface IMoveFileOrFolderJob extends IJob { fromLocation: string; toLocation: string; } \ No newline at end of file diff --git a/Website/modules/interfaces/Jobs/IMoveMangaLibraryJob.ts b/Website/modules/interfaces/Jobs/IMoveMangaLibraryJob.ts new file mode 100644 index 0000000..102646b --- /dev/null +++ b/Website/modules/interfaces/Jobs/IMoveMangaLibraryJob.ts @@ -0,0 +1,6 @@ +import IJob from "./IJob"; + +export default interface IMoveMangaLibraryJob extends IJob { + MangaId: string; + ToLibraryId: string; +} \ No newline at end of file diff --git a/Website/modules/interfaces/Jobs/IRetrieveChaptersJob.ts b/Website/modules/interfaces/Jobs/IRetrieveChaptersJob.ts new file mode 100644 index 0000000..2cadeb3 --- /dev/null +++ b/Website/modules/interfaces/Jobs/IRetrieveChaptersJob.ts @@ -0,0 +1,5 @@ +import IJob from "./IJob"; + +export default interface IRetrieveChaptersJob extends IJob { + mangaId: string; +} \ No newline at end of file diff --git a/Website/modules/interfaces/Jobs/IUpdateFilesDownloadedJob.ts b/Website/modules/interfaces/Jobs/IUpdateFilesDownloadedJob.ts new file mode 100644 index 0000000..8fc2516 --- /dev/null +++ b/Website/modules/interfaces/Jobs/IUpdateFilesDownloadedJob.ts @@ -0,0 +1,5 @@ +import IJob from "./IJob"; + +export default interface IUpdateFilesDownloadedJob extends IJob { + mangaId: string; +} \ No newline at end of file diff --git a/Website/modules/interfaces/Jobs/IUpdateMetadataJob.ts b/Website/modules/interfaces/Jobs/IUpdateMetadataJob.ts new file mode 100644 index 0000000..9464666 --- /dev/null +++ b/Website/modules/interfaces/Jobs/IUpdateMetadataJob.ts @@ -0,0 +1,5 @@ +import IJob from "./IJob"; + +export default interface IUpdateMetadataJob extends IJob { + mangaId: string; +} \ No newline at end of file diff --git a/Website/modules/interfaces/Jobs/RetrieveChaptersJob.ts b/Website/modules/interfaces/Jobs/RetrieveChaptersJob.ts deleted file mode 100644 index bd371bd..0000000 --- a/Website/modules/interfaces/Jobs/RetrieveChaptersJob.ts +++ /dev/null @@ -1,5 +0,0 @@ -import IJob from "./IJob"; - -export default interface RetrieveChaptersJob extends IJob { - mangaId: string; -} \ No newline at end of file diff --git a/Website/modules/interfaces/Jobs/UpdateFilesDownloadedJob.ts b/Website/modules/interfaces/Jobs/UpdateFilesDownloadedJob.ts deleted file mode 100644 index f5a7041..0000000 --- a/Website/modules/interfaces/Jobs/UpdateFilesDownloadedJob.ts +++ /dev/null @@ -1,5 +0,0 @@ -import IJob from "./IJob"; - -export default interface UpdateFilesDownloadedJob extends IJob { - mangaId: string; -} \ No newline at end of file diff --git a/Website/modules/interfaces/Jobs/UpdateMetadataJob.ts b/Website/modules/interfaces/Jobs/UpdateMetadataJob.ts deleted file mode 100644 index 36bd2b2..0000000 --- a/Website/modules/interfaces/Jobs/UpdateMetadataJob.ts +++ /dev/null @@ -1,5 +0,0 @@ -import IJob from "./IJob"; - -export default interface UpdateMetadataJob extends IJob { - mangaId: string; -} \ No newline at end of file diff --git a/Website/modules/interfaces/records/ICoverFormatRequestRecord.ts b/Website/modules/interfaces/records/ICoverFormatRequestRecord.ts deleted file mode 100644 index ea4a565..0000000 --- a/Website/modules/interfaces/records/ICoverFormatRequestRecord.ts +++ /dev/null @@ -1,9 +0,0 @@ -export default interface ICoverFormatRequestRecord { - size: Size; -} - -export interface Size { - width: number; - height: number; - isEmpty: boolean; -} \ No newline at end of file diff --git a/Website/modules/interfaces/records/ILunaseaRecord.ts b/Website/modules/interfaces/records/ILunaseaRecord.ts new file mode 100644 index 0000000..e714707 --- /dev/null +++ b/Website/modules/interfaces/records/ILunaseaRecord.ts @@ -0,0 +1,3 @@ +export default interface ILunaseaRecord { + id: string; +} \ No newline at end of file diff --git a/Website/modules/interfaces/records/IlunaseaRecord.ts b/Website/modules/interfaces/records/IlunaseaRecord.ts deleted file mode 100644 index 85a0200..0000000 --- a/Website/modules/interfaces/records/IlunaseaRecord.ts +++ /dev/null @@ -1,3 +0,0 @@ -export default interface IlunaseaRecord { - id: string; -} \ No newline at end of file diff --git a/Website/styles/MangaCoverCard.css b/Website/styles/mangaCover.css similarity index 100% rename from Website/styles/MangaCoverCard.css rename to Website/styles/mangaCover.css