mirror of
https://github.com/DumbWareio/DumbDrop.git
synced 2025-10-22 23:31:57 +00:00
* feat: Add ALLOWED_IFRAME_ORIGINS configuration and update security headers (#47) - Introduced ALLOWED_IFRAME_ORIGINS environment variable to specify trusted origins for iframe embedding. - Updated security headers middleware to conditionally allow specified origins in Content Security Policy. - Enhanced documentation in README.md to explain the new configuration and its security implications. Fixes #35 * feat: Update .env.example and .gitignore for improved configuration management - Enhanced .env.example with detailed comments for environment variables, including upload settings, security options, and notification configurations. - Updated .gitignore to include additional editor and OS-specific files, ensuring a cleaner repository. - Modified package.json to add a predev script for Node.js version validation and adjusted the dev script for nodemon. - Improved server.js shutdown handling to prevent multiple shutdowns and ensure graceful exits. - Refactored config/index.js to log loaded environment variables and ensure the upload directory exists based on environment settings. - Cleaned up fileUtils.js by removing unused functions and improving logging for directory creation. This commit enhances clarity and maintainability of configuration settings and improves application shutdown behavior. * feat: Update Docker configuration and documentation for upload handling - Explicitly set the upload directory environment variable in docker-compose.yml to ensure clarity in file storage. - Simplified the Dockerfile by removing the creation of the local_uploads directory, as it is now managed by the host system. - Enhanced README.md to reflect changes in upload directory management and provide clearer instructions for users. - Removed outdated development configuration files to streamline the development setup. This commit improves the clarity and usability of the Docker setup for file uploads. * feat: Add Local Development Guide and update README for clarity - Introduced a comprehensive LOCAL_DEVELOPMENT.md file with setup instructions, testing guidelines, and troubleshooting tips for local development. - Updated README.md to include a link to the new Local Development Guide and revised sections for clarity regarding upload directory management. - Enhanced the Quick Start section to direct users to the dedicated local development documentation. This commit improves the onboarding experience for developers and provides clear instructions for local setup. * feat: Implement BASE_URL configuration for asset management and API requests - Added BASE_URL configuration to README.md, emphasizing the need for a trailing slash when deploying under a subpath. - Updated index.html and login.html to utilize BASE_URL for linking stylesheets, icons, and API requests, ensuring correct asset loading. - Enhanced app.js to replace placeholders with the actual BASE_URL during HTML rendering. - Implemented a validation check in config/index.js to ensure BASE_URL is a valid URL and ends with a trailing slash. This commit improves the flexibility of the application for different deployment scenarios and enhances asset management. Fixes #34, Fixes #39, Fixes #38 * Update app.js, borked some of the css n such * resolved BASE_URL breaking frontend * fix: Update BASE_URL handling and security headers - Ensured BASE_URL has a trailing slash in app.js to prevent asset loading issues. - Refactored index.html and login.html to remove leading slashes from API paths for correct concatenation with BASE_URL. - Enhanced security headers middleware to include 'connect-src' directive in Content Security Policy. This commit addresses issues with asset management and improves security configurations.
3.3 KiB
3.3 KiB
Local Development (Recommended Quick Start)
Prerequisites
- Node.js >= 20.0.0
Why?: The app uses features only available in Node 20+. - npm (comes with Node.js)
- Python 3 (for notification testing, optional)
- Apprise (for notification testing, optional)
Setup Instructions
-
Clone the repository
git clone https://github.com/yourusername/dumbdrop.git cd dumbdrop
-
Copy and configure environment variables
cp .env.example .env
- Open
.env
in your editor and review the variables. - At minimum, set:
PORT=3000
LOCAL_UPLOAD_DIR=./local_uploads
MAX_FILE_SIZE=1024
DUMBDROP_PIN=
(optional, for PIN protection)APPRISE_URL=
(optional, for notifications)
- Open
-
Install dependencies
npm install
-
Start the development server
npm run dev
- You should see output like:
DumbDrop server running on http://localhost:3000
- You should see output like:
-
Open the app
- Go to http://localhost:3000 in your browser.
Testing File Uploads
- Drag and drop files onto the web interface.
- Supported file types: All, unless restricted by
ALLOWED_EXTENSIONS
in.env
. - Maximum file size: as set by
MAX_FILE_SIZE
(default: 1024 MB). - Uploaded files are stored in the directory specified by
LOCAL_UPLOAD_DIR
(default:./local_uploads
). - To verify uploads:
- Check the
local_uploads
folder for your files. - The UI will show a success message on upload.
- Check the
Notification Testing (Python/Apprise)
If you want to test notifications (e.g., for new uploads):
-
Install Python 3
- Download Python if not already installed.
-
Install Apprise
pip install apprise
-
Configure Apprise in
.env
- Set
APPRISE_URL
to your notification service URL (see Apprise documentation). - Example for a local test:
APPRISE_URL=mailto://your@email.com
- Set
-
Trigger a test notification
- Upload a file via the web UI.
- If configured, you should receive a notification.
Troubleshooting
Problem: Port already in use
Solution:
- Change the
PORT
in.env
to a free port.
Problem: "Cannot find module 'express'"
Solution:
- Run
npm install
to install dependencies.
Problem: File uploads not working
Solution:
- Ensure
LOCAL_UPLOAD_DIR
exists and is writable. - Check file size and extension restrictions in
.env
.
Problem: Notifications not sent
Solution:
- Verify
APPRISE_URL
is set and correct. - Ensure Apprise is installed and accessible.
Problem: Permission denied on uploads
Solution:
- Make sure your user has write permissions to
local_uploads
.
Problem: Environment variables not loading
Solution:
- Double-check that
.env
exists and is formatted correctly. - Restart the server after making changes.
Additional Notes
- For Docker-based development, see the "Quick Start" and "Docker Compose" sections in the main README.
- For more advanced configuration, review the "Configuration" section in the main README.
- If you encounter issues not listed here, please open an issue on GitHub or check the Discussions tab.