Skip to content

Commit

Permalink
feat: 添加docker启动方式
Browse files Browse the repository at this point in the history
  • Loading branch information
zhukai committed May 6, 2023
1 parent 8991213 commit 7ff4863
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 13 deletions.
45 changes: 34 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,43 @@
基于 [wechaty](https://github.com/wechaty/wechaty) 代理微信客户端,接入 MidJourney。
> ***微信代理有风险,使用需谨慎***
## 使用前提
1. NodeJS `18.0.0` 以上
2. 依赖 [midjourney-proxy](https://github.com/novicezk/midjourney-proxy) 提供的api接口
## 注意事项
- 依赖 [midjourney-proxy](https://github.com/novicezk/midjourney-proxy) 提供的api接口
- 推荐使用docker启动;mac M或其他arm架构电脑,暂时使用npm启动

## 快速启动
1. 下载项目
2. `cp .env.example .env` ,并更改配置项
3. 启动项目
```sh

1. 下载镜像
```shell
docker pull novicezk/wechat-midjourney:1.0
```
2. 启动容器,并设置参数
```shell
docker run -d --name wechat-midjourney \
-p 4120:4120 \
-e MJ_PROXY_ENDPOINT=http://172.17.0.1:8080/mj \
--restart=always \
novicezk/wechat-midjourney:1.0
```
3. 查看启动日志,微信扫描二维码,若二维码无法扫码,复制二维码链接浏览器打开扫码
```shell
docker logs -f -n 200 wechat-midjourney
```
## npm启动
```shell
git clone git@github.com:novicezk/wechat-midjourney.git
cd wechat-midjourney.git
npm install
# 可能执行错误,缺少library,按提示解决
cp .env.example .env
# 更改配置项,启动服务
npm run dev
```
4. 微信扫码登录

## .env 配置项
- `MJ_PROXY_ENDPOINT` midjourney代理服务的地址
- `BLOCK_WORDS` 敏感词,英文逗号分隔
## 配置项

| 变量名 | 非空 | 描述 |
| :-----| :----: | :---- |
| MJ_PROXY_ENDPOINT || midjourney代理服务的地址 |
| BLOCK_WORDS || 敏感词,英文逗号分隔 |

13 changes: 13 additions & 0 deletions build-image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
set -e -u -o pipefail

VERSION=latest

if [ $# -ge 1 ]; then
VERSION=$1
fi

docker build . -t wechat-midjourney:${VERSION}

docker tag wechat-midjourney:${VERSION} novicezk/wechat-midjourney:${VERSION}
docker push novicezk/wechat-midjourney:${VERSION}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wechat-midjourney",
"version": "1.0.0",
"version": "1.0",
"description": "",
"main": "dist/main.js",
"export": "dist/main.js",
Expand Down
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function isProhibited(text: string): boolean {

export function isNonsense(talker: ContactInterface, messageType: PUPPET.types.Message, text: string): boolean {
return messageType != PUPPET.types.Message.Text ||
// talker.self() ||
talker.self() ||
talker.name() === "微信团队" ||
text.includes("收到一条视频/语音聊天消息,请在手机上查看") ||
text.includes("收到红包,请在手机上查看") ||
Expand Down

0 comments on commit 7ff4863

Please sign in to comment.