API Dependency-Update

This commit is contained in:
glax 2025-05-17 17:59:30 +02:00
parent 00932bf6bd
commit 0907031583
17 changed files with 145 additions and 49 deletions

View File

@ -103,7 +103,7 @@ export function Manga({manga, children, loading} : { manga: IManga | undefined,
const mangaName = useManga.name.length > 30 ? useManga.name.substring(0, 27) + "..." : useManga.name; const mangaName = useManga.name.length > 30 ? useManga.name.substring(0, 27) + "..." : useManga.name;
return ( return (
<Badge sx={{margin:"8px !important"}} badgeContent={useManga.mangaConnectorId} color={ReleaseStatusToPalette(useManga.releaseStatus)} size={"lg"}> <Badge sx={{margin:"8px !important"}} badgeContent={useManga.mangaConnectorName} color={ReleaseStatusToPalette(useManga.releaseStatus)} size={"lg"}>
<Card sx={{height:"fit-content",width:"fit-content"}} onClick={(e) => { <Card sx={{height:"fit-content",width:"fit-content"}} onClick={(e) => {
const target = e.target as HTMLElement; const target = e.target as HTMLElement;
if(interactiveElements.find(x => x == target.localName) == undefined) if(interactiveElements.find(x => x == target.localName) == undefined)

View File

@ -164,7 +164,7 @@ export default function Search({open, setOpen}:{open:boolean, setOpen:React.Disp
})} })}
</Select> </Select>
<Button disabled={localLibrariesLoading || selectedLibraryId === undefined} onClick={() => { <Button disabled={localLibrariesLoading || selectedLibraryId === undefined} onClick={() => {
CreateDownloadAvailableChaptersJob(apiUri, result.mangaId, {localLibraryId: selectedLibraryId!,recurrenceTimeMs: 1000 * 60 * 60 * 3}) CreateDownloadAvailableChaptersJob(apiUri, result.mangaId, {localLibraryId: selectedLibraryId!,recurrenceTimeMs: 1000 * 60 * 60 * 3, language: "en"})
}} endDecorator={<Add />}>Watch</Button> }} endDecorator={<Add />}>Watch</Button>
</Manga>)} </Manga>)}
</Stack> </Stack>

View File

