Skip to content

Commit

Permalink
Develop changes (#18)
Browse files Browse the repository at this point in the history
* lunch but no food 😮‍💨

* optimizations, form error handling

simplified some of the types, temporary not disgusting error page, started work to handle tags, abstracted the create/edit library to a single form, lots of other stuff.

* oops

* update setup.sh

* Openapi and Pagination (#17)

* starting openapi support, it stinks doody

* bleh

* wip: pagination

* wip: pagination

* wip: pagination, merge develop

* compiles 😮‍💨

* fix auth issue, working on tags

* meh tag operations, wip scanner changes (needs lots of tlc)

* restructure scanner crate, other stuff

Co-authored-by: Logan Rotenberger <logarotenberger@gmail.com>
Co-authored-by: LRotenberger <62265343+LRotenberger@users.noreply.github.com>
  • Loading branch information
3 people committed Jun 1, 2022
1 parent 3e345c0 commit 892064e
Show file tree
Hide file tree
Showing 97 changed files with 3,464 additions and 1,829 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Expand Up @@ -3,4 +3,4 @@
*.sql linguist-detectable=false

# I don't want website to be included in language stats
packages/website/* linguist-vendored
packages/website/** linguist-vendored
Empty file added .github/CHANGELOG.md
Empty file.
2 changes: 1 addition & 1 deletion .github/scripts/setup.sh
Expand Up @@ -67,7 +67,7 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then
if which apt-get &> /dev/null; then
echo "Detected 'apt' based distro!"
sudo apt-get -y update
sudo apt-get -y install "pkg-config libssl-dev"
sudo apt-get -y install pkg-config libssl-dev build-essential
elif which pacman &> /dev/null; then
echo "Detected 'pacman' based distro!"
sudo pacman -Syu
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Expand Up @@ -14,6 +14,7 @@ build
# rust
static
target
client
*.db*
*.sqlite*
*prisma.rs*
Expand All @@ -38,4 +39,6 @@ target
_next

docker-compose.yaml
openapi-example*

# its a surprise
README_RELEASE.md
87 changes: 85 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 9 additions & 5 deletions README.md
Expand Up @@ -5,13 +5,19 @@
<img src="https://img.shields.io/discord/972593831172272148?label=Discord&color=5865F2" />
</a>
<a href="https://github.com/aaronleopold/stump/blob/main/LICENSE">
<img src="https://img.shields.io/static/v1?label=License&message=MIT&color=000" />
<img src="https://img.shields.io/static/v1?label=License&message=MIT&color=CF9977" />
</a>
<!-- <a href="./.github/CHANGELOG.md">
<img src="https://img.shields.io/github/package-json/v/aaronleopold/stump?logo=azurepipelines&amp;color=0aa8d2" alt="Current Version">
</a>
<a href="https://hub.docker.com/r/aaronleopold/stump">
<img src="https://img.shields.io/docker/pulls/aaronleopold/stump?logo=docker&color=0aa8d2&logoColor=fff" alt="Docker Pulls">
</a> -->
</p>

Stump is a free and open source comics server with OPDS support, **heavily** inspired by [Komga](https://github.com/gotson/komga), created with Rust, [Rocket](https://github.com/SergioBenitez/Rocket), [Prisma](https://github.com/Brendonovich/prisma-client-rust) and React.
Stump is a free and open source comics, manga and digital book server with OPDS support, **heavily** inspired by [Komga](https://github.com/gotson/komga), created with Rust, [Rocket](https://github.com/SergioBenitez/Rocket), [Prisma](https://github.com/Brendonovich/prisma-client-rust) and React.

I love Komga and use it at home, and I thought it would be cool to learn what goes into making something like this myself. I opted to develop this in Rust to hopefully, at the end of all this, create something just as if not almost as convenient but with a smaller footprint. _I also just want an excuse to practice Rust!_
I love Komga and use it at home, and I thought it would be cool to learn what goes into making something like this myself. I opted to develop this in Rust to hopefully, at the end of all this, create something just as, if not almost as, convenient but with a smaller footprint. _I also just want an excuse to practice Rust!_

<p align='center'>
<img alt="Screenshot of Stump" src="./.github/images/demo-img.png" style="width: 85%" />
Expand Down Expand Up @@ -50,8 +56,6 @@ I am ommitting a lot of files and only focusing on the main directories, but the
│   │   ├── prisma
│   │   ├── prisma-cli
│   │   └── src
│   │      └── bin
│   │         └── seed.rs
│   └── website
├── README.md
└── ...
Expand Down
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -14,8 +14,8 @@
},
"devDependencies": {
"husky": "^7.0.2",
"lint-staged": "^12.3.2",
"prettier": "^2.5.1"
"lint-staged": "^12.4.2",
"prettier": "^2.6.2"
},
"lint-staged": {
"*.{js,jsx,ts,tsx,md}": [
Expand Down
1 change: 1 addition & 0 deletions packages/core/.dockerignore
@@ -1,6 +1,7 @@
node_modules
build
static
client
target
*.lock
*.log
Expand Down
3 changes: 2 additions & 1 deletion packages/core/Dockerfile
Expand Up @@ -55,7 +55,7 @@ RUN mkdir -p data
COPY --from=builder /home/stump/target/x86_64-unknown-linux-musl/release/stump .

# copy the react build
COPY --from=frontend /home/stump/build static
COPY --from=frontend /home/stump/build client

# *sigh* Rocket requires the toml file at runtime
COPY server/Rocket.toml .
Expand All @@ -71,5 +71,6 @@ ENV STUMP_CLIENT_DIR=/home/stump/client
# Default Rocket environment variables
ENV ROCKET_PROFILE=release
ENV ROCKET_LOG_LEVEL=normal
ENV ROCKET_PORT=6969

CMD ["./stump"]
20 changes: 20 additions & 0 deletions packages/core/frontend/@types/index.d.ts
Expand Up @@ -2,3 +2,23 @@
type Option<T> = T | undefined | null;

type ApiResult<T, E = any> = import('axios').AxiosResponse<T, E>;

interface PageInfo {
// The number of pages available.
total_pages: number;
// The current page, zero-indexed.
current_page: number;
// The number of elements per page.
page_size: number;
// The offset of the current page. E.g. if current page is 1, and pageSize is 10, the offset is 20.
page_offset: number;
}

interface Pageable<T> {
// The target data being returned.
data: T;
// The pagination information (if paginated).
_page?: PageInfo;
}

type PageableApiResult<T> = ApiResult<Pageable<T>>;
8 changes: 7 additions & 1 deletion packages/core/frontend/@types/job.d.ts
Expand Up @@ -8,7 +8,13 @@ interface Job {
message?: string;
}

type JobEventKind = 'JobStarted' | 'JobProgress' | 'JobComplete' | 'CreatedMedia' | 'CreatedSeries';
type JobEventKind =
| 'JobStarted'
| 'JobProgress'
| 'JobComplete'
| 'JobFailed'
| 'CreatedMedia'
| 'CreatedSeries';

type JobEvent = {
[kind in JobEventKind]: any;
Expand Down
25 changes: 14 additions & 11 deletions packages/core/frontend/@types/library.d.ts
Expand Up @@ -15,18 +15,21 @@ interface Library {
* The (optional) description of the library.
*/
description?: string;
}

interface LibraryWithSeries extends Library {
/**
* The series in the library
* @see Series
* @see SeriesWithMedia
* The date in which the library was last updated. This is usually after a scan. ex: "2022-04-20 04:20:69"
*/
updatedAt: Date;
/**
* The series in this library. Will be undefined only if the relation is not loaded.
*/
series: SeriesWithMedia[];
series?: Series[];
/**
* The user assigned tags for the library. ex: ["Comics", "Family"]. Will be undefined only if the relation is not loaded.
*/
tags?: Tag[];
}

type CreateLibraryInput = Omit<Library, 'id'>;

type GetLibrariesResponse = ApiResult<Library[], any>;
type GetLibraryWithSeries = ApiResult<LibraryWithSeries, any>;
type CreateLibraryInput = Omit<Library, 'id' | 'updatedAt' | 'series'>;
interface EditLibraryInput extends Library {
removedTags?: Tag[];
}
21 changes: 7 additions & 14 deletions packages/core/frontend/@types/media.d.ts
Expand Up @@ -46,23 +46,16 @@ interface Media {
* The path of the media file on disk.
*/
path: string;
/**
* The user assigned tags for this media.
* @see Tag
*/
tags: Tag[];
}

interface MediaWithProgress extends Media {
/**
* The page the viewing user is currently on for the associated media.
*/
currentPage?: number;
/**
* The user assigned tags for this media. This will be undefined only if the relation is not loaded.
* @see Tag
*/
tags?: Tag[];
}

// interface MediaWithSeries extends MediaWithProgress {
// series_name: string;
// }

type GetMediaResponse = ApiResult<MediaWithProgress[]>;
type GetMediaById = ApiResult<MediaWithProgress>;
type GetMediaResponse = ApiResult<Media[]>;
type GetMediaById = ApiResult<Media>;
9 changes: 2 additions & 7 deletions packages/core/frontend/@types/series.d.ts
Expand Up @@ -23,14 +23,9 @@ interface Series {
* The (optional) description of the series.
*/
description?: string;
}

interface SeriesWithMedia extends Series {
/**
* The media files in the series
* The media files in the series. Will be undefined only if the relation is not loaded.
* @see Media
*/
media: Media[];
media?: Media[];
}

type GetSeriesWithMedia = ApiResult<SeriesWithMedia, any>;
4 changes: 2 additions & 2 deletions packages/core/frontend/@types/tag.d.ts
@@ -1,4 +1,4 @@
interface Tag {
id: String;
name: String;
id: string;
name: string;
}
8 changes: 4 additions & 4 deletions packages/core/frontend/@types/user.d.ts
Expand Up @@ -17,10 +17,10 @@ interface User {
* The role of the user.
*/
role: UserRole;
}

interface UserWithPreferences extends User {
preferences: UserPreferences;
/**
* The user preferences associated with this account. Will be undefined only if the relation is not loaded.
*/
preferences?: UserPreferences;
}

interface UserCredentials {
Expand Down

1 comment on commit 892064e

@vercel
Copy link

@vercel vercel bot commented on 892064e Jun 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.