refactor some shit
This commit is contained in:
112
README.md
112
README.md
@@ -36,41 +36,111 @@ A modern, feature-rich blog system built with **Next.js 14**, **TypeScript**, an
|
||||
```
|
||||
markdownblog/
|
||||
├── src/
|
||||
│ ├── app/
|
||||
│ │ ├── admin/ # Admin dashboard pages
|
||||
│ │ │ ├── manage/ # Content management interface
|
||||
│ │ │ └── page.tsx # Main admin dashboard
|
||||
│ │ ├── api/ # API routes
|
||||
│ ├── app/ # Next.js 14 App Router
|
||||
│ │ ├── admin/ # Admin dashboard pages
|
||||
│ │ │ ├── manage/ # Content management interface
|
||||
│ │ │ │ └── page.tsx # Manage posts and folders
|
||||
│ │ │ └── page.tsx # Main admin dashboard
|
||||
│ │ ├── api/ # API routes (Next.js API routes)
|
||||
│ │ │ ├── admin/ # Admin API endpoints
|
||||
│ │ │ │ ├── delete/ # Delete posts/folders
|
||||
│ │ │ │ │ └── route.ts
|
||||
│ │ │ │ ├── docker/ # Docker detection
|
||||
│ │ │ │ ├── export/ # Export functionality
|
||||
│ │ │ │ │ └── route.ts
|
||||
│ │ │ │ ├── export/ # Export functionality (Docker)
|
||||
│ │ │ │ │ └── route.ts
|
||||
│ │ │ │ ├── exportlocal/ # Export functionality (Local)
|
||||
│ │ │ │ │ └── route.ts
|
||||
│ │ │ │ ├── folders/ # Folder management
|
||||
│ │ │ │ │ ├── details/ # Folder details API
|
||||
│ │ │ │ │ │ └── route.ts
|
||||
│ │ │ │ │ └── route.ts
|
||||
│ │ │ │ ├── password/ # Password management
|
||||
│ │ │ │ │ └── route.ts
|
||||
│ │ │ │ ├── posts/ # Post CRUD operations
|
||||
│ │ │ │ │ ├── move/ # Move posts between folders
|
||||
│ │ │ │ │ │ └── route.ts
|
||||
│ │ │ │ │ ├── raw/ # Get raw post content
|
||||
│ │ │ │ │ │ └── route.ts
|
||||
│ │ │ │ │ ├── route.ts
|
||||
│ │ │ │ │ └── size/ # Get post size info
|
||||
│ │ │ │ │ └── route.ts
|
||||
│ │ │ │ └── upload/ # File upload handling
|
||||
│ │ │ │ └── route.ts
|
||||
│ │ │ └── posts/ # Public post API
|
||||
│ │ │ ├── [slug]/ # Dynamic post API routes
|
||||
│ │ │ │ └── route.ts
|
||||
│ │ │ └── route.ts # List all posts
|
||||
│ │ ├── posts/ # Blog post pages
|
||||
│ │ │ └── [...slug]/ # Dynamic post routing
|
||||
│ │ ├── globals.css # Global styles
|
||||
│ │ ├── layout.tsx # Root layout
|
||||
│ │ └── page.tsx # Homepage
|
||||
│ └── lib/
|
||||
│ ├── markdown.ts # Markdown processing utilities
|
||||
│ └── postsDirectory.ts # Post directory management
|
||||
├── posts/ # Markdown blog posts
|
||||
│ │ │ └── [...slug]/ # Dynamic post routing (catch-all)
|
||||
│ │ │ └── page.tsx # Individual post page with anchor linking
|
||||
│ │ ├── AboutButton.tsx # About page button component
|
||||
│ │ ├── BadgeButton.tsx # Badge display component
|
||||
│ │ ├── globals.css # Global styles and Tailwind imports
|
||||
│ │ ├── HeaderButtons.tsx # Header navigation buttons
|
||||
│ │ ├── highlight-github.css # Code syntax highlighting styles
|
||||
│ │ ├── layout.tsx # Root layout with metadata
|
||||
│ │ ├── MobileNav.tsx # Mobile navigation component
|
||||
│ │ └── page.tsx # Homepage with post listing
|
||||
│ └── lib/ # Utility libraries
|
||||
│ ├── markdown.ts # Markdown processing with marked.js
|
||||
│ └── postsDirectory.ts # Post directory management and parsing
|
||||
├── posts/ # Markdown blog posts storage
|
||||
│ ├── pinned.json # Pinned posts configuration
|
||||
│ ├── welcome.md # Welcome post
|
||||
│ └── mdtest.md # Test post
|
||||
├── public/ # Static assets (favicons, etc.)
|
||||
├── electron/ # Desktop app configuration
|
||||
│ └── main.js # Electron main process
|
||||
│ ├── welcome.md # Welcome post with frontmatter
|
||||
│ ├── mdtest.md # Test post with various markdown features
|
||||
│ ├── anchor-test.md # Test post for anchor linking
|
||||
│ └── ii/ # Example nested folder structure
|
||||
├── public/ # Static assets
|
||||
│ ├── android-chrome-192x192.png
|
||||
│ ├── android-chrome-512x512.png
|
||||
│ ├── apple-touch-icon.png
|
||||
│ ├── favicon-16x16.png
|
||||
│ ├── favicon-32x32.png
|
||||
│ ├── favicon.ico
|
||||
│ └── site.webmanifest
|
||||
├── electron/ # Desktop application
|
||||
│ └── main.js # Electron main process configuration
|
||||
├── Dockerfile # Docker container configuration
|
||||
├── docker.sh # Docker deployment script
|
||||
├── entrypoint.sh # Container entrypoint
|
||||
└── package.json # Dependencies and scripts
|
||||
├── entrypoint.sh # Container entrypoint script
|
||||
├── next-env.d.ts # Next.js TypeScript definitions
|
||||
├── next.config.js # Next.js configuration
|
||||
├── package-lock.json # npm lock file
|
||||
├── package.json # Dependencies and scripts
|
||||
├── postcss.config.js # PostCSS configuration
|
||||
├── tailwind.config.js # Tailwind CSS configuration
|
||||
├── tsconfig.json # TypeScript configuration
|
||||
└── LICENSE # MIT License
|
||||
```
|
||||
|
||||
### Key Components
|
||||
|
||||
#### Frontend (Next.js 14 App Router)
|
||||
- **`src/app/page.tsx`**: Homepage with responsive post listing and search
|
||||
- **`src/app/posts/[...slug]/page.tsx`**: Individual post pages with anchor linking support
|
||||
- **`src/app/admin/page.tsx`**: Admin dashboard with content management
|
||||
- **`src/app/admin/manage/page.tsx`**: Advanced content management interface
|
||||
|
||||
#### API Routes
|
||||
- **Post Management**: CRUD operations for blog posts
|
||||
- **Folder Management**: Create, delete, and organize content structure
|
||||
- **Authentication**: Password management and validation
|
||||
- **Export**: Docker and local export functionality
|
||||
- **Upload**: Drag & drop file upload handling
|
||||
|
||||
#### Utilities
|
||||
- **`src/lib/markdown.ts`**: Markdown processing with syntax highlighting
|
||||
- **`src/lib/postsDirectory.ts`**: File system operations and post parsing
|
||||
|
||||
#### Desktop App
|
||||
- **`electron/main.js`**: Electron configuration for desktop application
|
||||
|
||||
#### Deployment
|
||||
- **`Dockerfile`**: Multi-stage build for production deployment
|
||||
- **`docker.sh`**: Automated deployment script with volume management
|
||||
- **`entrypoint.sh`**: Container initialization and post setup
|
||||
|
||||
---
|
||||
|
||||
## ⚡ Quick Start
|
||||
|
||||
Reference in New Issue
Block a user