feat: Initial commit - Base application with Next.js - Configuration, Auth, Library navigation, CBZ/CBR reader, Cache, Responsive design

This commit is contained in:
Julien Froidefond
2025-02-11 21:04:40 +01:00
commit 33bdc43442
48 changed files with 9813 additions and 0 deletions

27
src/types/auth.ts Normal file
View File

@@ -0,0 +1,27 @@
import { KomgaUser } from "./komga";
export interface AuthConfig {
serverUrl: string;
credentials?: {
username: string;
password: string;
};
}
export interface AuthState {
isAuthenticated: boolean;
user: KomgaUser | null;
serverUrl: string | null;
}
export interface AuthError {
code: AuthErrorCode;
message: string;
}
export type AuthErrorCode =
| "INVALID_CREDENTIALS"
| "INVALID_SERVER_URL"
| "SERVER_UNREACHABLE"
| "NETWORK_ERROR"
| "UNKNOWN_ERROR";

7
src/types/env.d.ts vendored Normal file
View File

@@ -0,0 +1,7 @@
declare namespace NodeJS {
interface ProcessEnv {
NEXT_PUBLIC_APP_URL: string;
NEXT_PUBLIC_DEFAULT_KOMGA_URL?: string;
NEXT_PUBLIC_APP_VERSION: string;
}
}

100
src/types/komga.ts Normal file
View File

@@ -0,0 +1,100 @@
export interface KomgaUser {
id: string;
email: string;
roles: KomgaRole[];
sharedAllLibraries: boolean;
sharedLibrariesIds: string[];
authenticated: boolean;
authorities: string[];
}
export type KomgaRole = "ROLE_ADMIN" | "ROLE_USER";
export interface KomgaLibrary {
id: string;
name: string;
root: string;
importLastModified: string;
lastModified: string;
unavailable: boolean;
}
export interface KomgaSeries {
id: string;
libraryId: string;
name: string;
url: string;
created: string;
lastModified: string;
fileLastModified: string;
booksCount: number;
booksReadCount: number;
booksUnreadCount: number;
metadata: SeriesMetadata;
booksMetadata: BooksMetadata;
}
export interface SeriesMetadata {
status: "ENDED" | "ONGOING" | "ABANDONED" | "HIATUS";
title: string;
titleSort: string;
summary: string;
publisher: string;
readingDirection: "LEFT_TO_RIGHT" | "RIGHT_TO_LEFT" | "VERTICAL" | "WEBTOON";
ageRating: number | null;
language: string;
genres: string[];
tags: string[];
}
export interface BooksMetadata {
created: string;
lastModified: string;
authors: Author[];
}
export interface Author {
name: string;
role: string;
}
export interface ReadProgress {
booksCount: number;
booksReadCount: number;
booksUnreadCount: number;
booksInProgressCount: number;
completed: boolean;
}
export interface KomgaBook {
id: string;
seriesId: string;
seriesTitle: string;
name: string;
url: string;
number: number;
created: string;
lastModified: string;
fileLastModified: string;
sizeBytes: number;
size: string;
media: BookMedia;
metadata: BookMetadata;
}
export interface BookMedia {
status: "READY" | "UNKNOWN" | "ERROR";
mediaType: string;
pagesCount: number;
}
export interface BookMetadata {
title: string;
titleSort: string;
summary: string;
number: string;
authors: Author[];
tags: string[];
releaseDate: string;
isbn: string;
}