Display bullet screen directly on the desktop 在桌面直接顯示彈幕
This project is divided into two parts:
- Danmu-Desktop
- Client-side application that runs on your computer to display danmu
- Currently supports Windows and MacOS
- Available as both installer and portable version
- Server
- Creates a web interface for danmu input
- Manages danmu delivery to connected clients
- Includes admin panel for configuration, source fingerprint logging, and history review
- Download the latest release
- For MacOS users, run:
sudo xattr -r -d com.apple.quarantine 'danmu manager.app' - Launch the application
- Enter the server's IP and port (default: 4001)
- Pull and run the image directly (replace the password):
docker run -d --name danmu-server \ -p 4000:4000 \ -p 4001:4001 \ -e ADMIN_PASSWORD=your_secure_password \ -v danmu_fonts:/app/server/user_fonts \ -v danmu_static:/app/server/static \ -v danmu_logs:/app/server/logs \ albetyty/danmu-server:latest
- You can also use a bcrypt hash instead of plaintext:
- Generate hash:
python server/scripts/hash_password.py - Set
-e ADMIN_PASSWORD_HASHED='<bcrypt-hash>'
- Generate hash:
- Server startup now requires at least one of
ADMIN_PASSWORDorADMIN_PASSWORD_HASHED. - Multi-arch images published for
linux/amd64andlinux/arm64/v8 - Available tags:
latest: stable build frommainmain: rolling alias of the newestmainbuild<git-sha>: immutable build for a specific commit (see workflow logs)
- You can also use a bcrypt hash instead of plaintext:
- Optional: add
--restart unless-stoppedfor long-running deployments. - To update, just pull the latest tag and restart:
docker pull albetyty/danmu-server:latest docker stop danmu-server && docker rm danmu-server # rerun the docker run command above
-
Clone the repository:
git clone https://github.com/guan4tou2/danmu-desktop cd danmu-desktop -
Configure environment variables:
cp env.example .env # Edit .env and set ADMIN_PASSWORD / ADMIN_PASSWORD_HASHED and other settings -
Start services:
docker-compose up -d
reverse-proxyis exposed on host ports4000(HTTP) and4001(WebSocket).- The Python server is now internal-only behind Nginx in Compose mode.
-
Optional HTTPS mode (web panel):
# Put cert files first: # nginx/certs/fullchain.pem # nginx/certs/privkey.pem docker-compose --profile https up -d
- This starts
reverse-proxy-httpson80/443and redirects HTTP to HTTPS. - Desktop overlay connection remains on
4001unless you separately implement WSS for the desktop client flow.
- This starts
-
To use Redis for rate limiting (optional):
docker-compose --profile redis up -d
-
Clone the repository:
git clone https://github.com/guan4tou2/danmu-desktop cd danmu-desktop -
Configure environment:
cp env.example .env vim .env # Set your admin password and other settings -
Setup virtual environment and install dependencies:
cd server uv venv uv sync -
Start the server (HTTP + WebSocket):
# Terminal 1: HTTP server PYTHONPATH=.. uv run python -m server.app # Terminal 2: WebSocket server PYTHONPATH=.. uv run python -m server.ws_app
- Main interface:
http://ip:4000 - Admin panel:
http://ip:4000/admin
Key configuration options (set via .env file or environment variables):
ADMIN_PASSWORDorADMIN_PASSWORD_HASHED(at least one required): Admin authentication secretPORT: HTTP server port (default: 4000)WS_PORT: WebSocket server port (default: 4001)SECRET_KEY: Flask secret key (auto-generated if not set)TRUSTED_HOSTS: comma-separated allowed hostnames for Host header validation (recommended in production)TRUST_X_FORWARDED_FOR: trustX-Forwarded-Forfor client IP detection (default:false; enable only behind a trusted reverse proxy)WS_REQUIRE_TOKEN: require?token=for dedicated WebSocket clients (default:true)WS_AUTH_TOKEN: shared secret token for dedicated WebSocket clientsWS_MAX_SIZE: maximum incoming WebSocket message size in bytes (default:1048576)WS_MAX_QUEUE: maximum number of incoming WebSocket messages buffered (default:16)WS_WRITE_LIMIT: write buffer limit in bytes for WebSocket connections (default:32768)WEB_WS_ALLOWED_ORIGINS: optional allowlist for browser WebSocket Origin on/routeRATE_LIMIT_BACKEND: Rate limiter backend -memoryorredis(default: memory)REDIS_URL: Redis connection URL (required if using Redis backend)LOG_LEVEL: Logging level -DEBUG,INFO,WARNING,ERROR(default: INFO)SETTINGS_FILE: path to persisted runtime settings file (optional; defaults to a temp file)
See env.example for all available options.
- GitHub Advanced Security and Dependabot are enabled for this repository.
- OSV scanning runs on
push,pull_request, and scheduled jobs via.github/workflows/osv-scanner.yml. - Frontend lockfile enforces
serialize-javascript@7.0.3through npm overrides to address advisoryGHSA-5c6j-r48x-rmvq.
docs/README.md– index of technical notes and archives / 技術文件索引。DEPLOYMENT.md– production-grade setup instructions / 部署說明。README-CH.md– 中文總覽。docs/archive/– historical improvement notes kept for reference / 歷史紀錄。
- Workflow
.github/workflows/docker-build.ymlbuilds and tests the server image on each PR/push. - Set GitHub secrets
DOCKERHUB_USERNAME+DOCKERHUB_TOKEN(Docker Hub access token) to auto-publishDOCKERHUB_USERNAME/danmu-server:latestand a commit-SHA tag whenevermainis updated.
- Run tests:
make testormake test-verbose - Generate coverage report:
make coverage- Console summary via
coverage report - HTML report at
server/htmlcov/index.html
- Console summary via
4000: Web interface (HTTP via reverse proxy)4001: Danmu Desktop Client connection (WebSocket via reverse proxy)
SAO UI design inspired by SAO-UI-PLAN-LINK-START | Akilar の糖果屋




