diff --git a/Dockerfile b/Dockerfile index f1f173d..23e5207 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ RUN useradd --no-log-init -d /app napcat WORKDIR /app -COPY NapCat.Shell.zip entrypoint.sh /app/ +COPY NapCat.Shell.zip entrypoint.sh templates /app/ # 安装Linux QQ RUN arch=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) && \ curl -o linuxqq.deb https://dldir1.qq.com/qqfile/qq/QQNT/ee4bd910/linuxqq_3.2.16-32793_${arch}.deb && \ diff --git a/entrypoint.sh b/entrypoint.sh index 3aca77e..50a8671 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -46,82 +46,8 @@ remove_quotes() { echo "$str" } -: ${WS_ENABLE:='false'} -: ${WS_PORT:=3001} -: ${RWS_ENABLE:='false'} -: ${RWS_ADDRESS:='ws://127.0.0.1:8080/onebot/v11/ws'} - -# 配置 onebot -CONFIG_PATH=/app/napcat/config/onebot11_$ACCOUNT.json - -if [ ! -f "${CONFIG_PATH}" ]; then - cat > "${CONFIG_PATH}" << EOF -{ - "http": { - "enable": false, - "host": "", - "port": 3000, - "secret": "", - "enableHeart": false, - "enablePost": false, - "postUrls": [] - }, - "ws": { - "enable": false, - "host": "", - "port": 3001 - }, - "reverseWs": { - "enable": false, - "urls": [] - }, - "GroupLocalTime": { - "Record": false, - "RecordList": [] - }, - "debug": false, - "heartInterval": 30000, - "messagePostFormat": "array", - "enableLocalFile2Url": true, - "musicSignUrl": "", - "reportSelfMessage": false, - "token": "", - "network": { - "httpServers": [], - "httpSseServers": [], - "httpClients": [], - "websocketServers": [ - { - "enable": $(remove_quotes $WS_ENABLE), - "name": "ws", - "host": "0.0.0.0", - "port": $(remove_quotes $WS_PORT), - "reportSelfMessage": false, - "enableForcePushEvent": true, - "messagePostFormat": "array", - "token": "", - "debug": false, - "heartInterval": 30000 - } - ], - "websocketClients": [ - { - "enable": $(remove_quotes $RWS_ENABLE), - "name": "rws", - "url": "$(remove_quotes $RWS_ADDRESS)", - "reportSelfMessage": false, - "messagePostFormat": "array", - "token": "", - "debug": false, - "heartInterval": 30000, - "reconnectInterval": 30000 - } - ], - "plugins": [] - }, - "parseMultMsg": false -} -EOF +if [ -n "${MODE}" ]; then + cp /app/templates/$MODE.json /app/napcat/config/onebot.json fi rm -rf "/tmp/.X1-lock" @@ -139,4 +65,4 @@ sleep 2 export FFMPEG_PATH=/usr/bin/ffmpeg export DISPLAY=:1 cd /app/napcat -gosu napcat /opt/QQ/qq --no-sandbox -q $ACCOUNT +gosu napcat /opt/QQ/qq --no-sandbox diff --git a/templates/templates/astrbot.json b/templates/templates/astrbot.json new file mode 100644 index 0000000..5df2acc --- /dev/null +++ b/templates/templates/astrbot.json @@ -0,0 +1,25 @@ +{ + "network": { + "httpServers": [], + "httpSseServers": [], + "httpClients": [], + "websocketServers": [], + "websocketClients": [ + { + "enable": true, + "name": "rws", + "url": "ws://127.0.0.1:6199/ws", + "reportSelfMessage": false, + "messagePostFormat": "array", + "token": "", + "debug": false, + "heartInterval": 30000, + "reconnectInterval": 30000 + } + ], + "plugins": [] + }, + "musicSignUrl": "", + "enableLocalFile2Url": false, + "parseMultMsg": false +} \ No newline at end of file diff --git a/templates/templates/koishi.json b/templates/templates/koishi.json new file mode 100644 index 0000000..f088638 --- /dev/null +++ b/templates/templates/koishi.json @@ -0,0 +1,25 @@ +{ + "network": { + "httpServers": [], + "httpSseServers": [], + "httpClients": [], + "websocketServers": [], + "websocketClients": [ + { + "enable": true, + "name": "rws", + "url": "ws://127.0.0.1:5140/onebot", + "reportSelfMessage": false, + "messagePostFormat": "array", + "token": "", + "debug": false, + "heartInterval": 30000, + "reconnectInterval": 30000 + } + ], + "plugins": [] + }, + "musicSignUrl": "", + "enableLocalFile2Url": false, + "parseMultMsg": false +} \ No newline at end of file diff --git a/templates/templates/nonebot.json b/templates/templates/nonebot.json new file mode 100644 index 0000000..0a37fe0 --- /dev/null +++ b/templates/templates/nonebot.json @@ -0,0 +1,25 @@ +{ + "network": { + "httpServers": [], + "httpSseServers": [], + "httpClients": [], + "websocketServers": [], + "websocketClients": [ + { + "enable": true, + "name": "rws", + "url": "ws://127.0.0.1:8080/onebot/v11/ws", + "reportSelfMessage": false, + "messagePostFormat": "array", + "token": "", + "debug": false, + "heartInterval": 30000, + "reconnectInterval": 30000 + } + ], + "plugins": [] + }, + "musicSignUrl": "", + "enableLocalFile2Url": false, + "parseMultMsg": false +} \ No newline at end of file diff --git a/templates/templates/ws.json b/templates/templates/ws.json new file mode 100644 index 0000000..91c063e --- /dev/null +++ b/templates/templates/ws.json @@ -0,0 +1,26 @@ +{ + "network": { + "httpServers": [], + "httpSseServers": [], + "httpClients": [], + "websocketServers": [ + { + "enable": true, + "name": "ws", + "host": "0.0.0.0", + "port": 3001, + "reportSelfMessage": false, + "enableForcePushEvent": true, + "messagePostFormat": "array", + "token": "", + "debug": false, + "heartInterval": 30000 + } + ], + "websocketClients": [], + "plugins": [] + }, + "musicSignUrl": "", + "enableLocalFile2Url": false, + "parseMultMsg": false +} \ No newline at end of file