Initial
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
[submodule "frontend/public/books/WaysOfTheWorld-Strayer"]
|
||||
path = frontend/public/books/WaysOfTheWorld-Strayer
|
||||
url = https://github.com/npease18/StrayerChapters.git
|
||||
@@ -1,7 +1,266 @@
|
||||
## COS498-HW3 ##
|
||||
|
||||
[](https://gitea-actions.nicholaspease.com/latest-log?branch=main)
|
||||
[](https://drone.nicholaspease.com/umaine-npease/COS498-HW3)
|
||||
[](https://wakaapi.nicholaspease.com/summary?interval=any&project=COS498-HW3)
|
||||

|
||||
<hr>
|
||||
# COS498 Midterm Project: Server Side Programming Languages
|
||||
## Link to Website: [https://sswd.lax18.dev/](https://sswd.lax18.dev/)
|
||||
|
||||
This is a midterm project for **COS498: Server Side Programming Languages** that demonstrates a full-stack web application using containerized microservices architecture with user authentication and a complete comment system.
|
||||
|
||||
## Project Overview
|
||||
|
||||
This project implements a complete comment-sharing web application with the following architecture:
|
||||
- **Frontend**: Nginx serving static files and Handlebars templates
|
||||
- **Backend**: Node.js/Express server with session management and authentication
|
||||
- **Templating**: Handlebars with reusable partials for consistent UI
|
||||
- **Authentication**: Session-based user registration and login system
|
||||
- **Data Management**: In-memory storage for users, sessions, and comments
|
||||
- **Containerization**: Docker containers orchestrated with Docker Compose
|
||||
|
||||
## Features
|
||||
|
||||
### User Authentication
|
||||
- **User Registration**: Create new accounts with email and password confirmation
|
||||
- **User Login**: Secure session-based authentication
|
||||
- **Session Management**: Persistent login sessions with secure cookies
|
||||
- **Error Handling**: Visual feedback for invalid credentials and registration errors
|
||||
|
||||
### Comment System
|
||||
- **Browse Comments**: View all community discussions with filtering and sorting
|
||||
- **Create Comments**: Authenticated users can post new comments
|
||||
- **Interactive UI**: Inline comment form with toggle functionality
|
||||
- **User Avatars**: Generated avatar initials for visual user identification
|
||||
|
||||
### User Interface
|
||||
- **Responsive Design**: Mobile-friendly layout with consistent styling
|
||||
- **Navigation**: Dynamic navigation based on authentication status
|
||||
- **Visual Feedback**: Error messages, success states, and user guidance
|
||||
- **Accessibility**: Proper ARIA labels and semantic HTML structure
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Before running this project, ensure you have the following installed:
|
||||
- [Docker](https://docs.docker.com/get-docker/)
|
||||
- [Docker Compose](https://docs.docker.com/compose/install/)
|
||||
|
||||
## Project Structure
|
||||
|
||||
```
|
||||
COS498-MTP/
|
||||
├── docker-compose.yml # Docker Compose configuration
|
||||
├── README.md # This file
|
||||
├── backend/
|
||||
│ ├── Dockerfile # Backend container configuration
|
||||
│ └── server.js # Node.js Express server with authentication
|
||||
├── frontend/
|
||||
│ ├── Dockerfile # Frontend container configuration
|
||||
│ └── default.conf # Nginx configuration
|
||||
├── views/ # Handlebars templates
|
||||
│ ├── home.hbs # Homepage with project information
|
||||
│ ├── login.hbs # User sign-in page
|
||||
│ ├── register.hbs # User registration page
|
||||
│ ├── comments.hbs # Comments listing and creation
|
||||
│ └── new-comment.hbs # Standalone comment creation page
|
||||
├── partials/ # Reusable template components
|
||||
│ ├── nav.hbs # Navigation bar with auth state
|
||||
│ ├── footer.hbs # Site footer
|
||||
│ ├── comment.hbs # Individual comment display
|
||||
│ └── new-comment-form.hbs # Comment creation form
|
||||
└── public/ # Static assets
|
||||
├── favicon.ico # Site favicon
|
||||
├── styles/
|
||||
│ └── main.css # Stylesheet
|
||||
└── index.html # Legacy static file
|
||||
```
|
||||
|
||||
## How to Start the Webserver
|
||||
|
||||
### Option 1: Using Docker Compose (Recommended)
|
||||
|
||||
1. **Clone and navigate to the project directory:**
|
||||
```bash
|
||||
cd /home/npease/COS498-MTP
|
||||
```
|
||||
|
||||
2. **Start all services:**
|
||||
```bash
|
||||
docker-compose up --build
|
||||
```
|
||||
|
||||
3. **Access the application:**
|
||||
- Frontend: http://localhost
|
||||
- Comments page: http://localhost/comments
|
||||
- User registration: http://localhost/register
|
||||
- User login: http://localhost/login
|
||||
- Backend API: http://localhost/api/
|
||||
- Health check: http://localhost/api/health
|
||||
|
||||
4. **Stop the services:**
|
||||
```bash
|
||||
docker-compose down
|
||||
```
|
||||
|
||||
### Option 2: Manual Docker Build
|
||||
|
||||
1. **Build the backend:**
|
||||
```bash
|
||||
docker build -t mtp-backend ./backend
|
||||
```
|
||||
|
||||
2. **Build the frontend:**
|
||||
```bash
|
||||
docker build -f frontend/Dockerfile -t mtp-frontend .
|
||||
```
|
||||
|
||||
3. **Run the containers:**
|
||||
```bash
|
||||
# Run backend
|
||||
docker run -d -p 3000:3000 --name backend mtp-backend
|
||||
|
||||
# Run frontend
|
||||
docker run -d -p 80:80 --name frontend mtp-frontend
|
||||
```
|
||||
|
||||
## API Endpoints
|
||||
|
||||
The backend provides the following API endpoints:
|
||||
|
||||
### Public Endpoints
|
||||
- `GET /` - Homepage with project overview
|
||||
- `GET /login` - User sign-in page
|
||||
- `GET /register` - User registration page
|
||||
- `GET /comments` - Comments listing page
|
||||
- `GET /api/` - Welcome message with timestamp
|
||||
- `GET /api/health` - Health check endpoint
|
||||
|
||||
### Authentication Endpoints
|
||||
- `POST /api/register` - Create new user account
|
||||
- `POST /api/login` - Authenticate user and create session
|
||||
- `POST /api/logout` - Destroy user session and sign out
|
||||
|
||||
### Protected Endpoints
|
||||
- `GET /comments/new` - Comment creation page (requires authentication)
|
||||
- `POST /api/comments` - Create new comment (requires authentication)
|
||||
|
||||
## Architecture Details
|
||||
|
||||
### Frontend (Nginx + Handlebars)
|
||||
- Serves static files from the `public/` directory
|
||||
- Renders Handlebars templates with dynamic content
|
||||
- Proxies API requests to the backend service
|
||||
- Configured to strip `/api` prefix when forwarding to backend
|
||||
- Responsive design with consistent styling across all pages
|
||||
|
||||
### Backend (Node.js/Express)
|
||||
- REST API server running on port 3000
|
||||
- Session-based authentication with secure cookies
|
||||
- In-memory data storage for users, sessions, and comments
|
||||
- Handlebars templating engine with partials support
|
||||
- Comprehensive error handling and validation
|
||||
- Cookie parser middleware for session management
|
||||
|
||||
### Authentication System
|
||||
- **Registration**: Email/password with confirmation validation
|
||||
- **Login**: Username/password with session creation
|
||||
- **Session Management**: Secure HTTP-only cookies with expiration
|
||||
- **Authorization**: Protected routes requiring authentication
|
||||
- **Error Handling**: Visual feedback for authentication failures
|
||||
|
||||
### Template Architecture
|
||||
- **Reusable Partials**: Navigation, footer, comments, and forms
|
||||
- **Dynamic Navigation**: Different buttons based on auth state
|
||||
- **Consistent Styling**: Shared CSS classes and inline styles
|
||||
- **Error Display**: Template-based error messaging system
|
||||
|
||||
### Containerization
|
||||
- Each service runs in its own Docker container
|
||||
- Services communicate through Docker's internal network
|
||||
- Frontend acts as a reverse proxy for API requests
|
||||
- Persistent data stored in backend memory (resets on container restart)
|
||||
|
||||
## Development Notes
|
||||
|
||||
### Technical Implementation
|
||||
- **Handlebars Templating**: Server-side rendering with reusable partials
|
||||
- **Session Management**: Secure cookie-based authentication
|
||||
- **Error Handling**: Template-based error display with form preservation
|
||||
- **Responsive Design**: Mobile-friendly layout with consistent styling
|
||||
- **Modular Architecture**: Separation of concerns between templates and logic
|
||||
|
||||
### Data Storage
|
||||
- **In-Memory Storage**: Users, sessions, and comments stored in JavaScript objects
|
||||
- **Session Security**: HTTP-only cookies with proper security settings
|
||||
- **Data Persistence**: Data resets when backend container restarts
|
||||
- **Future Enhancement**: Ready for database integration (MongoDB, PostgreSQL, etc.)
|
||||
|
||||
### UI/UX Features
|
||||
- **Dynamic Navigation**: Auth state determines visible navigation options
|
||||
- **Inline Comment Creation**: Toggle-able comment form on comments page
|
||||
- **Form Validation**: Client-side required fields and server-side validation
|
||||
- **Visual Feedback**: Error messages, success states, and loading indicators
|
||||
- **Avatar Generation**: User initials displayed as visual avatars
|
||||
|
||||
### Security Considerations
|
||||
- **Password Storage**: Plain text (development only - needs hashing for production)
|
||||
- **Session Security**: Secure cookie settings with HTTP-only flag
|
||||
- **CSRF Protection**: SameSite cookie policy for basic protection
|
||||
- **Input Validation**: Server-side validation for all user inputs
|
||||
|
||||
## Course Information
|
||||
|
||||
**Course**: COS498 - Server Side Programming Languages
|
||||
**Project Type**: Midterm Project
|
||||
**Focus**: Demonstrating a complete full-stack web application with:
|
||||
- Containerized microservices architecture
|
||||
- Server-side templating and rendering
|
||||
- User authentication and session management
|
||||
- RESTful API design and implementation
|
||||
- Database-like data management (in-memory)
|
||||
- Responsive web design and user experience
|
||||
|
||||
## Future Enhancements
|
||||
|
||||
### Planned Improvements
|
||||
- **Database Integration**: Replace in-memory storage with PostgreSQL or MongoDB
|
||||
- **Password Security**: Implement bcrypt hashing for password storage
|
||||
- **Enhanced Validation**: Add email verification and password strength requirements
|
||||
- **Comment Features**: Add editing, deletion, and reply functionality
|
||||
- **User Profiles**: Implement user profile pages and settings
|
||||
- **Admin Features**: Add moderation tools and user management
|
||||
|
||||
### Production Readiness
|
||||
- **HTTPS Support**: Enable SSL/TLS certificates for secure communication
|
||||
- **Environment Variables**: Move configuration to environment-based settings
|
||||
- **Error Logging**: Implement comprehensive logging and monitoring
|
||||
- **Performance**: Add caching, CDN integration, and optimization
|
||||
- **Testing**: Unit tests, integration tests, and end-to-end testing
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Common Issues
|
||||
1. **Port conflicts**: Ensure ports 80 and 3000 are available
|
||||
2. **Docker issues**: Try `docker-compose down` and `docker-compose up --build`
|
||||
3. **Permission issues**: Ensure Docker has proper permissions on your system
|
||||
4. **API not responding**: Check that both containers are running with `docker-compose ps`
|
||||
5. **Login issues**: Check browser console for session cookie errors
|
||||
6. **Template errors**: Verify all partials are correctly registered and available
|
||||
|
||||
### Development Commands
|
||||
```bash
|
||||
# View container logs
|
||||
docker-compose logs backend-nodejs
|
||||
docker-compose logs frontend-nginx
|
||||
|
||||
# Restart services
|
||||
docker-compose restart
|
||||
|
||||
# Rebuild and restart
|
||||
docker-compose down && docker-compose up --build
|
||||
|
||||
# Check container status
|
||||
docker-compose ps
|
||||
```
|
||||
|
||||
### Data Reset
|
||||
Since the application uses in-memory storage, all user accounts and comments will be lost when the backend container restarts. This is expected behavior for the development version.
|
||||
|
||||
## Author
|
||||
|
||||
Nicholas Pease
|
||||
COS498: Server Side Programming Languages
|
||||
@@ -0,0 +1,18 @@
|
||||
FROM node:lts
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy source code
|
||||
COPY . .
|
||||
|
||||
WORKDIR /app/backend/
|
||||
|
||||
# Install dependencies
|
||||
RUN npm install
|
||||
|
||||
# Expose port (internal to container network)
|
||||
EXPOSE 3000
|
||||
|
||||
# Start the application
|
||||
CMD ["node", "server.js"]
|
||||
Generated
+956
@@ -0,0 +1,956 @@
|
||||
{
|
||||
"name": "backend",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "backend",
|
||||
"version": "1.0.0",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"cookie-parser": "^1.4.7",
|
||||
"express": "^5.1.0",
|
||||
"hbs": "^4.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/accepts": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz",
|
||||
"integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"mime-types": "^3.0.0",
|
||||
"negotiator": "^1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/body-parser": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.0.tgz",
|
||||
"integrity": "sha512-02qvAaxv8tp7fBa/mw1ga98OGm+eCbqzJOKoRt70sLmfEEi+jyBYVTDGfCL/k06/4EMk/z01gCe7HoCH/f2LTg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"bytes": "^3.1.2",
|
||||
"content-type": "^1.0.5",
|
||||
"debug": "^4.4.0",
|
||||
"http-errors": "^2.0.0",
|
||||
"iconv-lite": "^0.6.3",
|
||||
"on-finished": "^2.4.1",
|
||||
"qs": "^6.14.0",
|
||||
"raw-body": "^3.0.0",
|
||||
"type-is": "^2.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/bytes": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
|
||||
"integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/call-bind-apply-helpers": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
|
||||
"integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0",
|
||||
"function-bind": "^1.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/call-bound": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz",
|
||||
"integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"call-bind-apply-helpers": "^1.0.2",
|
||||
"get-intrinsic": "^1.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/content-disposition": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.0.0.tgz",
|
||||
"integrity": "sha512-Au9nRL8VNUut/XSzbQA38+M78dzP4D+eqg3gfJHMIHHYa3bg067xj1KxMUWj+VULbiZMowKngFFbKczUrNJ1mg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"safe-buffer": "5.2.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/content-type": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",
|
||||
"integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/cookie": {
|
||||
"version": "0.7.2",
|
||||
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz",
|
||||
"integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/cookie-parser": {
|
||||
"version": "1.4.7",
|
||||
"resolved": "https://registry.npmjs.org/cookie-parser/-/cookie-parser-1.4.7.tgz",
|
||||
"integrity": "sha512-nGUvgXnotP3BsjiLX2ypbQnWoGUPIIfHQNZkkC668ntrzGWEZVW70HDEB1qnNGMicPje6EttlIgzo51YSwNQGw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"cookie": "0.7.2",
|
||||
"cookie-signature": "1.0.6"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/cookie-signature": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
|
||||
"integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/debug": {
|
||||
"version": "4.4.3",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
|
||||
"integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ms": "^2.1.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"supports-color": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/depd": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
|
||||
"integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/dunder-proto": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
|
||||
"integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"call-bind-apply-helpers": "^1.0.1",
|
||||
"es-errors": "^1.3.0",
|
||||
"gopd": "^1.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/ee-first": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
|
||||
"integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/encodeurl": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",
|
||||
"integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/es-define-property": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
|
||||
"integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/es-errors": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
|
||||
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/es-object-atoms": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz",
|
||||
"integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/escape-html": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
|
||||
"integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/etag": {
|
||||
"version": "1.8.1",
|
||||
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
|
||||
"integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/express": {
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmjs.org/express/-/express-5.1.0.tgz",
|
||||
"integrity": "sha512-DT9ck5YIRU+8GYzzU5kT3eHGA5iL+1Zd0EutOmTE9Dtk+Tvuzd23VBU+ec7HPNSTxXYO55gPV/hq4pSBJDjFpA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"accepts": "^2.0.0",
|
||||
"body-parser": "^2.2.0",
|
||||
"content-disposition": "^1.0.0",
|
||||
"content-type": "^1.0.5",
|
||||
"cookie": "^0.7.1",
|
||||
"cookie-signature": "^1.2.1",
|
||||
"debug": "^4.4.0",
|
||||
"encodeurl": "^2.0.0",
|
||||
"escape-html": "^1.0.3",
|
||||
"etag": "^1.8.1",
|
||||
"finalhandler": "^2.1.0",
|
||||
"fresh": "^2.0.0",
|
||||
"http-errors": "^2.0.0",
|
||||
"merge-descriptors": "^2.0.0",
|
||||
"mime-types": "^3.0.0",
|
||||
"on-finished": "^2.4.1",
|
||||
"once": "^1.4.0",
|
||||
"parseurl": "^1.3.3",
|
||||
"proxy-addr": "^2.0.7",
|
||||
"qs": "^6.14.0",
|
||||
"range-parser": "^1.2.1",
|
||||
"router": "^2.2.0",
|
||||
"send": "^1.1.0",
|
||||
"serve-static": "^2.2.0",
|
||||
"statuses": "^2.0.1",
|
||||
"type-is": "^2.0.1",
|
||||
"vary": "^1.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/express/node_modules/cookie-signature": {
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz",
|
||||
"integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6.6.0"
|
||||
}
|
||||
},
|
||||
"node_modules/finalhandler": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.0.tgz",
|
||||
"integrity": "sha512-/t88Ty3d5JWQbWYgaOGCCYfXRwV1+be02WqYYlL6h0lEiUAMPM8o8qKGO01YIkOHzka2up08wvgYD0mDiI+q3Q==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"debug": "^4.4.0",
|
||||
"encodeurl": "^2.0.0",
|
||||
"escape-html": "^1.0.3",
|
||||
"on-finished": "^2.4.1",
|
||||
"parseurl": "^1.3.3",
|
||||
"statuses": "^2.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/foreachasync": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/foreachasync/-/foreachasync-3.0.0.tgz",
|
||||
"integrity": "sha512-J+ler7Ta54FwwNcx6wQRDhTIbNeyDcARMkOcguEqnEdtm0jKvN3Li3PDAb2Du3ubJYEWfYL83XMROXdsXAXycw==",
|
||||
"license": "Apache2"
|
||||
},
|
||||
"node_modules/forwarded": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
|
||||
"integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/fresh": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz",
|
||||
"integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/function-bind": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
|
||||
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/get-intrinsic": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
|
||||
"integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"call-bind-apply-helpers": "^1.0.2",
|
||||
"es-define-property": "^1.0.1",
|
||||
"es-errors": "^1.3.0",
|
||||
"es-object-atoms": "^1.1.1",
|
||||
"function-bind": "^1.1.2",
|
||||
"get-proto": "^1.0.1",
|
||||
"gopd": "^1.2.0",
|
||||
"has-symbols": "^1.1.0",
|
||||
"hasown": "^2.0.2",
|
||||
"math-intrinsics": "^1.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/get-proto": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",
|
||||
"integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"dunder-proto": "^1.0.1",
|
||||
"es-object-atoms": "^1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/gopd": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
|
||||
"integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/handlebars": {
|
||||
"version": "4.7.7",
|
||||
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz",
|
||||
"integrity": "sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"minimist": "^1.2.5",
|
||||
"neo-async": "^2.6.0",
|
||||
"source-map": "^0.6.1",
|
||||
"wordwrap": "^1.0.0"
|
||||
},
|
||||
"bin": {
|
||||
"handlebars": "bin/handlebars"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.4.7"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"uglify-js": "^3.1.4"
|
||||
}
|
||||
},
|
||||
"node_modules/has-symbols": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
|
||||
"integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/hasown": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
|
||||
"integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"function-bind": "^1.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/hbs": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/hbs/-/hbs-4.2.0.tgz",
|
||||
"integrity": "sha512-dQwHnrfWlTk5PvG9+a45GYpg0VpX47ryKF8dULVd6DtwOE6TEcYQXQ5QM6nyOx/h7v3bvEQbdn19EDAcfUAgZg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"handlebars": "4.7.7",
|
||||
"walk": "2.3.15"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8",
|
||||
"npm": "1.2.8000 || >= 1.4.16"
|
||||
}
|
||||
},
|
||||
"node_modules/http-errors": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
|
||||
"integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"depd": "2.0.0",
|
||||
"inherits": "2.0.4",
|
||||
"setprototypeof": "1.2.0",
|
||||
"statuses": "2.0.1",
|
||||
"toidentifier": "1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/http-errors/node_modules/statuses": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
|
||||
"integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/iconv-lite": {
|
||||
"version": "0.6.3",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
|
||||
"integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"safer-buffer": ">= 2.1.2 < 3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/inherits": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/ipaddr.js": {
|
||||
"version": "1.9.1",
|
||||
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
|
||||
"integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/is-promise": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz",
|
||||
"integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/math-intrinsics": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
|
||||
"integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/media-typer": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz",
|
||||
"integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/merge-descriptors": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz",
|
||||
"integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/mime-db": {
|
||||
"version": "1.54.0",
|
||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz",
|
||||
"integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/mime-types": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.1.tgz",
|
||||
"integrity": "sha512-xRc4oEhT6eaBpU1XF7AjpOFD+xQmXNB5OVKwp4tqCuBpHLS/ZbBDrc07mYTDqVMg6PfxUjjNp85O6Cd2Z/5HWA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"mime-db": "^1.54.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/minimist": {
|
||||
"version": "1.2.8",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
|
||||
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/ms": {
|
||||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
||||
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/negotiator": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz",
|
||||
"integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/neo-async": {
|
||||
"version": "2.6.2",
|
||||
"resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz",
|
||||
"integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/object-inspect": {
|
||||
"version": "1.13.4",
|
||||
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz",
|
||||
"integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/on-finished": {
|
||||
"version": "2.4.1",
|
||||
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
|
||||
"integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ee-first": "1.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/once": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"node_modules/parseurl": {
|
||||
"version": "1.3.3",
|
||||
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
|
||||
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/path-to-regexp": {
|
||||
"version": "8.3.0",
|
||||
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.3.0.tgz",
|
||||
"integrity": "sha512-7jdwVIRtsP8MYpdXSwOS0YdD0Du+qOoF/AEPIt88PcCFrZCzx41oxku1jD88hZBwbNUIEfpqvuhjFaMAqMTWnA==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/proxy-addr": {
|
||||
"version": "2.0.7",
|
||||
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
|
||||
"integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"forwarded": "0.2.0",
|
||||
"ipaddr.js": "1.9.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/qs": {
|
||||
"version": "6.14.0",
|
||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.14.0.tgz",
|
||||
"integrity": "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w==",
|
||||
"license": "BSD-3-Clause",
|
||||
"dependencies": {
|
||||
"side-channel": "^1.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.6"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/range-parser": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
|
||||
"integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/raw-body": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.1.tgz",
|
||||
"integrity": "sha512-9G8cA+tuMS75+6G/TzW8OtLzmBDMo8p1JRxN5AZ+LAp8uxGA8V8GZm4GQ4/N5QNQEnLmg6SS7wyuSmbKepiKqA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"bytes": "3.1.2",
|
||||
"http-errors": "2.0.0",
|
||||
"iconv-lite": "0.7.0",
|
||||
"unpipe": "1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/raw-body/node_modules/iconv-lite": {
|
||||
"version": "0.7.0",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.0.tgz",
|
||||
"integrity": "sha512-cf6L2Ds3h57VVmkZe+Pn+5APsT7FpqJtEhhieDCvrE2MK5Qk9MyffgQyuxQTm6BChfeZNtcOLHp9IcWRVcIcBQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"safer-buffer": ">= 2.1.2 < 3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/router": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz",
|
||||
"integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"debug": "^4.4.0",
|
||||
"depd": "^2.0.0",
|
||||
"is-promise": "^4.0.0",
|
||||
"parseurl": "^1.3.3",
|
||||
"path-to-regexp": "^8.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/safe-buffer": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
||||
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
],
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/send": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/send/-/send-1.2.0.tgz",
|
||||
"integrity": "sha512-uaW0WwXKpL9blXE2o0bRhoL2EGXIrZxQ2ZQ4mgcfoBxdFmQold+qWsD2jLrfZ0trjKL6vOw0j//eAwcALFjKSw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"debug": "^4.3.5",
|
||||
"encodeurl": "^2.0.0",
|
||||
"escape-html": "^1.0.3",
|
||||
"etag": "^1.8.1",
|
||||
"fresh": "^2.0.0",
|
||||
"http-errors": "^2.0.0",
|
||||
"mime-types": "^3.0.1",
|
||||
"ms": "^2.1.3",
|
||||
"on-finished": "^2.4.1",
|
||||
"range-parser": "^1.2.1",
|
||||
"statuses": "^2.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/serve-static": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.0.tgz",
|
||||
"integrity": "sha512-61g9pCh0Vnh7IutZjtLGGpTA355+OPn2TyDv/6ivP2h/AdAVX9azsoxmg2/M6nZeQZNYBEwIcsne1mJd9oQItQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"encodeurl": "^2.0.0",
|
||||
"escape-html": "^1.0.3",
|
||||
"parseurl": "^1.3.3",
|
||||
"send": "^1.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/setprototypeof": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
|
||||
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/side-channel": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz",
|
||||
"integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0",
|
||||
"object-inspect": "^1.13.3",
|
||||
"side-channel-list": "^1.0.0",
|
||||
"side-channel-map": "^1.0.1",
|
||||
"side-channel-weakmap": "^1.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/side-channel-list": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz",
|
||||
"integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0",
|
||||
"object-inspect": "^1.13.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/side-channel-map": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz",
|
||||
"integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"call-bound": "^1.0.2",
|
||||
"es-errors": "^1.3.0",
|
||||
"get-intrinsic": "^1.2.5",
|
||||
"object-inspect": "^1.13.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/side-channel-weakmap": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz",
|
||||
"integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"call-bound": "^1.0.2",
|
||||
"es-errors": "^1.3.0",
|
||||
"get-intrinsic": "^1.2.5",
|
||||
"object-inspect": "^1.13.3",
|
||||
"side-channel-map": "^1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/source-map": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
||||
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
|
||||
"license": "BSD-3-Clause",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/statuses": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz",
|
||||
"integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/toidentifier": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
|
||||
"integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/type-is": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/type-is/-/type-is-2.0.1.tgz",
|
||||
"integrity": "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"content-type": "^1.0.5",
|
||||
"media-typer": "^1.1.0",
|
||||
"mime-types": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/uglify-js": {
|
||||
"version": "3.19.3",
|
||||
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.19.3.tgz",
|
||||
"integrity": "sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ==",
|
||||
"license": "BSD-2-Clause",
|
||||
"optional": true,
|
||||
"bin": {
|
||||
"uglifyjs": "bin/uglifyjs"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/unpipe": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
|
||||
"integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/vary": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
|
||||
"integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/walk": {
|
||||
"version": "2.3.15",
|
||||
"resolved": "https://registry.npmjs.org/walk/-/walk-2.3.15.tgz",
|
||||
"integrity": "sha512-4eRTBZljBfIISK1Vnt69Gvr2w/wc3U6Vtrw7qiN5iqYJPH7LElcYh/iU4XWhdCy2dZqv1ToMyYlybDylfG/5Vg==",
|
||||
"license": "(MIT OR Apache-2.0)",
|
||||
"dependencies": {
|
||||
"foreachasync": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/wordwrap": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz",
|
||||
"integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/wrappy": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
|
||||
"license": "ISC"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "backend",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"packageManager": "pnpm@10.19.0",
|
||||
"dependencies": {
|
||||
"cookie-parser": "^1.4.7",
|
||||
"express": "^5.1.0",
|
||||
"hbs": "^4.2.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
const express = require('express');
|
||||
const hbs = require('hbs');
|
||||
const cookieParser = require('cookie-parser');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const app = express();
|
||||
const PORT = process.env.PORT || 3000;
|
||||
|
||||
// Handlebars
|
||||
app.set('view engine', 'hbs');
|
||||
app.set('views', '../frontend/views');
|
||||
|
||||
// Register partials directory
|
||||
hbs.registerPartials('../frontend/partials');
|
||||
|
||||
// Middleware
|
||||
app.use(express.static('../frontend/public'));
|
||||
app.use(express.json());
|
||||
app.use(cookieParser());
|
||||
|
||||
|
||||
// API Routes
|
||||
// Get list of available books
|
||||
app.get('/api/books', (req, res) => {
|
||||
const booksPath = path.join(__dirname, '../frontend/public/books');
|
||||
|
||||
try {
|
||||
const books = fs.readdirSync(booksPath, { withFileTypes: true })
|
||||
.filter(dirent => dirent.isDirectory())
|
||||
.map(dirent => ({
|
||||
name: dirent.name,
|
||||
displayName: dirent.name.replace(/-/g, ' ')
|
||||
}));
|
||||
|
||||
res.json({ books });
|
||||
} catch (error) {
|
||||
console.error('Error reading books directory:', error);
|
||||
res.status(500).json({ error: 'Failed to load books' });
|
||||
}
|
||||
});
|
||||
|
||||
// Get list of chapters for a specific book
|
||||
app.get('/api/books/:bookName/chapters', (req, res) => {
|
||||
const bookName = req.params.bookName;
|
||||
const bookPath = path.join(__dirname, '../frontend/public/books', bookName);
|
||||
|
||||
try {
|
||||
if (!fs.existsSync(bookPath)) {
|
||||
return res.status(404).json({ error: 'Book not found' });
|
||||
}
|
||||
|
||||
const files = fs.readdirSync(bookPath);
|
||||
const chapters = files
|
||||
.filter(file => file.toLowerCase().endsWith('.pdf'))
|
||||
.map(file => ({
|
||||
filename: file,
|
||||
displayName: file.replace('.pdf', '').replace(/chapter\s*/i, 'Chapter '),
|
||||
url: `/books/${bookName}/${encodeURIComponent(file)}`
|
||||
}))
|
||||
.sort((a, b) => {
|
||||
// Sort chapters numerically
|
||||
const aNum = parseInt(a.displayName.match(/\d+/)?.[0] || '0');
|
||||
const bNum = parseInt(b.displayName.match(/\d+/)?.[0] || '0');
|
||||
return aNum - bNum;
|
||||
});
|
||||
|
||||
res.json({ chapters });
|
||||
} catch (error) {
|
||||
console.error('Error reading chapters directory:', error);
|
||||
res.status(500).json({ error: 'Failed to load chapters' });
|
||||
}
|
||||
});
|
||||
|
||||
// Serve PDF files
|
||||
app.get('/books/:bookName/:chapterFile', (req, res) => {
|
||||
const bookName = req.params.bookName;
|
||||
const chapterFile = decodeURIComponent(req.params.chapterFile);
|
||||
const filePath = path.join(__dirname, '../frontend/public/books', bookName, chapterFile);
|
||||
|
||||
// Security check - ensure the file path is within the books directory
|
||||
const booksDir = path.resolve(__dirname, '../frontend/public/books');
|
||||
const resolvedPath = path.resolve(filePath);
|
||||
|
||||
if (!resolvedPath.startsWith(booksDir)) {
|
||||
return res.status(403).json({ error: 'Access denied' });
|
||||
}
|
||||
|
||||
if (!fs.existsSync(filePath)) {
|
||||
return res.status(404).json({ error: 'Chapter not found' });
|
||||
}
|
||||
|
||||
res.sendFile(resolvedPath);
|
||||
});
|
||||
|
||||
// Page Routes
|
||||
app.get('/', (req, res) => {
|
||||
res.render('index', { title: 'Book Viewer' });
|
||||
});
|
||||
|
||||
|
||||
// Start server
|
||||
app.listen(PORT, '0.0.0.0', () => {
|
||||
console.log(`Server running on port ${PORT}`);
|
||||
});
|
||||
@@ -0,0 +1,3 @@
|
||||
class Book {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
services:
|
||||
# Node.js Express application
|
||||
backend-nodejs:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./backend/Dockerfile
|
||||
container_name: backend-nodejs
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
- PORT=3000
|
||||
# No ports exposed - only nginx can access this container
|
||||
networks:
|
||||
- app-network
|
||||
|
||||
# nginx reverse proxy
|
||||
frontend:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./frontend/Dockerfile
|
||||
container_name: frontend
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "80:80" # Only nginx exposes ports to the host
|
||||
depends_on:
|
||||
- backend-nodejs
|
||||
networks:
|
||||
- app-network
|
||||
|
||||
networks:
|
||||
app-network:
|
||||
driver: bridge
|
||||
@@ -0,0 +1,11 @@
|
||||
FROM nginx:alpine
|
||||
|
||||
# Copy custom nginx configuration
|
||||
COPY ../frontend/default.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
# Copy static files to nginx html directory
|
||||
COPY ../frontend/public/ /usr/share/nginx/html/
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
@@ -0,0 +1,17 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
# # Serve static files
|
||||
# location / {
|
||||
# try_files $uri $uri/ /index.html;
|
||||
# }
|
||||
|
||||
# Proxy all requests to Node.js app
|
||||
location / {
|
||||
proxy_pass http://backend-nodejs:3000/;
|
||||
}
|
||||
}
|
||||
+1
Submodule frontend/public/books/WaysOfTheWorld-Strayer added at 86e5dfa129
@@ -0,0 +1,208 @@
|
||||
class BookViewer {
|
||||
constructor() {
|
||||
this.selectedBook = null;
|
||||
this.selectedChapter = null;
|
||||
this.books = [];
|
||||
this.chapters = [];
|
||||
|
||||
this.init();
|
||||
}
|
||||
|
||||
async init() {
|
||||
// Wait for DOM to be ready
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', () => this.setup());
|
||||
} else {
|
||||
this.setup();
|
||||
}
|
||||
}
|
||||
|
||||
async setup() {
|
||||
this.bindElements();
|
||||
await this.loadBooks();
|
||||
}
|
||||
|
||||
bindElements() {
|
||||
this.booksListEl = document.getElementById('books-list');
|
||||
this.chaptersListEl = document.getElementById('chapters-list');
|
||||
this.chaptersSectionEl = document.getElementById('chapters-section');
|
||||
this.pdfPlaceholderEl = document.getElementById('pdf-placeholder');
|
||||
this.pdfViewerEl = document.getElementById('pdf-viewer');
|
||||
}
|
||||
|
||||
async loadBooks() {
|
||||
try {
|
||||
this.showLoading(this.booksListEl, 'Loading books...');
|
||||
|
||||
const response = await fetch('/api/books');
|
||||
if (!response.ok) {
|
||||
throw new Error('Failed to load books');
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
this.books = data.books;
|
||||
|
||||
this.renderBooks();
|
||||
} catch (error) {
|
||||
console.error('Error loading books:', error);
|
||||
this.showError(this.booksListEl, 'Failed to load books. Please refresh the page.');
|
||||
}
|
||||
}
|
||||
|
||||
async loadChapters(bookName) {
|
||||
try {
|
||||
this.showLoading(this.chaptersListEl, 'Loading chapters...');
|
||||
|
||||
const response = await fetch(`/api/books/${encodeURIComponent(bookName)}/chapters`);
|
||||
if (!response.ok) {
|
||||
throw new Error('Failed to load chapters');
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
this.chapters = data.chapters;
|
||||
|
||||
this.renderChapters();
|
||||
this.showChaptersSection();
|
||||
} catch (error) {
|
||||
console.error('Error loading chapters:', error);
|
||||
this.showError(this.chaptersListEl, 'Failed to load chapters for this book.');
|
||||
}
|
||||
}
|
||||
|
||||
renderBooks() {
|
||||
this.booksListEl.innerHTML = '';
|
||||
|
||||
if (this.books.length === 0) {
|
||||
this.booksListEl.innerHTML = '<div class="error">No books available</div>';
|
||||
return;
|
||||
}
|
||||
|
||||
this.books.forEach(book => {
|
||||
const bookEl = document.createElement('div');
|
||||
bookEl.className = 'book-item';
|
||||
bookEl.textContent = book.displayName;
|
||||
bookEl.dataset.bookName = book.name;
|
||||
|
||||
bookEl.addEventListener('click', () => this.selectBook(book.name, bookEl));
|
||||
|
||||
this.booksListEl.appendChild(bookEl);
|
||||
});
|
||||
}
|
||||
|
||||
renderChapters() {
|
||||
this.chaptersListEl.innerHTML = '';
|
||||
|
||||
if (this.chapters.length === 0) {
|
||||
this.chaptersListEl.innerHTML = '<div class="error">No chapters available for this book</div>';
|
||||
return;
|
||||
}
|
||||
|
||||
this.chapters.forEach(chapter => {
|
||||
const chapterEl = document.createElement('div');
|
||||
chapterEl.className = 'chapter-item';
|
||||
chapterEl.textContent = chapter.displayName;
|
||||
chapterEl.dataset.chapterUrl = chapter.url;
|
||||
|
||||
chapterEl.addEventListener('click', () => this.selectChapter(chapter.url, chapterEl));
|
||||
|
||||
this.chaptersListEl.appendChild(chapterEl);
|
||||
});
|
||||
}
|
||||
|
||||
async selectBook(bookName, bookEl) {
|
||||
// Update selected book UI
|
||||
document.querySelectorAll('.book-item').forEach(el => el.classList.remove('selected'));
|
||||
bookEl.classList.add('selected');
|
||||
|
||||
// Clear selected chapter
|
||||
this.selectedChapter = null;
|
||||
document.querySelectorAll('.chapter-item').forEach(el => el.classList.remove('selected'));
|
||||
this.hidePDF();
|
||||
|
||||
this.selectedBook = bookName;
|
||||
|
||||
// Load chapters for selected book
|
||||
await this.loadChapters(bookName);
|
||||
}
|
||||
|
||||
selectChapter(chapterUrl, chapterEl) {
|
||||
// Update selected chapter UI
|
||||
document.querySelectorAll('.chapter-item').forEach(el => el.classList.remove('selected'));
|
||||
chapterEl.classList.add('selected');
|
||||
|
||||
this.selectedChapter = chapterUrl;
|
||||
this.showPDF(chapterUrl);
|
||||
}
|
||||
|
||||
showPDF(url) {
|
||||
this.pdfPlaceholderEl.style.display = 'none';
|
||||
this.pdfViewerEl.style.display = 'block';
|
||||
this.pdfViewerEl.src = url;
|
||||
|
||||
// Handle PDF load errors
|
||||
this.pdfViewerEl.onload = () => {
|
||||
// PDF loaded successfully
|
||||
};
|
||||
|
||||
this.pdfViewerEl.onerror = () => {
|
||||
this.showError(this.pdfPlaceholderEl, 'Failed to load PDF. Please try another chapter.');
|
||||
this.hidePDF();
|
||||
};
|
||||
}
|
||||
|
||||
hidePDF() {
|
||||
this.pdfViewerEl.style.display = 'none';
|
||||
this.pdfPlaceholderEl.style.display = 'flex';
|
||||
this.pdfViewerEl.src = '';
|
||||
}
|
||||
|
||||
showChaptersSection() {
|
||||
this.chaptersSectionEl.style.display = 'block';
|
||||
}
|
||||
|
||||
hideChaptersSection() {
|
||||
this.chaptersSectionEl.style.display = 'none';
|
||||
}
|
||||
|
||||
showLoading(element, message = 'Loading...') {
|
||||
element.innerHTML = `<div class="loading">${message}</div>`;
|
||||
}
|
||||
|
||||
showError(element, message) {
|
||||
element.innerHTML = `<div class="error">${message}</div>`;
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize the book viewer when the script loads
|
||||
const bookViewer = new BookViewer();
|
||||
|
||||
// Add some keyboard shortcuts for better UX
|
||||
document.addEventListener('keydown', (e) => {
|
||||
// ESC key to deselect
|
||||
if (e.key === 'Escape') {
|
||||
const selectedChapter = document.querySelector('.chapter-item.selected');
|
||||
if (selectedChapter) {
|
||||
selectedChapter.classList.remove('selected');
|
||||
bookViewer.hidePDF();
|
||||
}
|
||||
}
|
||||
|
||||
// Arrow keys for navigation
|
||||
if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {
|
||||
const chapters = document.querySelectorAll('.chapter-item');
|
||||
const selectedChapter = document.querySelector('.chapter-item.selected');
|
||||
|
||||
if (chapters.length > 0) {
|
||||
let currentIndex = Array.from(chapters).indexOf(selectedChapter);
|
||||
|
||||
if (e.key === 'ArrowUp') {
|
||||
currentIndex = Math.max(0, currentIndex - 1);
|
||||
} else {
|
||||
currentIndex = Math.min(chapters.length - 1, currentIndex + 1);
|
||||
}
|
||||
|
||||
chapters[currentIndex]?.click();
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,326 @@
|
||||
/* Themeing */
|
||||
:root {
|
||||
--primary-color: #4C5454;
|
||||
--secondary-color: #fff;
|
||||
--accent-color: #AEF78E;
|
||||
--tertiary-color: #2E0014;
|
||||
--additional-color: #B80C09;
|
||||
--sidebar-width: 320px;
|
||||
--navbar-height: 60px;
|
||||
--border-radius: 8px;
|
||||
--shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
/* Reset and base styles */
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'Arial', sans-serif;
|
||||
background-color: var(--secondary-color);
|
||||
overflow: hidden;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
/* Navigation Bar */
|
||||
.navbar {
|
||||
background-color: var(--primary-color);
|
||||
color: var(--secondary-color);
|
||||
height: var(--navbar-height);
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 1000;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
box-shadow: var(--shadow);
|
||||
}
|
||||
|
||||
.navbar-content {
|
||||
width: 100%;
|
||||
padding: 0 20px;
|
||||
}
|
||||
|
||||
.navbar-brand {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
font-size: 1.2rem;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.navbar-brand i {
|
||||
font-size: 1.4rem;
|
||||
color: var(--accent-color);
|
||||
}
|
||||
|
||||
/* Main Container */
|
||||
.main-container {
|
||||
display: flex;
|
||||
height: 100vh;
|
||||
margin-top: var(--navbar-height);
|
||||
}
|
||||
|
||||
/* Sidebar */
|
||||
.sidebar {
|
||||
width: var(--sidebar-width);
|
||||
background-color: #f8f9fa;
|
||||
border-right: 2px solid #e9ecef;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: calc(100vh - var(--navbar-height));
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.sidebar-header {
|
||||
background-color: var(--primary-color);
|
||||
color: var(--secondary-color);
|
||||
padding: 15px 20px;
|
||||
border-bottom: 1px solid #e9ecef;
|
||||
}
|
||||
|
||||
.sidebar-header h3 {
|
||||
font-size: 1.1rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.sidebar-content {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
/* Books Section */
|
||||
.books-section {
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.books-section h4,
|
||||
.chapters-section h4 {
|
||||
color: var(--primary-color);
|
||||
margin-bottom: 12px;
|
||||
font-size: 1rem;
|
||||
font-weight: 600;
|
||||
border-bottom: 2px solid var(--accent-color);
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
.books-list {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.book-item {
|
||||
background-color: var(--secondary-color);
|
||||
padding: 12px 15px;
|
||||
margin-bottom: 8px;
|
||||
border-radius: var(--border-radius);
|
||||
border: 2px solid #e9ecef;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.book-item:hover {
|
||||
background-color: var(--accent-color);
|
||||
border-color: var(--primary-color);
|
||||
color: var(--primary-color);
|
||||
transform: translateX(5px);
|
||||
}
|
||||
|
||||
.book-item.selected {
|
||||
background-color: var(--primary-color);
|
||||
color: var(--secondary-color);
|
||||
border-color: var(--primary-color);
|
||||
}
|
||||
|
||||
/* Chapters Section */
|
||||
.chapters-section {
|
||||
animation: slideDown 0.3s ease;
|
||||
}
|
||||
|
||||
.chapters-list {
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.chapter-item {
|
||||
background-color: var(--secondary-color);
|
||||
padding: 10px 12px;
|
||||
margin-bottom: 6px;
|
||||
border-radius: var(--border-radius);
|
||||
border: 1px solid #e9ecef;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
|
||||
.chapter-item:hover {
|
||||
background-color: var(--accent-color);
|
||||
border-color: var(--primary-color);
|
||||
color: var(--primary-color);
|
||||
transform: translateX(3px);
|
||||
}
|
||||
|
||||
.chapter-item.selected {
|
||||
background-color: var(--additional-color);
|
||||
color: var(--secondary-color);
|
||||
border-color: var(--additional-color);
|
||||
}
|
||||
|
||||
/* Content Area */
|
||||
.content-area {
|
||||
flex: 1;
|
||||
height: calc(100vh - var(--navbar-height));
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.pdf-container {
|
||||
height: 100%;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.pdf-placeholder {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: #f8f9fa;
|
||||
color: #6c757d;
|
||||
}
|
||||
|
||||
.placeholder-content {
|
||||
text-align: center;
|
||||
padding: 40px;
|
||||
}
|
||||
|
||||
.placeholder-content i {
|
||||
font-size: 4rem;
|
||||
margin-bottom: 20px;
|
||||
color: #dee2e6;
|
||||
}
|
||||
|
||||
.placeholder-content h2 {
|
||||
font-size: 1.5rem;
|
||||
margin-bottom: 10px;
|
||||
color: var(--primary-color);
|
||||
}
|
||||
|
||||
.placeholder-content p {
|
||||
font-size: 1rem;
|
||||
color: #6c757d;
|
||||
}
|
||||
|
||||
.pdf-viewer {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: none;
|
||||
}
|
||||
|
||||
/* Loading and utility classes */
|
||||
.loading {
|
||||
text-align: center;
|
||||
color: #6c757d;
|
||||
font-style: italic;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.error {
|
||||
color: var(--additional-color);
|
||||
background-color: #f8d7da;
|
||||
border: 1px solid #f5c6cb;
|
||||
border-radius: var(--border-radius);
|
||||
padding: 10px;
|
||||
margin: 10px 0;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
/* Animations */
|
||||
@keyframes slideDown {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(-10px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
/* Scrollbar styling */
|
||||
.sidebar-content::-webkit-scrollbar,
|
||||
.chapters-list::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
}
|
||||
|
||||
.sidebar-content::-webkit-scrollbar-track,
|
||||
.chapters-list::-webkit-scrollbar-track {
|
||||
background: #f1f1f1;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.sidebar-content::-webkit-scrollbar-thumb,
|
||||
.chapters-list::-webkit-scrollbar-thumb {
|
||||
background: #c1c1c1;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.sidebar-content::-webkit-scrollbar-thumb:hover,
|
||||
.chapters-list::-webkit-scrollbar-thumb:hover {
|
||||
background: #a8a8a8;
|
||||
}
|
||||
|
||||
/* Responsive Design */
|
||||
@media (max-width: 768px) {
|
||||
:root {
|
||||
--sidebar-width: 280px;
|
||||
}
|
||||
|
||||
.main-container {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
width: 100%;
|
||||
height: 300px;
|
||||
}
|
||||
|
||||
.content-area {
|
||||
height: calc(100vh - var(--navbar-height) - 300px);
|
||||
}
|
||||
}
|
||||
|
||||
/* Legacy styles - keeping for compatibility */
|
||||
a .active {
|
||||
background-color: var(--accent-color);
|
||||
color: var(--primary-color);
|
||||
}
|
||||
|
||||
#navbar_frame {
|
||||
width: 100%;
|
||||
border: none;
|
||||
height: 55px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#notable_ac_table {
|
||||
padding-left: 45px;
|
||||
padding-right: 45px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.notable_ac_table_img {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.notable_ac_table_caption {
|
||||
font-weight: bolder;
|
||||
font-size: 30px;
|
||||
}
|
||||
|
||||
.notable_ac_table_caption > a {
|
||||
text-decoration: none;
|
||||
color: black;
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
<!-- This content will be injected into the layout template -->
|
||||
<!-- The main functionality is handled by the layout template and JavaScript -->
|
||||
@@ -0,0 +1,65 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{{title}} - Book Viewer</title>
|
||||
<link rel="stylesheet" href="/styles/main.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
||||
</head>
|
||||
<body>
|
||||
<!-- Navigation Bar -->
|
||||
<nav class="navbar">
|
||||
<div class="navbar-content">
|
||||
<div class="navbar-brand">
|
||||
<i class="fas fa-book-open"></i>
|
||||
<span>Book Viewing Website</span>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<!-- Main Content Area -->
|
||||
<div class="main-container">
|
||||
<!-- Left Sidebar - Book and Chapter Selector -->
|
||||
<aside class="sidebar">
|
||||
<div class="sidebar-header">
|
||||
<h3>Books & Chapters</h3>
|
||||
</div>
|
||||
<div class="sidebar-content">
|
||||
<!-- Books List -->
|
||||
<div class="books-section">
|
||||
<h4>Available Books</h4>
|
||||
<div id="books-list" class="books-list">
|
||||
<div class="loading">Loading books...</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Chapters List -->
|
||||
<div class="chapters-section" id="chapters-section" style="display: none;">
|
||||
<h4>Chapters</h4>
|
||||
<div id="chapters-list" class="chapters-list">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<!-- Right Side - PDF Display Area -->
|
||||
<main class="content-area">
|
||||
<div class="pdf-container">
|
||||
<div id="pdf-placeholder" class="pdf-placeholder">
|
||||
<div class="placeholder-content">
|
||||
<i class="fas fa-file-pdf"></i>
|
||||
<h2>Select a chapter to view</h2>
|
||||
<p>Choose a book and chapter from the sidebar to display the PDF</p>
|
||||
</div>
|
||||
</div>
|
||||
<iframe id="pdf-viewer" class="pdf-viewer" style="display: none;"></iframe>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
{{{body}}}
|
||||
|
||||
<script src="/scripts/app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user