diff --git a/.github/workflows/docker_build.yml b/.github/workflows/docker_build.yml index b5f064b..00d9495 100644 --- a/.github/workflows/docker_build.yml +++ b/.github/workflows/docker_build.yml @@ -19,14 +19,14 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 - with: - lfs: true + # with: + # lfs: true - - name: Checkout LFS objects - run: git lfs checkout + # - name: Checkout LFS objects + # run: git lfs checkout - - name: init submodule - run: git submodule update --init --recursive + # - name: init submodule + # run: git submodule update --init --recursive - name: Set up QEMU uses: docker/setup-qemu-action@v1 @@ -73,4 +73,4 @@ jobs: cache-to: type=local,dest=/tmp/.buildx-cache - name: Image digest - run: echo ${{ steps.docker_build.outputs.digest }} \ No newline at end of file + run: echo ${{ steps.docker_build.outputs.digest }} diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 05627f3..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "ComWeChatRobot"] - path = ComWeChatRobot - url = https://github.com/ljc545w/ComWeChatRobot.git diff --git a/ComWeChatRobot b/ComWeChatRobot deleted file mode 160000 index 0d67151..0000000 --- a/ComWeChatRobot +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 0d67151cdbe466fe99eb968cbeb485cfadeb18d8 diff --git a/Dockerfile b/Dockerfile index d9ffd69..04cab56 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,8 @@ ENV WINEPREFIX=/home/user/.wine \ LANG=zh_CN.UTF-8 \ LC_ALL=zh_CN.UTF-8 \ DISPLAY=:5 \ - VNCPASS=YourSafeVNCPassword + VNCPASS=YourSafeVNCPassword \ + COMWECHAT=https://github.com/ljc545w/ComWeChatRobot/releases/download/3.7.0.30-0.0.5/3.7.0.30-0.0.5.zip # 提示 vnc 使用的端口, dll 的端口自行映射 EXPOSE 5905 @@ -27,8 +28,9 @@ COPY wine/userdef.reg /home/user/.wine/userdef.reg # COPY wine/Tencent.zip /Tencent.zip RUN wget --no-check-certificate -O /Tencent.zip "https://github.com/tom-snow/docker-ComWechat/releases/download/v0.2_wc3.7.0.30/Tencent.zip" -COPY ComWeChatRobot/Release/socket /socket -COPY WeChatHook.exe /socket/WeChatHook.exe + +# COPY ComWeChatRobot/Release/socket /socket +COPY WeChatHook.exe /WeChatHook.exe COPY run.py /run.py # https://github.com/tom-snow/wechat-windows-versions/releases/download/v3.7.0.30/WeChatSetup-3.7.0.30.exe diff --git a/README.md b/README.md index 6e04ba3..e74ee36 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ docker run \ --name comwechat \ --network host \ -e VNCPASS=asdfgh123 \ + -e COMWECHAT=https://github.com/ljc545w/ComWeChatRobot/releases/download/3.7.0.30-0.0.5/3.7.0.30-0.0.5.zip \ -dti \ --ipc=host \ --privileged \ @@ -23,6 +24,7 @@ docker run \ * 端口 5905: VNC 服务的端口(无法/无需修改) * network host: 使用宿主机网络(在 Linux Docker 环境下使用) * 环境变量 VNCPASS: 连接 VNC 的密码(可自定义,建议在服务器上使用本镜像的话设置得难一点) +* 环境变量 COMWECHAT: [ComWeChatRobot](https://github.com/ljc545w/ComWeChatRobot/releases)具体版本的动态库文件压缩包(右键复制发布的文件的下载链接)【不设置此参数则默认为`3.7.0.30-0.0.5`的链接】 * 目录映射 `WeChat Files`: 微信收到的图片/文件存储的目录(可以取消目录映射) * 目录映射 `Application Data`: 微信数据目录(可以取消目录映射) diff --git a/VERSION b/VERSION index e2cfc99..174a3d5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v0.2 \ No newline at end of file +v0.3 \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index 71d8576..9addff1 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -8,13 +8,14 @@ services: # - '10808:10808' # dll 开启的端口,具体由 python 端设置(建议冒号前后相同) environment: - VNCPASS=asdfgh123 + - COMWECHAT=https://github.com/ljc545w/ComWeChatRobot/releases/download/3.7.0.30-0.0.5/3.7.0.30-0.0.5.zip ipc: host volumes: - "./volume/WeChat Files/:/home/user/.wine/drive_c/users/user/My Documents/WeChat Files/" - "./volume/Application Data/:/home/user/.wine/drive_c/users/user/Application Data/" privileged: true network_mode: host - image: tomsnow1999/docker-com_wechat_robot:latest - # build: - # context: . - # dockerfile: ./Dockerfile \ No newline at end of file + # image: tomsnow1999/docker-com_wechat_robot:latest + build: + context: . + dockerfile: ./Dockerfile \ No newline at end of file diff --git a/run.py b/run.py index e0cedaf..15ab2e6 100644 --- a/run.py +++ b/run.py @@ -11,6 +11,20 @@ class DockerWechatHook: def now_exit(self, signum, frame): self.exit_container() + def prepare(self): + # if not os.path.exists("/comwechat/http/SWeChatRobot.dll"): + if not os.path.exists("/dll_downloaded.txt"): + COMWECHAT = os.environ['COMWECHAT'] + # NOTE: 当 ComWeChatRobot 的仓库地址变动的话需要修改 + if not COMWECHAT.startswith("https://github.com/ljc545w/ComWeChatRobot/releases/download/"): + print("你提供的地址不是 COMWECHAT 仓库的 Release 下载地址,程序将自动退出!") + self.exit_container() + self.prepare = subprocess.run(['wget', COMWECHAT, '-O', 'comwechat.zip']) + self.prepare = subprocess.run(['unzip', '-d', 'comwechat', 'comwechat.zip']) + self.prepare = subprocess.run(['mv', '/WeChatHook.exe', '/comwechat/http/WeChatHook.exe']) + with open("/dll_downloaded.txt", "w") as f: + f.write("True\n") + def run_vnc(self): # 根据 VNCPASS 环境变量生成 vncpasswd 文件 os.makedirs('/root/.vnc', mode=755, exist_ok=True) @@ -31,7 +45,7 @@ class DockerWechatHook: # self.wechat = subprocess.run(['wine','/home/user/.wine/drive_c/Program Files/Tencent/WeChat/WeChat.exe']) def run_hook(self): - self.reg_hook = subprocess.run(['wine','/socket/WeChatHook.exe']) + self.reg_hook = subprocess.run(['wine','/comwechat/http/WeChatHook.exe']) # self.reg_hook = subprocess.run(['wine', 'explorer.exe']) def exit_container(self): @@ -54,6 +68,7 @@ class DockerWechatHook: def run_all_in_one(self): print(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')+ ' 启动容器中...') + self.prepare() self.run_vnc() self.run_wechat() self.run_hook()