Skip to content

Commit 0a25c7d

Browse files
committed
Initial commit
1 parent 81971d1 commit 0a25c7d

27 files changed

Lines changed: 6693 additions & 1494 deletions

.eslintrc.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "next/core-web-vitals",
3+
"rules": {
4+
"@typescript-eslint/no-unused-vars": "off",
5+
"@typescript-eslint/no-explicit-any": "off"
6+
}
7+
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Build and Publish Docker Image
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
tags: [ 'v*.*.*' ]
7+
pull_request:
8+
branches: [ "main" ]
9+
10+
env:
11+
# Use docker.io for Docker Hub if empty
12+
REGISTRY: docker.io
13+
# github.repository as <account>/<repo>
14+
IMAGE_NAME: mrorbitman/bookgrab
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: read
21+
packages: write
22+
# This is used to complete the identity challenge
23+
# with sigstore/fulcio when running outside of PRs.
24+
id-token: write
25+
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v3
29+
30+
# Set up Docker Buildx
31+
- name: Set up Docker Buildx
32+
uses: docker/setup-buildx-action@v2
33+
34+
# Login to DockerHub
35+
- name: Login to DockerHub
36+
uses: docker/login-action@v2
37+
with:
38+
username: ${{ secrets.DOCKERHUB_USERNAME }}
39+
password: ${{ secrets.DOCKERHUB_TOKEN }}
40+
41+
# Extract metadata (tags, labels) for Docker
42+
- name: Extract Docker metadata
43+
id: meta
44+
uses: docker/metadata-action@v4
45+
with:
46+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
47+
tags: |
48+
type=semver,pattern={{version}}
49+
type=semver,pattern={{major}}.{{minor}}
50+
type=ref,event=branch
51+
type=ref,event=pr
52+
type=sha,format=long
53+
type=raw,value=latest,enable={{is_default_branch}}
54+
55+
# Build and push Docker image
56+
- name: Build and push Docker image
57+
id: build-and-push
58+
uses: docker/build-push-action@v4
59+
with:
60+
context: .
61+
push: ${{ github.event_name != 'pull_request' }}
62+
tags: ${{ steps.meta.outputs.tags }}
63+
labels: ${{ steps.meta.outputs.labels }}
64+
cache-from: type=gha
65+
cache-to: type=gha,mode=max

.prettierignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*.svg
2+
*.png
3+
*.ico
4+
.gitignore
5+
.prettierignore

Dockerfile

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
FROM node:18-alpine AS base
2+
3+
# Install dependencies only when needed
4+
FROM base AS deps
5+
WORKDIR /app
6+
7+
# Copy package files
8+
COPY package.json package-lock.json* ./
9+
RUN npm ci
10+
11+
# Rebuild the source code only when needed
12+
FROM base AS builder
13+
WORKDIR /app
14+
COPY --from=deps /app/node_modules ./node_modules
15+
COPY . .
16+
17+
# Next.js collects anonymous telemetry data about general usage.
18+
# Learn more here: https://nextjs.org/telemetry
19+
# Uncomment the following line to disable telemetry during the build.
20+
ENV NEXT_TELEMETRY_DISABLED=1
21+
22+
# Build the application
23+
RUN npm run build
24+
25+
# Production image, copy all the files and run next
26+
FROM base AS runner
27+
WORKDIR /app
28+
29+
ENV NODE_ENV=production
30+
ENV NEXT_TELEMETRY_DISABLED=1
31+
32+
RUN addgroup --system --gid 1001 nodejs
33+
RUN adduser --system --uid 1001 nextjs
34+
35+
# Copy necessary files from builder
36+
COPY --from=builder /app/public ./public
37+
COPY --from=builder /app/.next/standalone ./
38+
COPY --from=builder /app/.next/static ./.next/static
39+
40+
# Set proper permissions
41+
RUN chown -R nextjs:nodejs /app
42+
43+
# Switch to non-root user
44+
USER nextjs
45+
46+
# Expose the port the app will run on
47+
EXPOSE 3000
48+
49+
# Environment variables will be passed at runtime
50+
ENV PORT=3000
51+
52+
# Start the application
53+
CMD ["node", "server.js"]

README.md

