mirror of
https://github.com/tom-snow/docker-ComWechat.git
synced 2025-01-07 21:45:51 +08:00
支持"自定义" ComWeChatRobot 的发行文件
This commit is contained in:
parent
9259cb22c1
commit
37e6560e93
14
.github/workflows/docker_build.yml
vendored
14
.github/workflows/docker_build.yml
vendored
@ -19,14 +19,14 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
with:
|
# with:
|
||||||
lfs: true
|
# lfs: true
|
||||||
|
|
||||||
- name: Checkout LFS objects
|
# - name: Checkout LFS objects
|
||||||
run: git lfs checkout
|
# run: git lfs checkout
|
||||||
|
|
||||||
- name: init submodule
|
# - name: init submodule
|
||||||
run: git submodule update --init --recursive
|
# run: git submodule update --init --recursive
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v1
|
uses: docker/setup-qemu-action@v1
|
||||||
@ -73,4 +73,4 @@ jobs:
|
|||||||
cache-to: type=local,dest=/tmp/.buildx-cache
|
cache-to: type=local,dest=/tmp/.buildx-cache
|
||||||
|
|
||||||
- name: Image digest
|
- name: Image digest
|
||||||
run: echo ${{ steps.docker_build.outputs.digest }}
|
run: echo ${{ steps.docker_build.outputs.digest }}
|
||||||
|
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,3 +0,0 @@
|
|||||||
[submodule "ComWeChatRobot"]
|
|
||||||
path = ComWeChatRobot
|
|
||||||
url = https://github.com/ljc545w/ComWeChatRobot.git
|
|
@ -1 +0,0 @@
|
|||||||
Subproject commit 0d67151cdbe466fe99eb968cbeb485cfadeb18d8
|
|
@ -7,7 +7,8 @@ ENV WINEPREFIX=/home/user/.wine \
|
|||||||
LANG=zh_CN.UTF-8 \
|
LANG=zh_CN.UTF-8 \
|
||||||
LC_ALL=zh_CN.UTF-8 \
|
LC_ALL=zh_CN.UTF-8 \
|
||||||
DISPLAY=:5 \
|
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 的端口自行映射
|
# 提示 vnc 使用的端口, dll 的端口自行映射
|
||||||
EXPOSE 5905
|
EXPOSE 5905
|
||||||
@ -27,8 +28,9 @@ COPY wine/userdef.reg /home/user/.wine/userdef.reg
|
|||||||
|
|
||||||
# COPY wine/Tencent.zip /Tencent.zip
|
# 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"
|
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
|
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
|
# https://github.com/tom-snow/wechat-windows-versions/releases/download/v3.7.0.30/WeChatSetup-3.7.0.30.exe
|
||||||
|
@ -11,6 +11,7 @@ docker run \
|
|||||||
--name comwechat \
|
--name comwechat \
|
||||||
--network host \
|
--network host \
|
||||||
-e VNCPASS=asdfgh123 \
|
-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 \
|
-dti \
|
||||||
--ipc=host \
|
--ipc=host \
|
||||||
--privileged \
|
--privileged \
|
||||||
@ -23,6 +24,7 @@ docker run \
|
|||||||
* 端口 5905: VNC 服务的端口(无法/无需修改)
|
* 端口 5905: VNC 服务的端口(无法/无需修改)
|
||||||
* network host: 使用宿主机网络(在 Linux Docker 环境下使用)
|
* network host: 使用宿主机网络(在 Linux Docker 环境下使用)
|
||||||
* 环境变量 VNCPASS: 连接 VNC 的密码(可自定义,建议在服务器上使用本镜像的话设置得难一点)
|
* 环境变量 VNCPASS: 连接 VNC 的密码(可自定义,建议在服务器上使用本镜像的话设置得难一点)
|
||||||
|
* 环境变量 COMWECHAT: [ComWeChatRobot](https://github.com/ljc545w/ComWeChatRobot/releases)具体版本的动态库文件压缩包(右键复制发布的文件的下载链接)【不设置此参数则默认为`3.7.0.30-0.0.5`的链接】
|
||||||
* 目录映射 `WeChat Files`: 微信收到的图片/文件存储的目录(可以取消目录映射)
|
* 目录映射 `WeChat Files`: 微信收到的图片/文件存储的目录(可以取消目录映射)
|
||||||
* 目录映射 `Application Data`: 微信数据目录(可以取消目录映射)
|
* 目录映射 `Application Data`: 微信数据目录(可以取消目录映射)
|
||||||
|
|
||||||
|
@ -8,13 +8,14 @@ services:
|
|||||||
# - '10808:10808' # dll 开启的端口,具体由 python 端设置(建议冒号前后相同)
|
# - '10808:10808' # dll 开启的端口,具体由 python 端设置(建议冒号前后相同)
|
||||||
environment:
|
environment:
|
||||||
- VNCPASS=asdfgh123
|
- 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
|
ipc: host
|
||||||
volumes:
|
volumes:
|
||||||
- "./volume/WeChat Files/:/home/user/.wine/drive_c/users/user/My Documents/WeChat Files/"
|
- "./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/"
|
- "./volume/Application Data/:/home/user/.wine/drive_c/users/user/Application Data/"
|
||||||
privileged: true
|
privileged: true
|
||||||
network_mode: host
|
network_mode: host
|
||||||
image: tomsnow1999/docker-com_wechat_robot:latest
|
# image: tomsnow1999/docker-com_wechat_robot:latest
|
||||||
# build:
|
build:
|
||||||
# context: .
|
context: .
|
||||||
# dockerfile: ./Dockerfile
|
dockerfile: ./Dockerfile
|
17
run.py
17
run.py
@ -11,6 +11,20 @@ class DockerWechatHook:
|
|||||||
def now_exit(self, signum, frame):
|
def now_exit(self, signum, frame):
|
||||||
self.exit_container()
|
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):
|
def run_vnc(self):
|
||||||
# 根据 VNCPASS 环境变量生成 vncpasswd 文件
|
# 根据 VNCPASS 环境变量生成 vncpasswd 文件
|
||||||
os.makedirs('/root/.vnc', mode=755, exist_ok=True)
|
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'])
|
# self.wechat = subprocess.run(['wine','/home/user/.wine/drive_c/Program Files/Tencent/WeChat/WeChat.exe'])
|
||||||
|
|
||||||
def run_hook(self):
|
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'])
|
# self.reg_hook = subprocess.run(['wine', 'explorer.exe'])
|
||||||
|
|
||||||
def exit_container(self):
|
def exit_container(self):
|
||||||
@ -54,6 +68,7 @@ class DockerWechatHook:
|
|||||||
|
|
||||||
def run_all_in_one(self):
|
def run_all_in_one(self):
|
||||||
print(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')+ ' 启动容器中...')
|
print(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')+ ' 启动容器中...')
|
||||||
|
self.prepare()
|
||||||
self.run_vnc()
|
self.run_vnc()
|
||||||
self.run_wechat()
|
self.run_wechat()
|
||||||
self.run_hook()
|
self.run_hook()
|
||||||
|
Loading…
Reference in New Issue
Block a user