mirror of
https://github.com/C9Glax/tranga-website.git
synced 2025-09-10 20:08:19 +02:00
Compare commits
2 Commits
007b49c624
...
0b0abb3801
Author | SHA1 | Date | |
---|---|---|---|
0b0abb3801 | |||
62665f5660 |
@@ -14,7 +14,7 @@
|
|||||||
<h3 align="center">Tranga-Website</h3>
|
<h3 align="center">Tranga-Website</h3>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
Automatic Manga and Metadata downloader
|
Automatic MangaFunctions and Metadata downloader
|
||||||
</p>
|
</p>
|
||||||
<p align="center">
|
<p align="center">
|
||||||
This is the Website for <a href="https://github.com/C9Glax/tranga">Tranga</a> (API)
|
This is the Website for <a href="https://github.com/C9Glax/tranga">Tranga</a> (API)
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
| Search | SearchResults | Default-View |
|
| Search | SearchResults | Default-View |
|
||||||
|----------------------------------------------------------------------------|---------------------------------------------------------------------------------|----------------------------------------------------------------------------|
|
|----------------------------------------------------------------------------|---------------------------------------------------------------------------------|----------------------------------------------------------------------------|
|
||||||
|  |  |  |
|
|  |  |  |
|
||||||
| 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
|
## About The Project
|
||||||
|
@@ -39,7 +39,7 @@ export default function App(){
|
|||||||
const UpdateList = () => {setUpdateMonitorList(new Date())}
|
const UpdateList = () => {setUpdateMonitorList(new Date())}
|
||||||
|
|
||||||
return(<div>
|
return(<div>
|
||||||
<Header apiUri={apiUri} backendConnected={connected} settings={frontendSettings} changeSettings={ChangeSettings}/>
|
<Header apiUri={apiUri} backendConnected={connected} settings={frontendSettings} />
|
||||||
{connected
|
{connected
|
||||||
? <>
|
? <>
|
||||||
{showSearch
|
{showSearch
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import {getData} from "../App";
|
import {getData} from "../App";
|
||||||
import IChapter from "./interfaces/IChapter";
|
import IChapter from "./interfaces/IChapter";
|
||||||
|
|
||||||
export default class Chapter{
|
export default class ChapterFunctions {
|
||||||
|
|
||||||
static async GetChapterFromId(apiUri: string, chapterId: string): Promise<IChapter> {
|
static async GetChapterFromId(apiUri: string, chapterId: string): Promise<IChapter> {
|
||||||
if(chapterId === undefined || chapterId === null) {
|
if(chapterId === undefined || chapterId === null) {
|
||||||
@@ -10,7 +10,7 @@ export default class Chapter{
|
|||||||
}
|
}
|
||||||
return getData(`${apiUri}/v2/Query/Chapter/${chapterId}`)
|
return getData(`${apiUri}/v2/Query/Chapter/${chapterId}`)
|
||||||
.then((json) => {
|
.then((json) => {
|
||||||
//console.info("Got all Manga");
|
//console.info("Got all MangaFunctions");
|
||||||
const ret = json as IChapter;
|
const ret = json as IChapter;
|
||||||
//console.debug(ret);
|
//console.debug(ret);
|
||||||
return (ret);
|
return (ret);
|
@@ -1,6 +1,6 @@
|
|||||||
import React, {useEffect} from 'react';
|
import React, {useEffect} from 'react';
|
||||||
import '../styles/footer.css';
|
import '../styles/footer.css';
|
||||||
import Job from './Job';
|
import JobFunctions from './JobFunctions';
|
||||||
import Icon from '@mdi/react';
|
import Icon from '@mdi/react';
|
||||||
import {mdiCounter, mdiEyeCheck, mdiRun, mdiTrayFull} from '@mdi/js';
|
import {mdiCounter, mdiEyeCheck, mdiRun, mdiTrayFull} from '@mdi/js';
|
||||||
import QueuePopUp from "./QueuePopUp";
|
import QueuePopUp from "./QueuePopUp";
|
||||||
@@ -14,10 +14,10 @@ export default function Footer({connectedToBackend, apiUri} : {connectedToBacken
|
|||||||
const [countUpdateInterval, setCountUpdateInterval] = React.useState<number>();
|
const [countUpdateInterval, setCountUpdateInterval] = React.useState<number>();
|
||||||
|
|
||||||
function UpdateBackendState(){
|
function UpdateBackendState(){
|
||||||
Job.GetJobsWithType(apiUri, JobType.DownloadAvailableChaptersJob).then((jobs) => setMonitoringJobsCount(jobs.length));
|
JobFunctions.GetJobsWithType(apiUri, JobType.DownloadAvailableChaptersJob).then((jobs) => setMonitoringJobsCount(jobs.length));
|
||||||
Job.GetAllJobs(apiUri).then((jobs) => setAllJobsCount(jobs.length));
|
JobFunctions.GetAllJobs(apiUri).then((jobs) => setAllJobsCount(jobs.length));
|
||||||
Job.GetJobsInState(apiUri, JobState.Running).then((jobs) => setRunningJobsCount(jobs.length));
|
JobFunctions.GetJobsInState(apiUri, JobState.Running).then((jobs) => setRunningJobsCount(jobs.length));
|
||||||
Job.GetJobsInState(apiUri, JobState.Waiting).then((jobs) => setWaitingJobs(jobs.length));
|
JobFunctions.GetJobsInState(apiUri, JobState.Waiting).then((jobs) => setWaitingJobs(jobs.length));
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@@ -1,13 +1,15 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import '../styles/header.css'
|
import '../styles/header.css'
|
||||||
import IFrontendSettings from "./interfaces/IFrontendSettings";
|
import IFrontendSettings from "./interfaces/IFrontendSettings";
|
||||||
|
import Settings from "./Settings";
|
||||||
|
|
||||||
export default function Header({backendConnected, apiUri, settings, changeSettings} : {backendConnected: boolean, apiUri: string, settings: IFrontendSettings, changeSettings(settings: IFrontendSettings): void}){
|
export default function Header({backendConnected, apiUri, settings} : {backendConnected: boolean, apiUri: string, settings: IFrontendSettings}){
|
||||||
return (
|
return (
|
||||||
<header>
|
<header>
|
||||||
<div id="titlebox">
|
<div id="titlebox">
|
||||||
<img alt="website image is Blahaj" src="../media/blahaj.png"/>
|
<img alt="website image is Blahaj" src="../media/blahaj.png"/>
|
||||||
<span>Tranga</span>
|
<span>Tranga</span>
|
||||||
</div>
|
</div>
|
||||||
|
<Settings backendConnected={backendConnected} apiUri={apiUri} settings={settings} />
|
||||||
</header>)
|
</header>)
|
||||||
}
|
}
|
@@ -3,7 +3,7 @@ import IJob, {JobState, JobType} from "./interfaces/Jobs/IJob";
|
|||||||
import IModifyJobRecord from "./interfaces/records/IModifyJobRecord";
|
import IModifyJobRecord from "./interfaces/records/IModifyJobRecord";
|
||||||
import IDownloadAvailableJobsRecord from "./interfaces/records/IDownloadAvailableJobsRecord";
|
import IDownloadAvailableJobsRecord from "./interfaces/records/IDownloadAvailableJobsRecord";
|
||||||
|
|
||||||
export default class Job
|
export default class JobFunctions
|
||||||
{
|
{
|
||||||
static IntervalStringFromDate(date: Date) : string {
|
static IntervalStringFromDate(date: Date) : string {
|
||||||
let x = new Date(date);
|
let x = new Date(date);
|
||||||
@@ -82,10 +82,10 @@ export default class Job
|
|||||||
console.error(`JobId was not provided`);
|
console.error(`JobId was not provided`);
|
||||||
return Promise.reject();
|
return Promise.reject();
|
||||||
}
|
}
|
||||||
//console.info(`Getting Job ${jobId}`);
|
//console.info(`Getting JobFunctions ${jobId}`);
|
||||||
return getData(`${apiUri}/v2/Job/${jobId}`)
|
return getData(`${apiUri}/v2/Job/${jobId}`)
|
||||||
.then((json) => {
|
.then((json) => {
|
||||||
//console.info(`Got Job ${jobId}`);
|
//console.info(`Got JobFunctions ${jobId}`);
|
||||||
const ret = json as IJob;
|
const ret = json as IJob;
|
||||||
//console.debug(ret);
|
//console.debug(ret);
|
||||||
return (ret);
|
return (ret);
|
||||||
@@ -111,7 +111,7 @@ export default class Job
|
|||||||
}
|
}
|
||||||
return patchData(`${apiUri}/v2/Job/${jobId}`, modifyData)
|
return patchData(`${apiUri}/v2/Job/${jobId}`, modifyData)
|
||||||
.then((json) => {
|
.then((json) => {
|
||||||
//console.info(`Got Job ${jobId}`);
|
//console.info(`Got JobFunctions ${jobId}`);
|
||||||
const ret = json as IJob;
|
const ret = json as IJob;
|
||||||
//console.debug(ret);
|
//console.debug(ret);
|
||||||
return (ret);
|
return (ret);
|
||||||
@@ -129,7 +129,7 @@ export default class Job
|
|||||||
}
|
}
|
||||||
return putData(`${apiUri}/v2/Job/DownloadAvailableChaptersJob/${mangaId}`, data)
|
return putData(`${apiUri}/v2/Job/DownloadAvailableChaptersJob/${mangaId}`, data)
|
||||||
.then((json) => {
|
.then((json) => {
|
||||||
//console.info(`Got Job ${jobId}`);
|
//console.info(`Got JobFunctions ${jobId}`);
|
||||||
const ret = json as string[];
|
const ret = json as string[];
|
||||||
//console.debug(ret);
|
//console.debug(ret);
|
||||||
return (ret);
|
return (ret);
|
||||||
@@ -143,7 +143,7 @@ export default class Job
|
|||||||
}
|
}
|
||||||
return putData(`${apiUri}/v2/Job/DownloadSingleChapterJob/${chapterId}`, {})
|
return putData(`${apiUri}/v2/Job/DownloadSingleChapterJob/${chapterId}`, {})
|
||||||
.then((json) => {
|
.then((json) => {
|
||||||
//console.info(`Got Job ${jobId}`);
|
//console.info(`Got JobFunctions ${jobId}`);
|
||||||
const ret = json as string[];
|
const ret = json as string[];
|
||||||
//console.debug(ret);
|
//console.debug(ret);
|
||||||
return (ret);
|
return (ret);
|
||||||
@@ -157,7 +157,7 @@ export default class Job
|
|||||||
}
|
}
|
||||||
return putData(`${apiUri}/v2/Job/UpdateFilesJob/${mangaId}`, {})
|
return putData(`${apiUri}/v2/Job/UpdateFilesJob/${mangaId}`, {})
|
||||||
.then((json) => {
|
.then((json) => {
|
||||||
//console.info(`Got Job ${jobId}`);
|
//console.info(`Got JobFunctions ${jobId}`);
|
||||||
const ret = json as string[];
|
const ret = json as string[];
|
||||||
//console.debug(ret);
|
//console.debug(ret);
|
||||||
return (ret);
|
return (ret);
|
||||||
@@ -167,7 +167,7 @@ export default class Job
|
|||||||
static async CreateUpdateAllFilesJob(apiUri: string): Promise<string[]> {
|
static async CreateUpdateAllFilesJob(apiUri: string): Promise<string[]> {
|
||||||
return putData(`${apiUri}/v2/Job/UpdateAllFilesJob`, {})
|
return putData(`${apiUri}/v2/Job/UpdateAllFilesJob`, {})
|
||||||
.then((json) => {
|
.then((json) => {
|
||||||
//console.info(`Got Job ${jobId}`);
|
//console.info(`Got JobFunctions ${jobId}`);
|
||||||
const ret = json as string[];
|
const ret = json as string[];
|
||||||
//console.debug(ret);
|
//console.debug(ret);
|
||||||
return (ret);
|
return (ret);
|
||||||
@@ -181,7 +181,7 @@ export default class Job
|
|||||||
}
|
}
|
||||||
return putData(`${apiUri}/v2/Job/UpdateMetadataJob/${mangaId}`, {})
|
return putData(`${apiUri}/v2/Job/UpdateMetadataJob/${mangaId}`, {})
|
||||||
.then((json) => {
|
.then((json) => {
|
||||||
//console.info(`Got Job ${jobId}`);
|
//console.info(`Got JobFunctions ${jobId}`);
|
||||||
const ret = json as string[];
|
const ret = json as string[];
|
||||||
//console.debug(ret);
|
//console.debug(ret);
|
||||||
return (ret);
|
return (ret);
|
||||||
@@ -191,7 +191,7 @@ export default class Job
|
|||||||
static async CreateUpdateAllMetadataJob(apiUri: string): Promise<string[]> {
|
static async CreateUpdateAllMetadataJob(apiUri: string): Promise<string[]> {
|
||||||
return putData(`${apiUri}/v2/Job/UpdateAllMetadataJob`, {})
|
return putData(`${apiUri}/v2/Job/UpdateAllMetadataJob`, {})
|
||||||
.then((json) => {
|
.then((json) => {
|
||||||
//console.info(`Got Job ${jobId}`);
|
//console.info(`Got JobFunctions ${jobId}`);
|
||||||
const ret = json as string[];
|
const ret = json as string[];
|
||||||
//console.debug(ret);
|
//console.debug(ret);
|
||||||
return (ret);
|
return (ret);
|
@@ -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<ILibraryConnector[]> {
|
|
||||||
//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<boolean>;
|
|
||||||
public abstract Reset(apiUri: string) : Promise<boolean>;
|
|
||||||
public abstract Create(apiUri: string) : Promise<boolean>;
|
|
||||||
protected abstract CheckConnector() : boolean;
|
|
||||||
|
|
||||||
protected async TestConnector(apiUri: string, connectorType: string, data: object): Promise<boolean> {
|
|
||||||
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<boolean> {
|
|
||||||
//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<boolean> {
|
|
||||||
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<boolean> {
|
|
||||||
return this.TestConnector(apiUri, "Komga", {url: this.url, username: this.username, password: this.password}).then(() => true).catch(() => false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Reset(apiUri: string) : Promise<boolean> {
|
|
||||||
return this.ResetConnector(apiUri, "Komga").then(() => true).catch(() => false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Create(apiUri: string) : Promise<boolean> {
|
|
||||||
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<boolean> {
|
|
||||||
return this.TestConnector(apiUri, "Kavita", {url: this.url, username: this.username, password: this.password}).then(() => true).catch(() => false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Reset(apiUri: string) : Promise<boolean> {
|
|
||||||
return this.ResetConnector(apiUri, "Kavita").then(() => true).catch(() => false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Create(apiUri: string) : Promise<boolean> {
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,8 +1,8 @@
|
|||||||
import ILocalLibrary from "./ILocalLibrary";
|
import ILocalLibrary from "./interfaces/ILocalLibrary";
|
||||||
import {deleteData, getData, patchData, putData} from "../../App";
|
import {deleteData, getData, patchData, putData} from "../App";
|
||||||
import INewLibraryRecord from "./records/INewLibraryRecord";
|
import INewLibraryRecord from "./interfaces/records/INewLibraryRecord";
|
||||||
|
|
||||||
export default class LocalLibrary
|
export default class LocalLibraryFunctions
|
||||||
{
|
{
|
||||||
static async GetLibraries(apiUri: string): Promise<ILocalLibrary[]> {
|
static async GetLibraries(apiUri: string): Promise<ILocalLibrary[]> {
|
||||||
return getData(`${apiUri}/v2/LocalLibraries`)
|
return getData(`${apiUri}/v2/LocalLibraries`)
|
@@ -1,7 +1,7 @@
|
|||||||
import IMangaConnector from './interfaces/IMangaConnector';
|
import IMangaConnector from './interfaces/IMangaConnector';
|
||||||
import {getData, patchData} from '../App';
|
import {getData, patchData} from '../App';
|
||||||
|
|
||||||
export class MangaConnector
|
export class MangaConnectorFunctions
|
||||||
{
|
{
|
||||||
static async GetAllConnectors(apiUri: string): Promise<IMangaConnector[]> {
|
static async GetAllConnectors(apiUri: string): Promise<IMangaConnector[]> {
|
||||||
//console.info("Getting all MangaConnectors");
|
//console.info("Getting all MangaConnectors");
|
@@ -2,13 +2,13 @@ import IManga from './interfaces/IManga';
|
|||||||
import {deleteData, getData, patchData, postData} from '../App';
|
import {deleteData, getData, patchData, postData} from '../App';
|
||||||
import IChapter from "./interfaces/IChapter";
|
import IChapter from "./interfaces/IChapter";
|
||||||
|
|
||||||
export default class Manga
|
export default class MangaFunctions
|
||||||
{
|
{
|
||||||
static async GetAllManga(apiUri: string): Promise<IManga[]> {
|
static async GetAllManga(apiUri: string): Promise<IManga[]> {
|
||||||
//console.info("Getting all Manga");
|
//console.info("Getting all MangaFunctions");
|
||||||
return getData(`${apiUri}/v2/Manga`)
|
return getData(`${apiUri}/v2/Manga`)
|
||||||
.then((json) => {
|
.then((json) => {
|
||||||
//console.info("Got all Manga");
|
//console.info("Got all MangaFunctions");
|
||||||
const ret = json as IManga[];
|
const ret = json as IManga[];
|
||||||
//console.debug(ret);
|
//console.debug(ret);
|
||||||
return (ret);
|
return (ret);
|
||||||
@@ -23,7 +23,7 @@ export default class Manga
|
|||||||
//console.debug(`Getting Mangas ${internalIds.join(",")}`);
|
//console.debug(`Getting Mangas ${internalIds.join(",")}`);
|
||||||
return await postData(`${apiUri}/v2/Manga/WithIds`, mangaIds)
|
return await postData(`${apiUri}/v2/Manga/WithIds`, mangaIds)
|
||||||
.then((json) => {
|
.then((json) => {
|
||||||
//console.debug(`Got Manga ${internalIds.join(",")}`);
|
//console.debug(`Got MangaFunctions ${internalIds.join(",")}`);
|
||||||
const ret = json as IManga[];
|
const ret = json as IManga[];
|
||||||
//console.debug(ret);
|
//console.debug(ret);
|
||||||
return (ret);
|
return (ret);
|
||||||
@@ -35,10 +35,10 @@ export default class Manga
|
|||||||
console.error(`mangaId was not provided`);
|
console.error(`mangaId was not provided`);
|
||||||
return Promise.reject();
|
return Promise.reject();
|
||||||
}
|
}
|
||||||
//console.info(`Getting Manga ${internalId}`);
|
//console.info(`Getting MangaFunctions ${internalId}`);
|
||||||
return await getData(`${apiUri}/v2/Manga/${mangaId}`)
|
return await getData(`${apiUri}/v2/Manga/${mangaId}`)
|
||||||
.then((json) => {
|
.then((json) => {
|
||||||
//console.info(`Got Manga ${internalId}`);
|
//console.info(`Got MangaFunctions ${internalId}`);
|
||||||
const ret = json as IManga;
|
const ret = json as IManga;
|
||||||
//console.debug(ret);
|
//console.debug(ret);
|
||||||
return (ret);
|
return (ret);
|
||||||
@@ -54,7 +54,7 @@ export default class Manga
|
|||||||
}
|
}
|
||||||
|
|
||||||
static GetMangaCoverImageUrl(apiUri: string, mangaId: string, ref: HTMLImageElement | undefined): string {
|
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)
|
if(ref == null || ref == undefined)
|
||||||
return `${apiUri}/v2/Manga/${mangaId}/Cover?width=64&height=64`;
|
return `${apiUri}/v2/Manga/${mangaId}/Cover?width=64&height=64`;
|
||||||
return `${apiUri}/v2/Manga/${mangaId}/Cover?width=${ref.clientWidth}&height=${ref.clientHeight}`;
|
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`)
|
return getData(`${apiUri}/v2/Manga/${mangaId}/Chapters`)
|
||||||
.then((json) => {
|
.then((json) => {
|
||||||
//console.info(`Got Manga ${internalId}`);
|
//console.info(`Got MangaFunctions ${internalId}`);
|
||||||
const ret = json as IChapter[];
|
const ret = json as IChapter[];
|
||||||
//console.debug(ret);
|
//console.debug(ret);
|
||||||
return (ret);
|
return (ret);
|
||||||
@@ -81,7 +81,7 @@ export default class Manga
|
|||||||
}
|
}
|
||||||
return getData(`${apiUri}/v2/Manga/${mangaId}/Chapters/Downloaded`)
|
return getData(`${apiUri}/v2/Manga/${mangaId}/Chapters/Downloaded`)
|
||||||
.then((json) => {
|
.then((json) => {
|
||||||
//console.info(`Got Manga ${internalId}`);
|
//console.info(`Got MangaFunctions ${internalId}`);
|
||||||
const ret = json as IChapter[];
|
const ret = json as IChapter[];
|
||||||
//console.debug(ret);
|
//console.debug(ret);
|
||||||
return (ret);
|
return (ret);
|
||||||
@@ -95,7 +95,7 @@ export default class Manga
|
|||||||
}
|
}
|
||||||
return getData(`${apiUri}/v2/Manga/${mangaId}/Chapters/NotDownloaded`)
|
return getData(`${apiUri}/v2/Manga/${mangaId}/Chapters/NotDownloaded`)
|
||||||
.then((json) => {
|
.then((json) => {
|
||||||
//console.info(`Got Manga ${internalId}`);
|
//console.info(`Got MangaFunctions ${internalId}`);
|
||||||
const ret = json as IChapter[];
|
const ret = json as IChapter[];
|
||||||
//console.debug(ret);
|
//console.debug(ret);
|
||||||
return (ret);
|
return (ret);
|
||||||
@@ -109,7 +109,7 @@ export default class Manga
|
|||||||
}
|
}
|
||||||
return getData(`${apiUri}/v2/Manga/${mangaId}/Chapter/LatestAvailable`)
|
return getData(`${apiUri}/v2/Manga/${mangaId}/Chapter/LatestAvailable`)
|
||||||
.then((json) => {
|
.then((json) => {
|
||||||
//console.info(`Got Manga ${internalId}`);
|
//console.info(`Got MangaFunctions ${internalId}`);
|
||||||
const ret = json as IChapter;
|
const ret = json as IChapter;
|
||||||
//console.debug(ret);
|
//console.debug(ret);
|
||||||
return (ret);
|
return (ret);
|
||||||
@@ -123,7 +123,7 @@ export default class Manga
|
|||||||
}
|
}
|
||||||
return getData(`${apiUri}/v2/Manga/${mangaId}/Chapter/LatestDownloaded`)
|
return getData(`${apiUri}/v2/Manga/${mangaId}/Chapter/LatestDownloaded`)
|
||||||
.then((json) => {
|
.then((json) => {
|
||||||
//console.info(`Got Manga ${internalId}`);
|
//console.info(`Got MangaFunctions ${internalId}`);
|
||||||
const ret = json as IChapter;
|
const ret = json as IChapter;
|
||||||
//console.debug(ret);
|
//console.debug(ret);
|
||||||
return (ret);
|
return (ret);
|
@@ -1,14 +1,14 @@
|
|||||||
import React, {EventHandler, ReactElement, useEffect, useState} from 'react';
|
import React, {EventHandler, ReactElement, useEffect, useState} from 'react';
|
||||||
import Job from './Job';
|
import JobFunctions from './JobFunctions';
|
||||||
import '../styles/monitorMangaList.css';
|
import '../styles/monitorMangaList.css';
|
||||||
import {JobType} from "./interfaces/Jobs/IJob";
|
import {JobType} from "./interfaces/Jobs/IJob";
|
||||||
import '../styles/MangaCoverCard.css'
|
import '../styles/mangaCover.css'
|
||||||
import DownloadAvailableChaptersJob from "./interfaces/Jobs/DownloadAvailableChaptersJob";
|
import IDownloadAvailableChaptersJob from "./interfaces/Jobs/IDownloadAvailableChaptersJob";
|
||||||
import {MangaItem} from "./interfaces/IManga";
|
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<any>, connectedToBackend: boolean, apiUri: string, updateList: Date}) {
|
export default function MonitorJobsList({onStartSearch, onJobsChanged, connectedToBackend, apiUri, updateList} : {onStartSearch() : void, onJobsChanged: EventHandler<any>, connectedToBackend: boolean, apiUri: string, updateList: Date}) {
|
||||||
const [MonitoringJobs, setMonitoringJobs] = useState<DownloadAvailableChaptersJob[]>([]);
|
const [MonitoringJobs, setMonitoringJobs] = useState<IDownloadAvailableChaptersJob[]>([]);
|
||||||
const [joblistUpdateInterval, setJoblistUpdateInterval] = React.useState<number>();
|
const [joblistUpdateInterval, setJoblistUpdateInterval] = React.useState<number>();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -31,8 +31,8 @@ export default function MonitorJobsList({onStartSearch, onJobsChanged, connected
|
|||||||
if(!connectedToBackend)
|
if(!connectedToBackend)
|
||||||
return;
|
return;
|
||||||
//console.debug("Updating MonitoringJobsList");
|
//console.debug("Updating MonitoringJobsList");
|
||||||
Job.GetJobsWithType(apiUri, JobType.DownloadAvailableChaptersJob)
|
JobFunctions.GetJobsWithType(apiUri, JobType.DownloadAvailableChaptersJob)
|
||||||
.then((jobs) => setMonitoringJobs(jobs as DownloadAvailableChaptersJob[]));
|
.then((jobs) => setMonitoringJobs(jobs as IDownloadAvailableChaptersJob[]));
|
||||||
}
|
}
|
||||||
|
|
||||||
function StartSearchMangaEntry() : ReactElement {
|
function StartSearchMangaEntry() : ReactElement {
|
||||||
@@ -52,7 +52,7 @@ export default function MonitorJobsList({onStartSearch, onJobsChanged, connected
|
|||||||
<MangaItem apiUri={apiUri} mangaId={MonitoringJob.mangaId} key={MonitoringJob.mangaId}>
|
<MangaItem apiUri={apiUri} mangaId={MonitoringJob.mangaId} key={MonitoringJob.mangaId}>
|
||||||
<></>
|
<></>
|
||||||
<button className="Manga-DeleteButton" onClick={() => {
|
<button className="Manga-DeleteButton" onClick={() => {
|
||||||
Manga.DeleteManga(apiUri, MonitoringJob.mangaId);
|
MangaFunctions.DeleteManga(apiUri, MonitoringJob.mangaId);
|
||||||
}}>Delete</button>
|
}}>Delete</button>
|
||||||
</MangaItem>
|
</MangaItem>
|
||||||
)}
|
)}
|
||||||
|
@@ -2,9 +2,9 @@ import INotificationConnector from "./interfaces/INotificationConnector";
|
|||||||
import {deleteData, getData, putData} from "../App";
|
import {deleteData, getData, putData} from "../App";
|
||||||
import IGotifyRecord from "./interfaces/records/IGotifyRecord";
|
import IGotifyRecord from "./interfaces/records/IGotifyRecord";
|
||||||
import INtfyRecord from "./interfaces/records/INtfyRecord";
|
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<INotificationConnector[]> {
|
static async GetNotificationConnectors(apiUri: string) : Promise<INotificationConnector[]> {
|
||||||
//console.info("Getting Notification Connectors");
|
//console.info("Getting Notification Connectors");
|
||||||
@@ -81,7 +81,7 @@ export default class NotificationConnector {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static async CreateLunasea(apiUri: string, lunasea: IlunaseaRecord) : Promise<string> {
|
static async CreateLunasea(apiUri: string, lunasea: ILunaseaRecord) : Promise<string> {
|
||||||
if(lunasea === undefined || lunasea === null) {
|
if(lunasea === undefined || lunasea === null) {
|
||||||
console.error(`ntfy was not provided`);
|
console.error(`ntfy was not provided`);
|
||||||
return Promise.reject();
|
return Promise.reject();
|
@@ -2,9 +2,8 @@ import React, {useEffect, useState} from 'react';
|
|||||||
import IJob, {JobState, JobType} from "./interfaces/Jobs/IJob";
|
import IJob, {JobState, JobType} from "./interfaces/Jobs/IJob";
|
||||||
import '../styles/queuePopUp.css';
|
import '../styles/queuePopUp.css';
|
||||||
import '../styles/popup.css';
|
import '../styles/popup.css';
|
||||||
import Job from "./Job";
|
import JobFunctions from "./JobFunctions";
|
||||||
import DownloadSingleChapterJob from "./interfaces/Jobs/DownloadSingleChapterJob";
|
import IDownloadSingleChapterJob from "./interfaces/Jobs/IDownloadSingleChapterJob";
|
||||||
import { MangaItem } from "./interfaces/IManga";
|
|
||||||
import {ChapterItem} from "./interfaces/IChapter";
|
import {ChapterItem} from "./interfaces/IChapter";
|
||||||
|
|
||||||
export default function QueuePopUp({connectedToBackend, children, apiUri} : {connectedToBackend: boolean, children: JSX.Element[], apiUri: string}) {
|
export default function QueuePopUp({connectedToBackend, children, apiUri} : {connectedToBackend: boolean, children: JSX.Element[], apiUri: string}) {
|
||||||
@@ -33,13 +32,13 @@ export default function QueuePopUp({connectedToBackend, children, apiUri} : {con
|
|||||||
}, [connectedToBackend]);
|
}, [connectedToBackend]);
|
||||||
|
|
||||||
function UpdateMonitoringJobsList(){
|
function UpdateMonitoringJobsList(){
|
||||||
Job.GetJobsInState(apiUri, JobState.Waiting)
|
JobFunctions.GetJobsInState(apiUri, JobState.Waiting)
|
||||||
.then((jobs: IJob[]) => {
|
.then((jobs: IJob[]) => {
|
||||||
//console.log(jobs);
|
//console.log(jobs);
|
||||||
return jobs;
|
return jobs;
|
||||||
})
|
})
|
||||||
.then(setWaitingJobs);
|
.then(setWaitingJobs);
|
||||||
Job.GetJobsInState(apiUri, JobState.Running)
|
JobFunctions.GetJobsInState(apiUri, JobState.Running)
|
||||||
.then((jobs: IJob[]) => {
|
.then((jobs: IJob[]) => {
|
||||||
//console.log(jobs);
|
//console.log(jobs);
|
||||||
return jobs;
|
return jobs;
|
||||||
@@ -55,25 +54,25 @@ export default function QueuePopUp({connectedToBackend, children, apiUri} : {con
|
|||||||
? <div className="popup" id="QueuePopUp">
|
? <div className="popup" id="QueuePopUp">
|
||||||
<div className="popupHeader">
|
<div className="popupHeader">
|
||||||
<h1>Queue Status</h1>
|
<h1>Queue Status</h1>
|
||||||
<img alt="Close Search" className="close" src="../media/close-x.svg"
|
<img alt="Close Queue" className="close" src="../media/close-x.svg"
|
||||||
onClick={() => setShowQueuePopup(false)}/>
|
onClick={() => setShowQueuePopup(false)}/>
|
||||||
</div>
|
</div>
|
||||||
<div id="QueuePopUpBody" className="popupBody">
|
<div id="QueuePopUpBody" className="popupBody">
|
||||||
<div>
|
<div>
|
||||||
{RunningJobs.filter(j => j.jobType == JobType.DownloadSingleChapterJob).map(j => {
|
{RunningJobs.filter(j => j.jobType == JobType.DownloadSingleChapterJob).map(j => {
|
||||||
let job = j as DownloadSingleChapterJob;
|
let job = j as IDownloadSingleChapterJob;
|
||||||
return <ChapterItem apiUri={apiUri} chapterId={job.chapterId} />
|
return <ChapterItem apiUri={apiUri} chapterId={job.chapterId} />
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
{WaitingJobs.filter(j => j.jobType == JobType.DownloadSingleChapterJob).map(j =>{
|
{WaitingJobs.filter(j => j.jobType == JobType.DownloadSingleChapterJob).map(j =>{
|
||||||
let job = j as DownloadSingleChapterJob;
|
let job = j as IDownloadSingleChapterJob;
|
||||||
return <ChapterItem apiUri={apiUri} chapterId={job.chapterId} />
|
return <ChapterItem apiUri={apiUri} chapterId={job.chapterId} />
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
: <></>
|
: null
|
||||||
}
|
}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
@@ -1,13 +1,13 @@
|
|||||||
import React, {ChangeEventHandler, EventHandler, useEffect, useState} from 'react';
|
import React, {ChangeEventHandler, EventHandler, useEffect, useState} from 'react';
|
||||||
import {MangaConnector} from "./MangaConnector";
|
import {MangaConnectorFunctions} from "./MangaConnectorFunctions";
|
||||||
import IMangaConnector from "./interfaces/IMangaConnector";
|
import IMangaConnector from "./interfaces/IMangaConnector";
|
||||||
import {isValidUri} from "../App";
|
import {isValidUri} from "../App";
|
||||||
import IManga, {MangaItem} from "./interfaces/IManga";
|
import IManga, {MangaItem} from "./interfaces/IManga";
|
||||||
import '../styles/search.css';
|
import '../styles/search.css';
|
||||||
import SearchFunctions from "./SearchFunctions";
|
import SearchFunctions from "./SearchFunctions";
|
||||||
import Job from "./Job";
|
import JobFunctions from "./JobFunctions";
|
||||||
import ILocalLibrary from "./interfaces/ILocalLibrary";
|
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}) {
|
export default function Search({apiUri, jobInterval, onJobsChanged, closeSearch} : {apiUri: string, jobInterval: Date, onJobsChanged: (internalId: string) => void, closeSearch(): void}) {
|
||||||
const [mangaConnectors, setConnectors] = useState<IMangaConnector[]>();
|
const [mangaConnectors, setConnectors] = useState<IMangaConnector[]>();
|
||||||
@@ -20,7 +20,7 @@ export default function Search({apiUri, jobInterval, onJobsChanged, closeSearch}
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if(mangaConnectors === undefined) {
|
if(mangaConnectors === undefined) {
|
||||||
MangaConnector.GetAllConnectors(apiUri).then(setConnectors)
|
MangaConnectorFunctions.GetAllConnectors(apiUri).then(setConnectors)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}, [mangaConnectors]);
|
}, [mangaConnectors]);
|
||||||
@@ -90,7 +90,7 @@ export default function Search({apiUri, jobInterval, onJobsChanged, closeSearch}
|
|||||||
let [selectedLibrary, setSelectedLibrary] = useState<ILocalLibrary | null>(null);
|
let [selectedLibrary, setSelectedLibrary] = useState<ILocalLibrary | null>(null);
|
||||||
let [libraries, setLibraries] = useState<ILocalLibrary[] | null>(null);
|
let [libraries, setLibraries] = useState<ILocalLibrary[] | null>(null);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
LocalLibrary.GetLibraries(apiUri).then(setLibraries);
|
LocalLibraryFunctions.GetLibraries(apiUri).then(setLibraries);
|
||||||
}, []);
|
}, []);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if(libraries === null || libraries.length < 1)
|
if(libraries === null || libraries.length < 1)
|
||||||
@@ -137,7 +137,7 @@ export default function Search({apiUri, jobInterval, onJobsChanged, closeSearch}
|
|||||||
: libraries.map(library => <option key={library.localLibraryId} value={library.localLibraryId}>{library.libraryName} ({library.basePath})</option>)}
|
: libraries.map(library => <option key={library.localLibraryId} value={library.localLibraryId}>{library.libraryName} ({library.basePath})</option>)}
|
||||||
</select>
|
</select>
|
||||||
<button className="Manga-AddButton" onClick={() => {
|
<button className="Manga-AddButton" onClick={() => {
|
||||||
Job.CreateDownloadAvailableChaptersJob(apiUri, result.mangaId, {recurrenceTimeMs: jobInterval.getTime(), localLibraryId: selectedLibrary!.localLibraryId}).then(() => onJobsChanged(result.mangaId));
|
JobFunctions.CreateDownloadAvailableChaptersJob(apiUri, result.mangaId, {recurrenceTimeMs: jobInterval.getTime(), localLibraryId: selectedLibrary!.localLibraryId}).then(() => onJobsChanged(result.mangaId));
|
||||||
}}>Monitor</button>
|
}}>Monitor</button>
|
||||||
</MangaItem>
|
</MangaItem>
|
||||||
)
|
)
|
||||||
|
@@ -1,7 +1,38 @@
|
|||||||
import IFrontendSettings from "./interfaces/IFrontendSettings";
|
import IFrontendSettings from "./interfaces/IFrontendSettings";
|
||||||
import '../styles/settings.css';
|
import '../styles/settings.css';
|
||||||
import '../styles/react-toggle.css';
|
import '../styles/react-toggle.css';
|
||||||
|
import React, {useEffect, useState} from "react";
|
||||||
|
import INotificationConnector, {NotificationConnectorItem} from "./interfaces/INotificationConnector";
|
||||||
|
import NotificationConnectorFunctions from "./NotificationConnectorFunctions";
|
||||||
|
|
||||||
export default function Settings({backendConnected, apiUri, settings, changeSettings} : {backendConnected: boolean, apiUri: string, settings: IFrontendSettings, changeSettings: (settings: IFrontendSettings) => void}) {
|
export default function Settings({backendConnected, apiUri, settings} : {backendConnected: boolean, apiUri: string, settings: IFrontendSettings}) {
|
||||||
|
let [showSettings, setShowSettings] = useState<boolean>(false);
|
||||||
|
let [notificationConnectors, setNotificationConnectors] = useState<INotificationConnector[]>([]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if(!backendConnected)
|
||||||
|
return;
|
||||||
|
NotificationConnectorFunctions.GetNotificationConnectors(apiUri).then(setNotificationConnectors);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div id="Settings">
|
||||||
|
<div onClick={() => setShowSettings(true)}>
|
||||||
|
<img id="Settings-Cogwheel" src="../../media/settings-cogwheel.svg" alt="settings-cogwheel" />
|
||||||
|
</div>
|
||||||
|
{showSettings
|
||||||
|
? <div className="popup" id="SettingsPopUp">
|
||||||
|
<div className="popupHeader">
|
||||||
|
<h1>Settings</h1>
|
||||||
|
<img alt="Close Settings" className="close" src="../media/close-x.svg" onClick={() => setShowSettings(false)}/>
|
||||||
|
</div>
|
||||||
|
<div id="SettingsPopUpBody" className="popupBody">
|
||||||
|
{notificationConnectors.map(c => <NotificationConnectorItem apiUri={apiUri} notificationConnector={c} />)}
|
||||||
|
<NotificationConnectorItem apiUri={apiUri} notificationConnector={null} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
: null
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
@@ -1,7 +1,7 @@
|
|||||||
import React, {ReactElement, ReactEventHandler, useEffect, useState} from "react";
|
import React, {ReactElement, ReactEventHandler, useEffect, useState} from "react";
|
||||||
import Manga from "../Manga";
|
import MangaFunctions from "../MangaFunctions";
|
||||||
import IManga from "./IManga";
|
import IManga from "./IManga";
|
||||||
import Chapter from "../Chapter";
|
import ChapterFunctions from "../ChapterFunctions";
|
||||||
|
|
||||||
export default interface IChapter{
|
export default interface IChapter{
|
||||||
chapterId: string;
|
chapterId: string;
|
||||||
@@ -24,25 +24,28 @@ export function ChapterItem({apiUri, chapterId} : {apiUri: string, chapterId: st
|
|||||||
let [mangaCoverUrl, setMangaCoverUrl] = useState<string>("../../media/blahaj.png");
|
let [mangaCoverUrl, setMangaCoverUrl] = useState<string>("../../media/blahaj.png");
|
||||||
let [mangaCoverHtmlImageItem, setMangaCoverHtmlImageItem] = useState<HTMLImageElement | null>(null);
|
let [mangaCoverHtmlImageItem, setMangaCoverHtmlImageItem] = useState<HTMLImageElement | null>(null);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
Chapter.GetChapterFromId(apiUri, chapterId).then(setChapter);
|
ChapterFunctions.GetChapterFromId(apiUri, chapterId).then(setChapter);
|
||||||
}, []);
|
}, []);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if(chapter === null)
|
if(chapter === null)
|
||||||
manga = null;
|
manga = null;
|
||||||
else
|
else
|
||||||
Manga.GetMangaById(apiUri, chapter.parentMangaId).then(setManga);
|
MangaFunctions.GetMangaById(apiUri, chapter.parentMangaId).then(setManga);
|
||||||
}, [chapter]);
|
}, [chapter]);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if(chapter != null && mangaCoverHtmlImageItem != null)
|
if(chapter != null && mangaCoverHtmlImageItem != null)
|
||||||
setMangaCoverUrl(Manga.GetMangaCoverImageUrl(apiUri, chapter.parentMangaId, mangaCoverHtmlImageItem));
|
setMangaCoverUrl(MangaFunctions.GetMangaCoverImageUrl(apiUri, chapter.parentMangaId, mangaCoverHtmlImageItem));
|
||||||
}, [chapter, mangaCoverHtmlImageItem]);
|
}, [chapter, mangaCoverHtmlImageItem]);
|
||||||
|
|
||||||
return (<div className="ChapterItem" key={chapterId}>
|
let [clicked, setClicked] = useState<boolean>(false);
|
||||||
<img className="ChapterItem-Cover" src={mangaCoverUrl} alt="Manga Cover" onLoad={setCoverItem} onResize={setCoverItem}></img>
|
|
||||||
<p className="ChapterItem-MangaName">{manga ? manga.name : "Manga-Name"}</p>
|
return (<div className="ChapterItem" key={chapterId} is-clicked={clicked ? "clicked" : "not-clicked"} onClick={() => setClicked(!clicked)}>
|
||||||
<p className="ChapterItem-ChapterName">{chapter ? chapter.title : "Chapter-Title"}</p>
|
<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>
|
||||||
<p className="ChapterItem-Volume">Vol.{chapter ? chapter.volumeNumber : "VolNum"}</p>
|
<p className="ChapterItem-Volume">Vol.{chapter ? chapter.volumeNumber : "VolNum"}</p>
|
||||||
<p className="ChapterItem-Chapter">Ch.{chapter ? chapter.chapterNumber : "ChNum"}</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>
|
||||||
<a className="ChapterItem-Website" href={chapter ? chapter.url : "#"}><img src="../../media/link.svg" alt="Link"/></a>
|
<a className="ChapterItem-Website" href={chapter ? chapter.url : "#"}><img src="../../media/link.svg" alt="Link"/></a>
|
||||||
</div>)
|
</div>)
|
||||||
}
|
}
|
@@ -8,7 +8,7 @@ export default interface ILocalLibrary {
|
|||||||
|
|
||||||
export function LocalLibrary(library: ILocalLibrary) : ReactElement {
|
export function LocalLibrary(library: ILocalLibrary) : ReactElement {
|
||||||
return (<div key={library.localLibraryId}>
|
return (<div key={library.localLibraryId}>
|
||||||
<p className={"LocalLibrary-Name"}>{library.libraryName}</p>
|
<p className={"LocalLibraryFunctions-Name"}>{library.libraryName}</p>
|
||||||
<p className={"LocalLibrary-Path"}>{library.basePath}</p>
|
<p className={"LocalLibraryFunctions-Path"}>{library.basePath}</p>
|
||||||
</div>);
|
</div>);
|
||||||
}
|
}
|
@@ -1,4 +1,4 @@
|
|||||||
import Manga from "../Manga";
|
import MangaFunctions from "../MangaFunctions";
|
||||||
import React, {Children, ReactElement, ReactEventHandler, useEffect, useState} from "react";
|
import React, {Children, ReactElement, ReactEventHandler, useEffect, useState} from "react";
|
||||||
import Icon from '@mdi/react';
|
import Icon from '@mdi/react';
|
||||||
import { mdiTagTextOutline, mdiAccountEdit, mdiLinkVariant } from '@mdi/js';
|
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 {
|
export function MangaItem({apiUri, mangaId, children} : {apiUri: string, mangaId: string, children?: (string | ReactElement)[]}) : ReactElement {
|
||||||
const LoadMangaCover : ReactEventHandler<HTMLImageElement> = (e) => {
|
const LoadMangaCover : ReactEventHandler<HTMLImageElement> = (e) => {
|
||||||
if(e.currentTarget.src != Manga.GetMangaCoverImageUrl(apiUri, mangaId, e.currentTarget))
|
if(e.currentTarget.src != MangaFunctions.GetMangaCoverImageUrl(apiUri, mangaId, e.currentTarget))
|
||||||
e.currentTarget.src = Manga.GetMangaCoverImageUrl(apiUri, mangaId, e.currentTarget);
|
e.currentTarget.src = MangaFunctions.GetMangaCoverImageUrl(apiUri, mangaId, e.currentTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
let [manga, setManga] = useState<IManga | null>(null);
|
let [manga, setManga] = useState<IManga | null>(null);
|
||||||
let [clicked, setClicked] = useState<boolean>(false);
|
let [clicked, setClicked] = useState<boolean>(false);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
Manga.GetMangaById(apiUri, mangaId).then(setManga);
|
MangaFunctions.GetMangaById(apiUri, mangaId).then(setManga);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (<div className="MangaItem" key={mangaId} is-clicked={clicked ? "clicked" : "not-clicked"} onClick={()=>setClicked(!clicked)}>
|
return (<div className="MangaItem" key={mangaId} is-clicked={clicked ? "clicked" : "not-clicked"} onClick={()=>setClicked(!clicked)}>
|
||||||
<img className="MangaItem-Cover" src={Manga.GetMangaCoverImageUrl(apiUri, mangaId, undefined)} alt="Manga Cover" onLoad={LoadMangaCover} onResize={LoadMangaCover}></img>
|
<img className="MangaItem-Cover" src={MangaFunctions.GetMangaCoverImageUrl(apiUri, mangaId, undefined)} alt="MangaFunctions Cover" onLoad={LoadMangaCover} onResize={LoadMangaCover}></img>
|
||||||
<p className="MangaItem-Connector">{manga ? manga.mangaConnectorId : "Connector"}</p>
|
<p className="MangaItem-Connector">{manga ? manga.mangaConnectorId : "Connector"}</p>
|
||||||
<p className="MangaItem-Status" release-status={manga?.releaseStatus}></p>
|
<p className="MangaItem-Status" release-status={manga?.releaseStatus}></p>
|
||||||
<p className="MangaItem-Name">{manga ? manga.name : "Name"}</p>
|
<p className="MangaItem-Name">{manga ? manga.name : "Name"}</p>
|
||||||
|
@@ -1,7 +0,0 @@
|
|||||||
export default interface INotificationConnector {
|
|
||||||
name: string;
|
|
||||||
url: string;
|
|
||||||
headers: Record<string, string>[];
|
|
||||||
httpMethod: string;
|
|
||||||
body: string;
|
|
||||||
}
|
|
57
Website/modules/interfaces/INotificationConnector.tsx
Normal file
57
Website/modules/interfaces/INotificationConnector.tsx
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
import {ReactElement, ReactEventHandler, useState} from "react";
|
||||||
|
|
||||||
|
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 {
|
||||||
|
const Save : ReactEventHandler<HTMLButtonElement> = (e) => {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const AddHeader : ReactEventHandler<HTMLButtonElement> = (e) => {
|
||||||
|
const div = e.currentTarget.parentElement as HTMLDivElement;
|
||||||
|
setHeaderElements([...headerElements, <HeaderElement record={null} />])
|
||||||
|
}
|
||||||
|
const [headerElements, setHeaderElements] = useState<ReactElement[]>([]);
|
||||||
|
|
||||||
|
return (<div className="NotificationConnectorItem" key={notificationConnector ? notificationConnector.name : "new"}>
|
||||||
|
<p className="NotificationConnectorItem-Name">{notificationConnector ? notificationConnector.name : "New Notification Connector"}</p>
|
||||||
|
<select className="NotificationConnectorItem-RequestMethod" defaultValue={notificationConnector ? notificationConnector.httpMethod : ""} disabled={notificationConnector != null}>
|
||||||
|
<option value="" disabled hidden>Request Method</option>
|
||||||
|
<option value="GET">GET</option>
|
||||||
|
<option value="POST">POST</option>
|
||||||
|
</select>
|
||||||
|
<input type="url" className="NotificationConnectorItem-Url" placeholder="URL" value={notificationConnector ? notificationConnector.url : ""} disabled={notificationConnector != null} />
|
||||||
|
<textarea className="NotificationConnectorItem-Body" placeholder="Request-Body" value={notificationConnector ? notificationConnector.body : ""} disabled={notificationConnector != null} />
|
||||||
|
{notificationConnector != null ? null :
|
||||||
|
(
|
||||||
|
<p className="NotificationConnectorItem-Explanation">Explanation Text</p>
|
||||||
|
)}
|
||||||
|
<div className="NotificationConnectorItem-Headers">
|
||||||
|
{notificationConnector
|
||||||
|
? notificationConnector.headers.map((h: Record<string, string>) =>
|
||||||
|
(<HeaderElement record={h} />)
|
||||||
|
) :
|
||||||
|
(
|
||||||
|
<button className="NotificationConnectorItem-AddHeader" onClick={AddHeader}>Add Header</button>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
{headerElements}
|
||||||
|
</div>
|
||||||
|
{notificationConnector != null ? null : (
|
||||||
|
<button className="NotificationConnectorItem-Save" onClick={Save}>Save</button>
|
||||||
|
)}
|
||||||
|
</div>);
|
||||||
|
}
|
||||||
|
|
||||||
|
function HeaderElement({record} : {record: Record<string, string> | null}) : ReactElement {
|
||||||
|
return <div className="NotificationConnectorItem-Header" key={"newHeader"}>
|
||||||
|
<input type="text" className="NotificationConnectorItem-Header-Key" placeholder="Header-Key" value={record ? record.name : ""} disabled={record != null} />
|
||||||
|
<input type="text" className="NotificationConnectorItem-Header-Value" placeholder="Header-Value" value={record ? record.value : ""} disabled={record != null} />
|
||||||
|
</div>;
|
||||||
|
}
|
@@ -1,5 +0,0 @@
|
|||||||
import IJob from "./IJob";
|
|
||||||
|
|
||||||
export default interface DownloadAvailableChaptersJob extends IJob {
|
|
||||||
mangaId: string;
|
|
||||||
}
|
|
@@ -1,5 +0,0 @@
|
|||||||
import IJob from "./IJob";
|
|
||||||
|
|
||||||
export default interface DownloadMangaCoverJob extends IJob {
|
|
||||||
mangaId: string;
|
|
||||||
}
|
|
@@ -1,5 +0,0 @@
|
|||||||
import IJob from "./IJob";
|
|
||||||
|
|
||||||
export default interface DownloadSingleChapterJob extends IJob {
|
|
||||||
chapterId: string;
|
|
||||||
}
|
|
@@ -0,0 +1,5 @@
|
|||||||
|
import IJob from "./IJob";
|
||||||
|
|
||||||
|
export default interface IDownloadAvailableChaptersJob extends IJob {
|
||||||
|
mangaId: string;
|
||||||
|
}
|
@@ -0,0 +1,5 @@
|
|||||||
|
import IJob from "./IJob";
|
||||||
|
|
||||||
|
export default interface IDownloadMangaCoverJob extends IJob {
|
||||||
|
mangaId: string;
|
||||||
|
}
|
@@ -0,0 +1,5 @@
|
|||||||
|
import IJob from "./IJob";
|
||||||
|
|
||||||
|
export default interface IDownloadSingleChapterJob extends IJob {
|
||||||
|
chapterId: string;
|
||||||
|
}
|
@@ -17,7 +17,8 @@ export enum JobType {
|
|||||||
MoveFileOrFolderJob = "MoveFileOrFolderJob",
|
MoveFileOrFolderJob = "MoveFileOrFolderJob",
|
||||||
DownloadMangaCoverJob = "DownloadMangaCoverJob",
|
DownloadMangaCoverJob = "DownloadMangaCoverJob",
|
||||||
RetrieveChaptersJob = "RetrieveChaptersJob",
|
RetrieveChaptersJob = "RetrieveChaptersJob",
|
||||||
UpdateFilesDownloadedJob = "UpdateFilesDownloadedJob"
|
UpdateFilesDownloadedJob = "UpdateFilesDownloadedJob",
|
||||||
|
MoveMangaLibraryJob = "MoveMangaLibraryJob"
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum JobState {
|
export enum JobState {
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import IJob from "./IJob";
|
import IJob from "./IJob";
|
||||||
|
|
||||||
export default interface MoveFileOrFolderJob extends IJob {
|
export default interface IMoveFileOrFolderJob extends IJob {
|
||||||
fromLocation: string;
|
fromLocation: string;
|
||||||
toLocation: string;
|
toLocation: string;
|
||||||
}
|
}
|
6
Website/modules/interfaces/Jobs/IMoveMangaLibraryJob.ts
Normal file
6
Website/modules/interfaces/Jobs/IMoveMangaLibraryJob.ts
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import IJob from "./IJob";
|
||||||
|
|
||||||
|
export default interface IMoveMangaLibraryJob extends IJob {
|
||||||
|
MangaId: string;
|
||||||
|
ToLibraryId: string;
|
||||||
|
}
|
5
Website/modules/interfaces/Jobs/IRetrieveChaptersJob.ts
Normal file
5
Website/modules/interfaces/Jobs/IRetrieveChaptersJob.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
import IJob from "./IJob";
|
||||||
|
|
||||||
|
export default interface IRetrieveChaptersJob extends IJob {
|
||||||
|
mangaId: string;
|
||||||
|
}
|
@@ -0,0 +1,5 @@
|
|||||||
|
import IJob from "./IJob";
|
||||||
|
|
||||||
|
export default interface IUpdateFilesDownloadedJob extends IJob {
|
||||||
|
mangaId: string;
|
||||||
|
}
|
5
Website/modules/interfaces/Jobs/IUpdateMetadataJob.ts
Normal file
5
Website/modules/interfaces/Jobs/IUpdateMetadataJob.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
import IJob from "./IJob";
|
||||||
|
|
||||||
|
export default interface IUpdateMetadataJob extends IJob {
|
||||||
|
mangaId: string;
|
||||||
|
}
|
@@ -1,5 +0,0 @@
|
|||||||
import IJob from "./IJob";
|
|
||||||
|
|
||||||
export default interface RetrieveChaptersJob extends IJob {
|
|
||||||
mangaId: string;
|
|
||||||
}
|
|
@@ -1,5 +0,0 @@
|
|||||||
import IJob from "./IJob";
|
|
||||||
|
|
||||||
export default interface UpdateFilesDownloadedJob extends IJob {
|
|
||||||
mangaId: string;
|
|
||||||
}
|
|
@@ -1,5 +0,0 @@
|
|||||||
import IJob from "./IJob";
|
|
||||||
|
|
||||||
export default interface UpdateMetadataJob extends IJob {
|
|
||||||
mangaId: string;
|
|
||||||
}
|
|
@@ -1,9 +0,0 @@
|
|||||||
export default interface ICoverFormatRequestRecord {
|
|
||||||
size: Size;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Size {
|
|
||||||
width: number;
|
|
||||||
height: number;
|
|
||||||
isEmpty: boolean;
|
|
||||||
}
|
|
3
Website/modules/interfaces/records/ILunaseaRecord.ts
Normal file
3
Website/modules/interfaces/records/ILunaseaRecord.ts
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
export default interface ILunaseaRecord {
|
||||||
|
id: string;
|
||||||
|
}
|
@@ -1,3 +0,0 @@
|
|||||||
export default interface IlunaseaRecord {
|
|
||||||
id: string;
|
|
||||||
}
|
|
@@ -30,4 +30,8 @@ header > #titlebox > span{
|
|||||||
header > #titlebox > img {
|
header > #titlebox > img {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
cursor: grab;
|
cursor: grab;
|
||||||
|
}
|
||||||
|
|
||||||
|
header > * {
|
||||||
|
height: 100%;
|
||||||
}
|
}
|
@@ -0,0 +1,15 @@
|
|||||||
|
#Settings {
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
#Settings > * {
|
||||||
|
height: 80%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#Settings > div > img {
|
||||||
|
height: calc(100% - 10px);
|
||||||
|
margin: 5px;
|
||||||
|
filter: invert(100%) sepia(20%) saturate(7480%) hue-rotate(179deg) brightness(121%) contrast(102%);
|
||||||
|
}
|
Reference in New Issue
Block a user