SHA256
Updated to do local content w/ passwording and encryption
This commit is contained in:
@@ -1,53 +1,48 @@
|
||||
# markMyWords
|
||||
|
||||
A self-hostable Docker application that automatically pulls markdown repositories at user-defined intervals and displays them as searchable HTML pages.
|
||||
A self-hostable Docker application for hosting and searching markdown files with optional password protection and encryption.
|
||||
|
||||
## Features
|
||||
|
||||
- 🚀 **Self-hosted**: Run entirely on your own infrastructure
|
||||
- 📦 **Docker-ready**: Simple Docker Compose setup
|
||||
- 📅 **Scheduled Pulls**: Configure cron-style schedules for each repository
|
||||
- 🔍 **Full-text Search**: Search across all markdown files
|
||||
- 📄 **Markdown Rendering**: Beautiful HTML rendering with syntax highlighting
|
||||
- ⚡ **Zero Configuration**: Works out of the box with configuration file
|
||||
- 🔐 **Encryption**: Optional password-based file encryption
|
||||
- 🛡️ **Access Control**: Password-protect individual files
|
||||
- ⚡ **Simple Setup**: Just add files to the `content/` directory
|
||||
|
||||
## Quick Start
|
||||
|
||||
### 1. Clone and Configure
|
||||
### 1. Setup Directory
|
||||
|
||||
```bash
|
||||
cd markmywords
|
||||
# Create the config directory
|
||||
mkdir -p config
|
||||
|
||||
# Copy the example configuration
|
||||
cp config/repositories.json.example config/repositories.json
|
||||
|
||||
# Edit the configuration with your repositories
|
||||
nano config/repositories.json
|
||||
# Create necessary directories
|
||||
mkdir -p content config data
|
||||
```
|
||||
|
||||
### 2. Configure Repositories
|
||||
### 2. Add Markdown Files
|
||||
|
||||
Edit `config/repositories.json` to specify which repositories to pull:
|
||||
Copy your markdown files to the `content/` directory:
|
||||
|
||||
```json
|
||||
{
|
||||
"repo-name": {
|
||||
"url": "https://github.com/username/repo.git",
|
||||
"enabled": true,
|
||||
"schedule": "0 */6 * * *"
|
||||
}
|
||||
}
|
||||
```bash
|
||||
cp /path/to/your/markdown/files/* ./content/
|
||||
```
|
||||
|
||||
**Schedule Format**: Standard cron expression (minute, hour, day of month, month, day of week)
|
||||
Organize with subdirectories as needed:
|
||||
|
||||
Common schedules:
|
||||
- `0 * * * *` - Every hour
|
||||
- `0 */6 * * *` - Every 6 hours (default)
|
||||
- `0 9 * * *` - Daily at 9 AM
|
||||
- `0 0 * * 0` - Weekly (Sunday at midnight)
|
||||
```
|
||||
content/
|
||||
├── README.md
|
||||
├── docs/
|
||||
│ ├── guide.md
|
||||
│ └── tutorial.md
|
||||
└── blog/
|
||||
├── post1.md
|
||||
└── post2.md
|
||||
```
|
||||
|
||||
### 3. Run with Docker Compose
|
||||
|
||||
@@ -60,43 +55,109 @@ The application will be available at `http://localhost:5000`
|
||||
### 4. Access the Application
|
||||
|
||||
- **Main Page**: http://localhost:5000
|
||||
- View all repositories and their markdown files
|
||||
- Search across all files
|
||||
- Browse all files organized by directory
|
||||
- Search across all markdown content
|
||||
|
||||
- **View File**: Click on any markdown file to view it as HTML
|
||||
- **View File**: Click on any markdown file to view as HTML
|
||||
- **Encrypted Files**: Files with `.md.enc` extension require password authentication
|
||||
- **Search**: Full-text search across all unencrypted files
|
||||
|
||||
- **API Endpoints**:
|
||||
- `/api/status` - Application status and repository info
|
||||
- `/api/search?q=<query>` - Search markdown files
|
||||
### 5. (Optional) Encrypt Files
|
||||
|
||||
## Configuration
|
||||
Use the management script to encrypt sensitive files:
|
||||
|
||||
### repositories.json
|
||||
```bash
|
||||
# Encrypt a file with a password
|
||||
# File is automatically encrypted AND password-protected
|
||||
python manage_content.py encrypt content/secret.md "mypassword"
|
||||
|
||||
```json
|
||||
{
|
||||
"repo-name": {
|
||||
"url": "https://github.com/username/repo.git",
|
||||
"enabled": true,
|
||||
"schedule": "0 */6 * * *"
|
||||
}
|
||||
}
|
||||
# In browser: User enters password → file is decrypted and displayed
|
||||
# Same password used for both encryption and browser access
|
||||
```
|
||||
|
||||
**Fields**:
|
||||
- `url`: Git repository URL (HTTPS recommended, SSH with proper key mounting)
|
||||
- `enabled`: Boolean to enable/disable this repository
|
||||
- `schedule`: Cron expression for pull schedule
|
||||
See [ENCRYPTION.md](ENCRYPTION.md) for more details.
|
||||
|
||||
## File Management
|
||||
|
||||
### Adding Content
|
||||
|
||||
Simply add markdown files to `./content/` and they appear automatically:
|
||||
|
||||
```bash
|
||||
echo "# New Document" > content/new-file.md
|
||||
```
|
||||
|
||||
The search index updates automatically when the app starts.
|
||||
|
||||
### Directory Structure
|
||||
|
||||
Files are organized hierarchically in the UI:
|
||||
|
||||
```
|
||||
content/
|
||||
├── index.md → Shows as "index" in root
|
||||
├── docs/
|
||||
│ ├── guide.md → Shows as "docs > guide"
|
||||
│ └── images/ → Images in subdirectories
|
||||
│ └── diagram.png
|
||||
└── archive/
|
||||
└── old.md → Shows as "archive > old"
|
||||
```
|
||||
|
||||
### Supported Formats
|
||||
|
||||
- **Markdown**: `.md`, `.markdown`
|
||||
- **Encrypted Markdown**: `.md.enc` (password-protected, viewed in browser)
|
||||
- **Images**: `.png`, `.jpg`, `.jpeg`, `.gif`, `.webp` (referenced in markdown)
|
||||
- **Relative Paths**: Images referenced with relative paths work correctly
|
||||
|
||||
## Configuration
|
||||
|
||||
### Docker Compose Configuration
|
||||
|
||||
The `docker-compose.yml` file manages:
|
||||
- Port mapping (default 5000)
|
||||
- Volume management for configuration and data
|
||||
- Volume mounts for content and data
|
||||
- Restart policies
|
||||
- Networking
|
||||
- Encryption settings
|
||||
|
||||
To modify port or other settings, edit `docker-compose.yml`:
|
||||
To modify settings, edit `docker-compose.yml`:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
markmywords:
|
||||
ports:
|
||||
- "5000:5000" # Change port here if needed
|
||||
volumes:
|
||||
- ./content:/content:rw # Your markdown files
|
||||
- ./config:/config:rw # Password/protection config
|
||||
- ./data:/data:rw # Search index
|
||||
environment:
|
||||
ENCRYPTION_ENABLED: "true" # Enable/disable encryption
|
||||
```
|
||||
|
||||
### Environment Variables
|
||||
|
||||
```bash
|
||||
# Flask secret key (REQUIRED for production)
|
||||
export FLASK_SECRET_KEY="your-secure-random-key-here"
|
||||
|
||||
# Admin password for API operations (optional)
|
||||
export MARKMYWORDS_ADMIN_PASSWORD="admin-password"
|
||||
|
||||
# Enable/disable file encryption feature
|
||||
export ENCRYPTION_ENABLED="true"
|
||||
```
|
||||
|
||||
## API Endpoints
|
||||
|
||||
- `GET /` - Main page with file browser
|
||||
- `GET /view/<filepath>` - View markdown file as HTML
|
||||
- `GET /image/<filepath>` - Serve images from content
|
||||
- `GET /api/search?q=<query>` - Full-text search
|
||||
- `GET /api/status` - Application status
|
||||
- `POST /api/auth/<filepath>` - Authenticate for protected file
|
||||
- `POST /api/protect/<filepath>` - Protect/unprotect files (admin only)
|
||||
|
||||
```yaml
|
||||
ports:
|
||||
|
||||
Reference in New Issue
Block a user