// README.md # unknownBIN unknownBIN is a secure and modern open-source Pastebin software written in Node.js. It is a fork of the original Hastebin, completely modernized for security, performance, and easy deployment via Docker. ![unknownBIN Screenshot](https://raw.githubusercontent.com/MrUnknownDE/unknownbin/main/screenshot.png) ## ✨ Features * **Modern & Clean Interface:** A simple, classic design that focuses on the content. * **Syntax Highlighting:** Automatic language detection and highlighting for dozens of languages. * **Security First:** * Uses cryptographically-strong random generation for secure, unpredictable paste IDs. * Includes security headers via Helmet to protect against common web vulnerabilities. * Protects against path traversal attacks. * **Docker-Ready:** Deploy in seconds using the pre-built Docker image from GitHub Packages. * **Automated CI/CD:** Docker images are automatically built and published with GitHub Actions. * **Core Functionality:** * View raw paste content. * Duplicate and edit existing pastes easily. * Lightweight and fast. --- ## 🚀 Deployment (Recommended) The easiest and recommended way to deploy unknownBIN is by using the pre-built Docker image from the GitHub Container Registry (GHCR). ### Prerequisites * [Docker](https://docs.docker.com/get-docker/) installed on your system. ### Running the Container 1. **Pull the latest image:** ```bash docker pull ghcr.io/mrunknownde/unknownbin:main ``` 2. **Run the container:** To ensure your pastes are saved even if the container is removed or updated, you must mount a volume for the data directory. ```yml version: '3.9' services: unknownbin: image: 'ghcr.io/mrunknownde/unknownbin:main' container_name: unknownbin volumes: - '/path/to/your/data:/usr/src/app/data' ports: - '8080:8080' ``` ```bash docker run -d \ -p 8080:8080 \ -v /path/to/your/data:/usr/src/app/data \ --name my-unknownbin \ ghcr.io/mrunknownde/unknownbin:main ``` **Explanation:** * `-d`: Runs the container in the background (detached mode). * `-p 8080:8080`: Maps port 8080 on your host to port 8080 in the container. You can change the first number (e.g., `-p 3000:8080`) to use a different host port. * `-v /path/to/your/data:/usr/src/app/data`: **(Important!)** Mounts a directory from your host machine into the container to persist paste data. **Replace `/path/to/your/data`** with an actual path on your server (e.g., `/opt/unknownbin/data`). * `--name my-unknownbin`: Gives the container a memorable name. Your unknownBIN instance is now running and accessible at `http://localhost:8080`. --- ## 🛠️ Manual Installation If you prefer not to use Docker, you can install and run the application directly with Node.js. ### Prerequisites * [Node.js](https://nodejs.org/) (LTS version recommended) * [Git](https://git-scm.com/) ### Steps 1. **Clone the repository:** ```bash git clone https://github.com/MrUnknownDE/unknownbin.git cd unknownbin ``` 2. **Install dependencies:** ```bash npm install ``` 3. **Build static assets:** This step minifies the CSS and JavaScript files. ```bash npm run build ``` 4. **Configure the application:** Open `config.json` in a text editor and adjust the settings to your needs. 5. **Start the application:** ```bash npm start ``` The application will be available at `http://localhost:8080` (or as configured in `config.json`). --- ## ⚙️ Configuration Configuration is managed via the `config.json` file in the root directory. | Key | Description | Default Value | | ----------- | ------------------------------------------------- | --------------- | | `host` | The host address the server binds to. | `"0.0.0.0"` | | `port` | The port the server listens on. | `8080` | | `dataPath` | The directory where paste files are stored. | `"./data"` | | `keyLength` | The length of the randomly generated paste keys. | `10` | | `maxLength` | The maximum number of characters allowed in a paste. | `500000` | | `createKey` | A secret key that must be prepended to a paste to allow its creation. | `""` (disabled) | | `documents` | A map of static documents to serve from files. | `{}` | ### Example `config.json` ```json { "host": "0.0.0.0", "port": 8080, "dataPath": "./data", "keyLength": 10, "maxLength": 500000, "createKey": "", "documents": { "about": "./README.md" } } ``` ### 🔄 Updating **Docker Installation** 1. Pull the latest image: `docker pull ghcr.io/mrunknownde/unknownbin:main` 2. Stop and remove the old container: `docker stop my-unknownbin` `docker rm my-unknownbin` 3. Start a new container with the same docker run command you used initially (including the volume mount). Your data will be preserved. Manual Installation **Pull the latest changes:** `git pull` Install/update dependencies and rebuild assets: ``` npm install npm run build ``` Restart the application (e.g., using npm start or your process manager).