Upload 987 files
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .dockerignore +5 -0
- .gitattributes +6 -0
- .github/workflows/docker.yaml +64 -0
- .gitignore +143 -0
- .vscode/extensions.json +5 -0
- Dockerfile +33 -0
- LICENSE +674 -0
- README.md +200 -10
- config.json.example +13 -0
- doc/assets/bind-ck.png +0 -0
- doc/assets/bind-uid.png +0 -0
- doc/assets/demo.png +3 -0
- doc/assets/get-ck.png +0 -0
- doc/assets/help.png +3 -0
- doc/dev.md +40 -0
- doc/docker/.gitignore +3 -0
- doc/docker/Dockerfile +33 -0
- doc/docker/docker-compose.yml +33 -0
- docker-compose.yml +31 -0
- script/miyoushe-token-sender/README.md +30 -0
- script/miyoushe-token-sender/miyoushe-token-sender.js +83 -0
- script/yunzai-web-downloader/.gitignore +3 -0
- script/yunzai-web-downloader/README.md +21 -0
- script/yunzai-web-downloader/assets/files.png +3 -0
- script/yunzai-web-downloader/config.json.example +24 -0
- script/yunzai-web-downloader/main.py +69 -0
- script/yunzai-web-downloader/poetry.lock +206 -0
- script/yunzai-web-downloader/pyproject.toml +20 -0
- src/Yunzai-Bot/.eslintrc.cjs +22 -0
- src/Yunzai-Bot/.github/workflows/Docker Build Test.yml +26 -0
- src/Yunzai-Bot/.gitignore +142 -0
- src/Yunzai-Bot/LICENSE +674 -0
- src/Yunzai-Bot/README.md +41 -0
- src/Yunzai-Bot/app.js +4 -0
- src/Yunzai-Bot/config/config/other.yaml +23 -0
- src/Yunzai-Bot/config/config/redis.yaml +9 -0
- src/Yunzai-Bot/config/default_config/bot.yaml +21 -0
- src/Yunzai-Bot/config/default_config/group.yaml +26 -0
- src/Yunzai-Bot/config/default_config/other.yaml +23 -0
- src/Yunzai-Bot/config/default_config/qq.yaml +6 -0
- src/Yunzai-Bot/config/default_config/redis.yaml +9 -0
- src/Yunzai-Bot/config/pm2/pm2.json +10 -0
- src/Yunzai-Bot/config/test/default.yaml +10 -0
- src/Yunzai-Bot/docker-compose.yaml +51 -0
- src/Yunzai-Bot/docker-entrypoint.py +37 -0
- src/Yunzai-Bot/docker/Dockerfile +59 -0
- src/Yunzai-Bot/docker/docker-entrypoint.sh +181 -0
- src/Yunzai-Bot/docker/qq.yaml +6 -0
- src/Yunzai-Bot/lib/bot.js +20 -0
- src/Yunzai-Bot/lib/common/common.js +108 -0
.dockerignore
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Yunzai-Bot
|
2 |
+
Yunzai-Bot-*
|
3 |
+
old
|
4 |
+
.git
|
5 |
+
data
|
.gitattributes
CHANGED
@@ -33,3 +33,9 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
doc/assets/demo.png filter=lfs diff=lfs merge=lfs -text
|
37 |
+
doc/assets/help.png filter=lfs diff=lfs merge=lfs -text
|
38 |
+
script/yunzai-web-downloader/assets/files.png filter=lfs diff=lfs merge=lfs -text
|
39 |
+
src/Yunzai-Bot/resources/font/华文中宋.TTF filter=lfs diff=lfs merge=lfs -text
|
40 |
+
src/Yunzai-Bot/resources/font/HYWenHei-55W.ttf filter=lfs diff=lfs merge=lfs -text
|
41 |
+
src/yunzai-web-fe/docs/c2.png filter=lfs diff=lfs merge=lfs -text
|
.github/workflows/docker.yaml
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: docker
|
2 |
+
|
3 |
+
on:
|
4 |
+
push:
|
5 |
+
workflow_dispatch:
|
6 |
+
|
7 |
+
jobs:
|
8 |
+
build:
|
9 |
+
runs-on: ubuntu-latest
|
10 |
+
steps:
|
11 |
+
# https://github.com/actions/checkout
|
12 |
+
- name: Checkout
|
13 |
+
uses: actions/checkout@v3
|
14 |
+
|
15 |
+
# https://github.com/docker/setup-qemu-action
|
16 |
+
- name: Set up QEMU
|
17 |
+
uses: docker/setup-qemu-action@v2
|
18 |
+
|
19 |
+
# https://github.com/docker/setup-buildx-action
|
20 |
+
- name: Set up Docker Buildx
|
21 |
+
id: buildx
|
22 |
+
uses: docker/setup-buildx-action@v2
|
23 |
+
|
24 |
+
# https://github.com/docker/login-action
|
25 |
+
- name: Login to DockerHub
|
26 |
+
uses: docker/login-action@v2
|
27 |
+
with:
|
28 |
+
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
29 |
+
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
30 |
+
|
31 |
+
# https://github.com/docker/login-action
|
32 |
+
- name: Login to ACR
|
33 |
+
uses: docker/login-action@v2
|
34 |
+
with:
|
35 |
+
registry: registry.cn-hangzhou.aliyuncs.com
|
36 |
+
username: ${{ secrets.ALI_REGISTRY_USERNAME }}
|
37 |
+
password: ${{ secrets.ALI_REGISTRY_PASSWORD }}
|
38 |
+
|
39 |
+
# https://github.com/docker/metadata-action
|
40 |
+
- name: Docker meta
|
41 |
+
id: meta
|
42 |
+
uses: docker/metadata-action@v3
|
43 |
+
with:
|
44 |
+
images: |
|
45 |
+
117503445/yunzai-web
|
46 |
+
registry.cn-hangzhou.aliyuncs.com/117503445-mirror/yunzai-web
|
47 |
+
tags: |
|
48 |
+
type=schedule
|
49 |
+
type=ref,event=branch
|
50 |
+
type=ref,event=pr
|
51 |
+
type=semver,pattern={{version}}
|
52 |
+
type=semver,pattern={{major}}.{{minor}}
|
53 |
+
type=semver,pattern={{major}}
|
54 |
+
type=sha
|
55 |
+
type=raw,value=latest
|
56 |
+
# https://github.com/docker/build-push-action
|
57 |
+
- name: Build and push
|
58 |
+
uses: docker/build-push-action@v3
|
59 |
+
with:
|
60 |
+
context: .
|
61 |
+
platforms: linux/amd64, linux/arm64
|
62 |
+
push: ${{ github.event_name != 'pull_request' }}
|
63 |
+
tags: ${{ steps.meta.outputs.tags }}
|
64 |
+
labels: ${{ steps.meta.outputs.labels }}
|
.gitignore
ADDED
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Byte-compiled / optimized / DLL files
|
2 |
+
__pycache__/
|
3 |
+
*.py[cod]
|
4 |
+
*$py.class
|
5 |
+
|
6 |
+
# C extensions
|
7 |
+
*.so
|
8 |
+
|
9 |
+
# Distribution / packaging
|
10 |
+
.Python
|
11 |
+
build/
|
12 |
+
develop-eggs/
|
13 |
+
dist/
|
14 |
+
downloads/
|
15 |
+
eggs/
|
16 |
+
.eggs/
|
17 |
+
lib64/
|
18 |
+
parts/
|
19 |
+
sdist/
|
20 |
+
var/
|
21 |
+
wheels/
|
22 |
+
pip-wheel-metadata/
|
23 |
+
share/python-wheels/
|
24 |
+
*.egg-info/
|
25 |
+
.installed.cfg
|
26 |
+
*.egg
|
27 |
+
MANIFEST
|
28 |
+
|
29 |
+
# PyInstaller
|
30 |
+
# Usually these files are written by a python script from a template
|
31 |
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
32 |
+
*.manifest
|
33 |
+
*.spec
|
34 |
+
|
35 |
+
# Installer logs
|
36 |
+
pip-log.txt
|
37 |
+
pip-delete-this-directory.txt
|
38 |
+
|
39 |
+
# Unit test / coverage reports
|
40 |
+
htmlcov/
|
41 |
+
.tox/
|
42 |
+
.nox/
|
43 |
+
.coverage
|
44 |
+
.coverage.*
|
45 |
+
.cache
|
46 |
+
nosetests.xml
|
47 |
+
coverage.xml
|
48 |
+
*.cover
|
49 |
+
*.py,cover
|
50 |
+
.hypothesis/
|
51 |
+
.pytest_cache/
|
52 |
+
|
53 |
+
# Translations
|
54 |
+
*.mo
|
55 |
+
*.pot
|
56 |
+
|
57 |
+
# Django stuff:
|
58 |
+
*.log
|
59 |
+
local_settings.py
|
60 |
+
db.sqlite3
|
61 |
+
db.sqlite3-journal
|
62 |
+
|
63 |
+
# Flask stuff:
|
64 |
+
instance/
|
65 |
+
.webassets-cache
|
66 |
+
|
67 |
+
# Scrapy stuff:
|
68 |
+
.scrapy
|
69 |
+
|
70 |
+
# Sphinx documentation
|
71 |
+
docs/_build/
|
72 |
+
|
73 |
+
# PyBuilder
|
74 |
+
target/
|
75 |
+
|
76 |
+
# Jupyter Notebook
|
77 |
+
.ipynb_checkpoints
|
78 |
+
|
79 |
+
# IPython
|
80 |
+
profile_default/
|
81 |
+
ipython_config.py
|
82 |
+
|
83 |
+
# pyenv
|
84 |
+
.python-version
|
85 |
+
|
86 |
+
# pipenv
|
87 |
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
88 |
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
89 |
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
90 |
+
# install all needed dependencies.
|
91 |
+
#Pipfile.lock
|
92 |
+
|
93 |
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
94 |
+
__pypackages__/
|
95 |
+
|
96 |
+
# Celery stuff
|
97 |
+
celerybeat-schedule
|
98 |
+
celerybeat.pid
|
99 |
+
|
100 |
+
# SageMath parsed files
|
101 |
+
*.sage.py
|
102 |
+
|
103 |
+
# Environments
|
104 |
+
.env
|
105 |
+
.venv
|
106 |
+
env/
|
107 |
+
venv/
|
108 |
+
ENV/
|
109 |
+
env.bak/
|
110 |
+
venv.bak/
|
111 |
+
|
112 |
+
# Spyder project settings
|
113 |
+
.spyderproject
|
114 |
+
.spyproject
|
115 |
+
|
116 |
+
# Rope project settings
|
117 |
+
.ropeproject
|
118 |
+
|
119 |
+
# mkdocs documentation
|
120 |
+
/site
|
121 |
+
|
122 |
+
# mypy
|
123 |
+
.mypy_cache/
|
124 |
+
.dmypy.json
|
125 |
+
dmypy.json
|
126 |
+
|
127 |
+
# Pyre type checker
|
128 |
+
.pyre/
|
129 |
+
|
130 |
+
.devcontainer/_data
|
131 |
+
|
132 |
+
node_modules
|
133 |
+
yunzai-client-ws
|
134 |
+
|
135 |
+
.pnpm-store
|
136 |
+
|
137 |
+
egg-demo
|
138 |
+
fastify-demo
|
139 |
+
|
140 |
+
_data
|
141 |
+
old
|
142 |
+
config.json
|
143 |
+
data
|
.vscode/extensions.json
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"recommendations": [
|
3 |
+
"humao.rest-client"
|
4 |
+
]
|
5 |
+
}
|
Dockerfile
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM node:lts-slim AS fe-builder
|
2 |
+
|
3 |
+
COPY src/yunzai-web-fe /workspace/yunzai-web-fe
|
4 |
+
WORKDIR /workspace/yunzai-web-fe
|
5 |
+
RUN npm install pnpm -g && pnpm install && pnpm run build
|
6 |
+
|
7 |
+
FROM node:lts-slim AS runtime
|
8 |
+
|
9 |
+
RUN apt-get update \
|
10 |
+
&& apt-get upgrade -y \
|
11 |
+
&& apt-get install -y curl wget gnupg git python3-pip fonts-wqy-microhei xfonts-utils chromium fontconfig libxss1 libgl1 \
|
12 |
+
&& apt-get autoremove \
|
13 |
+
&& apt-get clean
|
14 |
+
|
15 |
+
RUN fc-cache -f -v
|
16 |
+
RUN npm install pnpm -g
|
17 |
+
RUN ln -s /usr/bin/python3 /usr/bin/python \
|
18 |
+
&& curl -fsSL https://install.python-poetry.org | python - \
|
19 |
+
&& ln -s /$HOME/.local/bin/poetry /usr/bin \
|
20 |
+
&& poetry config virtualenvs.in-project true
|
21 |
+
RUN rm -rf /var/cache/* \
|
22 |
+
&& rm -rf /tmp/*
|
23 |
+
|
24 |
+
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \
|
25 |
+
PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
|
26 |
+
|
27 |
+
COPY src/Yunzai-Bot /workspace/Yunzai-Bot
|
28 |
+
COPY --from=fe-builder /workspace/yunzai-web-fe/dist /workspace/Yunzai-Bot/web-data
|
29 |
+
|
30 |
+
WORKDIR /workspace/Yunzai-Bot
|
31 |
+
RUN pnpm install && pnpm add image-size fastify @fastify/static @fastify/cors @fastify/basic-auth uuid -w && mkdir ./data
|
32 |
+
EXPOSE 8080
|
33 |
+
ENTRYPOINT [ "./docker-entrypoint.py" ]
|
LICENSE
ADDED
@@ -0,0 +1,674 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
GNU GENERAL PUBLIC LICENSE
|
2 |
+
Version 3, 29 June 2007
|
3 |
+
|
4 |
+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
5 |
+
Everyone is permitted to copy and distribute verbatim copies
|
6 |
+
of this license document, but changing it is not allowed.
|
7 |
+
|
8 |
+
Preamble
|
9 |
+
|
10 |
+
The GNU General Public License is a free, copyleft license for
|
11 |
+
software and other kinds of works.
|
12 |
+
|
13 |
+
The licenses for most software and other practical works are designed
|
14 |
+
to take away your freedom to share and change the works. By contrast,
|
15 |
+
the GNU General Public License is intended to guarantee your freedom to
|
16 |
+
share and change all versions of a program--to make sure it remains free
|
17 |
+
software for all its users. We, the Free Software Foundation, use the
|
18 |
+
GNU General Public License for most of our software; it applies also to
|
19 |
+
any other work released this way by its authors. You can apply it to
|
20 |
+
your programs, too.
|
21 |
+
|
22 |
+
When we speak of free software, we are referring to freedom, not
|
23 |
+
price. Our General Public Licenses are designed to make sure that you
|
24 |
+
have the freedom to distribute copies of free software (and charge for
|
25 |
+
them if you wish), that you receive source code or can get it if you
|
26 |
+
want it, that you can change the software or use pieces of it in new
|
27 |
+
free programs, and that you know you can do these things.
|
28 |
+
|
29 |
+
To protect your rights, we need to prevent others from denying you
|
30 |
+
these rights or asking you to surrender the rights. Therefore, you have
|
31 |
+
certain responsibilities if you distribute copies of the software, or if
|
32 |
+
you modify it: responsibilities to respect the freedom of others.
|
33 |
+
|
34 |
+
For example, if you distribute copies of such a program, whether
|
35 |
+
gratis or for a fee, you must pass on to the recipients the same
|
36 |
+
freedoms that you received. You must make sure that they, too, receive
|
37 |
+
or can get the source code. And you must show them these terms so they
|
38 |
+
know their rights.
|
39 |
+
|
40 |
+
Developers that use the GNU GPL protect your rights with two steps:
|
41 |
+
(1) assert copyright on the software, and (2) offer you this License
|
42 |
+
giving you legal permission to copy, distribute and/or modify it.
|
43 |
+
|
44 |
+
For the developers' and authors' protection, the GPL clearly explains
|
45 |
+
that there is no warranty for this free software. For both users' and
|
46 |
+
authors' sake, the GPL requires that modified versions be marked as
|
47 |
+
changed, so that their problems will not be attributed erroneously to
|
48 |
+
authors of previous versions.
|
49 |
+
|
50 |
+
Some devices are designed to deny users access to install or run
|
51 |
+
modified versions of the software inside them, although the manufacturer
|
52 |
+
can do so. This is fundamentally incompatible with the aim of
|
53 |
+
protecting users' freedom to change the software. The systematic
|
54 |
+
pattern of such abuse occurs in the area of products for individuals to
|
55 |
+
use, which is precisely where it is most unacceptable. Therefore, we
|
56 |
+
have designed this version of the GPL to prohibit the practice for those
|
57 |
+
products. If such problems arise substantially in other domains, we
|
58 |
+
stand ready to extend this provision to those domains in future versions
|
59 |
+
of the GPL, as needed to protect the freedom of users.
|
60 |
+
|
61 |
+
Finally, every program is threatened constantly by software patents.
|
62 |
+
States should not allow patents to restrict development and use of
|
63 |
+
software on general-purpose computers, but in those that do, we wish to
|
64 |
+
avoid the special danger that patents applied to a free program could
|
65 |
+
make it effectively proprietary. To prevent this, the GPL assures that
|
66 |
+
patents cannot be used to render the program non-free.
|
67 |
+
|
68 |
+
The precise terms and conditions for copying, distribution and
|
69 |
+
modification follow.
|
70 |
+
|
71 |
+
TERMS AND CONDITIONS
|
72 |
+
|
73 |
+
0. Definitions.
|
74 |
+
|
75 |
+
"This License" refers to version 3 of the GNU General Public License.
|
76 |
+
|
77 |
+
"Copyright" also means copyright-like laws that apply to other kinds of
|
78 |
+
works, such as semiconductor masks.
|
79 |
+
|
80 |
+
"The Program" refers to any copyrightable work licensed under this
|
81 |
+
License. Each licensee is addressed as "you". "Licensees" and
|
82 |
+
"recipients" may be individuals or organizations.
|
83 |
+
|
84 |
+
To "modify" a work means to copy from or adapt all or part of the work
|
85 |
+
in a fashion requiring copyright permission, other than the making of an
|
86 |
+
exact copy. The resulting work is called a "modified version" of the
|
87 |
+
earlier work or a work "based on" the earlier work.
|
88 |
+
|
89 |
+
A "covered work" means either the unmodified Program or a work based
|
90 |
+
on the Program.
|
91 |
+
|
92 |
+
To "propagate" a work means to do anything with it that, without
|
93 |
+
permission, would make you directly or secondarily liable for
|
94 |
+
infringement under applicable copyright law, except executing it on a
|
95 |
+
computer or modifying a private copy. Propagation includes copying,
|
96 |
+
distribution (with or without modification), making available to the
|
97 |
+
public, and in some countries other activities as well.
|
98 |
+
|
99 |
+
To "convey" a work means any kind of propagation that enables other
|
100 |
+
parties to make or receive copies. Mere interaction with a user through
|
101 |
+
a computer network, with no transfer of a copy, is not conveying.
|
102 |
+
|
103 |
+
An interactive user interface displays "Appropriate Legal Notices"
|
104 |
+
to the extent that it includes a convenient and prominently visible
|
105 |
+
feature that (1) displays an appropriate copyright notice, and (2)
|
106 |
+
tells the user that there is no warranty for the work (except to the
|
107 |
+
extent that warranties are provided), that licensees may convey the
|
108 |
+
work under this License, and how to view a copy of this License. If
|
109 |
+
the interface presents a list of user commands or options, such as a
|
110 |
+
menu, a prominent item in the list meets this criterion.
|
111 |
+
|
112 |
+
1. Source Code.
|
113 |
+
|
114 |
+
The "source code" for a work means the preferred form of the work
|
115 |
+
for making modifications to it. "Object code" means any non-source
|
116 |
+
form of a work.
|
117 |
+
|
118 |
+
A "Standard Interface" means an interface that either is an official
|
119 |
+
standard defined by a recognized standards body, or, in the case of
|
120 |
+
interfaces specified for a particular programming language, one that
|
121 |
+
is widely used among developers working in that language.
|
122 |
+
|
123 |
+
The "System Libraries" of an executable work include anything, other
|
124 |
+
than the work as a whole, that (a) is included in the normal form of
|
125 |
+
packaging a Major Component, but which is not part of that Major
|
126 |
+
Component, and (b) serves only to enable use of the work with that
|
127 |
+
Major Component, or to implement a Standard Interface for which an
|
128 |
+
implementation is available to the public in source code form. A
|
129 |
+
"Major Component", in this context, means a major essential component
|
130 |
+
(kernel, window system, and so on) of the specific operating system
|
131 |
+
(if any) on which the executable work runs, or a compiler used to
|
132 |
+
produce the work, or an object code interpreter used to run it.
|
133 |
+
|
134 |
+
The "Corresponding Source" for a work in object code form means all
|
135 |
+
the source code needed to generate, install, and (for an executable
|
136 |
+
work) run the object code and to modify the work, including scripts to
|
137 |
+
control those activities. However, it does not include the work's
|
138 |
+
System Libraries, or general-purpose tools or generally available free
|
139 |
+
programs which are used unmodified in performing those activities but
|
140 |
+
which are not part of the work. For example, Corresponding Source
|
141 |
+
includes interface definition files associated with source files for
|
142 |
+
the work, and the source code for shared libraries and dynamically
|
143 |
+
linked subprograms that the work is specifically designed to require,
|
144 |
+
such as by intimate data communication or control flow between those
|
145 |
+
subprograms and other parts of the work.
|
146 |
+
|
147 |
+
The Corresponding Source need not include anything that users
|
148 |
+
can regenerate automatically from other parts of the Corresponding
|
149 |
+
Source.
|
150 |
+
|
151 |
+
The Corresponding Source for a work in source code form is that
|
152 |
+
same work.
|
153 |
+
|
154 |
+
2. Basic Permissions.
|
155 |
+
|
156 |
+
All rights granted under this License are granted for the term of
|
157 |
+
copyright on the Program, and are irrevocable provided the stated
|
158 |
+
conditions are met. This License explicitly affirms your unlimited
|
159 |
+
permission to run the unmodified Program. The output from running a
|
160 |
+
covered work is covered by this License only if the output, given its
|
161 |
+
content, constitutes a covered work. This License acknowledges your
|
162 |
+
rights of fair use or other equivalent, as provided by copyright law.
|
163 |
+
|
164 |
+
You may make, run and propagate covered works that you do not
|
165 |
+
convey, without conditions so long as your license otherwise remains
|
166 |
+
in force. You may convey covered works to others for the sole purpose
|
167 |
+
of having them make modifications exclusively for you, or provide you
|
168 |
+
with facilities for running those works, provided that you comply with
|
169 |
+
the terms of this License in conveying all material for which you do
|
170 |
+
not control copyright. Those thus making or running the covered works
|
171 |
+
for you must do so exclusively on your behalf, under your direction
|
172 |
+
and control, on terms that prohibit them from making any copies of
|
173 |
+
your copyrighted material outside their relationship with you.
|
174 |
+
|
175 |
+
Conveying under any other circumstances is permitted solely under
|
176 |
+
the conditions stated below. Sublicensing is not allowed; section 10
|
177 |
+
makes it unnecessary.
|
178 |
+
|
179 |
+
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
180 |
+
|
181 |
+
No covered work shall be deemed part of an effective technological
|
182 |
+
measure under any applicable law fulfilling obligations under article
|
183 |
+
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
184 |
+
similar laws prohibiting or restricting circumvention of such
|
185 |
+
measures.
|
186 |
+
|
187 |
+
When you convey a covered work, you waive any legal power to forbid
|
188 |
+
circumvention of technological measures to the extent such circumvention
|
189 |
+
is effected by exercising rights under this License with respect to
|
190 |
+
the covered work, and you disclaim any intention to limit operation or
|
191 |
+
modification of the work as a means of enforcing, against the work's
|
192 |
+
users, your or third parties' legal rights to forbid circumvention of
|
193 |
+
technological measures.
|
194 |
+
|
195 |
+
4. Conveying Verbatim Copies.
|
196 |
+
|
197 |
+
You may convey verbatim copies of the Program's source code as you
|
198 |
+
receive it, in any medium, provided that you conspicuously and
|
199 |
+
appropriately publish on each copy an appropriate copyright notice;
|
200 |
+
keep intact all notices stating that this License and any
|
201 |
+
non-permissive terms added in accord with section 7 apply to the code;
|
202 |
+
keep intact all notices of the absence of any warranty; and give all
|
203 |
+
recipients a copy of this License along with the Program.
|
204 |
+
|
205 |
+
You may charge any price or no price for each copy that you convey,
|
206 |
+
and you may offer support or warranty protection for a fee.
|
207 |
+
|
208 |
+
5. Conveying Modified Source Versions.
|
209 |
+
|
210 |
+
You may convey a work based on the Program, or the modifications to
|
211 |
+
produce it from the Program, in the form of source code under the
|
212 |
+
terms of section 4, provided that you also meet all of these conditions:
|
213 |
+
|
214 |
+
a) The work must carry prominent notices stating that you modified
|
215 |
+
it, and giving a relevant date.
|
216 |
+
|
217 |
+
b) The work must carry prominent notices stating that it is
|
218 |
+
released under this License and any conditions added under section
|
219 |
+
7. This requirement modifies the requirement in section 4 to
|
220 |
+
"keep intact all notices".
|
221 |
+
|
222 |
+
c) You must license the entire work, as a whole, under this
|
223 |
+
License to anyone who comes into possession of a copy. This
|
224 |
+
License will therefore apply, along with any applicable section 7
|
225 |
+
additional terms, to the whole of the work, and all its parts,
|
226 |
+
regardless of how they are packaged. This License gives no
|
227 |
+
permission to license the work in any other way, but it does not
|
228 |
+
invalidate such permission if you have separately received it.
|
229 |
+
|
230 |
+
d) If the work has interactive user interfaces, each must display
|
231 |
+
Appropriate Legal Notices; however, if the Program has interactive
|
232 |
+
interfaces that do not display Appropriate Legal Notices, your
|
233 |
+
work need not make them do so.
|
234 |
+
|
235 |
+
A compilation of a covered work with other separate and independent
|
236 |
+
works, which are not by their nature extensions of the covered work,
|
237 |
+
and which are not combined with it such as to form a larger program,
|
238 |
+
in or on a volume of a storage or distribution medium, is called an
|
239 |
+
"aggregate" if the compilation and its resulting copyright are not
|
240 |
+
used to limit the access or legal rights of the compilation's users
|
241 |
+
beyond what the individual works permit. Inclusion of a covered work
|
242 |
+
in an aggregate does not cause this License to apply to the other
|
243 |
+
parts of the aggregate.
|
244 |
+
|
245 |
+
6. Conveying Non-Source Forms.
|
246 |
+
|
247 |
+
You may convey a covered work in object code form under the terms
|
248 |
+
of sections 4 and 5, provided that you also convey the
|
249 |
+
machine-readable Corresponding Source under the terms of this License,
|
250 |
+
in one of these ways:
|
251 |
+
|
252 |
+
a) Convey the object code in, or embodied in, a physical product
|
253 |
+
(including a physical distribution medium), accompanied by the
|
254 |
+
Corresponding Source fixed on a durable physical medium
|
255 |
+
customarily used for software interchange.
|
256 |
+
|
257 |
+
b) Convey the object code in, or embodied in, a physical product
|
258 |
+
(including a physical distribution medium), accompanied by a
|
259 |
+
written offer, valid for at least three years and valid for as
|
260 |
+
long as you offer spare parts or customer support for that product
|
261 |
+
model, to give anyone who possesses the object code either (1) a
|
262 |
+
copy of the Corresponding Source for all the software in the
|
263 |
+
product that is covered by this License, on a durable physical
|
264 |
+
medium customarily used for software interchange, for a price no
|
265 |
+
more than your reasonable cost of physically performing this
|
266 |
+
conveying of source, or (2) access to copy the
|
267 |
+
Corresponding Source from a network server at no charge.
|
268 |
+
|
269 |
+
c) Convey individual copies of the object code with a copy of the
|
270 |
+
written offer to provide the Corresponding Source. This
|
271 |
+
alternative is allowed only occasionally and noncommercially, and
|
272 |
+
only if you received the object code with such an offer, in accord
|
273 |
+
with subsection 6b.
|
274 |
+
|
275 |
+
d) Convey the object code by offering access from a designated
|
276 |
+
place (gratis or for a charge), and offer equivalent access to the
|
277 |
+
Corresponding Source in the same way through the same place at no
|
278 |
+
further charge. You need not require recipients to copy the
|
279 |
+
Corresponding Source along with the object code. If the place to
|
280 |
+
copy the object code is a network server, the Corresponding Source
|
281 |
+
may be on a different server (operated by you or a third party)
|
282 |
+
that supports equivalent copying facilities, provided you maintain
|
283 |
+
clear directions next to the object code saying where to find the
|
284 |
+
Corresponding Source. Regardless of what server hosts the
|
285 |
+
Corresponding Source, you remain obligated to ensure that it is
|
286 |
+
available for as long as needed to satisfy these requirements.
|
287 |
+
|
288 |
+
e) Convey the object code using peer-to-peer transmission, provided
|
289 |
+
you inform other peers where the object code and Corresponding
|
290 |
+
Source of the work are being offered to the general public at no
|
291 |
+
charge under subsection 6d.
|
292 |
+
|
293 |
+
A separable portion of the object code, whose source code is excluded
|
294 |
+
from the Corresponding Source as a System Library, need not be
|
295 |
+
included in conveying the object code work.
|
296 |
+
|
297 |
+
A "User Product" is either (1) a "consumer product", which means any
|
298 |
+
tangible personal property which is normally used for personal, family,
|
299 |
+
or household purposes, or (2) anything designed or sold for incorporation
|
300 |
+
into a dwelling. In determining whether a product is a consumer product,
|
301 |
+
doubtful cases shall be resolved in favor of coverage. For a particular
|
302 |
+
product received by a particular user, "normally used" refers to a
|
303 |
+
typical or common use of that class of product, regardless of the status
|
304 |
+
of the particular user or of the way in which the particular user
|
305 |
+
actually uses, or expects or is expected to use, the product. A product
|
306 |
+
is a consumer product regardless of whether the product has substantial
|
307 |
+
commercial, industrial or non-consumer uses, unless such uses represent
|
308 |
+
the only significant mode of use of the product.
|
309 |
+
|
310 |
+
"Installation Information" for a User Product means any methods,
|
311 |
+
procedures, authorization keys, or other information required to install
|
312 |
+
and execute modified versions of a covered work in that User Product from
|
313 |
+
a modified version of its Corresponding Source. The information must
|
314 |
+
suffice to ensure that the continued functioning of the modified object
|
315 |
+
code is in no case prevented or interfered with solely because
|
316 |
+
modification has been made.
|
317 |
+
|
318 |
+
If you convey an object code work under this section in, or with, or
|
319 |
+
specifically for use in, a User Product, and the conveying occurs as
|
320 |
+
part of a transaction in which the right of possession and use of the
|
321 |
+
User Product is transferred to the recipient in perpetuity or for a
|
322 |
+
fixed term (regardless of how the transaction is characterized), the
|
323 |
+
Corresponding Source conveyed under this section must be accompanied
|
324 |
+
by the Installation Information. But this requirement does not apply
|
325 |
+
if neither you nor any third party retains the ability to install
|
326 |
+
modified object code on the User Product (for example, the work has
|
327 |
+
been installed in ROM).
|
328 |
+
|
329 |
+
The requirement to provide Installation Information does not include a
|
330 |
+
requirement to continue to provide support service, warranty, or updates
|
331 |
+
for a work that has been modified or installed by the recipient, or for
|
332 |
+
the User Product in which it has been modified or installed. Access to a
|
333 |
+
network may be denied when the modification itself materially and
|
334 |
+
adversely affects the operation of the network or violates the rules and
|
335 |
+
protocols for communication across the network.
|
336 |
+
|
337 |
+
Corresponding Source conveyed, and Installation Information provided,
|
338 |
+
in accord with this section must be in a format that is publicly
|
339 |
+
documented (and with an implementation available to the public in
|
340 |
+
source code form), and must require no special password or key for
|
341 |
+
unpacking, reading or copying.
|
342 |
+
|
343 |
+
7. Additional Terms.
|
344 |
+
|
345 |
+
"Additional permissions" are terms that supplement the terms of this
|
346 |
+
License by making exceptions from one or more of its conditions.
|
347 |
+
Additional permissions that are applicable to the entire Program shall
|
348 |
+
be treated as though they were included in this License, to the extent
|
349 |
+
that they are valid under applicable law. If additional permissions
|
350 |
+
apply only to part of the Program, that part may be used separately
|
351 |
+
under those permissions, but the entire Program remains governed by
|
352 |
+
this License without regard to the additional permissions.
|
353 |
+
|
354 |
+
When you convey a copy of a covered work, you may at your option
|
355 |
+
remove any additional permissions from that copy, or from any part of
|
356 |
+
it. (Additional permissions may be written to require their own
|
357 |
+
removal in certain cases when you modify the work.) You may place
|
358 |
+
additional permissions on material, added by you to a covered work,
|
359 |
+
for which you have or can give appropriate copyright permission.
|
360 |
+
|
361 |
+
Notwithstanding any other provision of this License, for material you
|
362 |
+
add to a covered work, you may (if authorized by the copyright holders of
|
363 |
+
that material) supplement the terms of this License with terms:
|
364 |
+
|
365 |
+
a) Disclaiming warranty or limiting liability differently from the
|
366 |
+
terms of sections 15 and 16 of this License; or
|
367 |
+
|
368 |
+
b) Requiring preservation of specified reasonable legal notices or
|
369 |
+
author attributions in that material or in the Appropriate Legal
|
370 |
+
Notices displayed by works containing it; or
|
371 |
+
|
372 |
+
c) Prohibiting misrepresentation of the origin of that material, or
|
373 |
+
requiring that modified versions of such material be marked in
|
374 |
+
reasonable ways as different from the original version; or
|
375 |
+
|
376 |
+
d) Limiting the use for publicity purposes of names of licensors or
|
377 |
+
authors of the material; or
|
378 |
+
|
379 |
+
e) Declining to grant rights under trademark law for use of some
|
380 |
+
trade names, trademarks, or service marks; or
|
381 |
+
|
382 |
+
f) Requiring indemnification of licensors and authors of that
|
383 |
+
material by anyone who conveys the material (or modified versions of
|
384 |
+
it) with contractual assumptions of liability to the recipient, for
|
385 |
+
any liability that these contractual assumptions directly impose on
|
386 |
+
those licensors and authors.
|
387 |
+
|
388 |
+
All other non-permissive additional terms are considered "further
|
389 |
+
restrictions" within the meaning of section 10. If the Program as you
|
390 |
+
received it, or any part of it, contains a notice stating that it is
|
391 |
+
governed by this License along with a term that is a further
|
392 |
+
restriction, you may remove that term. If a license document contains
|
393 |
+
a further restriction but permits relicensing or conveying under this
|
394 |
+
License, you may add to a covered work material governed by the terms
|
395 |
+
of that license document, provided that the further restriction does
|
396 |
+
not survive such relicensing or conveying.
|
397 |
+
|
398 |
+
If you add terms to a covered work in accord with this section, you
|
399 |
+
must place, in the relevant source files, a statement of the
|
400 |
+
additional terms that apply to those files, or a notice indicating
|
401 |
+
where to find the applicable terms.
|
402 |
+
|
403 |
+
Additional terms, permissive or non-permissive, may be stated in the
|
404 |
+
form of a separately written license, or stated as exceptions;
|
405 |
+
the above requirements apply either way.
|
406 |
+
|
407 |
+
8. Termination.
|
408 |
+
|
409 |
+
You may not propagate or modify a covered work except as expressly
|
410 |
+
provided under this License. Any attempt otherwise to propagate or
|
411 |
+
modify it is void, and will automatically terminate your rights under
|
412 |
+
this License (including any patent licenses granted under the third
|
413 |
+
paragraph of section 11).
|
414 |
+
|
415 |
+
However, if you cease all violation of this License, then your
|
416 |
+
license from a particular copyright holder is reinstated (a)
|
417 |
+
provisionally, unless and until the copyright holder explicitly and
|
418 |
+
finally terminates your license, and (b) permanently, if the copyright
|
419 |
+
holder fails to notify you of the violation by some reasonable means
|
420 |
+
prior to 60 days after the cessation.
|
421 |
+
|
422 |
+
Moreover, your license from a particular copyright holder is
|
423 |
+
reinstated permanently if the copyright holder notifies you of the
|
424 |
+
violation by some reasonable means, this is the first time you have
|
425 |
+
received notice of violation of this License (for any work) from that
|
426 |
+
copyright holder, and you cure the violation prior to 30 days after
|
427 |
+
your receipt of the notice.
|
428 |
+
|
429 |
+
Termination of your rights under this section does not terminate the
|
430 |
+
licenses of parties who have received copies or rights from you under
|
431 |
+
this License. If your rights have been terminated and not permanently
|
432 |
+
reinstated, you do not qualify to receive new licenses for the same
|
433 |
+
material under section 10.
|
434 |
+
|
435 |
+
9. Acceptance Not Required for Having Copies.
|
436 |
+
|
437 |
+
You are not required to accept this License in order to receive or
|
438 |
+
run a copy of the Program. Ancillary propagation of a covered work
|
439 |
+
occurring solely as a consequence of using peer-to-peer transmission
|
440 |
+
to receive a copy likewise does not require acceptance. However,
|
441 |
+
nothing other than this License grants you permission to propagate or
|
442 |
+
modify any covered work. These actions infringe copyright if you do
|
443 |
+
not accept this License. Therefore, by modifying or propagating a
|
444 |
+
covered work, you indicate your acceptance of this License to do so.
|
445 |
+
|
446 |
+
10. Automatic Licensing of Downstream Recipients.
|
447 |
+
|
448 |
+
Each time you convey a covered work, the recipient automatically
|
449 |
+
receives a license from the original licensors, to run, modify and
|
450 |
+
propagate that work, subject to this License. You are not responsible
|
451 |
+
for enforcing compliance by third parties with this License.
|
452 |
+
|
453 |
+
An "entity transaction" is a transaction transferring control of an
|
454 |
+
organization, or substantially all assets of one, or subdividing an
|
455 |
+
organization, or merging organizations. If propagation of a covered
|
456 |
+
work results from an entity transaction, each party to that
|
457 |
+
transaction who receives a copy of the work also receives whatever
|
458 |
+
licenses to the work the party's predecessor in interest had or could
|
459 |
+
give under the previous paragraph, plus a right to possession of the
|
460 |
+
Corresponding Source of the work from the predecessor in interest, if
|
461 |
+
the predecessor has it or can get it with reasonable efforts.
|
462 |
+
|
463 |
+
You may not impose any further restrictions on the exercise of the
|
464 |
+
rights granted or affirmed under this License. For example, you may
|
465 |
+
not impose a license fee, royalty, or other charge for exercise of
|
466 |
+
rights granted under this License, and you may not initiate litigation
|
467 |
+
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
468 |
+
any patent claim is infringed by making, using, selling, offering for
|
469 |
+
sale, or importing the Program or any portion of it.
|
470 |
+
|
471 |
+
11. Patents.
|
472 |
+
|
473 |
+
A "contributor" is a copyright holder who authorizes use under this
|
474 |
+
License of the Program or a work on which the Program is based. The
|
475 |
+
work thus licensed is called the contributor's "contributor version".
|
476 |
+
|
477 |
+
A contributor's "essential patent claims" are all patent claims
|
478 |
+
owned or controlled by the contributor, whether already acquired or
|
479 |
+
hereafter acquired, that would be infringed by some manner, permitted
|
480 |
+
by this License, of making, using, or selling its contributor version,
|
481 |
+
but do not include claims that would be infringed only as a
|
482 |
+
consequence of further modification of the contributor version. For
|
483 |
+
purposes of this definition, "control" includes the right to grant
|
484 |
+
patent sublicenses in a manner consistent with the requirements of
|
485 |
+
this License.
|
486 |
+
|
487 |
+
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
488 |
+
patent license under the contributor's essential patent claims, to
|
489 |
+
make, use, sell, offer for sale, import and otherwise run, modify and
|
490 |
+
propagate the contents of its contributor version.
|
491 |
+
|
492 |
+
In the following three paragraphs, a "patent license" is any express
|
493 |
+
agreement or commitment, however denominated, not to enforce a patent
|
494 |
+
(such as an express permission to practice a patent or covenant not to
|
495 |
+
sue for patent infringement). To "grant" such a patent license to a
|
496 |
+
party means to make such an agreement or commitment not to enforce a
|
497 |
+
patent against the party.
|
498 |
+
|
499 |
+
If you convey a covered work, knowingly relying on a patent license,
|
500 |
+
and the Corresponding Source of the work is not available for anyone
|
501 |
+
to copy, free of charge and under the terms of this License, through a
|
502 |
+
publicly available network server or other readily accessible means,
|
503 |
+
then you must either (1) cause the Corresponding Source to be so
|
504 |
+
available, or (2) arrange to deprive yourself of the benefit of the
|
505 |
+
patent license for this particular work, or (3) arrange, in a manner
|
506 |
+
consistent with the requirements of this License, to extend the patent
|
507 |
+
license to downstream recipients. "Knowingly relying" means you have
|
508 |
+
actual knowledge that, but for the patent license, your conveying the
|
509 |
+
covered work in a country, or your recipient's use of the covered work
|
510 |
+
in a country, would infringe one or more identifiable patents in that
|
511 |
+
country that you have reason to believe are valid.
|
512 |
+
|
513 |
+
If, pursuant to or in connection with a single transaction or
|
514 |
+
arrangement, you convey, or propagate by procuring conveyance of, a
|
515 |
+
covered work, and grant a patent license to some of the parties
|
516 |
+
receiving the covered work authorizing them to use, propagate, modify
|
517 |
+
or convey a specific copy of the covered work, then the patent license
|
518 |
+
you grant is automatically extended to all recipients of the covered
|
519 |
+
work and works based on it.
|
520 |
+
|
521 |
+
A patent license is "discriminatory" if it does not include within
|
522 |
+
the scope of its coverage, prohibits the exercise of, or is
|
523 |
+
conditioned on the non-exercise of one or more of the rights that are
|
524 |
+
specifically granted under this License. You may not convey a covered
|
525 |
+
work if you are a party to an arrangement with a third party that is
|
526 |
+
in the business of distributing software, under which you make payment
|
527 |
+
to the third party based on the extent of your activity of conveying
|
528 |
+
the work, and under which the third party grants, to any of the
|
529 |
+
parties who would receive the covered work from you, a discriminatory
|
530 |
+
patent license (a) in connection with copies of the covered work
|
531 |
+
conveyed by you (or copies made from those copies), or (b) primarily
|
532 |
+
for and in connection with specific products or compilations that
|
533 |
+
contain the covered work, unless you entered into that arrangement,
|
534 |
+
or that patent license was granted, prior to 28 March 2007.
|
535 |
+
|
536 |
+
Nothing in this License shall be construed as excluding or limiting
|
537 |
+
any implied license or other defenses to infringement that may
|
538 |
+
otherwise be available to you under applicable patent law.
|
539 |
+
|
540 |
+
12. No Surrender of Others' Freedom.
|
541 |
+
|
542 |
+
If conditions are imposed on you (whether by court order, agreement or
|
543 |
+
otherwise) that contradict the conditions of this License, they do not
|
544 |
+
excuse you from the conditions of this License. If you cannot convey a
|
545 |
+
covered work so as to satisfy simultaneously your obligations under this
|
546 |
+
License and any other pertinent obligations, then as a consequence you may
|
547 |
+
not convey it at all. For example, if you agree to terms that obligate you
|
548 |
+
to collect a royalty for further conveying from those to whom you convey
|
549 |
+
the Program, the only way you could satisfy both those terms and this
|
550 |
+
License would be to refrain entirely from conveying the Program.
|
551 |
+
|
552 |
+
13. Use with the GNU Affero General Public License.
|
553 |
+
|
554 |
+
Notwithstanding any other provision of this License, you have
|
555 |
+
permission to link or combine any covered work with a work licensed
|
556 |
+
under version 3 of the GNU Affero General Public License into a single
|
557 |
+
combined work, and to convey the resulting work. The terms of this
|
558 |
+
License will continue to apply to the part which is the covered work,
|
559 |
+
but the special requirements of the GNU Affero General Public License,
|
560 |
+
section 13, concerning interaction through a network will apply to the
|
561 |
+
combination as such.
|
562 |
+
|
563 |
+
14. Revised Versions of this License.
|
564 |
+
|
565 |
+
The Free Software Foundation may publish revised and/or new versions of
|
566 |
+
the GNU General Public License from time to time. Such new versions will
|
567 |
+
be similar in spirit to the present version, but may differ in detail to
|
568 |
+
address new problems or concerns.
|
569 |
+
|
570 |
+
Each version is given a distinguishing version number. If the
|
571 |
+
Program specifies that a certain numbered version of the GNU General
|
572 |
+
Public License "or any later version" applies to it, you have the
|
573 |
+
option of following the terms and conditions either of that numbered
|
574 |
+
version or of any later version published by the Free Software
|
575 |
+
Foundation. If the Program does not specify a version number of the
|
576 |
+
GNU General Public License, you may choose any version ever published
|
577 |
+
by the Free Software Foundation.
|
578 |
+
|
579 |
+
If the Program specifies that a proxy can decide which future
|
580 |
+
versions of the GNU General Public License can be used, that proxy's
|
581 |
+
public statement of acceptance of a version permanently authorizes you
|
582 |
+
to choose that version for the Program.
|
583 |
+
|
584 |
+
Later license versions may give you additional or different
|
585 |
+
permissions. However, no additional obligations are imposed on any
|
586 |
+
author or copyright holder as a result of your choosing to follow a
|
587 |
+
later version.
|
588 |
+
|
589 |
+
15. Disclaimer of Warranty.
|
590 |
+
|
591 |
+
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
592 |
+
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
593 |
+
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
594 |
+
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
595 |
+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
596 |
+
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
597 |
+
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
598 |
+
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
599 |
+
|
600 |
+
16. Limitation of Liability.
|
601 |
+
|
602 |
+
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
603 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
604 |
+
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
605 |
+
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
606 |
+
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
607 |
+
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
608 |
+
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
609 |
+
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
610 |
+
SUCH DAMAGES.
|
611 |
+
|
612 |
+
17. Interpretation of Sections 15 and 16.
|
613 |
+
|
614 |
+
If the disclaimer of warranty and limitation of liability provided
|
615 |
+
above cannot be given local legal effect according to their terms,
|
616 |
+
reviewing courts shall apply local law that most closely approximates
|
617 |
+
an absolute waiver of all civil liability in connection with the
|
618 |
+
Program, unless a warranty or assumption of liability accompanies a
|
619 |
+
copy of the Program in return for a fee.
|
620 |
+
|
621 |
+
END OF TERMS AND CONDITIONS
|
622 |
+
|
623 |
+
How to Apply These Terms to Your New Programs
|
624 |
+
|
625 |
+
If you develop a new program, and you want it to be of the greatest
|
626 |
+
possible use to the public, the best way to achieve this is to make it
|
627 |
+
free software which everyone can redistribute and change under these terms.
|
628 |
+
|
629 |
+
To do so, attach the following notices to the program. It is safest
|
630 |
+
to attach them to the start of each source file to most effectively
|
631 |
+
state the exclusion of warranty; and each file should have at least
|
632 |
+
the "copyright" line and a pointer to where the full notice is found.
|
633 |
+
|
634 |
+
<one line to give the program's name and a brief idea of what it does.>
|
635 |
+
Copyright (C) <year> <name of author>
|
636 |
+
|
637 |
+
This program is free software: you can redistribute it and/or modify
|
638 |
+
it under the terms of the GNU General Public License as published by
|
639 |
+
the Free Software Foundation, either version 3 of the License, or
|
640 |
+
(at your option) any later version.
|
641 |
+
|
642 |
+
This program is distributed in the hope that it will be useful,
|
643 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
644 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
645 |
+
GNU General Public License for more details.
|
646 |
+
|
647 |
+
You should have received a copy of the GNU General Public License
|
648 |
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
649 |
+
|
650 |
+
Also add information on how to contact you by electronic and paper mail.
|
651 |
+
|
652 |
+
If the program does terminal interaction, make it output a short
|
653 |
+
notice like this when it starts in an interactive mode:
|
654 |
+
|
655 |
+
<program> Copyright (C) <year> <name of author>
|
656 |
+
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
657 |
+
This is free software, and you are welcome to redistribute it
|
658 |
+
under certain conditions; type `show c' for details.
|
659 |
+
|
660 |
+
The hypothetical commands `show w' and `show c' should show the appropriate
|
661 |
+
parts of the General Public License. Of course, your program's commands
|
662 |
+
might be different; for a GUI interface, you would use an "about box".
|
663 |
+
|
664 |
+
You should also get your employer (if you work as a programmer) or school,
|
665 |
+
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
666 |
+
For more information on this, and how to apply and follow the GNU GPL, see
|
667 |
+
<https://www.gnu.org/licenses/>.
|
668 |
+
|
669 |
+
The GNU General Public License does not permit incorporating your program
|
670 |
+
into proprietary programs. If your program is a subroutine library, you
|
671 |
+
may consider it more useful to permit linking proprietary applications with
|
672 |
+
the library. If this is what you want to do, use the GNU Lesser General
|
673 |
+
Public License instead of this License. But first, please read
|
674 |
+
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
README.md
CHANGED
@@ -1,10 +1,200 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Yunzai-Bot-Web
|
2 |
+
|
3 |
+
> 基于 Web 的 Yunzai-Bot 发行版,不依赖 QQ,极易部署!
|
4 |
+
|
5 |
+
Yunzai-Bot 是查询原神游戏信息的 QQ 机器人,但是 QQ 登录比较麻烦(小号、扫码、要求和设备同局域网..)。对于单纯只想查询原神面板信息的用户来说,或许并不想处理 QQ 登录的问题。
|
6 |
+
|
7 |
+
**Yunzai-Bot-Web** 提供了一种更轻量的部署方案!通过解除 Yunzai-Bot 对 QQ 的依赖,**Yunzai-Bot-Web** 可以进行零手工配置的部署,一行 `docker compose up -d` 即可开始使用~
|
8 |
+
|
9 |
+
![demo](./doc/assets/demo.png)
|
10 |
+
|
11 |
+
## 快速上手
|
12 |
+
|
13 |
+
安装最新版本的 [Docker](https://docs.docker.com/engine/install/)
|
14 |
+
|
15 |
+
在合适的文件夹下新建 [docker-compose.yml](https://github.com/117503445/yunzai-bot-web/blob/master/docker-compose.yml)
|
16 |
+
|
17 |
+
```yaml
|
18 |
+
version: '3'
|
19 |
+
|
20 |
+
services:
|
21 |
+
yunzai-web:
|
22 |
+
image: registry.cn-hangzhou.aliyuncs.com/117503445-mirror/yunzai-web
|
23 |
+
container_name: yunzai-web
|
24 |
+
restart: unless-stopped
|
25 |
+
ports:
|
26 |
+
- 8080:8080
|
27 |
+
depends_on:
|
28 |
+
redis:
|
29 |
+
condition: service_healthy
|
30 |
+
volumes:
|
31 |
+
- ./data/yunzai-web/yunzai-bot-data:/workspace/Yunzai-Bot/data # data of `Yunzai-Bot`
|
32 |
+
- ./data/yunzai-web/be-images:/workspace/Yunzai-Bot/web-data/images # images of backend
|
33 |
+
|
34 |
+
- ./config/plugins:/workspace/Yunzai-Bot/user_plugins # plugins of `Yunzai-Bot`
|
35 |
+
# - ./config/config.json:/workspace/Yunzai-Bot/config.json # config of backend, unconment this line when config.json is provided
|
36 |
+
|
37 |
+
- ./dev-data/vsc:/root/.vscode-server # vscode-server cache
|
38 |
+
redis:
|
39 |
+
image: registry.cn-hangzhou.aliyuncs.com/117503445-mirror/redis:alpine
|
40 |
+
restart: unless-stopped
|
41 |
+
volumes:
|
42 |
+
- ./data/redis/data:/data
|
43 |
+
- ./data/redis/logs:/logs
|
44 |
+
healthcheck:
|
45 |
+
test: [ "CMD", "redis-cli", "PING" ]
|
46 |
+
start_period: 10s
|
47 |
+
interval: 5s
|
48 |
+
timeout: 1s
|
49 |
+
```
|
50 |
+
|
51 |
+
在此文件夹下运行命令
|
52 |
+
|
53 |
+
```sh
|
54 |
+
docker compose up -d
|
55 |
+
```
|
56 |
+
|
57 |
+
访问 <http://localhost:8080>
|
58 |
+
|
59 |
+
Enjoy :)
|
60 |
+
|
61 |
+
## 使用技巧
|
62 |
+
|
63 |
+
### 插件管理
|
64 |
+
|
65 |
+
以 [miao-plugin](https://gitee.com/yoimiya-kokomi/miao-plugin) 插件为例
|
66 |
+
|
67 |
+
#### 插件安装
|
68 |
+
|
69 |
+
先将插件下载至 `./config/plugins/` 目录
|
70 |
+
|
71 |
+
```sh
|
72 |
+
git clone --depth=1 https://gitee.com/yoimiya-kokomi/miao-plugin.git ./config/plugins/miao-plugin
|
73 |
+
```
|
74 |
+
|
75 |
+
重启容器,应用插件更新
|
76 |
+
|
77 |
+
```sh
|
78 |
+
docker compose down && docker compose up -d
|
79 |
+
```
|
80 |
+
|
81 |
+
#### 插件升级
|
82 |
+
|
83 |
+
拉取更改
|
84 |
+
|
85 |
+
```sh
|
86 |
+
cd ./config/plugins/miao-plugin
|
87 |
+
git pull
|
88 |
+
```
|
89 |
+
|
90 |
+
重启容器,应用插件更新
|
91 |
+
|
92 |
+
```sh
|
93 |
+
docker compose down && docker compose up -d
|
94 |
+
```
|
95 |
+
|
96 |
+
|
97 |
+
### 帮助
|
98 |
+
|
99 |
+
输入 `#帮助` 查看 Yunzai 的帮助
|
100 |
+
|
101 |
+
输入 `#喵喵帮助` 查看喵喵插件的帮助
|
102 |
+
|
103 |
+
![help](./doc/assets/help.png)
|
104 |
+
|
105 |
+
### 绑定 uid
|
106 |
+
|
107 |
+
![bind-uid](./doc/assets/bind-uid.png)
|
108 |
+
|
109 |
+
### 绑定 ck
|
110 |
+
|
111 |
+
ck 指的是 [米游社](https://www.miyoushe.com/ys) 的 cookie。Yunzai 在进行某些信息查询时需要用到 ck。
|
112 |
+
|
113 |
+
#### 油猴脚本[推荐]
|
114 |
+
|
115 |
+
可以通过油猴脚本,便捷的将 ck 发送至 Yunzai-Web。
|
116 |
+
|
117 |
+
详情见 <https://github.com/117503445/yunzai-bot-web/tree/master/script/miyoushe-token-sender>
|
118 |
+
|
119 |
+
#### 手动
|
120 |
+
|
121 |
+
在电脑上,登录 [米游社](https://www.miyoushe.com/ys),打开浏览器的开发者工具,抓包,得到 cookie
|
122 |
+
|
123 |
+
![get-ck](./doc/assets/get-ck.png)
|
124 |
+
|
125 |
+
然后将 cookie 直接发送即可完成绑定
|
126 |
+
|
127 |
+
![bind-ck](./doc/assets/bind-ck.png)
|
128 |
+
|
129 |
+
### 多用户
|
130 |
+
|
131 |
+
默认情况下 **Yunzai-Bot-Web** 只支持单个原神用户。可以通过本节的配置,开启安全的多原神用户功能。
|
132 |
+
|
133 |
+
准备配置文件 `./config/config.json`
|
134 |
+
|
135 |
+
以下为配置文件示例。
|
136 |
+
|
137 |
+
```json
|
138 |
+
{
|
139 |
+
"multiUser": false,
|
140 |
+
"users": {
|
141 |
+
"user1": {
|
142 |
+
"password": "pass1",
|
143 |
+
"qq": "10000000"
|
144 |
+
},
|
145 |
+
"user2": {
|
146 |
+
"password": "pass2",
|
147 |
+
"qq": "10000001"
|
148 |
+
}
|
149 |
+
}
|
150 |
+
}
|
151 |
+
```
|
152 |
+
|
153 |
+
定义了 2 个用户,分别是
|
154 |
+
|
155 |
+
- 用户名 user1 密码 pass1 QQ号 10000000
|
156 |
+
- 用户名 user2 密码 pass2 QQ号 10000001
|
157 |
+
|
158 |
+
QQ号字段不要求和真实 QQ 号一致,只要不同用户的 QQ 字段互相不同即可。其中 `10000000` 是 magic number, 表示 `user1` 是管理员。因为 `10000001` 不是 `10000000`, 所以 `user2` 是普通用户。
|
159 |
+
|
160 |
+
然后挂载配置文件即可
|
161 |
+
|
162 |
+
```yaml
|
163 |
+
volumes:
|
164 |
+
- ./config/config.json:/workspace/Yunzai-Bot/config.json
|
165 |
+
```
|
166 |
+
|
167 |
+
目前采用了 Basic Auth 方案,建议在网关上配置 HTTPS 以保障安全性。
|
168 |
+
|
169 |
+
### 米游社验证
|
170 |
+
|
171 |
+
当使用 `#体力` 等米游社功能,出现米游社验证错误时,代表当前账号被米游社风控系统盯上了。可以下载胡桃工具箱,登录自己账号后,点击 实时便笺 - 验证当前用户与角色,就能解决米游社账号的风控问题了。
|
172 |
+
|
173 |
+
可以参考 [胡桃工具箱文档](https://hut.ao/zh/advanced/exceptions.html#%E7%8A%B6%E6%80%81-1034-%E9%AA%8C%E8%AF%81%E5%A4%B1%E8%B4%A5)
|
174 |
+
|
175 |
+
### 镜像更新
|
176 |
+
|
177 |
+
当 `Yunzai-Bot` 或 `yunzai-bot-web` 更新时,需要通过本节描述的方法进行镜像更新。其中 `Yunzai-Bot` 基本已经停更了;`yunzai-bot-web` 修 bug 或者增添新功能(比较少见) 时会更新。
|
178 |
+
|
179 |
+
```sh
|
180 |
+
docker compose pull
|
181 |
+
docker compose up -d
|
182 |
+
```
|
183 |
+
|
184 |
+
### 脚本开发
|
185 |
+
|
186 |
+
可以编写脚本,进行一些自动化操作。例如 [yunzai-web-downloader](./script/yunzai-web-downloader/) 下载指定角色的面板、圣遗物,就不需要手动在 Web 面板上一个个问过来了。
|
187 |
+
|
188 |
+
### 调试
|
189 |
+
|
190 |
+
当 `yunzai-web` 出现非预期的故障时,需要进行调试。具体方法参考 [调试方法](./doc/dev.md)。
|
191 |
+
|
192 |
+
## 致谢
|
193 |
+
|
194 |
+
[Yunzai-Bot](https://gitee.com/Le-niao/Yunzai-Bot.git) 提供机器人框架
|
195 |
+
|
196 |
+
[miao-plugin](https://github.com/yoimiya-kokomi/miao-plugin.git) 提供高质量的原神信息查询插件
|
197 |
+
|
198 |
+
[chatgpt-web](https://github.com/Chanzhaoyu/chatgpt-web) 提供前端的基础框架
|
199 |
+
|
200 |
+
[胡桃工具箱](https://hut.ao/zh/) 提供米游社验证解决方案
|
config.json.example
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"multiUser": true,
|
3 |
+
"users": {
|
4 |
+
"user1": {
|
5 |
+
"password": "pass1",
|
6 |
+
"qq": 805475874
|
7 |
+
},
|
8 |
+
"user2": {
|
9 |
+
"password": "pass2",
|
10 |
+
"qq": 805475875
|
11 |
+
}
|
12 |
+
}
|
13 |
+
}
|
doc/assets/bind-ck.png
ADDED
![]() |
doc/assets/bind-uid.png
ADDED
![]() |
doc/assets/demo.png
ADDED
![]() |
Git LFS Details
|
doc/assets/get-ck.png
ADDED
![]() |
doc/assets/help.png
ADDED
![]() |
Git LFS Details
|
doc/dev.md
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# 开发技巧
|
2 |
+
|
3 |
+
## 调试方法
|
4 |
+
|
5 |
+
先在 `docker-compose.yml` 中添加
|
6 |
+
|
7 |
+
```yaml
|
8 |
+
entrypoint: /bin/bash
|
9 |
+
stdin_open: true # docker run -i
|
10 |
+
tty: true # docker run -t
|
11 |
+
```
|
12 |
+
|
13 |
+
attach 到容器中,修改代码
|
14 |
+
|
15 |
+
启动服务
|
16 |
+
|
17 |
+
```sh
|
18 |
+
node ./lib/tools/server.js
|
19 |
+
```
|
20 |
+
|
21 |
+
## 本地构建
|
22 |
+
|
23 |
+
```sh
|
24 |
+
docker build -t 117503445/yunzai-bot .
|
25 |
+
docker push 117503445/yunzai-bot
|
26 |
+
docker tag 117503445/yunzai-bot registry.cn-hangzhou.aliyuncs.com/117503445-mirror/yunzai-web
|
27 |
+
docker push registry.cn-hangzhou.aliyuncs.com/117503445-mirror/yunzai-web
|
28 |
+
```
|
29 |
+
|
30 |
+
## 本地开发
|
31 |
+
|
32 |
+
在项目根目录执行
|
33 |
+
|
34 |
+
```sh
|
35 |
+
docker compose -f doc/docker/docker-compose.yml up --build
|
36 |
+
```
|
37 |
+
|
38 |
+
会在 `doc/docker` 目录下生成 `data` `config` `dev-data` 目录,其中 `dev-data` 用来储存镜像中的 VSCode Server 缓存等数据
|
39 |
+
|
40 |
+
可以通过 `http://localhost:8080` 访问项目
|
doc/docker/.gitignore
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
config
|
2 |
+
data
|
3 |
+
dev-data
|
doc/docker/Dockerfile
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM node:lts-slim AS fe-builder
|
2 |
+
|
3 |
+
COPY src/yunzai-web-fe /workspace/yunzai-web-fe
|
4 |
+
WORKDIR /workspace/yunzai-web-fe
|
5 |
+
RUN npm install pnpm -g && pnpm install && pnpm run build
|
6 |
+
|
7 |
+
FROM node:lts-slim AS runtime
|
8 |
+
|
9 |
+
RUN apt-get update \
|
10 |
+
&& apt-get upgrade -y \
|
11 |
+
&& apt-get install -y curl wget gnupg git python3-pip fonts-wqy-microhei xfonts-utils chromium fontconfig libxss1 libgl1 \
|
12 |
+
&& apt-get autoremove \
|
13 |
+
&& apt-get clean
|
14 |
+
|
15 |
+
RUN fc-cache -f -v
|
16 |
+
RUN npm install pnpm -g
|
17 |
+
RUN ln -s /usr/bin/python3 /usr/bin/python \
|
18 |
+
&& curl -fsSL https://install.python-poetry.org | python - \
|
19 |
+
&& ln -s /$HOME/.local/bin/poetry /usr/bin \
|
20 |
+
&& poetry config virtualenvs.in-project true
|
21 |
+
RUN rm -rf /var/cache/* \
|
22 |
+
&& rm -rf /tmp/*
|
23 |
+
|
24 |
+
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \
|
25 |
+
PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
|
26 |
+
|
27 |
+
COPY src/Yunzai-Bot /workspace/Yunzai-Bot
|
28 |
+
COPY --from=fe-builder /workspace/yunzai-web-fe/dist /workspace/Yunzai-Bot/web-data
|
29 |
+
|
30 |
+
WORKDIR /workspace/Yunzai-Bot
|
31 |
+
RUN pnpm install && pnpm add image-size fastify @fastify/static @fastify/cors @fastify/basic-auth uuid -w && mkdir ./data
|
32 |
+
EXPOSE 8080
|
33 |
+
ENTRYPOINT [ "./docker-entrypoint.py" ]
|
doc/docker/docker-compose.yml
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
version: '3'
|
2 |
+
|
3 |
+
services:
|
4 |
+
yunzai-web-dev:
|
5 |
+
build:
|
6 |
+
context: ../../
|
7 |
+
dockerfile: doc/docker/Dockerfile
|
8 |
+
depends_on:
|
9 |
+
redis:
|
10 |
+
condition: service_healthy
|
11 |
+
ports:
|
12 |
+
- 8080:8080
|
13 |
+
volumes:
|
14 |
+
- ./data/yunzai-web/yunzai-bot-data:/workspace/Yunzai-Bot/data # data of `Yunzai-Bot`
|
15 |
+
- ./data/yunzai-web/be-images:/workspace/Yunzai-Bot/web-data/images # images of backend
|
16 |
+
|
17 |
+
# - ./config/config.json:/workspace/Yunzai-Bot/config.json # config of backend
|
18 |
+
- ./config/plugins:/workspace/Yunzai-Bot/user_plugins # plugins of `Yunzai-Bot`
|
19 |
+
|
20 |
+
- ../../src/Yunzai-Bot/docker-entrypoint.py:/workspace/Yunzai-Bot/docker-entrypoint.py
|
21 |
+
|
22 |
+
- ./dev-data/vsc:/root/.vscode-server # vscode-server cache
|
23 |
+
redis:
|
24 |
+
# docker pull registry.cn-hangzhou.aliyuncs.com/117503445-mirror/redis:alpine && docker image tag registry.cn-hangzhou.aliyuncs.com/117503445-mirror/redis:alpine redis:alpine
|
25 |
+
image: redis:alpine
|
26 |
+
volumes:
|
27 |
+
- ./data/redis/data:/data
|
28 |
+
- ./data/redis/logs:/logs
|
29 |
+
healthcheck:
|
30 |
+
test: [ "CMD", "redis-cli", "PING" ]
|
31 |
+
start_period: 10s
|
32 |
+
interval: 5s
|
33 |
+
timeout: 1s
|
docker-compose.yml
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
version: '3'
|
2 |
+
|
3 |
+
services:
|
4 |
+
yunzai-web:
|
5 |
+
image: registry.cn-hangzhou.aliyuncs.com/117503445-mirror/yunzai-web
|
6 |
+
container_name: yunzai-web
|
7 |
+
restart: unless-stopped
|
8 |
+
ports:
|
9 |
+
- 8080:8080
|
10 |
+
depends_on:
|
11 |
+
redis:
|
12 |
+
condition: service_healthy
|
13 |
+
volumes:
|
14 |
+
- ./data/yunzai-web/yunzai-bot-data:/workspace/Yunzai-Bot/data # data of `Yunzai-Bot`
|
15 |
+
- ./data/yunzai-web/be-images:/workspace/Yunzai-Bot/web-data/images # images of backend
|
16 |
+
|
17 |
+
- ./config/plugins:/workspace/Yunzai-Bot/user_plugins # plugins of `Yunzai-Bot`
|
18 |
+
# - ./config/config.json:/workspace/Yunzai-Bot/config.json # config of backend, unconment this line when config.json is provided
|
19 |
+
|
20 |
+
- ./dev-data/vsc:/root/.vscode-server # vscode-server cache
|
21 |
+
redis:
|
22 |
+
image: registry.cn-hangzhou.aliyuncs.com/117503445-mirror/redis:alpine
|
23 |
+
restart: unless-stopped
|
24 |
+
volumes:
|
25 |
+
- ./data/redis/data:/data
|
26 |
+
- ./data/redis/logs:/logs
|
27 |
+
healthcheck:
|
28 |
+
test: [ "CMD", "redis-cli", "PING" ]
|
29 |
+
start_period: 10s
|
30 |
+
interval: 5s
|
31 |
+
timeout: 1s
|
script/miyoushe-token-sender/README.md
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# miyoushe-token-sender
|
2 |
+
|
3 |
+
将米游社 Cookie 发送至 Yunzai-Web
|
4 |
+
|
5 |
+
## 安装
|
6 |
+
|
7 |
+
安装 Chrome 插件 [tampermonkey-beta](https://chrome.google.com/webstore/detail/tampermonkey-beta/gcalenpjmijncebpfijmoaglllgpjagf)
|
8 |
+
|
9 |
+
> 使用 **tampermonkey-beta** 的原因: 米游社的 Cookie 中有些 HTTPOnly 的字段,需要通过油猴的 `GM_cookie` API 才能获取到。但是这个 API 目前只在测试版可用,稳定版还无法使用此 API。
|
10 |
+
|
11 |
+
安装脚本 <https://greasyfork.org/zh-CN/scripts/465204-miyoushe-token-sender>
|
12 |
+
|
13 |
+
## 修改配置
|
14 |
+
|
15 |
+
修改脚本中的相关配置
|
16 |
+
|
17 |
+
```js
|
18 |
+
// Yunzai-Web 的 host
|
19 |
+
const host = "https://example.yunzai-web.com"
|
20 |
+
|
21 |
+
// Basic Auth 的用户名 / 密码, 为空则不使用 Basic Auth
|
22 |
+
const username = "user1"
|
23 |
+
const password = "pass1"
|
24 |
+
```
|
25 |
+
|
26 |
+
## 使用方法
|
27 |
+
|
28 |
+
访问 [米游社](https://www.miyoushe.com/ys/)
|
29 |
+
|
30 |
+
点击页面右上方的按钮
|
script/miyoushe-token-sender/miyoushe-token-sender.js
ADDED
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// ==UserScript==
|
2 |
+
// @name miyoushe token sender
|
3 |
+
// @namespace http://tampermonkey.net/
|
4 |
+
// @version 0.1
|
5 |
+
// @description send miyoushe cookies to yunzai-web
|
6 |
+
// @author 117503445
|
7 |
+
// @match https://www.miyoushe.com/*
|
8 |
+
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
|
9 |
+
// @grant GM_xmlhttpRequest
|
10 |
+
// @grant GM_cookie
|
11 |
+
// @license GNU/GPL V3
|
12 |
+
// ==/UserScript==
|
13 |
+
|
14 |
+
(function () {
|
15 |
+
'use strict';
|
16 |
+
|
17 |
+
const host = "https://example.yunzai-web.com"
|
18 |
+
|
19 |
+
// Basic Auth 的用户名 / 密码, 为空则不使用 Basic Auth
|
20 |
+
const username = "user1"
|
21 |
+
const password = "pass1"
|
22 |
+
|
23 |
+
var button = document.createElement("button");
|
24 |
+
button.innerHTML = "Send Cookie To Yunzai-Web";
|
25 |
+
button.className = "my-button";
|
26 |
+
var style = document.createAttribute("style");
|
27 |
+
button.setAttributeNode(style);
|
28 |
+
button.style.position = "fixed";
|
29 |
+
button.style.top = "80px";
|
30 |
+
button.style.right = "20px";
|
31 |
+
|
32 |
+
document.body.appendChild(button);
|
33 |
+
|
34 |
+
function log(msg) {
|
35 |
+
console.log(`[miyoushe token] ${msg}`)
|
36 |
+
}
|
37 |
+
|
38 |
+
function error_alert(msg) {
|
39 |
+
msg = `[miyoushe token] meeting error: ${msg}`
|
40 |
+
console.error(msg);
|
41 |
+
alert(msg);
|
42 |
+
}
|
43 |
+
|
44 |
+
button.addEventListener("click", function () {
|
45 |
+
GM_cookie.list({}, function (cookies, error) {
|
46 |
+
if (!error) {
|
47 |
+
let cookieStr = "";
|
48 |
+
|
49 |
+
log(`get cookies: ${JSON.stringify(cookies)}`)
|
50 |
+
cookies.forEach(cookie => {
|
51 |
+
cookieStr += `${cookie.name}=${cookie.value}; `;
|
52 |
+
});
|
53 |
+
log(`cookieMsg: ${cookieStr}`)
|
54 |
+
|
55 |
+
var data = {
|
56 |
+
// prompt: document.cookie
|
57 |
+
prompt: cookieStr
|
58 |
+
};
|
59 |
+
|
60 |
+
let headers = {
|
61 |
+
'Content-Type': 'application/json',
|
62 |
+
}
|
63 |
+
if (username) {
|
64 |
+
let authorization = btoa(`${username}:${password}`)
|
65 |
+
headers.Authorization = `Basic ${authorization}`
|
66 |
+
}
|
67 |
+
|
68 |
+
GM_xmlhttpRequest({
|
69 |
+
method: 'POST',
|
70 |
+
url: `${host}/api/chat-process`,
|
71 |
+
headers: headers,
|
72 |
+
data: JSON.stringify(data),
|
73 |
+
onload(xhr) {
|
74 |
+
log(xhr.responseText)
|
75 |
+
alert(`[miyoushe token] Yunzai-Web 返回: \n ${xhr.responseText}`)
|
76 |
+
}
|
77 |
+
});
|
78 |
+
} else {
|
79 |
+
error_alert(error);
|
80 |
+
}
|
81 |
+
});
|
82 |
+
});
|
83 |
+
})();
|
script/yunzai-web-downloader/.gitignore
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
面板
|
2 |
+
圣遗物
|
3 |
+
config.json
|
script/yunzai-web-downloader/README.md
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Yunzai-web-downloader
|
2 |
+
|
3 |
+
基于 `Yunzai-Bot-Web` 获取指定角色的圣遗物和面板
|
4 |
+
|
5 |
+
![files](./assets/files.png)
|
6 |
+
|
7 |
+
## 使用方法
|
8 |
+
|
9 |
+
1. 安装依赖
|
10 |
+
|
11 |
+
```sh
|
12 |
+
poetry install
|
13 |
+
```
|
14 |
+
|
15 |
+
2. 将 `config.json.examle` 粘贴为 `config.json`,填写对应字段
|
16 |
+
|
17 |
+
3. 运行命令
|
18 |
+
|
19 |
+
```sh
|
20 |
+
poetry run python main.py
|
21 |
+
```
|
script/yunzai-web-downloader/assets/files.png
ADDED
![]() |
Git LFS Details
|
script/yunzai-web-downloader/config.json.example
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"host": "https://HOST:20000",
|
3 |
+
"auth": {
|
4 |
+
"username": "USERNAME",
|
5 |
+
"password": "PASSWORD"
|
6 |
+
},
|
7 |
+
"names": [
|
8 |
+
"胡桃",
|
9 |
+
"夜兰",
|
10 |
+
"温迪",
|
11 |
+
"可莉",
|
12 |
+
"甘雨",
|
13 |
+
"枫原万叶",
|
14 |
+
"雷电将军",
|
15 |
+
"妮露",
|
16 |
+
"纳西妲",
|
17 |
+
"流浪者",
|
18 |
+
"班尼特",
|
19 |
+
"行秋",
|
20 |
+
"香菱",
|
21 |
+
"久岐忍",
|
22 |
+
"瑶瑶"
|
23 |
+
]
|
24 |
+
}
|
script/yunzai-web-downloader/main.py
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from htutil import file
|
2 |
+
import requests
|
3 |
+
import re
|
4 |
+
import logging
|
5 |
+
import time
|
6 |
+
from pathlib import Path
|
7 |
+
from requests.auth import HTTPBasicAuth
|
8 |
+
|
9 |
+
cfg = file.read_json('config.json')
|
10 |
+
|
11 |
+
|
12 |
+
logging.basicConfig(format='%(asctime)s,%(msecs)03d %(levelname)-8s [%(filename)s:%(lineno)d] %(message)s',
|
13 |
+
datefmt='%Y-%m-%d:%H:%M:%S',
|
14 |
+
level=logging.INFO)
|
15 |
+
|
16 |
+
|
17 |
+
pattern = re.compile(r'\((.*?)\)')
|
18 |
+
|
19 |
+
host = cfg['host']
|
20 |
+
|
21 |
+
session = requests.Session()
|
22 |
+
if cfg['auth']:
|
23 |
+
session.auth = HTTPBasicAuth(
|
24 |
+
cfg['auth']['username'], cfg['auth']['password'])
|
25 |
+
session.proxies = {'http': '', 'https': ''}
|
26 |
+
|
27 |
+
|
28 |
+
def get_image(name: str, _type: str) -> bool:
|
29 |
+
p = Path(_type)
|
30 |
+
if not p.exists():
|
31 |
+
p.mkdir()
|
32 |
+
|
33 |
+
prompt = f'#{name}{_type}'
|
34 |
+
path = p / f'{name}.jpg'
|
35 |
+
# path = f'{name}-{_type}.jpg'
|
36 |
+
|
37 |
+
resp = session.post(f'{host}/api/chat-process', json={
|
38 |
+
"prompt": prompt
|
39 |
+
}, ).text
|
40 |
+
|
41 |
+
match = pattern.search(resp)
|
42 |
+
if not match:
|
43 |
+
logging.info(f"img not found, resp = {resp}")
|
44 |
+
return False
|
45 |
+
else:
|
46 |
+
img_url = f'{host}/{match.group(1)}'
|
47 |
+
resp = session.get(img_url)
|
48 |
+
with open(path, 'wb') as f:
|
49 |
+
f.write(resp.content)
|
50 |
+
return True
|
51 |
+
|
52 |
+
resp = session.post(f'{host}/api/chat-process', json={
|
53 |
+
"prompt": "#更新面板"
|
54 |
+
}).text
|
55 |
+
|
56 |
+
logging.info(resp)
|
57 |
+
|
58 |
+
fail_names = []
|
59 |
+
|
60 |
+
for name in cfg['names']:
|
61 |
+
for _type in ['面板', '圣遗物']:
|
62 |
+
logging.info(f'{name} {_type}')
|
63 |
+
r = get_image(name, _type)
|
64 |
+
if not r:
|
65 |
+
fail_names.append(name)
|
66 |
+
time.sleep(2)
|
67 |
+
|
68 |
+
if fail_names:
|
69 |
+
logging.info(fail_names)
|
script/yunzai-web-downloader/poetry.lock
ADDED
@@ -0,0 +1,206 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# This file is automatically @generated by Poetry 1.4.2 and should not be changed by hand.
|
2 |
+
|
3 |
+
[[package]]
|
4 |
+
name = "autopep8"
|
5 |
+
version = "2.0.2"
|
6 |
+
description = "A tool that automatically formats Python code to conform to the PEP 8 style guide"
|
7 |
+
category = "dev"
|
8 |
+
optional = false
|
9 |
+
python-versions = ">=3.6"
|
10 |
+
files = [
|
11 |
+
{file = "autopep8-2.0.2-py2.py3-none-any.whl", hash = "sha256:86e9303b5e5c8160872b2f5ef611161b2893e9bfe8ccc7e2f76385947d57a2f1"},
|
12 |
+
{file = "autopep8-2.0.2.tar.gz", hash = "sha256:f9849cdd62108cb739dbcdbfb7fdcc9a30d1b63c4cc3e1c1f893b5360941b61c"},
|
13 |
+
]
|
14 |
+
|
15 |
+
[package.dependencies]
|
16 |
+
pycodestyle = ">=2.10.0"
|
17 |
+
tomli = {version = "*", markers = "python_version < \"3.11\""}
|
18 |
+
|
19 |
+
[[package]]
|
20 |
+
name = "certifi"
|
21 |
+
version = "2022.12.7"
|
22 |
+
description = "Python package for providing Mozilla's CA Bundle."
|
23 |
+
category = "main"
|
24 |
+
optional = false
|
25 |
+
python-versions = ">=3.6"
|
26 |
+
files = [
|
27 |
+
{file = "certifi-2022.12.7-py3-none-any.whl", hash = "sha256:4ad3232f5e926d6718ec31cfc1fcadfde020920e278684144551c91769c7bc18"},
|
28 |
+
{file = "certifi-2022.12.7.tar.gz", hash = "sha256:35824b4c3a97115964b408844d64aa14db1cc518f6562e8d7261699d1350a9e3"},
|
29 |
+
]
|
30 |
+
|
31 |
+
[[package]]
|
32 |
+
name = "charset-normalizer"
|
33 |
+
version = "3.1.0"
|
34 |
+
description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet."
|
35 |
+
category = "main"
|
36 |
+
optional = false
|
37 |
+
python-versions = ">=3.7.0"
|
38 |
+
files = [
|
39 |
+
{file = "charset-normalizer-3.1.0.tar.gz", hash = "sha256:34e0a2f9c370eb95597aae63bf85eb5e96826d81e3dcf88b8886012906f509b5"},
|
40 |
+
{file = "charset_normalizer-3.1.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:e0ac8959c929593fee38da1c2b64ee9778733cdf03c482c9ff1d508b6b593b2b"},
|
41 |
+
{file = "charset_normalizer-3.1.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:d7fc3fca01da18fbabe4625d64bb612b533533ed10045a2ac3dd194bfa656b60"},
|
42 |
+
{file = "charset_normalizer-3.1.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:04eefcee095f58eaabe6dc3cc2262f3bcd776d2c67005880894f447b3f2cb9c1"},
|
43 |
+
{file = "charset_normalizer-3.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:20064ead0717cf9a73a6d1e779b23d149b53daf971169289ed2ed43a71e8d3b0"},
|
44 |
+
{file = "charset_normalizer-3.1.0-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1435ae15108b1cb6fffbcea2af3d468683b7afed0169ad718451f8db5d1aff6f"},
|
45 |
+
{file = "charset_normalizer-3.1.0-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:c84132a54c750fda57729d1e2599bb598f5fa0344085dbde5003ba429a4798c0"},
|
46 |
+
{file = "charset_normalizer-3.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:75f2568b4189dda1c567339b48cba4ac7384accb9c2a7ed655cd86b04055c795"},
|
47 |
+
{file = "charset_normalizer-3.1.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:11d3bcb7be35e7b1bba2c23beedac81ee893ac9871d0ba79effc7fc01167db6c"},
|
48 |
+
{file = "charset_normalizer-3.1.0-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:891cf9b48776b5c61c700b55a598621fdb7b1e301a550365571e9624f270c203"},
|
49 |
+
{file = "charset_normalizer-3.1.0-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:5f008525e02908b20e04707a4f704cd286d94718f48bb33edddc7d7b584dddc1"},
|
50 |
+
{file = "charset_normalizer-3.1.0-cp310-cp310-musllinux_1_1_ppc64le.whl", hash = "sha256:b06f0d3bf045158d2fb8837c5785fe9ff9b8c93358be64461a1089f5da983137"},
|
51 |
+
{file = "charset_normalizer-3.1.0-cp310-cp310-musllinux_1_1_s390x.whl", hash = "sha256:49919f8400b5e49e961f320c735388ee686a62327e773fa5b3ce6721f7e785ce"},
|
52 |
+
{file = "charset_normalizer-3.1.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:22908891a380d50738e1f978667536f6c6b526a2064156203d418f4856d6e86a"},
|
53 |
+
{file = "charset_normalizer-3.1.0-cp310-cp310-win32.whl", hash = "sha256:12d1a39aa6b8c6f6248bb54550efcc1c38ce0d8096a146638fd4738e42284448"},
|
54 |
+
{file = "charset_normalizer-3.1.0-cp310-cp310-win_amd64.whl", hash = "sha256:65ed923f84a6844de5fd29726b888e58c62820e0769b76565480e1fdc3d062f8"},
|
55 |
+
{file = "charset_normalizer-3.1.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:9a3267620866c9d17b959a84dd0bd2d45719b817245e49371ead79ed4f710d19"},
|
56 |
+
{file = "charset_normalizer-3.1.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:6734e606355834f13445b6adc38b53c0fd45f1a56a9ba06c2058f86893ae8017"},
|
57 |
+
{file = "charset_normalizer-3.1.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:f8303414c7b03f794347ad062c0516cee0e15f7a612abd0ce1e25caf6ceb47df"},
|
58 |
+
{file = "charset_normalizer-3.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:aaf53a6cebad0eae578f062c7d462155eada9c172bd8c4d250b8c1d8eb7f916a"},
|
59 |
+
{file = "charset_normalizer-3.1.0-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3dc5b6a8ecfdc5748a7e429782598e4f17ef378e3e272eeb1340ea57c9109f41"},
|
60 |
+
{file = "charset_normalizer-3.1.0-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:e1b25e3ad6c909f398df8921780d6a3d120d8c09466720226fc621605b6f92b1"},
|
61 |
+
{file = "charset_normalizer-3.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0ca564606d2caafb0abe6d1b5311c2649e8071eb241b2d64e75a0d0065107e62"},
|
62 |
+
{file = "charset_normalizer-3.1.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b82fab78e0b1329e183a65260581de4375f619167478dddab510c6c6fb04d9b6"},
|
63 |
+
{file = "charset_normalizer-3.1.0-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:bd7163182133c0c7701b25e604cf1611c0d87712e56e88e7ee5d72deab3e76b5"},
|
64 |
+
{file = "charset_normalizer-3.1.0-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:11d117e6c63e8f495412d37e7dc2e2fff09c34b2d09dbe2bee3c6229577818be"},
|
65 |
+
{file = "charset_normalizer-3.1.0-cp311-cp311-musllinux_1_1_ppc64le.whl", hash = "sha256:cf6511efa4801b9b38dc5546d7547d5b5c6ef4b081c60b23e4d941d0eba9cbeb"},
|
66 |
+
{file = "charset_normalizer-3.1.0-cp311-cp311-musllinux_1_1_s390x.whl", hash = "sha256:abc1185d79f47c0a7aaf7e2412a0eb2c03b724581139193d2d82b3ad8cbb00ac"},
|
67 |
+
{file = "charset_normalizer-3.1.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:cb7b2ab0188829593b9de646545175547a70d9a6e2b63bf2cd87a0a391599324"},
|
68 |
+
{file = "charset_normalizer-3.1.0-cp311-cp311-win32.whl", hash = "sha256:c36bcbc0d5174a80d6cccf43a0ecaca44e81d25be4b7f90f0ed7bcfbb5a00909"},
|
69 |
+
{file = "charset_normalizer-3.1.0-cp311-cp311-win_amd64.whl", hash = "sha256:cca4def576f47a09a943666b8f829606bcb17e2bc2d5911a46c8f8da45f56755"},
|
70 |
+
{file = "charset_normalizer-3.1.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:0c95f12b74681e9ae127728f7e5409cbbef9cd914d5896ef238cc779b8152373"},
|
71 |
+
{file = "charset_normalizer-3.1.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fca62a8301b605b954ad2e9c3666f9d97f63872aa4efcae5492baca2056b74ab"},
|
72 |
+
{file = "charset_normalizer-3.1.0-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ac0aa6cd53ab9a31d397f8303f92c42f534693528fafbdb997c82bae6e477ad9"},
|
73 |
+
{file = "charset_normalizer-3.1.0-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:c3af8e0f07399d3176b179f2e2634c3ce9c1301379a6b8c9c9aeecd481da494f"},
|
74 |
+
{file = "charset_normalizer-3.1.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3a5fc78f9e3f501a1614a98f7c54d3969f3ad9bba8ba3d9b438c3bc5d047dd28"},
|
75 |
+
{file = "charset_normalizer-3.1.0-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:628c985afb2c7d27a4800bfb609e03985aaecb42f955049957814e0491d4006d"},
|
76 |
+
{file = "charset_normalizer-3.1.0-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:74db0052d985cf37fa111828d0dd230776ac99c740e1a758ad99094be4f1803d"},
|
77 |
+
{file = "charset_normalizer-3.1.0-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:1e8fcdd8f672a1c4fc8d0bd3a2b576b152d2a349782d1eb0f6b8e52e9954731d"},
|
78 |
+
{file = "charset_normalizer-3.1.0-cp37-cp37m-musllinux_1_1_ppc64le.whl", hash = "sha256:04afa6387e2b282cf78ff3dbce20f0cc071c12dc8f685bd40960cc68644cfea6"},
|
79 |
+
{file = "charset_normalizer-3.1.0-cp37-cp37m-musllinux_1_1_s390x.whl", hash = "sha256:dd5653e67b149503c68c4018bf07e42eeed6b4e956b24c00ccdf93ac79cdff84"},
|
80 |
+
{file = "charset_normalizer-3.1.0-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:d2686f91611f9e17f4548dbf050e75b079bbc2a82be565832bc8ea9047b61c8c"},
|
81 |
+
{file = "charset_normalizer-3.1.0-cp37-cp37m-win32.whl", hash = "sha256:4155b51ae05ed47199dc5b2a4e62abccb274cee6b01da5b895099b61b1982974"},
|
82 |
+
{file = "charset_normalizer-3.1.0-cp37-cp37m-win_amd64.whl", hash = "sha256:322102cdf1ab682ecc7d9b1c5eed4ec59657a65e1c146a0da342b78f4112db23"},
|
83 |
+
{file = "charset_normalizer-3.1.0-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:e633940f28c1e913615fd624fcdd72fdba807bf53ea6925d6a588e84e1151531"},
|
84 |
+
{file = "charset_normalizer-3.1.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:3a06f32c9634a8705f4ca9946d667609f52cf130d5548881401f1eb2c39b1e2c"},
|
85 |
+
{file = "charset_normalizer-3.1.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:7381c66e0561c5757ffe616af869b916c8b4e42b367ab29fedc98481d1e74e14"},
|
86 |
+
{file = "charset_normalizer-3.1.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3573d376454d956553c356df45bb824262c397c6e26ce43e8203c4c540ee0acb"},
|
87 |
+
{file = "charset_normalizer-3.1.0-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e89df2958e5159b811af9ff0f92614dabf4ff617c03a4c1c6ff53bf1c399e0e1"},
|
88 |
+
{file = "charset_normalizer-3.1.0-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:78cacd03e79d009d95635e7d6ff12c21eb89b894c354bd2b2ed0b4763373693b"},
|
89 |
+
{file = "charset_normalizer-3.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:de5695a6f1d8340b12a5d6d4484290ee74d61e467c39ff03b39e30df62cf83a0"},
|
90 |
+
{file = "charset_normalizer-3.1.0-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1c60b9c202d00052183c9be85e5eaf18a4ada0a47d188a83c8f5c5b23252f649"},
|
91 |
+
{file = "charset_normalizer-3.1.0-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:f645caaf0008bacf349875a974220f1f1da349c5dbe7c4ec93048cdc785a3326"},
|
92 |
+
{file = "charset_normalizer-3.1.0-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:ea9f9c6034ea2d93d9147818f17c2a0860d41b71c38b9ce4d55f21b6f9165a11"},
|
93 |
+
{file = "charset_normalizer-3.1.0-cp38-cp38-musllinux_1_1_ppc64le.whl", hash = "sha256:80d1543d58bd3d6c271b66abf454d437a438dff01c3e62fdbcd68f2a11310d4b"},
|
94 |
+
{file = "charset_normalizer-3.1.0-cp38-cp38-musllinux_1_1_s390x.whl", hash = "sha256:73dc03a6a7e30b7edc5b01b601e53e7fc924b04e1835e8e407c12c037e81adbd"},
|
95 |
+
{file = "charset_normalizer-3.1.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:6f5c2e7bc8a4bf7c426599765b1bd33217ec84023033672c1e9a8b35eaeaaaf8"},
|
96 |
+
{file = "charset_normalizer-3.1.0-cp38-cp38-win32.whl", hash = "sha256:12a2b561af122e3d94cdb97fe6fb2bb2b82cef0cdca131646fdb940a1eda04f0"},
|
97 |
+
{file = "charset_normalizer-3.1.0-cp38-cp38-win_amd64.whl", hash = "sha256:3160a0fd9754aab7d47f95a6b63ab355388d890163eb03b2d2b87ab0a30cfa59"},
|
98 |
+
{file = "charset_normalizer-3.1.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:38e812a197bf8e71a59fe55b757a84c1f946d0ac114acafaafaf21667a7e169e"},
|
99 |
+
{file = "charset_normalizer-3.1.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:6baf0baf0d5d265fa7944feb9f7451cc316bfe30e8df1a61b1bb08577c554f31"},
|
100 |
+
{file = "charset_normalizer-3.1.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:8f25e17ab3039b05f762b0a55ae0b3632b2e073d9c8fc88e89aca31a6198e88f"},
|
101 |
+
{file = "charset_normalizer-3.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3747443b6a904001473370d7810aa19c3a180ccd52a7157aacc264a5ac79265e"},
|
102 |
+
{file = "charset_normalizer-3.1.0-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b116502087ce8a6b7a5f1814568ccbd0e9f6cfd99948aa59b0e241dc57cf739f"},
|
103 |
+
{file = "charset_normalizer-3.1.0-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d16fd5252f883eb074ca55cb622bc0bee49b979ae4e8639fff6ca3ff44f9f854"},
|
104 |
+
{file = "charset_normalizer-3.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:21fa558996782fc226b529fdd2ed7866c2c6ec91cee82735c98a197fae39f706"},
|
105 |
+
{file = "charset_normalizer-3.1.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6f6c7a8a57e9405cad7485f4c9d3172ae486cfef1344b5ddd8e5239582d7355e"},
|
106 |
+
{file = "charset_normalizer-3.1.0-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:ac3775e3311661d4adace3697a52ac0bab17edd166087d493b52d4f4f553f9f0"},
|
107 |
+
{file = "charset_normalizer-3.1.0-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:10c93628d7497c81686e8e5e557aafa78f230cd9e77dd0c40032ef90c18f2230"},
|
108 |
+
{file = "charset_normalizer-3.1.0-cp39-cp39-musllinux_1_1_ppc64le.whl", hash = "sha256:6f4f4668e1831850ebcc2fd0b1cd11721947b6dc7c00bf1c6bd3c929ae14f2c7"},
|
109 |
+
{file = "charset_normalizer-3.1.0-cp39-cp39-musllinux_1_1_s390x.whl", hash = "sha256:0be65ccf618c1e7ac9b849c315cc2e8a8751d9cfdaa43027d4f6624bd587ab7e"},
|
110 |
+
{file = "charset_normalizer-3.1.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:53d0a3fa5f8af98a1e261de6a3943ca631c526635eb5817a87a59d9a57ebf48f"},
|
111 |
+
{file = "charset_normalizer-3.1.0-cp39-cp39-win32.whl", hash = "sha256:a04f86f41a8916fe45ac5024ec477f41f886b3c435da2d4e3d2709b22ab02af1"},
|
112 |
+
{file = "charset_normalizer-3.1.0-cp39-cp39-win_amd64.whl", hash = "sha256:830d2948a5ec37c386d3170c483063798d7879037492540f10a475e3fd6f244b"},
|
113 |
+
{file = "charset_normalizer-3.1.0-py3-none-any.whl", hash = "sha256:3d9098b479e78c85080c98e1e35ff40b4a31d8953102bb0fd7d1b6f8a2111a3d"},
|
114 |
+
]
|
115 |
+
|
116 |
+
[[package]]
|
117 |
+
name = "htutil"
|
118 |
+
version = "3.0.0"
|
119 |
+
description = "HaoTian's Python Util"
|
120 |
+
category = "main"
|
121 |
+
optional = false
|
122 |
+
python-versions = "*"
|
123 |
+
files = [
|
124 |
+
{file = "htutil-3.0.0-py3-none-any.whl", hash = "sha256:b0e8f323515cadc9100884699a3464ddf0272fc0009403b1cd5e68b4b7c47825"},
|
125 |
+
{file = "htutil-3.0.0.tar.gz", hash = "sha256:75bef2704bad8114c33a8b32db4a62226d573af2623ed7d8efa2364ac2dfaea2"},
|
126 |
+
]
|
127 |
+
|
128 |
+
[[package]]
|
129 |
+
name = "idna"
|
130 |
+
version = "3.4"
|
131 |
+
description = "Internationalized Domain Names in Applications (IDNA)"
|
132 |
+
category = "main"
|
133 |
+
optional = false
|
134 |
+
python-versions = ">=3.5"
|
135 |
+
files = [
|
136 |
+
{file = "idna-3.4-py3-none-any.whl", hash = "sha256:90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2"},
|
137 |
+
{file = "idna-3.4.tar.gz", hash = "sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4"},
|
138 |
+
]
|
139 |
+
|
140 |
+
[[package]]
|
141 |
+
name = "pycodestyle"
|
142 |
+
version = "2.10.0"
|
143 |
+
description = "Python style guide checker"
|
144 |
+
category = "dev"
|
145 |
+
optional = false
|
146 |
+
python-versions = ">=3.6"
|
147 |
+
files = [
|
148 |
+
{file = "pycodestyle-2.10.0-py2.py3-none-any.whl", hash = "sha256:8a4eaf0d0495c7395bdab3589ac2db602797d76207242c17d470186815706610"},
|
149 |
+
{file = "pycodestyle-2.10.0.tar.gz", hash = "sha256:347187bdb476329d98f695c213d7295a846d1152ff4fe9bacb8a9590b8ee7053"},
|
150 |
+
]
|
151 |
+
|
152 |
+
[[package]]
|
153 |
+
name = "requests"
|
154 |
+
version = "2.28.2"
|
155 |
+
description = "Python HTTP for Humans."
|
156 |
+
category = "main"
|
157 |
+
optional = false
|
158 |
+
python-versions = ">=3.7, <4"
|
159 |
+
files = [
|
160 |
+
{file = "requests-2.28.2-py3-none-any.whl", hash = "sha256:64299f4909223da747622c030b781c0d7811e359c37124b4bd368fb8c6518baa"},
|
161 |
+
{file = "requests-2.28.2.tar.gz", hash = "sha256:98b1b2782e3c6c4904938b84c0eb932721069dfdb9134313beff7c83c2df24bf"},
|
162 |
+
]
|
163 |
+
|
164 |
+
[package.dependencies]
|
165 |
+
certifi = ">=2017.4.17"
|
166 |
+
charset-normalizer = ">=2,<4"
|
167 |
+
idna = ">=2.5,<4"
|
168 |
+
urllib3 = ">=1.21.1,<1.27"
|
169 |
+
|
170 |
+
[package.extras]
|
171 |
+
socks = ["PySocks (>=1.5.6,!=1.5.7)"]
|
172 |
+
use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"]
|
173 |
+
|
174 |
+
[[package]]
|
175 |
+
name = "tomli"
|
176 |
+
version = "2.0.1"
|
177 |
+
description = "A lil' TOML parser"
|
178 |
+
category = "dev"
|
179 |
+
optional = false
|
180 |
+
python-versions = ">=3.7"
|
181 |
+
files = [
|
182 |
+
{file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"},
|
183 |
+
{file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"},
|
184 |
+
]
|
185 |
+
|
186 |
+
[[package]]
|
187 |
+
name = "urllib3"
|
188 |
+
version = "1.26.15"
|
189 |
+
description = "HTTP library with thread-safe connection pooling, file post, and more."
|
190 |
+
category = "main"
|
191 |
+
optional = false
|
192 |
+
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*"
|
193 |
+
files = [
|
194 |
+
{file = "urllib3-1.26.15-py2.py3-none-any.whl", hash = "sha256:aa751d169e23c7479ce47a0cb0da579e3ede798f994f5816a74e4f4500dcea42"},
|
195 |
+
{file = "urllib3-1.26.15.tar.gz", hash = "sha256:8a388717b9476f934a21484e8c8e61875ab60644d29b9b39e11e4b9dc1c6b305"},
|
196 |
+
]
|
197 |
+
|
198 |
+
[package.extras]
|
199 |
+
brotli = ["brotli (>=1.0.9)", "brotlicffi (>=0.8.0)", "brotlipy (>=0.6.0)"]
|
200 |
+
secure = ["certifi", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "ipaddress", "pyOpenSSL (>=0.14)", "urllib3-secure-extra"]
|
201 |
+
socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"]
|
202 |
+
|
203 |
+
[metadata]
|
204 |
+
lock-version = "2.0"
|
205 |
+
python-versions = "^3.10"
|
206 |
+
content-hash = "bb7ea60608f0522cbc4ea15cbb55eb928258b107abfb45f6dca4b099a9ce8871"
|
script/yunzai-web-downloader/pyproject.toml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[tool.poetry]
|
2 |
+
name = "yunzai-web-downloader"
|
3 |
+
version = "0.1.0"
|
4 |
+
description = ""
|
5 |
+
authors = ["117503445 <t117503445@gmail.com>"]
|
6 |
+
readme = "README.md"
|
7 |
+
packages = [{include = "yunzai_web_downloader"}]
|
8 |
+
|
9 |
+
[tool.poetry.dependencies]
|
10 |
+
python = "^3.10"
|
11 |
+
htutil = "^3.0.0"
|
12 |
+
requests = "^2.28.2"
|
13 |
+
|
14 |
+
|
15 |
+
[tool.poetry.group.dev.dependencies]
|
16 |
+
autopep8 = "^2.0.2"
|
17 |
+
|
18 |
+
[build-system]
|
19 |
+
requires = ["poetry-core"]
|
20 |
+
build-backend = "poetry.core.masonry.api"
|
src/Yunzai-Bot/.eslintrc.cjs
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
module.exports = {
|
2 |
+
env: {
|
3 |
+
es2021: true,
|
4 |
+
node: true
|
5 |
+
},
|
6 |
+
extends: ['standard'],
|
7 |
+
parserOptions: {
|
8 |
+
ecmaVersion: 'latest',
|
9 |
+
sourceType: 'module'
|
10 |
+
},
|
11 |
+
globals: {
|
12 |
+
Bot: true,
|
13 |
+
redis: true,
|
14 |
+
logger: true,
|
15 |
+
plugin: true
|
16 |
+
},
|
17 |
+
rules: {
|
18 |
+
eqeqeq: ['off'],
|
19 |
+
'prefer-const': ['off'],
|
20 |
+
'arrow-body-style': 'off'
|
21 |
+
}
|
22 |
+
}
|
src/Yunzai-Bot/.github/workflows/Docker Build Test.yml
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: docker test
|
2 |
+
|
3 |
+
on:
|
4 |
+
push:
|
5 |
+
branches:
|
6 |
+
- main
|
7 |
+
|
8 |
+
jobs:
|
9 |
+
build:
|
10 |
+
runs-on: ubuntu-latest
|
11 |
+
|
12 |
+
steps:
|
13 |
+
- uses: actions/checkout@v2
|
14 |
+
|
15 |
+
- name: Modify Build File
|
16 |
+
run: sed -i "s|# build|build|g" ./docker-compose.yaml
|
17 |
+
&& sed -i "s|gitee|github|g" ./docker/Dockerfile
|
18 |
+
|
19 |
+
- name: Build Docker Images
|
20 |
+
run: docker compose up -d --build
|
21 |
+
|
22 |
+
- name: Use Default Config
|
23 |
+
run: docker cp docker/qq.yaml yunzai-bot:/app/Yunzai-Bot/config/config
|
24 |
+
|
25 |
+
- name: Run Test Script
|
26 |
+
run: docker exec yunzai-bot npm --prefix=/app/Yunzai-Bot run test
|
src/Yunzai-Bot/.gitignore
ADDED
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Logs
|
2 |
+
logs
|
3 |
+
*.log
|
4 |
+
npm-debug.log*
|
5 |
+
yarn-debug.log*
|
6 |
+
yarn-error.log*
|
7 |
+
lerna-debug.log*
|
8 |
+
.pnpm-debug.log*
|
9 |
+
|
10 |
+
# Diagnostic reports (https://nodejs.org/api/report.html)
|
11 |
+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
12 |
+
|
13 |
+
# Runtime data
|
14 |
+
pids
|
15 |
+
*.pid
|
16 |
+
*.seed
|
17 |
+
*.pid.lock
|
18 |
+
|
19 |
+
# Directory for instrumented libs generated by jscoverage/JSCover
|
20 |
+
lib-cov
|
21 |
+
|
22 |
+
# Coverage directory used by tools like istanbul
|
23 |
+
coverage
|
24 |
+
*.lcov
|
25 |
+
|
26 |
+
# nyc test coverage
|
27 |
+
.nyc_output
|
28 |
+
|
29 |
+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
30 |
+
.grunt
|
31 |
+
|
32 |
+
# Bower dependency directory (https://bower.io/)
|
33 |
+
bower_components
|
34 |
+
|
35 |
+
# node-waf configuration
|
36 |
+
.lock-wscript
|
37 |
+
|
38 |
+
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
39 |
+
build/Release
|
40 |
+
|
41 |
+
# Dependency directories
|
42 |
+
node_modules/
|
43 |
+
jspm_packages/
|
44 |
+
|
45 |
+
# Snowpack dependency directory (https://snowpack.dev/)
|
46 |
+
web_modules/
|
47 |
+
|
48 |
+
# TypeScript cache
|
49 |
+
*.tsbuildinfo
|
50 |
+
|
51 |
+
# Optional npm cache directory
|
52 |
+
.npm
|
53 |
+
|
54 |
+
# Optional eslint cache
|
55 |
+
.eslintcache
|
56 |
+
|
57 |
+
# Optional stylelint cache
|
58 |
+
.stylelintcache
|
59 |
+
|
60 |
+
# Microbundle cache
|
61 |
+
.rpt2_cache/
|
62 |
+
.rts2_cache_cjs/
|
63 |
+
.rts2_cache_es/
|
64 |
+
.rts2_cache_umd/
|
65 |
+
|
66 |
+
# Optional REPL history
|
67 |
+
.node_repl_history
|
68 |
+
|
69 |
+
# Output of 'npm pack'
|
70 |
+
*.tgz
|
71 |
+
|
72 |
+
# Yarn Integrity file
|
73 |
+
.yarn-integrity
|
74 |
+
|
75 |
+
# dotenv environment variable files
|
76 |
+
.env
|
77 |
+
.env.development.local
|
78 |
+
.env.test.local
|
79 |
+
.env.production.local
|
80 |
+
.env.local
|
81 |
+
|
82 |
+
# parcel-bundler cache (https://parceljs.org/)
|
83 |
+
.cache
|
84 |
+
.parcel-cache
|
85 |
+
|
86 |
+
# Next.js build output
|
87 |
+
.next
|
88 |
+
out
|
89 |
+
|
90 |
+
# Nuxt.js build / generate output
|
91 |
+
.nuxt
|
92 |
+
dist
|
93 |
+
|
94 |
+
# Gatsby files
|
95 |
+
.cache/
|
96 |
+
# Comment in the public line in if your project uses Gatsby and not Next.js
|
97 |
+
# https://nextjs.org/blog/next-9-1#public-directory-support
|
98 |
+
# public
|
99 |
+
|
100 |
+
# vuepress build output
|
101 |
+
.vuepress/dist
|
102 |
+
|
103 |
+
# vuepress v2.x temp and cache directory
|
104 |
+
.temp
|
105 |
+
.cache
|
106 |
+
|
107 |
+
# Docusaurus cache and generated files
|
108 |
+
.docusaurus
|
109 |
+
|
110 |
+
# Serverless directories
|
111 |
+
.serverless/
|
112 |
+
|
113 |
+
# FuseBox cache
|
114 |
+
.fusebox/
|
115 |
+
|
116 |
+
# DynamoDB Local files
|
117 |
+
.dynamodb/
|
118 |
+
|
119 |
+
# TernJS port file
|
120 |
+
.tern-port
|
121 |
+
|
122 |
+
# Stores VSCode versions used for testing VSCode extensions
|
123 |
+
.vscode-test
|
124 |
+
.vscode/
|
125 |
+
|
126 |
+
# yarn v2
|
127 |
+
.yarn/cache
|
128 |
+
.yarn/unplugged
|
129 |
+
.yarn/build-state.yml
|
130 |
+
.yarn/install-state.gz
|
131 |
+
.pnp.*
|
132 |
+
|
133 |
+
# Yunzai data
|
134 |
+
dump.rdb
|
135 |
+
data/
|
136 |
+
config/test/*
|
137 |
+
!config/test/default.yaml
|
138 |
+
logs/
|
139 |
+
|
140 |
+
# Docker file
|
141 |
+
redis
|
142 |
+
yunzai
|
src/Yunzai-Bot/LICENSE
ADDED
@@ -0,0 +1,674 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
GNU GENERAL PUBLIC LICENSE
|
2 |
+
Version 3, 29 June 2007
|
3 |
+
|
4 |
+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
5 |
+
Everyone is permitted to copy and distribute verbatim copies
|
6 |
+
of this license document, but changing it is not allowed.
|
7 |
+
|
8 |
+
Preamble
|
9 |
+
|
10 |
+
The GNU General Public License is a free, copyleft license for
|
11 |
+
software and other kinds of works.
|
12 |
+
|
13 |
+
The licenses for most software and other practical works are designed
|
14 |
+
to take away your freedom to share and change the works. By contrast,
|
15 |
+
the GNU General Public License is intended to guarantee your freedom to
|
16 |
+
share and change all versions of a program--to make sure it remains free
|
17 |
+
software for all its users. We, the Free Software Foundation, use the
|
18 |
+
GNU General Public License for most of our software; it applies also to
|
19 |
+
any other work released this way by its authors. You can apply it to
|
20 |
+
your programs, too.
|
21 |
+
|
22 |
+
When we speak of free software, we are referring to freedom, not
|
23 |
+
price. Our General Public Licenses are designed to make sure that you
|
24 |
+
have the freedom to distribute copies of free software (and charge for
|
25 |
+
them if you wish), that you receive source code or can get it if you
|
26 |
+
want it, that you can change the software or use pieces of it in new
|
27 |
+
free programs, and that you know you can do these things.
|
28 |
+
|
29 |
+
To protect your rights, we need to prevent others from denying you
|
30 |
+
these rights or asking you to surrender the rights. Therefore, you have
|
31 |
+
certain responsibilities if you distribute copies of the software, or if
|
32 |
+
you modify it: responsibilities to respect the freedom of others.
|
33 |
+
|
34 |
+
For example, if you distribute copies of such a program, whether
|
35 |
+
gratis or for a fee, you must pass on to the recipients the same
|
36 |
+
freedoms that you received. You must make sure that they, too, receive
|
37 |
+
or can get the source code. And you must show them these terms so they
|
38 |
+
know their rights.
|
39 |
+
|
40 |
+
Developers that use the GNU GPL protect your rights with two steps:
|
41 |
+
(1) assert copyright on the software, and (2) offer you this License
|
42 |
+
giving you legal permission to copy, distribute and/or modify it.
|
43 |
+
|
44 |
+
For the developers' and authors' protection, the GPL clearly explains
|
45 |
+
that there is no warranty for this free software. For both users' and
|
46 |
+
authors' sake, the GPL requires that modified versions be marked as
|
47 |
+
changed, so that their problems will not be attributed erroneously to
|
48 |
+
authors of previous versions.
|
49 |
+
|
50 |
+
Some devices are designed to deny users access to install or run
|
51 |
+
modified versions of the software inside them, although the manufacturer
|
52 |
+
can do so. This is fundamentally incompatible with the aim of
|
53 |
+
protecting users' freedom to change the software. The systematic
|
54 |
+
pattern of such abuse occurs in the area of products for individuals to
|
55 |
+
use, which is precisely where it is most unacceptable. Therefore, we
|
56 |
+
have designed this version of the GPL to prohibit the practice for those
|
57 |
+
products. If such problems arise substantially in other domains, we
|
58 |
+
stand ready to extend this provision to those domains in future versions
|
59 |
+
of the GPL, as needed to protect the freedom of users.
|
60 |
+
|
61 |
+
Finally, every program is threatened constantly by software patents.
|
62 |
+
States should not allow patents to restrict development and use of
|
63 |
+
software on general-purpose computers, but in those that do, we wish to
|
64 |
+
avoid the special danger that patents applied to a free program could
|
65 |
+
make it effectively proprietary. To prevent this, the GPL assures that
|
66 |
+
patents cannot be used to render the program non-free.
|
67 |
+
|
68 |
+
The precise terms and conditions for copying, distribution and
|
69 |
+
modification follow.
|
70 |
+
|
71 |
+
TERMS AND CONDITIONS
|
72 |
+
|
73 |
+
0. Definitions.
|
74 |
+
|
75 |
+
"This License" refers to version 3 of the GNU General Public License.
|
76 |
+
|
77 |
+
"Copyright" also means copyright-like laws that apply to other kinds of
|
78 |
+
works, such as semiconductor masks.
|
79 |
+
|
80 |
+
"The Program" refers to any copyrightable work licensed under this
|
81 |
+
License. Each licensee is addressed as "you". "Licensees" and
|
82 |
+
"recipients" may be individuals or organizations.
|
83 |
+
|
84 |
+
To "modify" a work means to copy from or adapt all or part of the work
|
85 |
+
in a fashion requiring copyright permission, other than the making of an
|
86 |
+
exact copy. The resulting work is called a "modified version" of the
|
87 |
+
earlier work or a work "based on" the earlier work.
|
88 |
+
|
89 |
+
A "covered work" means either the unmodified Program or a work based
|
90 |
+
on the Program.
|
91 |
+
|
92 |
+
To "propagate" a work means to do anything with it that, without
|
93 |
+
permission, would make you directly or secondarily liable for
|
94 |
+
infringement under applicable copyright law, except executing it on a
|
95 |
+
computer or modifying a private copy. Propagation includes copying,
|
96 |
+
distribution (with or without modification), making available to the
|
97 |
+
public, and in some countries other activities as well.
|
98 |
+
|
99 |
+
To "convey" a work means any kind of propagation that enables other
|
100 |
+
parties to make or receive copies. Mere interaction with a user through
|
101 |
+
a computer network, with no transfer of a copy, is not conveying.
|
102 |
+
|
103 |
+
An interactive user interface displays "Appropriate Legal Notices"
|
104 |
+
to the extent that it includes a convenient and prominently visible
|
105 |
+
feature that (1) displays an appropriate copyright notice, and (2)
|
106 |
+
tells the user that there is no warranty for the work (except to the
|
107 |
+
extent that warranties are provided), that licensees may convey the
|
108 |
+
work under this License, and how to view a copy of this License. If
|
109 |
+
the interface presents a list of user commands or options, such as a
|
110 |
+
menu, a prominent item in the list meets this criterion.
|
111 |
+
|
112 |
+
1. Source Code.
|
113 |
+
|
114 |
+
The "source code" for a work means the preferred form of the work
|
115 |
+
for making modifications to it. "Object code" means any non-source
|
116 |
+
form of a work.
|
117 |
+
|
118 |
+
A "Standard Interface" means an interface that either is an official
|
119 |
+
standard defined by a recognized standards body, or, in the case of
|
120 |
+
interfaces specified for a particular programming language, one that
|
121 |
+
is widely used among developers working in that language.
|
122 |
+
|
123 |
+
The "System Libraries" of an executable work include anything, other
|
124 |
+
than the work as a whole, that (a) is included in the normal form of
|
125 |
+
packaging a Major Component, but which is not part of that Major
|
126 |
+
Component, and (b) serves only to enable use of the work with that
|
127 |
+
Major Component, or to implement a Standard Interface for which an
|
128 |
+
implementation is available to the public in source code form. A
|
129 |
+
"Major Component", in this context, means a major essential component
|
130 |
+
(kernel, window system, and so on) of the specific operating system
|
131 |
+
(if any) on which the executable work runs, or a compiler used to
|
132 |
+
produce the work, or an object code interpreter used to run it.
|
133 |
+
|
134 |
+
The "Corresponding Source" for a work in object code form means all
|
135 |
+
the source code needed to generate, install, and (for an executable
|
136 |
+
work) run the object code and to modify the work, including scripts to
|
137 |
+
control those activities. However, it does not include the work's
|
138 |
+
System Libraries, or general-purpose tools or generally available free
|
139 |
+
programs which are used unmodified in performing those activities but
|
140 |
+
which are not part of the work. For example, Corresponding Source
|
141 |
+
includes interface definition files associated with source files for
|
142 |
+
the work, and the source code for shared libraries and dynamically
|
143 |
+
linked subprograms that the work is specifically designed to require,
|
144 |
+
such as by intimate data communication or control flow between those
|
145 |
+
subprograms and other parts of the work.
|
146 |
+
|
147 |
+
The Corresponding Source need not include anything that users
|
148 |
+
can regenerate automatically from other parts of the Corresponding
|
149 |
+
Source.
|
150 |
+
|
151 |
+
The Corresponding Source for a work in source code form is that
|
152 |
+
same work.
|
153 |
+
|
154 |
+
2. Basic Permissions.
|
155 |
+
|
156 |
+
All rights granted under this License are granted for the term of
|
157 |
+
copyright on the Program, and are irrevocable provided the stated
|
158 |
+
conditions are met. This License explicitly affirms your unlimited
|
159 |
+
permission to run the unmodified Program. The output from running a
|
160 |
+
covered work is covered by this License only if the output, given its
|
161 |
+
content, constitutes a covered work. This License acknowledges your
|
162 |
+
rights of fair use or other equivalent, as provided by copyright law.
|
163 |
+
|
164 |
+
You may make, run and propagate covered works that you do not
|
165 |
+
convey, without conditions so long as your license otherwise remains
|
166 |
+
in force. You may convey covered works to others for the sole purpose
|
167 |
+
of having them make modifications exclusively for you, or provide you
|
168 |
+
with facilities for running those works, provided that you comply with
|
169 |
+
the terms of this License in conveying all material for which you do
|
170 |
+
not control copyright. Those thus making or running the covered works
|
171 |
+
for you must do so exclusively on your behalf, under your direction
|
172 |
+
and control, on terms that prohibit them from making any copies of
|
173 |
+
your copyrighted material outside their relationship with you.
|
174 |
+
|
175 |
+
Conveying under any other circumstances is permitted solely under
|
176 |
+
the conditions stated below. Sublicensing is not allowed; section 10
|
177 |
+
makes it unnecessary.
|
178 |
+
|
179 |
+
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
180 |
+
|
181 |
+
No covered work shall be deemed part of an effective technological
|
182 |
+
measure under any applicable law fulfilling obligations under article
|
183 |
+
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
184 |
+
similar laws prohibiting or restricting circumvention of such
|
185 |
+
measures.
|
186 |
+
|
187 |
+
When you convey a covered work, you waive any legal power to forbid
|
188 |
+
circumvention of technological measures to the extent such circumvention
|
189 |
+
is effected by exercising rights under this License with respect to
|
190 |
+
the covered work, and you disclaim any intention to limit operation or
|
191 |
+
modification of the work as a means of enforcing, against the work's
|
192 |
+
users, your or third parties' legal rights to forbid circumvention of
|
193 |
+
technological measures.
|
194 |
+
|
195 |
+
4. Conveying Verbatim Copies.
|
196 |
+
|
197 |
+
You may convey verbatim copies of the Program's source code as you
|
198 |
+
receive it, in any medium, provided that you conspicuously and
|
199 |
+
appropriately publish on each copy an appropriate copyright notice;
|
200 |
+
keep intact all notices stating that this License and any
|
201 |
+
non-permissive terms added in accord with section 7 apply to the code;
|
202 |
+
keep intact all notices of the absence of any warranty; and give all
|
203 |
+
recipients a copy of this License along with the Program.
|
204 |
+
|
205 |
+
You may charge any price or no price for each copy that you convey,
|
206 |
+
and you may offer support or warranty protection for a fee.
|
207 |
+
|
208 |
+
5. Conveying Modified Source Versions.
|
209 |
+
|
210 |
+
You may convey a work based on the Program, or the modifications to
|
211 |
+
produce it from the Program, in the form of source code under the
|
212 |
+
terms of section 4, provided that you also meet all of these conditions:
|
213 |
+
|
214 |
+
a) The work must carry prominent notices stating that you modified
|
215 |
+
it, and giving a relevant date.
|
216 |
+
|
217 |
+
b) The work must carry prominent notices stating that it is
|
218 |
+
released under this License and any conditions added under section
|
219 |
+
7. This requirement modifies the requirement in section 4 to
|
220 |
+
"keep intact all notices".
|
221 |
+
|
222 |
+
c) You must license the entire work, as a whole, under this
|
223 |
+
License to anyone who comes into possession of a copy. This
|
224 |
+
License will therefore apply, along with any applicable section 7
|
225 |
+
additional terms, to the whole of the work, and all its parts,
|
226 |
+
regardless of how they are packaged. This License gives no
|
227 |
+
permission to license the work in any other way, but it does not
|
228 |
+
invalidate such permission if you have separately received it.
|
229 |
+
|
230 |
+
d) If the work has interactive user interfaces, each must display
|
231 |
+
Appropriate Legal Notices; however, if the Program has interactive
|
232 |
+
interfaces that do not display Appropriate Legal Notices, your
|
233 |
+
work need not make them do so.
|
234 |
+
|
235 |
+
A compilation of a covered work with other separate and independent
|
236 |
+
works, which are not by their nature extensions of the covered work,
|
237 |
+
and which are not combined with it such as to form a larger program,
|
238 |
+
in or on a volume of a storage or distribution medium, is called an
|
239 |
+
"aggregate" if the compilation and its resulting copyright are not
|
240 |
+
used to limit the access or legal rights of the compilation's users
|
241 |
+
beyond what the individual works permit. Inclusion of a covered work
|
242 |
+
in an aggregate does not cause this License to apply to the other
|
243 |
+
parts of the aggregate.
|
244 |
+
|
245 |
+
6. Conveying Non-Source Forms.
|
246 |
+
|
247 |
+
You may convey a covered work in object code form under the terms
|
248 |
+
of sections 4 and 5, provided that you also convey the
|
249 |
+
machine-readable Corresponding Source under the terms of this License,
|
250 |
+
in one of these ways:
|
251 |
+
|
252 |
+
a) Convey the object code in, or embodied in, a physical product
|
253 |
+
(including a physical distribution medium), accompanied by the
|
254 |
+
Corresponding Source fixed on a durable physical medium
|
255 |
+
customarily used for software interchange.
|
256 |
+
|
257 |
+
b) Convey the object code in, or embodied in, a physical product
|
258 |
+
(including a physical distribution medium), accompanied by a
|
259 |
+
written offer, valid for at least three years and valid for as
|
260 |
+
long as you offer spare parts or customer support for that product
|
261 |
+
model, to give anyone who possesses the object code either (1) a
|
262 |
+
copy of the Corresponding Source for all the software in the
|
263 |
+
product that is covered by this License, on a durable physical
|
264 |
+
medium customarily used for software interchange, for a price no
|
265 |
+
more than your reasonable cost of physically performing this
|
266 |
+
conveying of source, or (2) access to copy the
|
267 |
+
Corresponding Source from a network server at no charge.
|
268 |
+
|
269 |
+
c) Convey individual copies of the object code with a copy of the
|
270 |
+
written offer to provide the Corresponding Source. This
|
271 |
+
alternative is allowed only occasionally and noncommercially, and
|
272 |
+
only if you received the object code with such an offer, in accord
|
273 |
+
with subsection 6b.
|
274 |
+
|
275 |
+
d) Convey the object code by offering access from a designated
|
276 |
+
place (gratis or for a charge), and offer equivalent access to the
|
277 |
+
Corresponding Source in the same way through the same place at no
|
278 |
+
further charge. You need not require recipients to copy the
|
279 |
+
Corresponding Source along with the object code. If the place to
|
280 |
+
copy the object code is a network server, the Corresponding Source
|
281 |
+
may be on a different server (operated by you or a third party)
|
282 |
+
that supports equivalent copying facilities, provided you maintain
|
283 |
+
clear directions next to the object code saying where to find the
|
284 |
+
Corresponding Source. Regardless of what server hosts the
|
285 |
+
Corresponding Source, you remain obligated to ensure that it is
|
286 |
+
available for as long as needed to satisfy these requirements.
|
287 |
+
|
288 |
+
e) Convey the object code using peer-to-peer transmission, provided
|
289 |
+
you inform other peers where the object code and Corresponding
|
290 |
+
Source of the work are being offered to the general public at no
|
291 |
+
charge under subsection 6d.
|
292 |
+
|
293 |
+
A separable portion of the object code, whose source code is excluded
|
294 |
+
from the Corresponding Source as a System Library, need not be
|
295 |
+
included in conveying the object code work.
|
296 |
+
|
297 |
+
A "User Product" is either (1) a "consumer product", which means any
|
298 |
+
tangible personal property which is normally used for personal, family,
|
299 |
+
or household purposes, or (2) anything designed or sold for incorporation
|
300 |
+
into a dwelling. In determining whether a product is a consumer product,
|
301 |
+
doubtful cases shall be resolved in favor of coverage. For a particular
|
302 |
+
product received by a particular user, "normally used" refers to a
|
303 |
+
typical or common use of that class of product, regardless of the status
|
304 |
+
of the particular user or of the way in which the particular user
|
305 |
+
actually uses, or expects or is expected to use, the product. A product
|
306 |
+
is a consumer product regardless of whether the product has substantial
|
307 |
+
commercial, industrial or non-consumer uses, unless such uses represent
|
308 |
+
the only significant mode of use of the product.
|
309 |
+
|
310 |
+
"Installation Information" for a User Product means any methods,
|
311 |
+
procedures, authorization keys, or other information required to install
|
312 |
+
and execute modified versions of a covered work in that User Product from
|
313 |
+
a modified version of its Corresponding Source. The information must
|
314 |
+
suffice to ensure that the continued functioning of the modified object
|
315 |
+
code is in no case prevented or interfered with solely because
|
316 |
+
modification has been made.
|
317 |
+
|
318 |
+
If you convey an object code work under this section in, or with, or
|
319 |
+
specifically for use in, a User Product, and the conveying occurs as
|
320 |
+
part of a transaction in which the right of possession and use of the
|
321 |
+
User Product is transferred to the recipient in perpetuity or for a
|
322 |
+
fixed term (regardless of how the transaction is characterized), the
|
323 |
+
Corresponding Source conveyed under this section must be accompanied
|
324 |
+
by the Installation Information. But this requirement does not apply
|
325 |
+
if neither you nor any third party retains the ability to install
|
326 |
+
modified object code on the User Product (for example, the work has
|
327 |
+
been installed in ROM).
|
328 |
+
|
329 |
+
The requirement to provide Installation Information does not include a
|
330 |
+
requirement to continue to provide support service, warranty, or updates
|
331 |
+
for a work that has been modified or installed by the recipient, or for
|
332 |
+
the User Product in which it has been modified or installed. Access to a
|
333 |
+
network may be denied when the modification itself materially and
|
334 |
+
adversely affects the operation of the network or violates the rules and
|
335 |
+
protocols for communication across the network.
|
336 |
+
|
337 |
+
Corresponding Source conveyed, and Installation Information provided,
|
338 |
+
in accord with this section must be in a format that is publicly
|
339 |
+
documented (and with an implementation available to the public in
|
340 |
+
source code form), and must require no special password or key for
|
341 |
+
unpacking, reading or copying.
|
342 |
+
|
343 |
+
7. Additional Terms.
|
344 |
+
|
345 |
+
"Additional permissions" are terms that supplement the terms of this
|
346 |
+
License by making exceptions from one or more of its conditions.
|
347 |
+
Additional permissions that are applicable to the entire Program shall
|
348 |
+
be treated as though they were included in this License, to the extent
|
349 |
+
that they are valid under applicable law. If additional permissions
|
350 |
+
apply only to part of the Program, that part may be used separately
|
351 |
+
under those permissions, but the entire Program remains governed by
|
352 |
+
this License without regard to the additional permissions.
|
353 |
+
|
354 |
+
When you convey a copy of a covered work, you may at your option
|
355 |
+
remove any additional permissions from that copy, or from any part of
|
356 |
+
it. (Additional permissions may be written to require their own
|
357 |
+
removal in certain cases when you modify the work.) You may place
|
358 |
+
additional permissions on material, added by you to a covered work,
|
359 |
+
for which you have or can give appropriate copyright permission.
|
360 |
+
|
361 |
+
Notwithstanding any other provision of this License, for material you
|
362 |
+
add to a covered work, you may (if authorized by the copyright holders of
|
363 |
+
that material) supplement the terms of this License with terms:
|
364 |
+
|
365 |
+
a) Disclaiming warranty or limiting liability differently from the
|
366 |
+
terms of sections 15 and 16 of this License; or
|
367 |
+
|
368 |
+
b) Requiring preservation of specified reasonable legal notices or
|
369 |
+
author attributions in that material or in the Appropriate Legal
|
370 |
+
Notices displayed by works containing it; or
|
371 |
+
|
372 |
+
c) Prohibiting misrepresentation of the origin of that material, or
|
373 |
+
requiring that modified versions of such material be marked in
|
374 |
+
reasonable ways as different from the original version; or
|
375 |
+
|
376 |
+
d) Limiting the use for publicity purposes of names of licensors or
|
377 |
+
authors of the material; or
|
378 |
+
|
379 |
+
e) Declining to grant rights under trademark law for use of some
|
380 |
+
trade names, trademarks, or service marks; or
|
381 |
+
|
382 |
+
f) Requiring indemnification of licensors and authors of that
|
383 |
+
material by anyone who conveys the material (or modified versions of
|
384 |
+
it) with contractual assumptions of liability to the recipient, for
|
385 |
+
any liability that these contractual assumptions directly impose on
|
386 |
+
those licensors and authors.
|
387 |
+
|
388 |
+
All other non-permissive additional terms are considered "further
|
389 |
+
restrictions" within the meaning of section 10. If the Program as you
|
390 |
+
received it, or any part of it, contains a notice stating that it is
|
391 |
+
governed by this License along with a term that is a further
|
392 |
+
restriction, you may remove that term. If a license document contains
|
393 |
+
a further restriction but permits relicensing or conveying under this
|
394 |
+
License, you may add to a covered work material governed by the terms
|
395 |
+
of that license document, provided that the further restriction does
|
396 |
+
not survive such relicensing or conveying.
|
397 |
+
|
398 |
+
If you add terms to a covered work in accord with this section, you
|
399 |
+
must place, in the relevant source files, a statement of the
|
400 |
+
additional terms that apply to those files, or a notice indicating
|
401 |
+
where to find the applicable terms.
|
402 |
+
|
403 |
+
Additional terms, permissive or non-permissive, may be stated in the
|
404 |
+
form of a separately written license, or stated as exceptions;
|
405 |
+
the above requirements apply either way.
|
406 |
+
|
407 |
+
8. Termination.
|
408 |
+
|
409 |
+
You may not propagate or modify a covered work except as expressly
|
410 |
+
provided under this License. Any attempt otherwise to propagate or
|
411 |
+
modify it is void, and will automatically terminate your rights under
|
412 |
+
this License (including any patent licenses granted under the third
|
413 |
+
paragraph of section 11).
|
414 |
+
|
415 |
+
However, if you cease all violation of this License, then your
|
416 |
+
license from a particular copyright holder is reinstated (a)
|
417 |
+
provisionally, unless and until the copyright holder explicitly and
|
418 |
+
finally terminates your license, and (b) permanently, if the copyright
|
419 |
+
holder fails to notify you of the violation by some reasonable means
|
420 |
+
prior to 60 days after the cessation.
|
421 |
+
|
422 |
+
Moreover, your license from a particular copyright holder is
|
423 |
+
reinstated permanently if the copyright holder notifies you of the
|
424 |
+
violation by some reasonable means, this is the first time you have
|
425 |
+
received notice of violation of this License (for any work) from that
|
426 |
+
copyright holder, and you cure the violation prior to 30 days after
|
427 |
+
your receipt of the notice.
|
428 |
+
|
429 |
+
Termination of your rights under this section does not terminate the
|
430 |
+
licenses of parties who have received copies or rights from you under
|
431 |
+
this License. If your rights have been terminated and not permanently
|
432 |
+
reinstated, you do not qualify to receive new licenses for the same
|
433 |
+
material under section 10.
|
434 |
+
|
435 |
+
9. Acceptance Not Required for Having Copies.
|
436 |
+
|
437 |
+
You are not required to accept this License in order to receive or
|
438 |
+
run a copy of the Program. Ancillary propagation of a covered work
|
439 |
+
occurring solely as a consequence of using peer-to-peer transmission
|
440 |
+
to receive a copy likewise does not require acceptance. However,
|
441 |
+
nothing other than this License grants you permission to propagate or
|
442 |
+
modify any covered work. These actions infringe copyright if you do
|
443 |
+
not accept this License. Therefore, by modifying or propagating a
|
444 |
+
covered work, you indicate your acceptance of this License to do so.
|
445 |
+
|
446 |
+
10. Automatic Licensing of Downstream Recipients.
|
447 |
+
|
448 |
+
Each time you convey a covered work, the recipient automatically
|
449 |
+
receives a license from the original licensors, to run, modify and
|
450 |
+
propagate that work, subject to this License. You are not responsible
|
451 |
+
for enforcing compliance by third parties with this License.
|
452 |
+
|
453 |
+
An "entity transaction" is a transaction transferring control of an
|
454 |
+
organization, or substantially all assets of one, or subdividing an
|
455 |
+
organization, or merging organizations. If propagation of a covered
|
456 |
+
work results from an entity transaction, each party to that
|
457 |
+
transaction who receives a copy of the work also receives whatever
|
458 |
+
licenses to the work the party's predecessor in interest had or could
|
459 |
+
give under the previous paragraph, plus a right to possession of the
|
460 |
+
Corresponding Source of the work from the predecessor in interest, if
|
461 |
+
the predecessor has it or can get it with reasonable efforts.
|
462 |
+
|
463 |
+
You may not impose any further restrictions on the exercise of the
|
464 |
+
rights granted or affirmed under this License. For example, you may
|
465 |
+
not impose a license fee, royalty, or other charge for exercise of
|
466 |
+
rights granted under this License, and you may not initiate litigation
|
467 |
+
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
468 |
+
any patent claim is infringed by making, using, selling, offering for
|
469 |
+
sale, or importing the Program or any portion of it.
|
470 |
+
|
471 |
+
11. Patents.
|
472 |
+
|
473 |
+
A "contributor" is a copyright holder who authorizes use under this
|
474 |
+
License of the Program or a work on which the Program is based. The
|
475 |
+
work thus licensed is called the contributor's "contributor version".
|
476 |
+
|
477 |
+
A contributor's "essential patent claims" are all patent claims
|
478 |
+
owned or controlled by the contributor, whether already acquired or
|
479 |
+
hereafter acquired, that would be infringed by some manner, permitted
|
480 |
+
by this License, of making, using, or selling its contributor version,
|
481 |
+
but do not include claims that would be infringed only as a
|
482 |
+
consequence of further modification of the contributor version. For
|
483 |
+
purposes of this definition, "control" includes the right to grant
|
484 |
+
patent sublicenses in a manner consistent with the requirements of
|
485 |
+
this License.
|
486 |
+
|
487 |
+
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
488 |
+
patent license under the contributor's essential patent claims, to
|
489 |
+
make, use, sell, offer for sale, import and otherwise run, modify and
|
490 |
+
propagate the contents of its contributor version.
|
491 |
+
|
492 |
+
In the following three paragraphs, a "patent license" is any express
|
493 |
+
agreement or commitment, however denominated, not to enforce a patent
|
494 |
+
(such as an express permission to practice a patent or covenant not to
|
495 |
+
sue for patent infringement). To "grant" such a patent license to a
|
496 |
+
party means to make such an agreement or commitment not to enforce a
|
497 |
+
patent against the party.
|
498 |
+
|
499 |
+
If you convey a covered work, knowingly relying on a patent license,
|
500 |
+
and the Corresponding Source of the work is not available for anyone
|
501 |
+
to copy, free of charge and under the terms of this License, through a
|
502 |
+
publicly available network server or other readily accessible means,
|
503 |
+
then you must either (1) cause the Corresponding Source to be so
|
504 |
+
available, or (2) arrange to deprive yourself of the benefit of the
|
505 |
+
patent license for this particular work, or (3) arrange, in a manner
|
506 |
+
consistent with the requirements of this License, to extend the patent
|
507 |
+
license to downstream recipients. "Knowingly relying" means you have
|
508 |
+
actual knowledge that, but for the patent license, your conveying the
|
509 |
+
covered work in a country, or your recipient's use of the covered work
|
510 |
+
in a country, would infringe one or more identifiable patents in that
|
511 |
+
country that you have reason to believe are valid.
|
512 |
+
|
513 |
+
If, pursuant to or in connection with a single transaction or
|
514 |
+
arrangement, you convey, or propagate by procuring conveyance of, a
|
515 |
+
covered work, and grant a patent license to some of the parties
|
516 |
+
receiving the covered work authorizing them to use, propagate, modify
|
517 |
+
or convey a specific copy of the covered work, then the patent license
|
518 |
+
you grant is automatically extended to all recipients of the covered
|
519 |
+
work and works based on it.
|
520 |
+
|
521 |
+
A patent license is "discriminatory" if it does not include within
|
522 |
+
the scope of its coverage, prohibits the exercise of, or is
|
523 |
+
conditioned on the non-exercise of one or more of the rights that are
|
524 |
+
specifically granted under this License. You may not convey a covered
|
525 |
+
work if you are a party to an arrangement with a third party that is
|
526 |
+
in the business of distributing software, under which you make payment
|
527 |
+
to the third party based on the extent of your activity of conveying
|
528 |
+
the work, and under which the third party grants, to any of the
|
529 |
+
parties who would receive the covered work from you, a discriminatory
|
530 |
+
patent license (a) in connection with copies of the covered work
|
531 |
+
conveyed by you (or copies made from those copies), or (b) primarily
|
532 |
+
for and in connection with specific products or compilations that
|
533 |
+
contain the covered work, unless you entered into that arrangement,
|
534 |
+
or that patent license was granted, prior to 28 March 2007.
|
535 |
+
|
536 |
+
Nothing in this License shall be construed as excluding or limiting
|
537 |
+
any implied license or other defenses to infringement that may
|
538 |
+
otherwise be available to you under applicable patent law.
|
539 |
+
|
540 |
+
12. No Surrender of Others' Freedom.
|
541 |
+
|
542 |
+
If conditions are imposed on you (whether by court order, agreement or
|
543 |
+
otherwise) that contradict the conditions of this License, they do not
|
544 |
+
excuse you from the conditions of this License. If you cannot convey a
|
545 |
+
covered work so as to satisfy simultaneously your obligations under this
|
546 |
+
License and any other pertinent obligations, then as a consequence you may
|
547 |
+
not convey it at all. For example, if you agree to terms that obligate you
|
548 |
+
to collect a royalty for further conveying from those to whom you convey
|
549 |
+
the Program, the only way you could satisfy both those terms and this
|
550 |
+
License would be to refrain entirely from conveying the Program.
|
551 |
+
|
552 |
+
13. Use with the GNU Affero General Public License.
|
553 |
+
|
554 |
+
Notwithstanding any other provision of this License, you have
|
555 |
+
permission to link or combine any covered work with a work licensed
|
556 |
+
under version 3 of the GNU Affero General Public License into a single
|
557 |
+
combined work, and to convey the resulting work. The terms of this
|
558 |
+
License will continue to apply to the part which is the covered work,
|
559 |
+
but the special requirements of the GNU Affero General Public License,
|
560 |
+
section 13, concerning interaction through a network will apply to the
|
561 |
+
combination as such.
|
562 |
+
|
563 |
+
14. Revised Versions of this License.
|
564 |
+
|
565 |
+
The Free Software Foundation may publish revised and/or new versions of
|
566 |
+
the GNU General Public License from time to time. Such new versions will
|
567 |
+
be similar in spirit to the present version, but may differ in detail to
|
568 |
+
address new problems or concerns.
|
569 |
+
|
570 |
+
Each version is given a distinguishing version number. If the
|
571 |
+
Program specifies that a certain numbered version of the GNU General
|
572 |
+
Public License "or any later version" applies to it, you have the
|
573 |
+
option of following the terms and conditions either of that numbered
|
574 |
+
version or of any later version published by the Free Software
|
575 |
+
Foundation. If the Program does not specify a version number of the
|
576 |
+
GNU General Public License, you may choose any version ever published
|
577 |
+
by the Free Software Foundation.
|
578 |
+
|
579 |
+
If the Program specifies that a proxy can decide which future
|
580 |
+
versions of the GNU General Public License can be used, that proxy's
|
581 |
+
public statement of acceptance of a version permanently authorizes you
|
582 |
+
to choose that version for the Program.
|
583 |
+
|
584 |
+
Later license versions may give you additional or different
|
585 |
+
permissions. However, no additional obligations are imposed on any
|
586 |
+
author or copyright holder as a result of your choosing to follow a
|
587 |
+
later version.
|
588 |
+
|
589 |
+
15. Disclaimer of Warranty.
|
590 |
+
|
591 |
+
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
592 |
+
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
593 |
+
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
594 |
+
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
595 |
+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
596 |
+
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
597 |
+
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
598 |
+
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
599 |
+
|
600 |
+
16. Limitation of Liability.
|
601 |
+
|
602 |
+
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
603 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
604 |
+
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
605 |
+
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
606 |
+
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
607 |
+
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
608 |
+
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
609 |
+
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
610 |
+
SUCH DAMAGES.
|
611 |
+
|
612 |
+
17. Interpretation of Sections 15 and 16.
|
613 |
+
|
614 |
+
If the disclaimer of warranty and limitation of liability provided
|
615 |
+
above cannot be given local legal effect according to their terms,
|
616 |
+
reviewing courts shall apply local law that most closely approximates
|
617 |
+
an absolute waiver of all civil liability in connection with the
|
618 |
+
Program, unless a warranty or assumption of liability accompanies a
|
619 |
+
copy of the Program in return for a fee.
|
620 |
+
|
621 |
+
END OF TERMS AND CONDITIONS
|
622 |
+
|
623 |
+
How to Apply These Terms to Your New Programs
|
624 |
+
|
625 |
+
If you develop a new program, and you want it to be of the greatest
|
626 |
+
possible use to the public, the best way to achieve this is to make it
|
627 |
+
free software which everyone can redistribute and change under these terms.
|
628 |
+
|
629 |
+
To do so, attach the following notices to the program. It is safest
|
630 |
+
to attach them to the start of each source file to most effectively
|
631 |
+
state the exclusion of warranty; and each file should have at least
|
632 |
+
the "copyright" line and a pointer to where the full notice is found.
|
633 |
+
|
634 |
+
<one line to give the program's name and a brief idea of what it does.>
|
635 |
+
Copyright (C) <year> <name of author>
|
636 |
+
|
637 |
+
This program is free software: you can redistribute it and/or modify
|
638 |
+
it under the terms of the GNU General Public License as published by
|
639 |
+
the Free Software Foundation, either version 3 of the License, or
|
640 |
+
(at your option) any later version.
|
641 |
+
|
642 |
+
This program is distributed in the hope that it will be useful,
|
643 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
644 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
645 |
+
GNU General Public License for more details.
|
646 |
+
|
647 |
+
You should have received a copy of the GNU General Public License
|
648 |
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
649 |
+
|
650 |
+
Also add information on how to contact you by electronic and paper mail.
|
651 |
+
|
652 |
+
If the program does terminal interaction, make it output a short
|
653 |
+
notice like this when it starts in an interactive mode:
|
654 |
+
|
655 |
+
<program> Copyright (C) <year> <name of author>
|
656 |
+
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
657 |
+
This is free software, and you are welcome to redistribute it
|
658 |
+
under certain conditions; type `show c' for details.
|
659 |
+
|
660 |
+
The hypothetical commands `show w' and `show c' should show the appropriate
|
661 |
+
parts of the General Public License. Of course, your program's commands
|
662 |
+
might be different; for a GUI interface, you would use an "about box".
|
663 |
+
|
664 |
+
You should also get your employer (if you work as a programmer) or school,
|
665 |
+
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
666 |
+
For more information on this, and how to apply and follow the GNU GPL, see
|
667 |
+
<https://www.gnu.org/licenses/>.
|
668 |
+
|
669 |
+
The GNU General Public License does not permit incorporating your program
|
670 |
+
into proprietary programs. If your program is a subroutine library, you
|
671 |
+
may consider it more useful to permit linking proprietary applications with
|
672 |
+
the library. If this is what you want to do, use the GNU Lesser General
|
673 |
+
Public License instead of this License. But first, please read
|
674 |
+
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
src/Yunzai-Bot/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Yunzai-Bot v3
|
2 |
+
云崽v3.0,原神qq群机器人,通过米游社接口,查询原神游戏信息,快速生成图片返回
|
3 |
+
|
4 |
+
项目仅供学习交流使用,严禁用于任何商业用途和非法行为
|
5 |
+
|
6 |
+
[目前功能](https://github.com/Le-niao/Yunzai-Bot/tree/main/plugins/genshin)
|
7 |
+
|
8 |
+
## 使用方法
|
9 |
+
>环境准备: Windows or Linux,Node.js([版本至少v16以上](http://nodejs.cn/download/)),[Redis](https://redis.io/docs/getting-started/installation/)
|
10 |
+
|
11 |
+
1.克隆项目
|
12 |
+
```
|
13 |
+
git clone --depth=1 -b main https://github.com/Le-niao/Yunzai-Bot.git
|
14 |
+
```
|
15 |
+
```
|
16 |
+
cd Yunzai-Bot #进入Yunzai目录
|
17 |
+
```
|
18 |
+
2.安装[pnpm](https://pnpm.io/zh/installation),已安装的可以跳过
|
19 |
+
```
|
20 |
+
npm install pnpm -g
|
21 |
+
```
|
22 |
+
3.安装依赖
|
23 |
+
```
|
24 |
+
pnpm install -P
|
25 |
+
```
|
26 |
+
4.运行(首次运行按提示输入登录)
|
27 |
+
```
|
28 |
+
node app
|
29 |
+
```
|
30 |
+
|
31 |
+
## 致谢
|
32 |
+
| Nickname | Contribution |
|
33 |
+
| :----------------------------------------------------------: | ----------------------------------- |
|
34 |
+
|[GardenHamster](https://github.com/GardenHamster/GenshinPray) | 模拟抽卡背景素材来源 |
|
35 |
+
|[西风驿站](https://bbs.mihoyo.com/ys/collection/839181) | 角色攻略图来源 |
|
36 |
+
|[米游社友人A](https://bbs.mihoyo.com/ys/collection/428421) | 角色突破素材图来源 |
|
37 |
+
|
38 |
+
## 其他
|
39 |
+
- 最后给个star或者[爱发电](https://afdian.net/@Le-niao),你的支持是维护本项目的动力~~
|
40 |
+
- 图片素材来源于网络,仅供交流学习使用
|
41 |
+
- 严禁用于任何商业用途和非法行为
|
src/Yunzai-Bot/app.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import Yunzai from './lib/bot.js'
|
2 |
+
|
3 |
+
/** 全局变量 bot */
|
4 |
+
global.Bot = await Yunzai.run()
|
src/Yunzai-Bot/config/config/other.yaml
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# 是否自动同意加好友 1-同意 0-不处理
|
2 |
+
autoFriend: 1
|
3 |
+
# 是否自动退群人数,当被好友拉进群时,群人数小于配置值自动退出, 默认50,0则不处理
|
4 |
+
autoQuit: 50
|
5 |
+
# 主人QQ号
|
6 |
+
masterQQ: "10000000"
|
7 |
+
|
8 |
+
# 禁用私聊功能 true:私聊只接受ck以及抽卡链接(Bot主人不受限制),false:私聊可以触发全部指令,默认false
|
9 |
+
disablePrivate: false
|
10 |
+
# 禁用私聊Bot提示内容
|
11 |
+
disableMsg: "私聊功能已禁用,仅支持发送cookie,抽卡记录链接,记录日志文件"
|
12 |
+
# 私聊通行字符串
|
13 |
+
disableAdopt:
|
14 |
+
- stoken
|
15 |
+
#白名单群,配置后只在该群生效
|
16 |
+
whiteGroup:
|
17 |
+
|
18 |
+
#黑名单群
|
19 |
+
blackGroup:
|
20 |
+
- 213938015
|
21 |
+
#黑名单qq
|
22 |
+
blackQQ:
|
23 |
+
- 528952540
|
src/Yunzai-Bot/config/config/redis.yaml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# redis地址
|
2 |
+
host: redis
|
3 |
+
# redis端口
|
4 |
+
port: 6379
|
5 |
+
# redis密码,没有密码可以为空
|
6 |
+
password:
|
7 |
+
# redis数据库
|
8 |
+
db: 0
|
9 |
+
|
src/Yunzai-Bot/config/default_config/bot.yaml
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# 日志等级:trace,debug,info,warn,fatal,mark,error,off
|
2 |
+
# mark时只显示执行命令,不显示聊天记录
|
3 |
+
log_level: info
|
4 |
+
# 群聊和频道中过滤自己的消息
|
5 |
+
ignore_self: true
|
6 |
+
# 被风控时是否尝试用分片发送
|
7 |
+
resend: false
|
8 |
+
# ffmpeg
|
9 |
+
ffmpeg_path:
|
10 |
+
ffprobe_path:
|
11 |
+
|
12 |
+
# chromium其他路径
|
13 |
+
chromium_path:
|
14 |
+
|
15 |
+
# 米游社接口代理地址,国际服用
|
16 |
+
proxyAddress:
|
17 |
+
|
18 |
+
# 上线时给首个主人QQ推送帮助
|
19 |
+
online_msg: true
|
20 |
+
# 上线推送通知的冷却时间
|
21 |
+
online_msg_exp: 86400
|
src/Yunzai-Bot/config/default_config/group.yaml
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# 默认设置
|
2 |
+
default:
|
3 |
+
groupCD: 500 # 群聊中所有指令操作冷却时间,单位毫秒,0则无限制
|
4 |
+
singleCD: 2000 # 群聊中个人操作冷却时间,单位毫秒
|
5 |
+
|
6 |
+
onlyReplyAt: 0 # 是否只仅关注主动@机器人的消息, 0-否 1-是
|
7 |
+
botAlias: # 开启后则只回复@机器人的消息及特定前缀的消息,支持多个
|
8 |
+
- 云崽
|
9 |
+
- 云宝
|
10 |
+
|
11 |
+
imgAddLimit: 0 #添加表情是否限制 0-所有群员都可以添加 1-群管理员才能添加 2-主人才能添加
|
12 |
+
imgMaxSize: 2 #添加表情图片大小限制,默认2m
|
13 |
+
addPrivate: 1 #是否允许私聊添加 1-允许 0-禁止
|
14 |
+
|
15 |
+
enable: #只启用功能,配置后只有该功能才响应
|
16 |
+
|
17 |
+
#禁用功能,功能名称,例如:十连、角色查询、体力查询、用户绑定、抽卡记录、添加表情、欢迎新人、退群通知
|
18 |
+
#禁用功能,功能名称,例如:云崽帮助、角色素材、今日素材、养成计算、米游社公告
|
19 |
+
disable:
|
20 |
+
- 禁用示例
|
21 |
+
- 支持多个
|
22 |
+
|
23 |
+
# 群单独设置,自动覆盖默认值
|
24 |
+
123456:
|
25 |
+
groupCD: 500 # 群聊中所有指令操作冷却时间,单位毫秒,0则无限制
|
26 |
+
singleCD: 2000 # 群聊中个人操作冷却时间,单位毫秒
|
src/Yunzai-Bot/config/default_config/other.yaml
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# 是否自动同意加好友 1-同意 0-不处理
|
2 |
+
autoFriend: 1
|
3 |
+
# 是否自动退群人数,当被好友拉进群时,群人数小于配置值自动退出, 默认50,0则不处理
|
4 |
+
autoQuit: 50
|
5 |
+
# 主人QQ号
|
6 |
+
masterQQ:
|
7 |
+
|
8 |
+
# 禁用私聊功能 true:私聊只接受ck以及抽卡链接(Bot主人不受限制),false:私聊可以触发全部指令,默认false
|
9 |
+
disablePrivate: false
|
10 |
+
# 禁用私聊Bot提示内容
|
11 |
+
disableMsg: "私聊功能已禁用,仅支持发送cookie,抽卡记录链接,记录日志文件"
|
12 |
+
# 私聊通行字符串
|
13 |
+
disableAdopt:
|
14 |
+
- stoken
|
15 |
+
#白名单群,配置后只在该群生效
|
16 |
+
whiteGroup:
|
17 |
+
|
18 |
+
#黑名单群
|
19 |
+
blackGroup:
|
20 |
+
- 213938015
|
21 |
+
#黑名单qq
|
22 |
+
blackQQ:
|
23 |
+
- 528952540
|
src/Yunzai-Bot/config/default_config/qq.yaml
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# qq账号
|
2 |
+
qq:
|
3 |
+
# 密码,为空则用扫码登录,扫码登录现在仅能在同一ip下进行
|
4 |
+
pwd:
|
5 |
+
# 1:安卓手机、 2:aPad 、 3:安卓手表、 4:MacOS 、 5:iPad
|
6 |
+
platform: 5
|
src/Yunzai-Bot/config/default_config/redis.yaml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# redis地址
|
2 |
+
host: 127.0.0.1
|
3 |
+
# redis端口
|
4 |
+
port: 6379
|
5 |
+
# redis密码,没有密码可以为空
|
6 |
+
password:
|
7 |
+
# redis数据库
|
8 |
+
db: 0
|
9 |
+
|
src/Yunzai-Bot/config/pm2/pm2.json
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"apps": [
|
3 |
+
{
|
4 |
+
"name": "Yunzai-Bot",
|
5 |
+
"script": "./app.js",
|
6 |
+
"max_memory_restart": "512M",
|
7 |
+
"restart_delay": 60000
|
8 |
+
}
|
9 |
+
]
|
10 |
+
}
|
src/Yunzai-Bot/config/test/default.yaml
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# 默认测试配置,其他配置自行复制
|
2 |
+
post_type: message
|
3 |
+
message_type: group
|
4 |
+
sub_type: normal
|
5 |
+
group_id: 213938015
|
6 |
+
group_name: '2333'
|
7 |
+
user_id: 805475874
|
8 |
+
# 测试命令
|
9 |
+
text: 十连
|
10 |
+
card: 测试(104070461)
|
src/Yunzai-Bot/docker-compose.yaml
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
version: "3"
|
2 |
+
services:
|
3 |
+
yunzai-bot:
|
4 |
+
container_name: yunzai-bot
|
5 |
+
# build: ./docker # 使用 Dockerfile 本地构建
|
6 |
+
image: swr.cn-south-1.myhuaweicloud.com/sirly/yunzai-bot:v3 # 使用云端精简镜像
|
7 |
+
# image: swr.cn-south-1.myhuaweicloud.com/sirly/yunzai-bot:v3plus # 使用扩展镜像,包含ffmpeg和python
|
8 |
+
# image: sirly/yunzai-bot:v3 # Docker Hub源
|
9 |
+
# image: sirly/yunzai-bot:v3plus
|
10 |
+
# user: "1000:1000" # 指定容器内用户,格式"UID:GID"(请先修改文件夹权限)
|
11 |
+
restart: always
|
12 |
+
# ports:
|
13 |
+
# - "50831:50831" # 映射锅巴插件端口,格式"主机端口:容器内部端口"
|
14 |
+
volumes:
|
15 |
+
- ./yunzai/config/:/app/Yunzai-Bot/config/config/ # Bot基础配置文件
|
16 |
+
- ./yunzai/genshin_config:/app/Yunzai-Bot/plugins/genshin/config # 公共Cookie,云崽功能配置文件
|
17 |
+
- ./yunzai/logs:/app/Yunzai-Bot/logs # 日志文件
|
18 |
+
- ./yunzai/data:/app/Yunzai-Bot/data # 数据文件
|
19 |
+
# 以下目录是插件目录,安装完插件后需要手动添加映射(如有其他插件请自行添加)
|
20 |
+
# 映射格式:./yunzai/plugins/<插件目录名>:/app/Yunzai-Bot/plugins/<插件目录名>
|
21 |
+
# - ./yunzai/plugins/example:/app/Yunzai-Bot/plugins/example # 单js插件目录
|
22 |
+
# - ./yunzai/plugins/miao-plugin:/app/Yunzai-Bot/plugins/miao-plugin # 喵喵插件
|
23 |
+
# - ./yunzai/plugins/py-plugin:/app/Yunzai-Bot/plugins/py-plugin # 新py插件
|
24 |
+
# - ./yunzai/plugins/xiaoyao-cvs-plugin:/app/Yunzai-Bot/plugins/xiaoyao-cvs-plugin # 图鉴插件
|
25 |
+
#### [警告] 受云崽架构和docker特性限制,使用锅巴插件安装的插件无法持久化,销毁容器后新安装的插件会消失,请谨慎使用 ####
|
26 |
+
# - ./yunzai/plugins/Guoba-Plugin:/app/Yunzai-Bot/plugins/Guoba-Plugin # 锅巴插件
|
27 |
+
environment:
|
28 |
+
- CUID=1000 # 宿主机运行 id -u 获取
|
29 |
+
- CGID=1000 # 宿主机运行 id -g 获取
|
30 |
+
depends_on:
|
31 |
+
redis: { condition: service_healthy }
|
32 |
+
deploy:
|
33 |
+
resources:
|
34 |
+
limits:
|
35 |
+
memory: 2G
|
36 |
+
|
37 |
+
redis:
|
38 |
+
container_name: yunzai-redis
|
39 |
+
image: redis:alpine
|
40 |
+
restart: always
|
41 |
+
volumes:
|
42 |
+
# 前往 https://download.redis.io/redis-stable/redis.conf 下载配置文件,放入 ./redis/config 文件夹中
|
43 |
+
# - ./redis/config:/etc/redis/ # Redis配置文件
|
44 |
+
- ./redis/data:/data
|
45 |
+
- ./redis/logs:/logs
|
46 |
+
# command: /etc/redis/redis.conf # 取消注释以应用Redis配置文件
|
47 |
+
healthcheck:
|
48 |
+
test: [ "CMD", "redis-cli", "PING" ]
|
49 |
+
start_period: 10s
|
50 |
+
interval: 5s
|
51 |
+
timeout: 1s
|
src/Yunzai-Bot/docker-entrypoint.py
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env python
|
2 |
+
|
3 |
+
import subprocess
|
4 |
+
import os
|
5 |
+
|
6 |
+
# soft link every plugin in ./user_plugins to ./plugins, like ./user_plugins/miao -> ./plugins/miao
|
7 |
+
def link_plugins():
|
8 |
+
buildin_plugins = [
|
9 |
+
"example", "genshin", "other", "system"
|
10 |
+
]
|
11 |
+
|
12 |
+
# when container restart, remove all plugins in ./plugins except buildin plugins
|
13 |
+
for plugin in os.listdir("./plugins"):
|
14 |
+
if plugin not in buildin_plugins:
|
15 |
+
subprocess.run(["rm", "-rf", "./plugins/" + plugin])
|
16 |
+
|
17 |
+
for plugin in os.listdir("./user_plugins"):
|
18 |
+
if plugin in buildin_plugins:
|
19 |
+
print(f"plugin {plugin} is buildin, please rename it", flush=True)
|
20 |
+
exit(1)
|
21 |
+
|
22 |
+
subprocess.run(["ln", "-s", "../user_plugins/" + plugin, "./plugins/" + plugin])
|
23 |
+
print("copy plugin %s to ./plugins" % plugin, flush=True)
|
24 |
+
|
25 |
+
|
26 |
+
def run_server():
|
27 |
+
print("run server", flush=True)
|
28 |
+
subprocess.run(["node", "./lib/tools/server.js"])
|
29 |
+
|
30 |
+
|
31 |
+
def main():
|
32 |
+
link_plugins()
|
33 |
+
run_server()
|
34 |
+
|
35 |
+
|
36 |
+
if __name__ == '__main__':
|
37 |
+
main()
|
src/Yunzai-Bot/docker/Dockerfile
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM debian:stable AS resource
|
2 |
+
|
3 |
+
RUN apt-get update \
|
4 |
+
&& apt-get upgrade -y \
|
5 |
+
&& apt-get install -y wget xz-utils dos2unix \
|
6 |
+
&& wget https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-$(dpkg --print-architecture)-static.tar.xz \
|
7 |
+
&& mkdir -p /res/ffmpeg \
|
8 |
+
&& tar -xvf ./ffmpeg-git-$(dpkg --print-architecture)-static.tar.xz -C /res/ffmpeg --strip-components 1
|
9 |
+
|
10 |
+
COPY docker-entrypoint.sh /res/entrypoint.sh
|
11 |
+
|
12 |
+
RUN dos2unix /res/entrypoint.sh \
|
13 |
+
&& chmod +x /res/entrypoint.sh
|
14 |
+
|
15 |
+
|
16 |
+
FROM node:lts-slim AS runtime
|
17 |
+
|
18 |
+
COPY --from=resource /res/ffmpeg/ffmpeg /usr/bin/ffmpeg
|
19 |
+
|
20 |
+
COPY --from=resource /res/ffmpeg/ffprobe /usr/bin/ffprobe
|
21 |
+
|
22 |
+
RUN apt-get update \
|
23 |
+
&& apt-get upgrade -y \
|
24 |
+
&& apt-get install -y curl wget gnupg git python3-pip fonts-wqy-microhei xfonts-utils chromium fontconfig libxss1 libgl1 \
|
25 |
+
&& apt-get autoremove \
|
26 |
+
&& apt-get clean
|
27 |
+
|
28 |
+
RUN fc-cache -f -v
|
29 |
+
|
30 |
+
RUN git config --global --add safe.directory '*' \
|
31 |
+
&& git config --global pull.rebase false \
|
32 |
+
&& git config --global user.email "Yunzai@yunzai.bot" \
|
33 |
+
&& git config --global user.name "Yunzai"
|
34 |
+
|
35 |
+
RUN npm install pnpm -g
|
36 |
+
|
37 |
+
RUN ln -s /usr/bin/python3 /usr/bin/python \
|
38 |
+
&& curl -fsSL https://install.python-poetry.org | python - \
|
39 |
+
&& ln -s /$HOME/.local/bin/poetry /usr/bin \
|
40 |
+
&& poetry config virtualenvs.in-project true
|
41 |
+
|
42 |
+
RUN rm -rf /var/cache/* \
|
43 |
+
&& rm -rf /tmp/*
|
44 |
+
|
45 |
+
|
46 |
+
FROM runtime AS prod
|
47 |
+
|
48 |
+
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \
|
49 |
+
PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
|
50 |
+
|
51 |
+
RUN git clone --depth=1 --branch main https://gitee.com/Le-niao/Yunzai-Bot.git /app/Yunzai-Bot\
|
52 |
+
&& cd /app/Yunzai-Bot \
|
53 |
+
&& sed -i 's/127.0.0.1/redis/g' ./config/default_config/redis.yaml \
|
54 |
+
&& pnpm install -P
|
55 |
+
|
56 |
+
COPY --from=resource /res/entrypoint.sh /app/Yunzai-Bot/entrypoint.sh
|
57 |
+
|
58 |
+
WORKDIR /app/Yunzai-Bot
|
59 |
+
ENTRYPOINT ["/app/Yunzai-Bot/entrypoint.sh"]
|
src/Yunzai-Bot/docker/docker-entrypoint.sh
ADDED
@@ -0,0 +1,181 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env bash
|
2 |
+
|
3 |
+
set +e
|
4 |
+
|
5 |
+
GreenBG="\\033[42;37m"
|
6 |
+
YellowBG="\\033[43;37m"
|
7 |
+
BlueBG="\\033[44;37m"
|
8 |
+
Font="\\033[0m"
|
9 |
+
|
10 |
+
Version="${BlueBG}[版本]${Font}"
|
11 |
+
Info="${GreenBG}[信息]${Font}"
|
12 |
+
Warn="${YellowBG}[提示]${Font}"
|
13 |
+
|
14 |
+
WORK_DIR="/app/Yunzai-Bot"
|
15 |
+
MIAO_PLUGIN_PATH="/app/Yunzai-Bot/plugins/miao-plugin"
|
16 |
+
XIAOYAO_CVS_PATH="/app/Yunzai-Bot/plugins/xiaoyao-cvs-plugin"
|
17 |
+
PY_PLUGIN_PATH="/app/Yunzai-Bot/plugins/py-plugin"
|
18 |
+
|
19 |
+
if [[ ! -d "$HOME/.ovo" ]]; then
|
20 |
+
mkdir ~/.ovo
|
21 |
+
fi
|
22 |
+
|
23 |
+
echo -e "\n ================ \n ${Info} ${GreenBG} 拉取 Yunzai-Bot 更新 ${Font} \n ================ \n"
|
24 |
+
|
25 |
+
cd $WORK_DIR
|
26 |
+
|
27 |
+
if [[ -z $(git status -s) ]]; then
|
28 |
+
echo -e " ${Warn} ${YellowBG} 当前工作区有修改,尝试暂存后更新。${Font}"
|
29 |
+
git add .
|
30 |
+
git stash
|
31 |
+
git pull origin main --allow-unrelated-histories --rebase
|
32 |
+
git stash pop
|
33 |
+
else
|
34 |
+
git pull origin main --allow-unrelated-histories
|
35 |
+
fi
|
36 |
+
|
37 |
+
if [[ ! -f "$HOME/.ovo/yunzai.ok" ]]; then
|
38 |
+
set -e
|
39 |
+
echo -e "\n ================ \n ${Info} ${GreenBG} 更新 Yunzai-Bot 运行依赖 ${Font} \n ================ \n"
|
40 |
+
pnpm install -P
|
41 |
+
touch ~/.ovo/yunzai.ok
|
42 |
+
set +e
|
43 |
+
fi
|
44 |
+
|
45 |
+
echo -e "\n ================ \n ${Version} ${BlueBG} Yunzai-Bot 版本信息 ${Font} \n ================ \n"
|
46 |
+
|
47 |
+
git log -1 --pretty=format:"%h - %an, %ar (%cd) : %s"
|
48 |
+
|
49 |
+
if [ -d $MIAO_PLUGIN_PATH"/.git" ]; then
|
50 |
+
|
51 |
+
echo -e "\n ================ \n ${Info} ${GreenBG} 拉取 喵喵插件 更新 ${Font} \n ================ \n"
|
52 |
+
|
53 |
+
cd $MIAO_PLUGIN_PATH
|
54 |
+
|
55 |
+
if [[ -n $(git status -s) ]]; then
|
56 |
+
echo -e " ${Warn} ${YellowBG} 当前工作区有修改,尝试暂存后更新。${Font}"
|
57 |
+
git add .
|
58 |
+
git stash
|
59 |
+
git pull origin master --allow-unrelated-histories --rebase
|
60 |
+
git stash pop
|
61 |
+
else
|
62 |
+
git pull origin master --allow-unrelated-histories
|
63 |
+
fi
|
64 |
+
|
65 |
+
if [[ ! -f "$HOME/.ovo/miao.ok" ]]; then
|
66 |
+
set -e
|
67 |
+
echo -e "\n ================ \n ${Info} ${GreenBG} 更新 喵喵插件 运行依赖 ${Font} \n ================ \n"
|
68 |
+
pnpm add image-size -w
|
69 |
+
touch ~/.ovo/miao.ok
|
70 |
+
set +e
|
71 |
+
fi
|
72 |
+
|
73 |
+
echo -e "\n ================ \n ${Version} ${BlueBG} 喵喵插件版本信息 ${Font} \n ================ \n"
|
74 |
+
git log -1 --pretty=format:"%h - %an, %ar (%cd) : %s"
|
75 |
+
|
76 |
+
fi
|
77 |
+
|
78 |
+
if [ -d $PY_PLUGIN_PATH"/.git" ]; then
|
79 |
+
|
80 |
+
echo -e "\n ================ \n ${Info} ${GreenBG} 拉取 py-plugin 插件更新 ${Font} \n ================ \n"
|
81 |
+
|
82 |
+
cd $PY_PLUGIN_PATH
|
83 |
+
|
84 |
+
if [[ -n $(git status -s) ]]; then
|
85 |
+
echo -e " ${Warn} ${YellowBG} 当前工作区有修改,尝试暂存后更新。${Font}"
|
86 |
+
git add .
|
87 |
+
git stash
|
88 |
+
git pull origin main --allow-unrelated-histories --rebase
|
89 |
+
git stash pop
|
90 |
+
else
|
91 |
+
git pull origin main --allow-unrelated-histories
|
92 |
+
fi
|
93 |
+
|
94 |
+
if [[ ! -f "$HOME/.ovo/py.ok" ]]; then
|
95 |
+
set -e
|
96 |
+
echo -e "\n ================ \n ${Info} ${GreenBG} 更新 py-plugin 运行依赖 ${Font} \n ================ \n"
|
97 |
+
pnpm install iconv-lite @grpc/grpc-js @grpc/proto-loader -w
|
98 |
+
poetry config virtualenvs.in-project true
|
99 |
+
poetry install
|
100 |
+
touch ~/.ovo/py.ok
|
101 |
+
set +e
|
102 |
+
fi
|
103 |
+
|
104 |
+
echo -e "\n ================ \n ${Version} ${BlueBG} py-plugin 插件版本信息 ${Font} \n ================ \n"
|
105 |
+
|
106 |
+
git log -1 --pretty=format:"%h - %an, %ar (%cd) : %s"
|
107 |
+
|
108 |
+
fi
|
109 |
+
|
110 |
+
if [ -d $XIAOYAO_CVS_PATH"/.git" ]; then
|
111 |
+
|
112 |
+
echo -e "\n ================ \n ${Info} ${GreenBG} 拉取 xiaoyao-cvs 插件更新 ${Font} \n ================ \n"
|
113 |
+
|
114 |
+
cd $XIAOYAO_CVS_PATH
|
115 |
+
|
116 |
+
if [[ -n $(git status -s) ]]; then
|
117 |
+
echo -e " ${Warn} ${YellowBG} 当前工作区有修改,尝试暂存后更新。${Font}"
|
118 |
+
git add .
|
119 |
+
git stash
|
120 |
+
git pull origin master --allow-unrelated-histories --rebase
|
121 |
+
git stash pop
|
122 |
+
else
|
123 |
+
git pull origin master --allow-unrelated-histories
|
124 |
+
fi
|
125 |
+
|
126 |
+
if [[ ! -f "$HOME/.ovo/xiaoyao.ok" ]]; then
|
127 |
+
set -e
|
128 |
+
echo -e "\n ================ \n ${Info} ${GreenBG} 更新 xiaoyao-cvs 插件运行依赖 ${Font} \n ================ \n"
|
129 |
+
pnpm add promise-retry superagent -w
|
130 |
+
touch ~/.ovo/xiaoyao.ok
|
131 |
+
set +e
|
132 |
+
fi
|
133 |
+
|
134 |
+
echo -e "\n ================ \n ${Version} ${BlueBG} xiaoyao-cvs 插件版本信息 ${Font} \n ================ \n"
|
135 |
+
|
136 |
+
git log -1 --pretty=format:"%h - %an, %ar (%cd) : %s"
|
137 |
+
fi
|
138 |
+
|
139 |
+
if [ -d $GUOBA_PLUGIN_PATH"/.git" ]; then
|
140 |
+
|
141 |
+
echo -e "\n ================ \n ${Info} ${GreenBG} 拉取 Guoba-Plugin 插件更新 ${Font} \n ================ \n"
|
142 |
+
|
143 |
+
cd $GUOBA_PLUGIN_PATH
|
144 |
+
|
145 |
+
if [[ -n $(git status -s) ]]; then
|
146 |
+
echo -e " ${Warn} ${YellowBG} 当前工作区有修改,尝试暂存后更新。${Font}"
|
147 |
+
git add .
|
148 |
+
git stash
|
149 |
+
git pull origin master --allow-unrelated-histories --rebase
|
150 |
+
git stash pop
|
151 |
+
else
|
152 |
+
git pull origin master --allow-unrelated-histories
|
153 |
+
fi
|
154 |
+
|
155 |
+
if [[ ! -f "$HOME/.ovo/guoba.ok" ]]; then
|
156 |
+
set -e
|
157 |
+
echo -e "\n ================ \n ${Info} ${GreenBG} 更新 Guoba-Plugin 插件运行依赖 ${Font} \n ================ \n"
|
158 |
+
pnpm add multer body-parser jsonwebtoken -w
|
159 |
+
touch ~/.ovo/guoba.ok
|
160 |
+
set +e
|
161 |
+
fi
|
162 |
+
|
163 |
+
echo -e "\n ================ \n ${Version} ${BlueBG} Guoba-Plugin 插件版本信息 ${Font} \n ================ \n"
|
164 |
+
|
165 |
+
git log -1 --pretty=format:"%h - %an, %ar (%cd) : %s"
|
166 |
+
fi
|
167 |
+
|
168 |
+
set -e
|
169 |
+
|
170 |
+
cd $WORK_DIR
|
171 |
+
|
172 |
+
echo -e "\n ================ \n ${Info} ${GreenBG} 初始化 Docker 环境 ${Font} \n ================ \n"
|
173 |
+
|
174 |
+
if [ -f "./config/config/redis.yaml" ]; then
|
175 |
+
sed -i 's/127.0.0.1/redis/g' ./config/config/redis.yaml
|
176 |
+
echo -e "\n 修改Redis地址完成~ \n"
|
177 |
+
fi
|
178 |
+
|
179 |
+
echo -e "\n ================ \n ${Info} ${GreenBG} 启动 Yunzai-Bot ${Font} \n ================ \n"
|
180 |
+
|
181 |
+
node app
|
src/Yunzai-Bot/docker/qq.yaml
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# qq账号
|
2 |
+
qq: 123456
|
3 |
+
# 密码,为空则用扫码登录,扫码登录现在仅能在同一ip下进行
|
4 |
+
pwd:
|
5 |
+
# 1:安卓手机、 2:aPad 、 3:安卓手表、 4:MacOS 、 5:iPad
|
6 |
+
platform: 5
|
src/Yunzai-Bot/lib/bot.js
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import './config/init.js'
|
2 |
+
import ListenerLoader from './listener/loader.js'
|
3 |
+
import { Client } from 'oicq'
|
4 |
+
import cfg from './config/config.js'
|
5 |
+
|
6 |
+
export default class Yunzai extends Client {
|
7 |
+
// eslint-disable-next-line no-useless-constructor
|
8 |
+
constructor (uin, conf) {
|
9 |
+
super(uin, conf)
|
10 |
+
}
|
11 |
+
|
12 |
+
/** 登录机器人 */
|
13 |
+
static async run () {
|
14 |
+
const bot = new Yunzai(cfg.qq, cfg.bot)
|
15 |
+
/** 加载oicq事件监听 */
|
16 |
+
await ListenerLoader.load(bot)
|
17 |
+
await bot.login(cfg.pwd)
|
18 |
+
return bot
|
19 |
+
}
|
20 |
+
}
|
src/Yunzai-Bot/lib/common/common.js
ADDED
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
import { pipeline } from 'stream'
|
3 |
+
import { promisify } from 'util'
|
4 |
+
import fetch from 'node-fetch'
|
5 |
+
import fs from 'node:fs'
|
6 |
+
import path from 'node:path'
|
7 |
+
|
8 |
+
/**
|
9 |
+
* 发送私聊消息,仅给好友发送
|
10 |
+
* @param user_id qq号
|
11 |
+
* @param msg 消息
|
12 |
+
*/
|
13 |
+
async function relpyPrivate (userId, msg) {
|
14 |
+
userId = Number(userId)
|
15 |
+
|
16 |
+
let friend = Bot.fl.get(userId)
|
17 |
+
if (friend) {
|
18 |
+
logger.mark(`发送好友消息[${friend.nickname}](${userId})`)
|
19 |
+
return await Bot.pickUser(userId).sendMsg(msg).catch((err) => {
|
20 |
+
logger.mark(err)
|
21 |
+
})
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* 休眠函数
|
27 |
+
* @param ms 毫秒
|
28 |
+
*/
|
29 |
+
function sleep (ms) {
|
30 |
+
return new Promise((resolve) => setTimeout(resolve, ms))
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* 下载保存文件
|
35 |
+
* @param fileUrl 下载地址
|
36 |
+
* @param savePath 保存路径
|
37 |
+
*/
|
38 |
+
async function downFile (fileUrl, savePath,param = {}) {
|
39 |
+
try {
|
40 |
+
mkdirs(path.dirname(savePath))
|
41 |
+
logger.debug(`[下载文件] ${fileUrl}`)
|
42 |
+
const response = await fetch(fileUrl,param)
|
43 |
+
const streamPipeline = promisify(pipeline)
|
44 |
+
await streamPipeline(response.body, fs.createWriteStream(savePath))
|
45 |
+
return true
|
46 |
+
} catch (err) {
|
47 |
+
logger.error(`下载文件错误:${err}`)
|
48 |
+
return false
|
49 |
+
}
|
50 |
+
}
|
51 |
+
|
52 |
+
function mkdirs (dirname) {
|
53 |
+
if (fs.existsSync(dirname)) {
|
54 |
+
return true
|
55 |
+
} else {
|
56 |
+
if (mkdirs(path.dirname(dirname))) {
|
57 |
+
fs.mkdirSync(dirname)
|
58 |
+
return true
|
59 |
+
}
|
60 |
+
}
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* 制作转发消息
|
65 |
+
* @param e oicq消息e
|
66 |
+
* @param msg 消息数组
|
67 |
+
* @param dec 转发描述
|
68 |
+
*/
|
69 |
+
async function makeForwardMsg (e, msg = [], dec = '') {
|
70 |
+
let nickname = Bot.nickname
|
71 |
+
if (e.isGroup) {
|
72 |
+
let info = await Bot.getGroupMemberInfo(e.group_id, Bot.uin)
|
73 |
+
nickname = info.card || info.nickname
|
74 |
+
}
|
75 |
+
let userInfo = {
|
76 |
+
user_id: Bot.uin,
|
77 |
+
nickname
|
78 |
+
}
|
79 |
+
|
80 |
+
let forwardMsg = []
|
81 |
+
msg.forEach(v => {
|
82 |
+
forwardMsg.push({
|
83 |
+
...userInfo,
|
84 |
+
message: v
|
85 |
+
})
|
86 |
+
})
|
87 |
+
|
88 |
+
/** 制作转发内容 */
|
89 |
+
if (e.isGroup) {
|
90 |
+
forwardMsg = await e.group.makeForwardMsg(forwardMsg)
|
91 |
+
} else if (e.friend) {
|
92 |
+
forwardMsg = await e.friend.makeForwardMsg(forwardMsg)
|
93 |
+
} else {
|
94 |
+
return false
|
95 |
+
}
|
96 |
+
|
97 |
+
if (dec) {
|
98 |
+
/** 处理描述 */
|
99 |
+
forwardMsg.data = forwardMsg.data
|
100 |
+
.replace(/\n/g, '')
|
101 |
+
.replace(/<title color="#777777" size="26">(.+?)<\/title>/g, '___')
|
102 |
+
.replace(/___+/, `<title color="#777777" size="26">${dec}</title>`)
|
103 |
+
}
|
104 |
+
|
105 |
+
return forwardMsg
|
106 |
+
}
|
107 |
+
|
108 |
+
export default { sleep, relpyPrivate, downFile, makeForwardMsg }
|