Sharey
A simple file sharing and pastebin service using Backblaze B2 cloud storage.
Features
- 📁 File Sharing: Upload files and get shareable links
- 📝 Pastebin: Share text snippets with syntax highlighting support
- ☁️ Cloud Storage: Files stored securely in Backblaze B2
- 🔗 Short URLs: Clean, easy-to-share links
- 🎨 Clean UI: Simple, responsive web interface
Setup
Prerequisites
- Python 3.7+
- Backblaze B2 account with:
- Application Key ID
- Application Key
- Bucket name
Installation
-
Clone the repository
git clone <your-repo-url> cd sharey -
Run the setup script
python setup.pyThis will automatically create a virtual environment and install dependencies.
-
Configure B2 credentials
Sharey supports two configuration methods:
Option 1: JSON Configuration (Recommended)
# Edit config.json with your credentials nano config.jsonOption 2: Environment Variables
# Edit .env file with your credentials nano .envInteractive Configuration
python config_util.py set -
Test B2 connection
python test_b2.py -
Run the application
# If using virtual environment (recommended) source venv/bin/activate python app.py # Or directly venv/bin/python app.py
The application will be available at http://127.0.0.1:8866
Backblaze B2 Setup
-
Create a Backblaze B2 account at backblaze.com
-
Create an application key:
- Go to App Keys
- Click "Add a New Application Key"
- Name it "Sharey" or similar
- Choose appropriate permissions (read/write access to your bucket)
- Save the Key ID and Application Key
-
Create a bucket:
- Go to Buckets
- Click "Create a Bucket"
- Choose "Public" if you want files to be publicly accessible
- Note the bucket name
-
Configure bucket for public access (if desired):
- Set bucket type to "Public"
- Configure CORS settings if needed for web access
File Organization in B2
Files are organized in your B2 bucket as follows:
your-bucket/
├── files/
│ ├── abc123.jpg
│ ├── def456.pdf
│ └── ...
└── pastes/
├── ghi789.txt
├── jkl012.txt
└── ...
Development
Manual Installation
If you prefer not to use the setup script:
# Install dependencies
pip install -r requirements.txt
# Copy environment template
cp .env.example .env
# Edit .env with your credentials
nano .env
# Test configuration
python test_b2.py
# Run the app
python app.py
Configuration
Sharey uses a flexible configuration system that supports both JSON files and environment variables.
Configuration Files
config.json- Main configuration file (recommended).env- Environment variables (fallback/legacy support)
Configuration Management
View current configuration:
python config_util.py show
Interactive setup:
python config_util.py set
Validate configuration:
python config_util.py validate
Reset to defaults:
python config_util.py reset
Configuration Options
{
"b2": {
"application_key_id": "your_key_id_here",
"application_key": "your_application_key_here",
"bucket_name": "your_bucket_name_here"
},
"flask": {
"host": "127.0.0.1",
"port": 8866,
"debug": true
},
"upload": {
"max_file_size_mb": 100,
"allowed_extensions": [".jpg", ".jpeg", ".png", ".gif", ".pdf", ".txt", ".doc", ".docx", ".zip", ".mp4", ".mp3"]
},
"paste": {
"max_length": 1000000
},
"security": {
"rate_limit_enabled": false,
"max_uploads_per_hour": 50
}
}
License
MIT License - see LICENSE file for details.