From 4c6f122b540602d80e4e52910d062d2d58563b29 Mon Sep 17 00:00:00 2001 From: touchscale <11134128+touchscale@user.noreply.gitee.com> Date: Wed, 15 Mar 2023 00:23:21 +0000 Subject: [PATCH 1/7] update package.json. Signed-off-by: touchscale <11134128+touchscale@user.noreply.gitee.com> --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 54cbb44..985001f 100644 --- a/package.json +++ b/package.json @@ -33,10 +33,10 @@ "node-xlsx": "^0.21.0", "oicq": "^2.3.1", "pm2": "^5.2.2", - "puppeteer": "^19.7.4", + "puppeteer": "^19.7.5", "redis": "^4.6.5", "sequelize": "^6.29.3", - "sqlite3": "^5.1.4", + "sqlite3": "^5.1.6", "yaml": "^2.2.1" }, "devDependencies": { From 9db2edcf19b4ec76b371024c99c7c2279f51fa7a Mon Sep 17 00:00:00 2001 From: touchscale <11134128+touchscale@user.noreply.gitee.com> Date: Sun, 19 Mar 2023 12:51:47 +0000 Subject: [PATCH 2/7] update package.json. Signed-off-by: touchscale <11134128+touchscale@user.noreply.gitee.com> --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 985001f..d35781a 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "chalk": "^5.2.0", "chokidar": "^3.5.3", "https-proxy-agent": "5.0.1", - "icqq": "^0.0.31", + "icqq": "^0.0.33", "image-size": "^1.0.2", "inquirer": "^8.2.5", "lodash": "^4.17.21", @@ -32,7 +32,7 @@ "node-schedule": "^2.1.1", "node-xlsx": "^0.21.0", "oicq": "^2.3.1", - "pm2": "^5.2.2", + "pm2": "^5.3.0", "puppeteer": "^19.7.5", "redis": "^4.6.5", "sequelize": "^6.29.3", From e9513c2fb8ecc0663dd64da49f4b41beaa43bf6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=95=85?= <45375162+story-x@users.noreply.github.com> Date: Tue, 21 Mar 2023 02:47:56 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E7=B1=B3=E6=B8=B8=E7=A4=BE=E5=85=AC?= =?UTF-8?q?=E5=91=8A=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1=E6=8E=A8=E9=80=81?= =?UTF-8?q?=E5=89=8D=EF=BC=8C=E5=88=A4=E6=96=AD=E6=98=AF=E5=90=A6=E5=AD=98?= =?UTF-8?q?=E5=9C=A8=E7=BE=A4=E5=85=B3=E7=B3=BB=20(#36)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/genshin/model/mysNews.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/genshin/model/mysNews.js b/plugins/genshin/model/mysNews.js index 0059f6e..a7a0dda 100644 --- a/plugins/genshin/model/mysNews.js +++ b/plugins/genshin/model/mysNews.js @@ -395,6 +395,12 @@ export default class MysNews extends base { let sended = await redis.get(`${this.key}${groupId}:${postId}`) if (sended) return + // 判断是否存在群关系 + if (!Bot.gl.get(Number(groupId))) { + logger.error(`[米游社${typeName}推送] 群${groupId}未关联`) + return + } + if (!this[postId]) { const param = await this.newsDetail(postId) From b1b13e8bcf779b30f3c6a824020416dd22ce90cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=97=B6=E9=9B=A8=E2=97=8E=E6=98=9F=E7=A9=BA?= Date: Tue, 21 Mar 2023 17:19:49 +0000 Subject: [PATCH 4/7] =?UTF-8?q?chromium=20--single-process=20=E5=B7=B2?= =?UTF-8?q?=E4=B8=8D=E5=8F=97=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 时雨◎星空 --- lib/puppeteer/puppeteer.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/puppeteer/puppeteer.js b/lib/puppeteer/puppeteer.js index c52aeac..06b98b8 100644 --- a/lib/puppeteer/puppeteer.js +++ b/lib/puppeteer/puppeteer.js @@ -27,8 +27,7 @@ class Puppeteer { '--disable-gpu', '--disable-setuid-sandbox', '--no-sandbox', - '--no-zygote', - '--single-process' + '--no-zygote' ] } From 906696f64624ef4f193357eb25b121de62fe86dc Mon Sep 17 00:00:00 2001 From: touchscale <11134128+touchscale@user.noreply.gitee.com> Date: Fri, 24 Mar 2023 14:48:01 +0000 Subject: [PATCH 5/7] =?UTF-8?q?puppeteer=E7=89=88=E6=9C=AC=E5=8D=87?= =?UTF-8?q?=E7=BA=A7=EF=BC=8C=E5=8D=87=E7=BA=A7=E5=90=8E=E4=B8=8D=E4=BC=9A?= =?UTF-8?q?=E5=87=BA=E5=BC=B9=E7=AA=97=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: touchscale <11134128+touchscale@user.noreply.gitee.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d35781a..d725111 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "node-xlsx": "^0.21.0", "oicq": "^2.3.1", "pm2": "^5.3.0", - "puppeteer": "^19.7.5", + "puppeteer": "^19.8.0", "redis": "^4.6.5", "sequelize": "^6.29.3", "sqlite3": "^5.1.6", From 7b0c03db34d597fe12b4d737a3e78ff50be59496 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BA=B8=E9=A3=9E=E6=9C=BA=E9=81=87=E4=B8=8A=E9=9B=A8?= =?UTF-8?q?=E5=A4=A9?= <11189655+chen-haonb@user.noreply.gitee.com> Date: Fri, 24 Mar 2023 15:05:46 +0000 Subject: [PATCH 6/7] =?UTF-8?q?update=20package.json.=20icqq0.0.33?= =?UTF-8?q?=E6=9C=89bug=E4=BC=9A=E5=87=BA=E7=8E=B0=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E8=BF=87=E4=BD=8E=EF=BC=8C0.0.31=E5=8F=AF=E4=BB=A5=E7=99=BB?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 纸飞机遇上雨天 <11189655+chen-haonb@user.noreply.gitee.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d35781a..86de1ea 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "chalk": "^5.2.0", "chokidar": "^3.5.3", "https-proxy-agent": "5.0.1", - "icqq": "^0.0.33", + "icqq": "^0.0.31", "image-size": "^1.0.2", "inquirer": "^8.2.5", "lodash": "^4.17.21", From 94cc12d5a2875adadd1ecdb115b6e50d9808ce8a Mon Sep 17 00:00:00 2001 From: ikuaki1009 Date: Sat, 25 Mar 2023 19:42:43 +0000 Subject: [PATCH 7/7] =?UTF-8?q?!12=20=E9=80=9A=E8=BF=87=20Docker=20ARG=20?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E6=8E=A7=E5=88=B6=20Docker=20=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=E6=B5=81=E7=A8=8B=20*=20=E9=80=9A=E8=BF=87=20Docker?= =?UTF-8?q?=20ARG=20=E5=8F=82=E6=95=B0=E6=8E=A7=E5=88=B6=20Docker=20?= =?UTF-8?q?=E6=9E=84=E5=BB=BA=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker-compose.yaml | 9 ++++- docker/Dockerfile | 91 ++++++++++++++++++++++++++++++--------------- 2 files changed, 68 insertions(+), 32 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 1fb107b..438b358 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -2,7 +2,14 @@ version: "3" services: miao-yunzai: container_name: miao-yunzai - build: ./docker # 使用 Dockerfile 本地构建 + build: # 使用 Dockerfile 本地构建 + context: ./docker + args: + BUNDLE_FFMPEG: false # 是否在构建时打包 ffmpeg + BUNDLE_POETRY: false # 是否在构建时打包 poetry + USE_APT_MIRROR: true # 是否在构建时使用 apt 镜像 + USE_NPM_MIRROR: true # 是否在构建时使用 npm 镜像 + USE_PYPI_MIRROR: true # 是否在构建时使用 pypi 镜像 restart: always # ports: # - "50831:50831" # 映射锅巴插件端口,格式"主机端口:容器内部端口" diff --git a/docker/Dockerfile b/docker/Dockerfile index 91906d4..9067522 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,12 +1,4 @@ -FROM debian:stable AS resource - -RUN sed -i "s/deb.debian.org/mirrors.ustc.edu.cn/g" /etc/apt/sources.list \ - && apt-get update \ - && apt-get upgrade -y \ - && apt-get install -y wget xz-utils dos2unix \ - && wget https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-$(dpkg --print-architecture)-static.tar.xz \ - && mkdir -p /res/ffmpeg \ - && tar -xvf ./ffmpeg-git-$(dpkg --print-architecture)-static.tar.xz -C /res/ffmpeg --strip-components 1 +FROM busybox:latest AS resource COPY docker-entrypoint.sh /res/entrypoint.sh @@ -16,35 +8,65 @@ RUN dos2unix /res/entrypoint.sh \ FROM node:lts-slim AS runtime -COPY --from=resource /res/ffmpeg/ffmpeg /usr/bin/ffmpeg +ARG BUNDLE_FFMPEG true +ARG BUNDLE_POETRY true +ARG USE_APT_MIRROR true +ARG USE_NPM_MIRROR true +ARG USE_PYPI_MIRROR true +ARG REPO_URL https://gitee.com/yoimiya-kokomi/Miao-Yunzai.git +ARG REPO_BRANCH master -COPY --from=resource /res/ffmpeg/ffprobe /usr/bin/ffprobe - -RUN sed -i "s/deb.debian.org/mirrors.ustc.edu.cn/g" /etc/apt/sources.list \ +RUN export BUNDLE_FFMPEG=${BUNDLE_FFMPEG:-true} \ + && export BUNDLE_POETRY=${BUNDLE_POETRY:-true} \ + && export USE_APT_MIRROR=${USE_APT_MIRROR:-true} \ + && export USE_NPM_MIRROR=${USE_NPM_MIRROR:-true} \ + && export USE_PYPI_MIRROR=${USE_PYPI_MIRROR:-true} \ + \ + && ((test "$USE_APT_MIRROR"x = "true"x \ + && sed -i "s/deb.debian.org/mirrors.bit.edu.cn/g" /etc/apt/sources.list) || true) \ && apt-get update \ && apt-get upgrade -y \ - && apt-get install -y curl wget gnupg git python3-pip python3-venv fonts-wqy-microhei xfonts-utils chromium fontconfig libxss1 libgl1 \ + && apt-get install -y wget xz-utils dos2unix \ + && ((test "$BUNDLE_FFMPEG"x = "true"x \ + && wget https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-$(dpkg --print-architecture)-static.tar.xz \ + && mkdir -p /res/ffmpeg \ + && tar -xvf ./ffmpeg-git-$(dpkg --print-architecture)-static.tar.xz -C /res/ffmpeg --strip-components 1 \ + && cp /res/ffmpeg/ffmpeg /usr/bin/ffmpeg \ + && cp /res/ffmpeg/ffprobe /usr/bin/ffprobe) || true) \ + \ + && apt-get update \ + && apt-get upgrade -y \ + && apt-get install -y curl wget gnupg git fonts-wqy-microhei xfonts-utils chromium fontconfig libxss1 libgl1 \ && apt-get autoremove \ - && apt-get clean - -RUN fc-cache -f -v - -RUN git config --global --add safe.directory '*' \ + && apt-get clean \ + \ + && fc-cache -f -v \ + \ + && git config --global --add safe.directory '*' \ && git config --global pull.rebase false \ && git config --global user.email "Yunzai@yunzai.bot" \ - && git config --global user.name "Yunzai" - -RUN npm install pnpm -g - -RUN ln -s /usr/bin/python3 /usr/bin/python \ + && git config --global user.name "Yunzai" \ + \ + && _NPM_MIRROR_FLAG="" \ + && if [ "$USE_NPM_MIRROR"x = "true"x ]; then _NPM_MIRROR_FLAG="--registry=https://registry.npmmirror.com"; fi \ + && npm install pnpm -g $_NPM_MIRROR_FLAG \ + \ + && ((test "$BUNDLE_POETRY"x = "true"x \ + && apt-get update \ + && apt-get install -y python3-pip python3-venv \ + && apt-get autoremove \ + && apt-get clean \ + && ln -s /usr/bin/python3 /usr/bin/python \ && POETRY_HOME=$HOME/venv-poetry \ && python -m venv $POETRY_HOME \ - && $POETRY_HOME/bin/pip install --upgrade pip setuptools -i https://pypi.tuna.tsinghua.edu.cn/simple \ - && $POETRY_HOME/bin/pip install poetry -i https://pypi.tuna.tsinghua.edu.cn/simple \ + && _PYPI_MIRROR_FLAG="" \ + && if [ "$USE_PYPI_MIRROR"x = "true"x ]; then _PYPI_MIRROR_FLAG="-i https://pypi.tuna.tsinghua.edu.cn/simple"; fi \ + && $POETRY_HOME/bin/pip install --upgrade pip setuptools $_PYPI_MIRROR_FLAG \ + && $POETRY_HOME/bin/pip install poetry $_PYPI_MIRROR_FLAG \ && ln -s $POETRY_HOME/bin/poetry /usr/bin \ - && poetry config virtualenvs.in-project true - -RUN rm -rf /var/cache/* \ + && poetry config virtualenvs.in-project true) || true) \ + \ + && rm -rf /var/cache/* \ && rm -rf /tmp/* @@ -53,10 +75,17 @@ FROM runtime AS prod ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \ PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium -RUN git clone --depth=1 --branch master https://gitee.com/yoimiya-kokomi/Miao-Yunzai.git /app/Miao-Yunzai\ +RUN REPO_URL=${REPO_URL:-"https://gitee.com/yoimiya-kokomi/Miao-Yunzai.git"} \ + && REPO_BRANCH=${REPO_BRANCH:-master} \ + && USE_NPM_MIRROR=${USE_NPM_MIRROR:-true} \ + \ + && _NPM_MIRROR_FLAG="" \ + && if [ "$USE_NPM_MIRROR"x = "true"x ]; then _NPM_MIRROR_FLAG="--registry=https://registry.npmmirror.com"; fi \ + && git clone --depth=1 --branch $REPO_BRANCH $REPO_URL /app/Miao-Yunzai \ && cd /app/Miao-Yunzai \ && sed -i 's/127.0.0.1/redis/g' ./config/default_config/redis.yaml \ - && pnpm install -P + && pnpm install -P $_NPM_MIRROR_FLAG \ + && git remote set-url origin https://gitee.com/yoimiya-kokomi/Miao-Yunzai.git COPY --from=resource /res/entrypoint.sh /app/Miao-Yunzai/entrypoint.sh