@ -1,7 +1,7 @@
import {deleteData, getData, patchData, postData, putData} from "./fetchApi"; import {deleteData, getData, patchData, postData, putData} from "./fetchApi";
import IJob, {JobState, JobType} from "./types/Jobs/IJob"; import IJob, {JobState, JobType} from "./types/Jobs/IJob";
import IModifyJobRecord from "./types/records/IModifyJobRecord"; import IModifyJobRecord from "./types/records/IModifyJobRecord";
import IDownloadAvailableJobsRecord from "./types/records/IDownloadAvailableJobsRecord.ts"; import IDownloadAvailableChaptersJobRecord from "./types/records/IDownloadAvailableChaptersJobRecord.ts";
export const GetAllJobs = async (apiUri: string) : Promise<IJob[]> => { export const GetAllJobs = async (apiUri: string) : Promise<IJob[]> => {
return await getData(`${apiUri}/v2/Job`) as Promise<IJob[]>; return await getData(`${apiUri}/v2/Job`) as Promise<IJob[]>;
@ -54,7 +54,7 @@ export const ModifyJob = async (apiUri: string, jobId: string, modifyData: IModi
return await patchData(`${apiUri}/v2/Job/${jobId}`, modifyData) as Promise<IJob>; return await patchData(`${apiUri}/v2/Job/${jobId}`, modifyData) as Promise<IJob>;
} }
export const CreateDownloadAvailableChaptersJob = async (apiUri: string, mangaId: string, data: IDownloadAvailableJobsRecord) : Promise<string[]> => { export const CreateDownloadAvailableChaptersJob = async (apiUri: string, mangaId: string, data: IDownloadAvailableChaptersJobRecord) : Promise<string[]> => {
if(mangaId === undefined || mangaId === null || mangaId.length < 1) if(mangaId === undefined || mangaId === null || mangaId.length < 1)
return Promise.reject("mangaId was not provided"); return Promise.reject("mangaId was not provided");
if(data === undefined || data === null) if(data === undefined || data === null)

View File

@ -1,4 +1,4 @@
import {postData} from "./fetchApi.tsx"; import {getData, postData} from "./fetchApi.tsx";
import IManga from "./types/IManga.ts"; import IManga from "./types/IManga.ts";
export const SearchName = async (apiUri: string, name: string) : Promise<IManga[]> => { export const SearchName = async (apiUri: string, name: string) : Promise<IManga[]> => {
@ -12,7 +12,7 @@ export const SearchNameOnConnector = async (apiUri: string, connectorName: strin
return Promise.reject("connectorName was not provided"); return Promise.reject("connectorName was not provided");
if(name === undefined || name === null || name.length < 1) if(name === undefined || name === null || name.length < 1)
return Promise.reject("name was not provided"); return Promise.reject("name was not provided");
return await postData(`${apiUri}/v2/Search/${connectorName}`, name) as Promise<IManga[]>; return await getData(`${apiUri}/v2/Search/${connectorName}/${name}`) as Promise<IManga[]>;
} }
export const SearchUrl = async (apiUri: string, url: string) : Promise<IManga> => { export const SearchUrl = async (apiUri: string, url: string) : Promise<IManga> => {

View File

@ -1,4 +0,0 @@
export enum LibraryType {
Komga = "Komga",
Kavita = "Kavita"
}

View File

@ -1,10 +1,11 @@
export default interface IChapter{ export default interface IChapter{
chapterId: string; chapterId: string;
volumeNumber: number; parentMangaId: string;
volumeNumber: number | null;
chapterNumber: string; chapterNumber: string;
url: string; url: string;
title: string | undefined; title: string | null;
archiveFileName: string; fileName: string | null;
downloaded: boolean; downloaded: boolean;
parentMangaId: string; fullArchiveFilePath: string;
} }

View File

@ -1,8 +1,11 @@
import {LibraryType} from "./EnumLibraryType";
export default interface ILibraryConnector { export default interface ILibraryConnector {
libraryConnectorId: string; libraryConnectorId: string;
libraryType: LibraryType; libraryType: LibraryType;
baseUrl: string; baseUrl: string;
auth: string; auth: string;
}
export enum LibraryType {
Komga = "Komga",
Kavita = "Kavita"
} }

View File

@ -1,4 +1,8 @@
import {MangaReleaseStatus} from "./EnumMangaReleaseStatus"; import {MangaReleaseStatus} from "./EnumMangaReleaseStatus";
import IAuthor from "./IAuthor.ts";
import IMangaAltTitle from "./IMangaAltTitle.ts";
import IMangaTag from "./IMangaTag.ts";
import ILink from "./ILink.ts";
export default interface IManga{ export default interface IManga{
mangaId: string; mangaId: string;
@ -6,16 +10,18 @@ export default interface IManga{
name: string; name: string;
description: string; description: string;
websiteUrl: string; websiteUrl: string;
year: number;
originalLanguage: string;
releaseStatus: MangaReleaseStatus; releaseStatus: MangaReleaseStatus;
folderName: string; libraryId: string | null;
ignoreChapterBefore: number; mangaConnectorName: string;
mangaConnectorId: string; authors: IAuthor[] | null;
authorIds: string[]; mangaTags: IMangaTag[] | null;
tags: string[]; links: ILink[] | null;
linkIds: string[]; altTitles: IMangaAltTitle[] | null;
altTitleIds: string[]; ignoreChaptersBefore: number;
directoryName: string;
year: number | null;
originalLanguage: string | null;
chapterIds: string[] | null;
} }
export const DefaultManga : IManga = { export const DefaultManga : IManga = {
@ -24,14 +30,16 @@ export const DefaultManga : IManga = {
name: "Loading", name: "Loading",
description: "Loading", description: "Loading",
websiteUrl: "", websiteUrl: "",
releaseStatus: MangaReleaseStatus.Continuing,
libraryId: null,
mangaConnectorName: "Loading",
authors: null,
mangaTags: null,
links: null,
altTitles: null,
ignoreChaptersBefore: 0,
directoryName: "",
year: 1999, year: 1999,
originalLanguage: "en", originalLanguage: "en",
releaseStatus: MangaReleaseStatus.Continuing, chapterIds: null
folderName: "Loading",
ignoreChapterBefore: 0,
mangaConnectorId: "Loading",
authorIds: ["Loading"],
tags: ["Loading"],
linkIds: ["Loading"],
altTitleIds: ["Loading"],
} }

View File

@ -0,0 +1,3 @@
export default interface IMangaTag {
tag: string;
}

View File

@ -1,7 +1,6 @@
export default interface IJob{ export default interface IJob{
jobId: string; jobId: string;
parentJobId: string; parentJobId: string | null;
dependsOnJobIds: string[];
jobType: JobType; jobType: JobType;
recurrenceMs: number; recurrenceMs: number;
lastExecution: Date; lastExecution: Date;
@ -17,13 +16,15 @@ export enum JobType {
MoveFileOrFolderJob = "MoveFileOrFolderJob", MoveFileOrFolderJob = "MoveFileOrFolderJob",
DownloadMangaCoverJob = "DownloadMangaCoverJob", DownloadMangaCoverJob = "DownloadMangaCoverJob",
RetrieveChaptersJob = "RetrieveChaptersJob", RetrieveChaptersJob = "RetrieveChaptersJob",
UpdateFilesDownloadedJob = "UpdateFilesDownloadedJob", UpdateChaptersDownloadedJob = "UpdateChaptersDownloadedJob",
MoveMangaLibraryJob = "MoveMangaLibraryJob" MoveMangaLibraryJob = "MoveMangaLibraryJob",
UpdateSingleChapterDownloadedJob = "UpdateSingleChapterDownloadedJob"
} }
export enum JobState { export enum JobState {
Waiting = "Waiting", FirstExecution = "FirstExecution",
Running = "Running", Running = "Running",
Completed = "Completed", Completed = "Completed",
CompletedWaiting = "CompletedWaiting",
Failed = "Failed" Failed = "Failed"
} }

View File

@ -0,0 +1,5 @@
export default interface IDownloadAvailableChaptersJobRecord {
language: string;
recurrenceTimeMs: number;
localLibraryId: string;
}

View File

@ -1,4 +0,0 @@
export default interface IDownloadAvailableJobsRecord {
recurrenceTimeMs: number;
localLibraryId: string;
}

View File

@ -1,5 +1,3 @@
import "../../../styles/notificationConnector.css";
export default interface IGotifyRecord { export default interface IGotifyRecord {
endpoint: string; endpoint: string;
appToken: string; appToken: string;

View File

@ -1,5 +1,3 @@
import "../../../styles/notificationConnector.css";
export default interface INtfyRecord { export default interface INtfyRecord {
endpoint: string; endpoint: string;
username: string; username: string;

View File

@ -1,5 +1,3 @@
import "../../../styles/notificationConnector.css";
export default interface IPushoverRecord { export default interface IPushoverRecord {
apptoken: string; apptoken: string;
user: string; user: string;

View File

@ -6,11 +6,12 @@ import '@fontsource/inter';
import { CssVarsProvider } from '@mui/joy/styles'; import { CssVarsProvider } from '@mui/joy/styles';
import CssBaseline from '@mui/joy/CssBaseline'; import CssBaseline from '@mui/joy/CssBaseline';
import {StrictMode} from "react"; import {StrictMode} from "react";
import {trangaTheme} from "./theme.ts";
export default function MyApp() { export default function MyApp() {
return ( return (
<StrictMode> <StrictMode>
<CssVarsProvider> <CssVarsProvider theme={trangaTheme}>
{/* must be used under CssVarsProvider */} {/* must be used under CssVarsProvider */}
<CssBaseline /> <CssBaseline />

View File

@ -0,0 +1,88 @@
import { extendTheme } from '@mui/joy/styles';
export const trangaTheme = extendTheme({
"colorSchemes": {
"light": {
"palette": {
"primary": {
"50": "#FCE5EA",
"100": "#FBDDE3",
"200": "#F9CBD4",
"300": "#F7BAC6",
"400": "#F5A9B8",
"500": "#F5A9B8",
"600": "#C48793",
"700": "#AC7681",
"800": "#93656E",
"900": "#7B555C"
},
"neutral": {
"50": "#E6E6E6",
"100": "#CCCCCC",
"200": "#B3B3B3",
"300": "#999999",
"400": "#808080",
"500": "#666666",
"600": "#4C4C4C",
"700": "#333333",
"800": "#191919",
"900": "#000",
"plainColor": "var(--joy-palette-neutral-50)",
"plainHoverBg": "var(--joy-palette-neutral-700)",
"outlinedColor": "var(--joy-palette-neutral-50)",
},
"success": {
"50": "#cef0fe",
"100": "#bdebfd",
"200": "#9de2fc",
"300": "#7cd8fb",
"400": "#5bcefa",
"500": "#5bcefa",
"600": "#49a5c8",
"700": "#4090af",
"800": "#2e677d",
"900": "#245264"
},
"danger": {
"50": "#f2c0b3",
"100": "#ea9680",
"200": "#e68166",
"300": "#dd5733",
"400": "#d52d00",
"500": "#d52d00",
"600": "#aa2400",
"700": "#951f00",
"800": "#6b1700",
"900": "#400d00"
},
"warning": {
"50": "#ffebdd",
"100": "#ffd7bb",
"200": "#ffc29a",
"300": "#ffae78",
"400": "#ff9a56",
"500": "#ff9a56",
"600": "#cc7b45",
"700": "#995c34",
"800": "#663e22",
"900": "#331f11"
},
"background": {
"body": "var(--joy-palette-neutral-900)",
"surface": "var(--joy-palette-neutral-900)",
"popup": "var(--joy-palette-neutral-800)"
},
"text": {
"primary": "var(--joy-palette-neutral-50)",
"secondary": "var(--joy-palette-success-200)",
"tertiary": "var(--joy-palette-primary-200)",
"icon": "var(--joy-palette-primary-50)"
}
}
},
"dark": {
"palette": {}
}
}
})