{"id":13754736,"url":"https://github.com/zsxsoft/danmu-server","last_synced_at":"2026-01-05T00:03:12.030Z","repository":{"id":23629266,"uuid":"26998951","full_name":"zsxsoft/danmu-server","owner":"zsxsoft","description":"A danmaku server based on WebSocket. 弹幕服务器，基于WebSocket。","archived":false,"fork":false,"pushed_at":"2017-08-19T13:43:50.000Z","size":1220,"stargazers_count":172,"open_issues_count":0,"forks_count":44,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-02-11T22:46:37.404Z","etag":null,"topics":["danmaku","danmu","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zsxsoft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-11-22T13:01:42.000Z","updated_at":"2024-01-19T04:43:27.000Z","dependencies_parsed_at":"2022-08-22T02:50:23.712Z","dependency_job_id":null,"html_url":"https://github.com/zsxsoft/danmu-server","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zsxsoft%2Fdanmu-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zsxsoft%2Fdanmu-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zsxsoft%2Fdanmu-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zsxsoft%2Fdanmu-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zsxsoft","download_url":"https://codeload.github.com/zsxsoft/danmu-server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253346375,"owners_count":21894263,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["danmaku","danmu","nodejs"],"created_at":"2024-08-03T10:00:33.577Z","updated_at":"2025-05-10T00:31:08.567Z","avatar_url":"https://github.com/zsxsoft.png","language":"JavaScript","funding_links":[],"categories":["Servers"],"sub_categories":["Misc / Desktop"],"readme":"danmu-server\n================\n[![David deps](https://david-dm.org/zsxsoft/danmu-server.svg)](https://david-dm.org/zsxsoft/danmu-server)\n\n弹幕服务器，其客户端项目见[danmu-client](https://github.com/zsxsoft/danmu-client)。\n\n**欲使用此项目，客户端需要使用对应的版本。[已发布的服务端](https://github.com/zsxsoft/danmu-server/releases)均已写明对应的客户端版本号，开发分支内的服务端版本仅对应开发分支的客户端。**\n\n## 功能特色\n- 跨平台；\n- 房间功能；\n- 后台管理；\n- 弹幕记录与搜索（需要开启数据库）；\n- 黑名单功能；\n- 关键词替换、拦截功能；\n- 弹幕记录；\n- 扩展；\n   - 新浪微博登录扩展（需要开启缓存）；\n   - 自动封禁功能扩展（需要开启缓存）；\n   - 审核扩展；\n   - 直播拉取扩展\n- 删除单条弹幕功能；\n- 易于部署，简单高效。\n\n## 后台截图\n![后台截图](http://zsxsoft.github.io/danmu-server/management.png)\n\n## 一些警告\n\n稳定版请于[Release](https://github.com/zsxsoft/danmu-server/releases)手动下载。\n\n\n## 部署方式\n\n### 检查环境\n\n#### Nodejs\n\nNodejs \u003e= 6\n\n#### 数据库\n 如使用``csv``，可无视此节。\n\n 默认使用``MySQL``数据库。如需使用，需检查[MariaDB](https://mariadb.org/)或[MySQL](https://www.mysql.com/)的安装状态。支持``5.0+``。安装完成后，请创建相应的数据库。\n\n 如使用``MongoDB``数据库，请检查[MongoDB](https://www.mongodb.org/)的安装状态。然后需要在安装完成后执行：``npm install mongodb``。\n\n#### 缓存\n\n 如不使用新浪微博与自动封禁功能，可无视此节。\n\n 默认使用``memcached``。如需使用，请检查[Memcached(Linux)](http://memcached.org/)的安装状态。``Windows``用户请自行查找适合的``Memcached``版本。\n\n 如果要用[阿里云开放缓存服务OCS](http://www.aliyun.com/product/ocs/)，需要在安装完成后执行：``npm install aliyun-sdk``。\n\n### 直接安装\n 1. 配置MariaDB，创建数据库等，不需要创建数据表。\n 2. 修改``config.js``，使其参数与环境相符。\n 3. 切换到命令行或终端，``cd``到程序所在目录执行``npm install``，安装程序依赖库。\n 4. 现在，你可以直接``npm start``启动。\n\n### Docker安装\n\n__Dockerfile可能年久失修，建议自己用``alpine``封装一个。__\n直接用``Docker``安装的话，镜像内是含``MariaDB``的。\n 1. [安装Docker](http://yeasy.gitbooks.io/docker_practice/content/install/index.html)。\n 2. ``config.js``调整配置。\n 3. ``docker build -t=\"zsxsoft/danmu-server:\" . \u0026\u0026 docker run -t -i -p 3000:3000 \"zsxsoft/danmu-server\"``\n\n## 升级\n### 1.0.6 -\u003e 1.1.0\n* 在每个房间内增加cdn: false配置\n### 1.0.5 -\u003e 1.0.6\n* 在每个房间内增加hostname配置，类型为数组，用于将房间与域名绑定\n\n## 网页接口\n\n### GET /\n可以直接发布最简单的弹幕。\n\n### GET /advanced\n可以发布高级弹幕（需要密码）\n\n### GET /manage\n可以进行后台管理\n\n### GET /realtime\n可以实时接收弹幕并直接删除或封禁（需要密码）\n\n## 配置说明\n\n以下标有``*``的配置项，运行时不可在后台修改。\n\n```javascript\n\t\"rooms\": {\n\t\t\"房间1\": {\n\t\t\t* \"hostname\": [\"test.zsxsoft.com\", \"localhost\", \"127.0.0.1\"],\n\t\t\t* \"cdn\": 是否使用CDN或反向代理（用于获取正确的IP）,\n\t\t\t* \"display\": \"房间显示名\",\n\t\t\t* \"table\": \"对应MySQL的数据表、MongoDB的集合\",\n\t\t\t\"connectpassword\": \"客户端连接密码\",\n\t\t\t\"managepassword\": \"管理密码\",\n\t\t\t\"advancedpassword\": \"高级弹幕密码\",\n\t\t\t\"keyword\": {\n\t\t\t\t\"block\": /强制屏蔽关键词，正则格式。/\n\t\t\t\t\"replacement\": /替换关键词，正则格式/,\n\t\t\t\t\"ignore\": /忽略词，正则格式/\n\t\t\t},\n\t\t\t\"blockusers\": [\n\t\t\t\t\"默认封禁用户列表\"\n\t\t\t],\n\t\t\t\"maxlength\": 弹幕堆积队列最大长度,\n\t\t\t\"textlength\": 每条弹幕最大长度,\n\t\t\t* \"image\": {\n\t\t\t\t* \"regex\": /图片弹幕解析正则，正则格式，不要修改/ig,\n\t\t\t\t* \"lifetime\": 每个图片给每条弹幕增加的存货时间\n\t\t\t},\n\t\t\t\"permissions\": { // 普通用户允许的弹幕权限\n\t\t\t\t\"send\": 弹幕开关；关闭后无论普通用户还是高级权限都完全禁止弹幕。,\n\t\t\t\t\"style\": 弹幕样式开关,\n\t\t\t\t\"color\": 颜色开关,\n\t\t\t\t\"textStyle\": CSS开关,\n\t\t\t\t\"height\": 高度开关,\n\t\t\t\t\"lifeTime\": 显示时间开关,\n\t\t\t}\n\t\t},\n\t\t\"房间ID2\": {\n\t\t\t// 同上\n\t\t}\n\t},\n\t* \"database\": { // 数据库\n\t\t* \"type\": \"数据库类型（mysql / mongo / csv / none）\",\n\t\t* \"server\": \" 数据库地址（mysql / mongo）\",\n\t\t* \"username\": \"数据库用户名（mysql / mongo）\",\n\t\t* \"password\": \"数据库密码（mysql / mongo）\",\n\t\t* \"port\": \"数据库端口（mysql / mongo）\",\n\t\t* \"db\": \"数据库（mysql / mongo）\",\n\t\t* \"retry\": 24小时允许断线重连最大次数，超过则自动退出程序。24小时以第一次断线时间计。（mysql）,\n\t\t* \"timeout\": 数据库重连延时及Ping（mysql）,\n\t\t* \"savedir\": \"指定文件保存位置（csv）\",\n\t},\n\t\"websocket\": {\n\t\t\"interval\": 弹幕发送间隔\n\t\t\"singlesize\": 每次弹幕发送数量\n\t},\n\t* \"http\": {\n\t\t* \"port\": 服务器HTTP端口,\n\t\t* \"headers\": {}, // HTTP头\n\t\t* \"sessionKey\": \"随便写点，防冲突的\"\n\t},\n\t* \"cache\": {\n\t\t* \"type\": \"缓存类型（memcached / aliyun）\",\n\t\t* \"host\": \"缓存服务器地址，可用socket\",\n\t\t* \"auth\": 打开身份验证,\n\t\t* \"authUser\": 身份验证账号,\n\t\t* \"authPassword\": 身份验证密码,\n\t},\n\t\"ext\": {\n\t\t// 扩展\n\t}\n}\n```\n\n## 扩展\n### 新浪微博登录\n```javascript\n\"weibo\": { // 新浪微博扩展\n\t\"clientID\": '', // App ID\n\t\"clientSecret\": '', // App Secret\n\t\"callbackURL\": 'http://test.zsxsoft.com:3000/auth/sina/callback', // 这里填写的是 网站地址/auth/sina/callback\n\t\"requireState\": true // 是否打开CSRF防御\n}\n```\n\n### 自动封禁\n```javascript\n\"autoban\": { // 自动封号扩展\n\t\"block\": 3, // 被拦截超过一定数字自动封号\n}\n```\n\n### 全局审核\n```javascript\n\"audit\": { // 审核扩展\n}\n```\n\n### 直播同步\n\n此扩展基于[danmu](https://github.com/littlecodersh/danmu)项目开发，需要安装Python 2.7+ 或 Python 3.5+。在启用前，你首先需要\n```bash\npip install danmu\n```\n\n才可打开。\n\n```javascript\n\"livesync\": { // 新浪微博扩展\n\t\"房间名\": {\n\t\t\"liveUrl\": '', // 直播网站地址\n\t}\n}\n```\n## 常见问题\n### 数据库相关\n``{ [Error: Connection lost: The server closed the connection.] fatal: true, code: 'PROTOCOL_CONNECTION_LOST' }``\n\n请把MySQL的``wait_timeout``设置得大一些。\n\n## 搭配项目\n\n- [danmu-client](https://github.com/zsxsoft/danmu-client)\n\n## 流程图\n\n![流程图](http://zsxsoft.github.io/danmu-server/route.png)\n\n## 协议\nThe MIT License (MIT)\n\n## 博文\n[弹幕服务器及搭配之透明弹幕客户端研究结题报告](http://blog.zsxsoft.com/post/15)\n\n[弹幕服务器及搭配之透明弹幕客户端研究中期报告](http://blog.zsxsoft.com/post/14)\n\n[弹幕服务器及搭配之透明弹幕客户端研究开题报告](http://blog.zsxsoft.com/post/13)\n\n## 开发者\nzsx - https://www.zsxsoft.com / 博客 - https://blog.zsxsoft.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzsxsoft%2Fdanmu-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzsxsoft%2Fdanmu-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzsxsoft%2Fdanmu-server/lists"}