Lines changed: 67 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,82 @@
1-
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
1+
# BookGrab
2+
3+
> **Disclaimer:** BookGrab is a personal project I built for myself. Support is limited to MyAnonyMouse (MAM) and Transmission. Use at your own risk.
4+
5+
BookGrab is a simple, streamlined web application that allows you to search for books on MyAnonyMouse using their RSS API and send downloads directly to your Transmission client. It provides a clean, straightforward interface for finding and downloading both ebooks and audiobooks.
6+
7+
## Why BookGrab?
8+
9+
Most people looking for book automation probably want [Readarr](https://readarr.com/). However, I built BookGrab because:
10+
11+
1. Readarr requires separate instances for audiobooks and ebooks, which is cumbersome
12+
2. Readarr's author-based interface is too complicated to share with friends and family
13+
3. I wanted a simpler, more direct search-and-download experience without the complexity of a full media management system
14+
15+
BookGrab focuses on doing one thing well: making it easy to search MAM and download books with a single click.
16+
17+
## Features
18+
19+
- Simple search interface for MyAnonyMouse's extensive book collection
20+
- Display search results with book details (title, author, format, length for audiobooks)
21+
- Download books directly to your Transmission client with a single click
22+
- Separate download paths for audiobooks and ebooks (I send my audiobooks to the directory scanned by AudioBookshelf and the ebooks I send to the directory scanned by Calibre-Web)
23+
- Light and dark mode support
24+
- Minimal setup and configuration
225

326
## Getting Started
427

5-
First, run the development server:
28+
### Prerequisites
629

7-
```bash
8-
npm run dev
9-
# or
10-
yarn dev
11-
# or
12-
pnpm dev
13-
# or
14-
bun dev
30+
- Node.js 18+ and npm
31+
- A MyAnonyMouse account and session token
32+
- A running Transmission client
33+
34+
### Environment Variables
35+
36+
Create a `.env.local` file in the root directory with the following variables:
37+
38+
```
39+
MAM_TOKEN=your_mam_token_here
40+
TRANSMISSION_URL=http://your-transmission-server:9091/transmission/rpc
41+
AUDIOBOOK_DESTINATION_PATH=/path/to/audiobooks
42+
EBOOK_DESTINATION_PATH=/path/to/ebooks
1543
```
1644

17-
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
45+
### Installation
1846

19-
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
47+
1. Clone the repository
48+
2. Install dependencies:
2049

21-
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
50+
```bash
51+
npm install
52+
```
2253

23-
## Learn More
54+
3. Run the development server:
2455

25-
To learn more about Next.js, take a look at the following resources:
56+
```bash
57+
npm run dev
58+
```
59+
60+
4. Open [http://localhost:3000](http://localhost:3000) with your browser to see the application.
61+
62+
## Building for Production
2663

27-
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
28-
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
64+
```bash
65+
npm run build
66+
npm start
67+
```
2968

30-
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
69+
## Technologies Used
3170

32-
## Deploy on Vercel
71+
- Next.js
72+
- TypeScript
73+
- AWS Amplify UI
74+
- MyAnonyMouse RSS API
75+
- Transmission RPC API
3376

34-
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
77+
## Limitations
3578

36-
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
79+
- Only works with MyAnonyMouse as the content source
80+
- Requires a Transmission client for downloads
81+
- No library management features - just search and download
82+
- No automatic organization of downloaded content beyond basic path separation

next.config.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/** @type {import('next').NextConfig} */
2+
const nextConfig = {
3+
output: 'standalone',
4+
eslint: {
5+
// Warning: This allows production builds to successfully complete even if
6+
// your project has ESLint errors.
7+
ignoreDuringBuilds: true,
8+
},
9+
typescript: {
10+
// !! WARN !!
11+
// Dangerously allow production builds to successfully complete even if
12+
// your project has type errors.
13+
// !! WARN !!
14+
ignoreBuildErrors: true,
15+
},
16+
};
17+
18+
module.exports = nextConfig;

next.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ import type { NextConfig } from "next";
22

33
const nextConfig: NextConfig = {
44
/* config options here */
5+
images: {
6+
remotePatterns: [new URL("https://cdn.myanonamouse.net/**")],
7+
},
58
};
69

710
export default nextConfig;

0 commit comments

Comments
 (0)