From 0907031583d72a18b9ee79776ac9af70b334ca26 Mon Sep 17 00:00:00 2001 From: glax Date: Sat, 17 May 2025 17:59:30 +0200 Subject: [PATCH] API Dependency-Update --- tranga-website/src/Components/Manga.tsx | 2 +- tranga-website/src/Components/Search.tsx | 2 +- tranga-website/src/api/Job.tsx | 4 +- tranga-website/src/api/Search.tsx | 4 +- .../src/api/types/EnumLibraryType.ts | 4 - tranga-website/src/api/types/IChapter.ts | 9 +- .../src/api/types/ILibraryConnector.ts | 7 +- tranga-website/src/api/types/IManga.ts | 42 +++++---- tranga-website/src/api/types/IMangaTag.ts | 3 + tranga-website/src/api/types/Jobs/IJob.ts | 11 +-- .../IDownloadAvailableChaptersJobRecord.ts | 5 ++ .../records/IDownloadAvailableJobsRecord.ts | 4 - .../src/api/types/records/IGotifyRecord.ts | 2 - .../src/api/types/records/INtfyRecord.ts | 2 - .../src/api/types/records/IPushoverRecord.ts | 2 - tranga-website/src/main.tsx | 3 +- tranga-website/src/theme.ts | 88 +++++++++++++++++++ 17 files changed, 145 insertions(+), 49 deletions(-) create mode 100644 tranga-website/src/api/types/IMangaTag.ts create mode 100644 tranga-website/src/api/types/records/IDownloadAvailableChaptersJobRecord.ts delete mode 100644 tranga-website/src/api/types/records/IDownloadAvailableJobsRecord.ts create mode 100644 tranga-website/src/theme.ts diff --git a/tranga-website/src/Components/Manga.tsx b/tranga-website/src/Components/Manga.tsx index 8bc1951..822d60a 100644 --- a/tranga-website/src/Components/Manga.tsx +++ b/tranga-website/src/Components/Manga.tsx @@ -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; return ( - + { const target = e.target as HTMLElement; if(interactiveElements.find(x => x == target.localName) == undefined) diff --git a/tranga-website/src/Components/Search.tsx b/tranga-website/src/Components/Search.tsx index c2b9f8c..4bacf63 100644 --- a/tranga-website/src/Components/Search.tsx +++ b/tranga-website/src/Components/Search.tsx @@ -164,7 +164,7 @@ export default function Search({open, setOpen}:{open:boolean, setOpen:React.Disp })} )} diff --git a/tranga-website/src/api/Job.tsx b/tranga-website/src/api/Job.tsx index 07a6a76..8ad08a0 100644 --- a/tranga-website/src/api/Job.tsx +++ b/tranga-website/src/api/Job.tsx @@ -1,7 +1,7 @@ import {deleteData, getData, patchData, postData, putData} from "./fetchApi"; import IJob, {JobState, JobType} from "./types/Jobs/IJob"; 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 => { return await getData(`${apiUri}/v2/Job`) as Promise; @@ -54,7 +54,7 @@ export const ModifyJob = async (apiUri: string, jobId: string, modifyData: IModi return await patchData(`${apiUri}/v2/Job/${jobId}`, modifyData) as Promise; } -export const CreateDownloadAvailableChaptersJob = async (apiUri: string, mangaId: string, data: IDownloadAvailableJobsRecord) : Promise => { +export const CreateDownloadAvailableChaptersJob = async (apiUri: string, mangaId: string, data: IDownloadAvailableChaptersJobRecord) : Promise => { if(mangaId === undefined || mangaId === null || mangaId.length < 1) return Promise.reject("mangaId was not provided"); if(data === undefined || data === null) diff --git a/tranga-website/src/api/Search.tsx b/tranga-website/src/api/Search.tsx index 1ca2372..4abf20f 100644 --- a/tranga-website/src/api/Search.tsx +++ b/tranga-website/src/api/Search.tsx @@ -1,4 +1,4 @@ -import {postData} from "./fetchApi.tsx"; +import {getData, postData} from "./fetchApi.tsx"; import IManga from "./types/IManga.ts"; export const SearchName = async (apiUri: string, name: string) : Promise => { @@ -12,7 +12,7 @@ export const SearchNameOnConnector = async (apiUri: string, connectorName: strin return Promise.reject("connectorName was not provided"); if(name === undefined || name === null || name.length < 1) return Promise.reject("name was not provided"); - return await postData(`${apiUri}/v2/Search/${connectorName}`, name) as Promise; + return await getData(`${apiUri}/v2/Search/${connectorName}/${name}`) as Promise; } export const SearchUrl = async (apiUri: string, url: string) : Promise => { diff --git a/tranga-website/src/api/types/EnumLibraryType.ts b/tranga-website/src/api/types/EnumLibraryType.ts index 5665b04..e69de29 100644 --- a/tranga-website/src/api/types/EnumLibraryType.ts +++ b/tranga-website/src/api/types/EnumLibraryType.ts @@ -1,4 +0,0 @@ -export enum LibraryType { - Komga = "Komga", - Kavita = "Kavita" -} \ No newline at end of file diff --git a/tranga-website/src/api/types/IChapter.ts b/tranga-website/src/api/types/IChapter.ts index e255ff6..e2f091a 100644 --- a/tranga-website/src/api/types/IChapter.ts +++ b/tranga-website/src/api/types/IChapter.ts @@ -1,10 +1,11 @@ export default interface IChapter{ chapterId: string; - volumeNumber: number; + parentMangaId: string; + volumeNumber: number | null; chapterNumber: string; url: string; - title: string | undefined; - archiveFileName: string; + title: string | null; + fileName: string | null; downloaded: boolean; - parentMangaId: string; + fullArchiveFilePath: string; } \ No newline at end of file diff --git a/tranga-website/src/api/types/ILibraryConnector.ts b/tranga-website/src/api/types/ILibraryConnector.ts index 7e2322e..a477475 100644 --- a/tranga-website/src/api/types/ILibraryConnector.ts +++ b/tranga-website/src/api/types/ILibraryConnector.ts @@ -1,8 +1,11 @@ -import {LibraryType} from "./EnumLibraryType"; - export default interface ILibraryConnector { libraryConnectorId: string; libraryType: LibraryType; baseUrl: string; auth: string; +} + +export enum LibraryType { + Komga = "Komga", + Kavita = "Kavita" } \ No newline at end of file diff --git a/tranga-website/src/api/types/IManga.ts b/tranga-website/src/api/types/IManga.ts index d6e9bf8..d34b3cb 100644 --- a/tranga-website/src/api/types/IManga.ts +++ b/tranga-website/src/api/types/IManga.ts @@ -1,4 +1,8 @@ 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{ mangaId: string; @@ -6,16 +10,18 @@ export default interface IManga{ name: string; description: string; websiteUrl: string; - year: number; - originalLanguage: string; releaseStatus: MangaReleaseStatus; - folderName: string; - ignoreChapterBefore: number; - mangaConnectorId: string; - authorIds: string[]; - tags: string[]; - linkIds: string[]; - altTitleIds: string[]; + libraryId: string | null; + mangaConnectorName: string; + authors: IAuthor[] | null; + mangaTags: IMangaTag[] | null; + links: ILink[] | null; + altTitles: IMangaAltTitle[] | null; + ignoreChaptersBefore: number; + directoryName: string; + year: number | null; + originalLanguage: string | null; + chapterIds: string[] | null; } export const DefaultManga : IManga = { @@ -24,14 +30,16 @@ export const DefaultManga : IManga = { name: "Loading", description: "Loading", websiteUrl: "", + releaseStatus: MangaReleaseStatus.Continuing, + libraryId: null, + mangaConnectorName: "Loading", + authors: null, + mangaTags: null, + links: null, + altTitles: null, + ignoreChaptersBefore: 0, + directoryName: "", year: 1999, originalLanguage: "en", - releaseStatus: MangaReleaseStatus.Continuing, - folderName: "Loading", - ignoreChapterBefore: 0, - mangaConnectorId: "Loading", - authorIds: ["Loading"], - tags: ["Loading"], - linkIds: ["Loading"], - altTitleIds: ["Loading"], + chapterIds: null } \ No newline at end of file diff --git a/tranga-website/src/api/types/IMangaTag.ts b/tranga-website/src/api/types/IMangaTag.ts new file mode 100644 index 0000000..64aa37c --- /dev/null +++ b/tranga-website/src/api/types/IMangaTag.ts @@ -0,0 +1,3 @@ +export default interface IMangaTag { + tag: string; +} \ No newline at end of file diff --git a/tranga-website/src/api/types/Jobs/IJob.ts b/tranga-website/src/api/types/Jobs/IJob.ts index a23e08d..e1f0757 100644 --- a/tranga-website/src/api/types/Jobs/IJob.ts +++ b/tranga-website/src/api/types/Jobs/IJob.ts @@ -1,7 +1,6 @@ export default interface IJob{ jobId: string; - parentJobId: string; - dependsOnJobIds: string[]; + parentJobId: string | null; jobType: JobType; recurrenceMs: number; lastExecution: Date; @@ -17,13 +16,15 @@ export enum JobType { MoveFileOrFolderJob = "MoveFileOrFolderJob", DownloadMangaCoverJob = "DownloadMangaCoverJob", RetrieveChaptersJob = "RetrieveChaptersJob", - UpdateFilesDownloadedJob = "UpdateFilesDownloadedJob", - MoveMangaLibraryJob = "MoveMangaLibraryJob" + UpdateChaptersDownloadedJob = "UpdateChaptersDownloadedJob", + MoveMangaLibraryJob = "MoveMangaLibraryJob", + UpdateSingleChapterDownloadedJob = "UpdateSingleChapterDownloadedJob" } export enum JobState { - Waiting = "Waiting", + FirstExecution = "FirstExecution", Running = "Running", Completed = "Completed", + CompletedWaiting = "CompletedWaiting", Failed = "Failed" } \ No newline at end of file diff --git a/tranga-website/src/api/types/records/IDownloadAvailableChaptersJobRecord.ts b/tranga-website/src/api/types/records/IDownloadAvailableChaptersJobRecord.ts new file mode 100644 index 0000000..e41ae9b --- /dev/null +++ b/tranga-website/src/api/types/records/IDownloadAvailableChaptersJobRecord.ts @@ -0,0 +1,5 @@ +export default interface IDownloadAvailableChaptersJobRecord { + language: string; + recurrenceTimeMs: number; + localLibraryId: string; +} \ No newline at end of file diff --git a/tranga-website/src/api/types/records/IDownloadAvailableJobsRecord.ts b/tranga-website/src/api/types/records/IDownloadAvailableJobsRecord.ts deleted file mode 100644 index f8f3402..0000000 --- a/tranga-website/src/api/types/records/IDownloadAvailableJobsRecord.ts +++ /dev/null @@ -1,4 +0,0 @@ -export default interface IDownloadAvailableJobsRecord { - recurrenceTimeMs: number; - localLibraryId: string; -} \ No newline at end of file diff --git a/tranga-website/src/api/types/records/IGotifyRecord.ts b/tranga-website/src/api/types/records/IGotifyRecord.ts index 9ff6869..ffd66ae 100644 --- a/tranga-website/src/api/types/records/IGotifyRecord.ts +++ b/tranga-website/src/api/types/records/IGotifyRecord.ts @@ -1,5 +1,3 @@ -import "../../../styles/notificationConnector.css"; - export default interface IGotifyRecord { endpoint: string; appToken: string; diff --git a/tranga-website/src/api/types/records/INtfyRecord.ts b/tranga-website/src/api/types/records/INtfyRecord.ts index 6470347..9c67e0c 100644 --- a/tranga-website/src/api/types/records/INtfyRecord.ts +++ b/tranga-website/src/api/types/records/INtfyRecord.ts @@ -1,5 +1,3 @@ -import "../../../styles/notificationConnector.css"; - export default interface INtfyRecord { endpoint: string; username: string; diff --git a/tranga-website/src/api/types/records/IPushoverRecord.ts b/tranga-website/src/api/types/records/IPushoverRecord.ts index bdca0b7..52001f8 100644 --- a/tranga-website/src/api/types/records/IPushoverRecord.ts +++ b/tranga-website/src/api/types/records/IPushoverRecord.ts @@ -1,5 +1,3 @@ -import "../../../styles/notificationConnector.css"; - export default interface IPushoverRecord { apptoken: string; user: string; diff --git a/tranga-website/src/main.tsx b/tranga-website/src/main.tsx index f585b6c..213d9f5 100644 --- a/tranga-website/src/main.tsx +++ b/tranga-website/src/main.tsx @@ -6,11 +6,12 @@ import '@fontsource/inter'; import { CssVarsProvider } from '@mui/joy/styles'; import CssBaseline from '@mui/joy/CssBaseline'; import {StrictMode} from "react"; +import {trangaTheme} from "./theme.ts"; export default function MyApp() { return ( - + {/* must be used under CssVarsProvider */} diff --git a/tranga-website/src/theme.ts b/tranga-website/src/theme.ts new file mode 100644 index 0000000..c84e93b --- /dev/null +++ b/tranga-website/src/theme.ts @@ -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": {} + } + } +})