Skip to content

Commit

Permalink
Develop changes (#9)
Browse files Browse the repository at this point in the history
* aint much but honest work

* werkin it

* 😩

* Kinda reworked scanner (#7)

* updating scanner, removed book_count from series

* scanner updates, api tweaks, version updates

* wip: working on scanner and other misc fixes

* tiny progress

* Migrate from SeaORM to Prisma (#8)

* werkin

* meh

* major work towards seaorm -> prisma migration

* added prisma commands to scripts

* reworked opds api

* werkin

* did some things

* Migration mostly complete
  • Loading branch information
aaronleopold authored Apr 25, 2022
1 parent a709ef3 commit 079d139
Show file tree
Hide file tree
Showing 125 changed files with 5,633 additions and 4,842 deletions.
4 changes: 2 additions & 2 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github: aaronleopold
ko_fi: aaronleop
# github: aaronleopold
ko_fi: aaronleop
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,18 @@ $houdini
.eslintcache

# rust
server/static
static
target
*.db*
*.sqlite*
*prisma.rs*

# os
.DS_Store

# editors / idea
.idea


# TODO: remove this
server--old
3 changes: 1 addition & 2 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
pnpm run server:fmt
npx lint-staged
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
node_modules
.svelte-kit
build
server
server*
4 changes: 2 additions & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"semi": true,
"useTabs": true,
"tabWidth": 4,
"tabWidth": 2,
"singleQuote": true,
"trailingComma": "all",
"printWidth": 100
}
}
14 changes: 14 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Contributing

You can contribute by opening new issues or PRs. Please do not drop random PRs without talking with me first, please follow these steps:

1. Check to see if an issue already exists relevant to your feature/topic
2. Create an issue (if an issue does not already exist) and express interest in working it
3. Create a fork of the repository.
4. Create a new feature branch from `develop`.
5. Add appropiate documentation to public items.
6. Ensure you have your code formatter properly configured.
7. Once you add your contributions, create a PR from your feature branch into `develop` - _not_ `main`.
8. Be sure to pull in new changes **before** making the PR.

Thanks for contributing to my project!!
60 changes: 38 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,39 @@
# ![Stump Icon icon](./.github/images/logo.png)
<p align="center">
<img alt="Stump logo" src="./.github/images/logo.png" style="width: 50%" />
</p>

A free and open source comics server with OPDS support, **heavily** inspired by [Komga](https://github.com/gotson/komga).
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.

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 to practice Rust!_

## Roadmap

I moved my roadmap/todo list to a [GitHub Project](https://github.com/users/aaronleopold/projects/1) to keep it more organized since the codebase is growing. Have a look, I am very open to suggestions and ideas!
I'll list the major target features below - I am very open to suggestions and ideas, so feel free to reach out if you have anything you'd like to see!

- Full OPDS + OPDS Page Streaming support
- EPUB, PDF, and CBZ/CBR support
- Customizable configuration (for both Docker and local hosting)
- Scheduled and invokable filesystem indexing/scanning
- Support for a range of metadata operations (e.g. adding/removing tags, changing metadata, etc.)
- Import/export of libraries
- Configurable CBR-to-CBZ conversion
- Small footprint and resource utilization (Docker image size currently sits at ~41MB)
- Integrated web client (React) served by Rust server
- Full Text Search
- Server management
- Built-in webreader for media
- SSR would be an awesome feature, but so far seems to be a bit of a pain (since I am using Rust)
- Role-based access control (i.e. the server owner and authorized users)

## Getting Started

There are no releases yet, so you'll have to clone the repo and build it yourself:
There are no releases yet, so for now you'll have to clone the repo and run it yourself:

```bash
git clone https://github.com/aaronleopold/stump.git
cd stump
pnpm frontend:install
cargo install cargo-watch sea-orm-cli
pnpm server:migrate-up
# handles all the setup required for local development
pnpm dev:setup
```

## Running Stump
Expand All @@ -37,35 +53,35 @@ pnpm server:dev # start the server
pnpm frontend:dev # start the frontend
```

### Building the Frontend

Because of the prerendering options, the backend needs to be running while the frontend is being built. I am working on a script to automate this, but for now you'll just need two separate processes:

```bash
pnpm server:start
# once the server starts, delete the `static` folder.
pnpm frontend:build # this will build and move the build to the `server/static` folder
```

### Docker

No images have been published to dockerhub yet, so you'll have to build it yourself (requires frontend to have been built first):
<details>
<summary>
<b>Note: This is currently non-functional. Migrating to Prisma from SeaORM bork this, but I am working on it.</b>
</summary>

No images have been published to dockerhub yet, so you'll have to build it yourself:

```bash
pnpm server:build:docker-alpine # builds the image
# build the docker image
pnpm build:docker
# create the docker container
docker create \
--name=stump \
--user 1000:1000 \
-p 6969:6969 \
--volume ~/.stump:/home/stump/.stump \
--mount type=bind,source=/path/to/data,target=/data \
--restart unless-stopped \
stump # creates the container
docker start stump # runs the container
stump
# run the docker container
docker start stump
```

As of now, you'll need to make the `source` and `target` paths match. So if you keep your libraries in `/Users/user/Library`, you'll need to bind `/Users/user/Library` to both `source` and `target`. This will eventually change to be more flexible.

</details>

## Contributing

Contributions are very **encouraged** and **welcome**! Please open an issue prior to working on a bug or feature to let me know what you're interested in working on. Thanks!
Contributions are very **encouraged** and **welcome**! Please review the [CONTRIBUTING.md](./CONTRIBUTING.md) file beforehand. Thanks!
14 changes: 8 additions & 6 deletions frontend/@types/log.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
declare enum LogLevel {
Error = 'error',
Warn = 'warn',
Info = 'info',
Debug = 'debug',
Error = 'ERROR',
Warn = 'WARN',
Info = 'INFO',
Debug = 'DEBUG',
}

interface Log {
Expand All @@ -18,8 +18,10 @@ interface Log {
* The message of the log.
*/
message: string;
// TODO: see if this maps correctly
created_at: Date;
/**
* The timestamp of the log.
*/
createdAt: Date;
}

type Logs = Log[];
6 changes: 3 additions & 3 deletions frontend/@types/media.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ interface Media {
/**
* The id of the series which this media belongs to.
*/
series_id: number;
seriesId: number;
/**
* The common name of the media. Either the name extracted from metadata or the file name.
*/
Expand All @@ -38,7 +38,7 @@ interface Media {
/**
* The date/time the media was last modified. Extracted from metadata.
*/
updated_at?: Date;
updatedAt?: Date;
// TODO: this should be removed...
downloaded: boolean;
/**
Expand All @@ -55,7 +55,7 @@ interface MediaWithProgress extends Media {
/**
* The page the viewing user is currently on for the associated media.
*/
current_page?: number;
currentPage?: number;
}

// interface MediaWithSeries extends MediaWithProgress {
Expand Down
8 changes: 4 additions & 4 deletions frontend/@types/preference.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ interface UserPreferences {
/**
* The id of the user this preference belongs to
*/
user_id: number;
userId: number;
/**
* Boolean indicating whether the user wants dark mode
*/
dark_mode: boolean;
darkMode: boolean;
}

interface ServerPreferences {
Expand All @@ -23,9 +23,9 @@ interface ServerPreferences {
* Flag indicating whether or not to attempt to rename scanned series according to a ComicInfo.xml file inside the directory.
* If none found, the series name will be the directory name. Default is false
*/
rename_series: boolean;
renameSeries: boolean;
/**
* Flag indicating whether or not to attempt to convert scanned .cbr files to .cbz files.
*/
convert_cbr_to_cbz: boolean;
convertCbrToCbz: boolean;
}
4 changes: 2 additions & 2 deletions frontend/@types/read-progress.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ interface ReadProgress {
/**
* The id of the media file this progress belongs to.
*/
media_id: number;
mediaId: number;
/**
* The id of the user this progress belongs to.
*/
user_id: number;
userId: number;
/**
* The current page the user is on.
*/
Expand Down
9 changes: 5 additions & 4 deletions frontend/@types/series.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,20 @@ interface Series {
/**
* The id of the library this series belongs to.
*/
library_id: number;
libraryId: number;
/**
* The name of the series. Either the directory name or extracted from the ComicInfo.xml file.
*/
title: string;
/**
* The number of media files in the series.
* The number of media files in the series. This is not part of the SeaORM model,
* and will be populated with an aggregate subquery in the backend.
*/
book_count: number;
bookCount?: number;
/**
* The date/time the series was last modified.
*/
updated_at: string;
updatedAt: string;
/**
* The path of the series on disk.
*/
Expand Down
4 changes: 2 additions & 2 deletions frontend/@types/user.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
declare enum UserRole {
Owner = 'owner',
Member = 'member',
Owner = 'OWNER',
Member = 'MEMBER',
}

// No password field intentionally
Expand Down
44 changes: 25 additions & 19 deletions frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,45 +1,51 @@
{
"name": "frontend",
"private": true,
"version": "0.0.0",
"version": "0.0.1",
"homepage": ".",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview --port 3000"
},
"dependencies": {
"@chakra-ui/react": "^1.8.5",
"@emotion/react": "^11",
"@chakra-ui/react": "^1.8.7",
"@emotion/react": "^11.8.2",
"@emotion/styled": "^11",
"axios": "^0.26.0",
"@hookform/resolvers": "^2.8.8",
"axios": "^0.26.1",
"clsx": "^1.1.1",
"framer-motion": "^6",
"history": "^5.3.0",
"nprogress": "^0.2.0",
"phosphor-react": "^1.4.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"phosphor-react": "^1.4.1",
"pluralize": "^8.0.0",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-error-boundary": "^3.1.4",
"react-query": "^3.34.16",
"react-router-dom": "6",
"react-hook-form": "^7.28.1",
"react-hot-toast": "^2.2.0",
"react-query": "^3.34.19",
"react-router-dom": "^6.2.2",
"vite-plugin-package-version": "^1.0.2",
"zustand": "^3.7.0"
"zod": "^3.14.3",
"zustand": "^3.7.1"
},
"devDependencies": {
"@tailwindcss/aspect-ratio": "^0.4.0",
"@tailwindcss/forms": "^0.4.0",
"@tailwindcss/forms": "^0.5.0",
"@tailwindcss/typography": "^0.5.2",
"@types/node": "^17.0.21",
"@types/node": "^17.0.23",
"@types/nprogress": "^0.2.0",
"@types/react": "^17.0.33",
"@types/react-dom": "^17.0.10",
"@types/pluralize": "^0.0.29",
"@types/react": "^17.0.43",
"@types/react-dom": "^17.0.14",
"@vitejs/plugin-react": "^1.0.7",
"autoprefixer": "^10.4.2",
"postcss": "^8.4.7",
"autoprefixer": "^10.4.4",
"postcss": "^8.4.12",
"tailwind-scrollbar-hide": "^1.1.7",
"tailwindcss": "^3.0.23",
"typescript": "^4.5.4",
"vite": "^2.8.0"
"typescript": "^4.6.3",
"vite": "^2.8.6"
}
}
}
Loading

0 comments on commit 079d139

Please sign in to comment.