From 199aacb656fb30134c98664a5ef679c45e77c419 Mon Sep 17 00:00:00 2001 From: krau Date: Thu, 18 Dec 2025 10:44:35 +0000 Subject: [PATCH] deploy: ca0fd67fba0bcda3285ac0d4d4c4f195f86b52af --- deployment/configuration/index.html | 19 +++++++++++++++---- deployment/configuration/storages/index.html | 17 +++++++++++------ deployment/installation/index.html | 14 ++++++++------ sitemap.xml | 2 +- zh/sitemap.xml | 2 +- 5 files changed, 36 insertions(+), 18 deletions(-) diff --git a/deployment/configuration/index.html b/deployment/configuration/index.html index ed55b05..ccd8ffa 100644 --- a/deployment/configuration/index.html +++ b/deployment/configuration/index.html @@ -44,7 +44,13 @@ Stream 模式对于磁盘空间有限的部署环境十分有用, 但也有一 workers: 同时处理任务数量, 默认为 3 threads: 下载文件时使用的线程数, 默认为 4. 仅在未启用 Stream 模式时生效. retry: 任务失败时的重试次数, 默认为 3. +proxy: 全局代理配置, 配置后程序内一切网络连接将会尝试使用该代理, 可选. +stream = false +workers = 3 +threads = 4 +retry = 3 +proxy = "socks5://127.0.0.1:7890" Telegram 配置 # @@ -96,7 +102,7 @@ session = "data/usersession.db" 存储端列表用于定义 Bot 支持的存储位置, 每个存储端需要指定名称、类型和相关配置, 使用双中括号语法 [[storages]] 定义.'>配置说明 | Save Any Bot +[telegram] token = "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZ" [[users]] # telegram user id id = 777000 blacklist = true [[storages]] name = "本机存储" type = "local" enable = true base_path = "./downloads" 详细配置 # 全局配置 # stream: 是否启用 Stream 模式, 默认为 false. 启用后 Bot 将直接将文件流式传输到存储端(若存储端支持), 不需要下载到本地 Stream 模式对于磁盘空间有限的部署环境十分有用, 但也有一些弊端: 无法使用多线程从 Telegram 下载文件, 速度较慢. 网络不稳定时, 任务失败率高. 无法在中间层对文件进行处理, 例如自动文件类型识别. 并非支持所有存储端, 不支持的存储端可能会降级为普通模式或无法上传. workers: 同时处理任务数量, 默认为 3 threads: 下载文件时使用的线程数, 默认为 4. 仅在未启用 Stream 模式时生效. retry: 任务失败时的重试次数, 默认为 3. proxy: 全局代理配置, 配置后程序内一切网络连接将会尝试使用该代理, 可选. stream = false workers = 3 threads = 4 retry = 3 proxy = "socks5://127.0.0.1:7890" Telegram 配置 # token: 你的 Telegram Bot Token, 可以通过 BotFather 创建 Bot 并获取 Token. app_id, app_hash: Telegram API ID & Hash, 在 Telegram API 创建应用获取, 若不提供则使用默认值. flood_retry: Flood 控制重试次数, 默认为 5. rpc_retry: RPC 请求重试次数, 默认为 5. proxy: 代理配置, 可选. enable: 是否启用代理. url: 代理地址, 只支持 socks5:// userbot: userbot 配置, 可选. enable: 启用 userbot 集成, 需要登录用户账号, 此时请务必使用自己的 api id & hash. session: userbot 会话文件路径, 默认为 data/usersession.db. 启用 userbot 集成后, bot 可以下载私密频道和群组的文件, 但具有无法避免的账号被封禁的风险. 开启 userbot 集成后第一次启动 bot 时需要通过终端交互输入手机号, 2FA 和验证码. 如果你使用 docker 部署, 请使用 -it 参数为容器提供交互式环境, 然后执行登录操作. [telegram] token = "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZ" app_id = 1025907 app_hash = "452b0359b988148995f22ff0f4229750" flood_retry = 5 rpc_retry = 5 [telegram.proxy] enable = false url = "socks5://127.0.0.1:7890" [telegram.userbot] enable = false session = "data/usersession.db" 存储端列表 # 存储端列表用于定义 Bot 支持的存储位置, 每个存储端需要指定名称、类型和相关配置, 使用双中括号语法 [[storages]] 定义.'>配置说明 | Save Any Bot

配置说明

配置说明 @@ -115,7 +121,12 @@ SaveAnyBot 需要读取工作目录下的 config.toml 文件作为配置文件, base_path = "./downloads"

详细配置 #

全局配置 -#

Telegram 配置 +#

stream = false
+workers = 3
+threads = 4
+retry = 3
+proxy = "socks5://127.0.0.1:7890"
+

Telegram 配置 #

启用 userbot 集成后, bot 可以下载私密频道和群组的文件, 但具有无法避免的账号被封禁的风险.
开启 userbot 集成后第一次启动 bot 时需要通过终端交互输入手机号, 2FA 和验证码.
如果你使用 docker 部署, 请使用 -it 参数为容器提供交互式环境, 然后执行登录操作.
[telegram]
 token = "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZ"
 app_id = 1025907
@@ -174,6 +185,6 @@ SaveAnyBot 需要读取工作目录下的 config.toml 文件作为配置文件,
 # 临时下载文件夹配置
 [temp]
 base_path = "./cache"
-
\ No newline at end of file diff --git a/deployment/configuration/storages/index.html b/deployment/configuration/storages/index.html index ef4142d..6cbb75b 100644 --- a/deployment/configuration/storages/index.html +++ b/deployment/configuration/storages/index.html @@ -41,7 +41,7 @@ Alist # type=alist 不支持 Stream 模式. url = "https://alist.example.com" # Alist 的 URL username = "your_username" # Alist 的用户名 password = "your_password" # Alist 的密码 base_path = "/path/saveanybot" # Alist 中的基础路径, 所有文件将存储在此路径下 token_exp = 3600 # Alist 访问令牌的自动刷新时间, 单位秒 token = "your_token" # Alist 的访问令牌, 可选, 如果不设置则使用用户名和密码进行身份验证. # 使用 token 验证时无法自动刷新 token 本地磁盘 # type=local base_path = "./downloads" # 本地存储的基础路径, 所有文件将存储在此路径下 WebDAV # type=webdav -url = "https://webdav.example.com" # WebDAV 的 URL username = "your_username" # WebDAV password = "your_password" # WebDAV 的密码 base_path = "/path/to/webdav" # WebDAV 中的基础路径, 所有文件将存储在此路径下 S3 # type=s3'>存储端配置 | Save Any Bot +url = "https://webdav.example.com" # WebDAV 的 URL username = "your_username" # WebDAV password = "your_password" # WebDAV 的密码 base_path = "/path/to/webdav" # WebDAV 中的基础路径, 所有文件将存储在此路径下 S3 # type=s3'>存储端配置 | Save Any Bot

存储端配置

存储端配置 @@ -62,15 +62,20 @@ url = "https://webdav.example.com" # WebDAV 的 URL username = "your_username" # password = "your_password" # WebDAV 的密码 base_path = "/path/to/webdav" # WebDAV 中的基础路径, 所有文件将存储在此路径下

S3 -#

type=s3

endpoint = "s3.example.com" # S3 的端点
+#

type=s3

endpoint = "s3.example.com" # S3 的端点, 默认为 aws S3 的端点
 region = "us-east-1" # S3 的区域
 access_key_id = "your_access_key_id" # S3 的访问密钥 ID
 secret_access_key = "your_secret_access_key" # S3 的秘密访问密钥
 bucket_name = "your_bucket_name" # S3 的存储桶名称
-use_ssl = true # 是否使用 SSL, 默认为 true
 base_path = "/path/to/s3" # S3 中的基础路径, 所有文件将存储在此路径下
-

Telegram +virtual_host = false # 使用虚拟主机风格的 URL, 默认为 false +

虚拟主机风格的 URL 示例:

https://your_bucket_name.s3.example.com/path/to/s3/your_file
+

路径风格(关闭 virtual_host)的 URL 示例:

https://s3.example.com/your_bucket_name/path/to/s3/your_file
+

如果你使用的是第三方的兼容 S3 的服务, 一般使用的是路径风格的 URL. 而 AWS S3 则通常使用虚拟主机风格的 URL. 详情请参考你所使用的 S3 兼容服务的文档.

Telegram #

type=telegram

不支持 Stream 模式.

chat_id = "123456789" # Telegram 聊天 ID, Bot 将把文件发送到这个聊天
-
\ No newline at end of file diff --git a/deployment/installation/index.html b/deployment/installation/index.html index 1e355a4..f7cf4d3 100644 --- a/deployment/installation/index.html +++ b/deployment/installation/index.html @@ -111,7 +111,7 @@ chmod +x /usr/bin/sabot 下载 docker-compose.yml 文件, 在同目录下新建 config.toml 文件, 参考 config.example.toml 编辑配置文件.">安装与更新 | Save Any Bot +chmod +x saveany-bot ./saveany-bot 进程守护 # systemd (常规 Linux) 创建文件 /etc/systemd/system/saveany-bot.service 并写入以下内容: [Unit] Description=SaveAnyBot After=systemd-user-sessions.service [Service] Type=simple WorkingDirectory=/yourpath/ ExecStart=/yourpath/saveany-bot Restart=always [Install] WantedBy=multi-user.target 设为开机启动并启动服务: systemctl enable --now saveany-bot procd (OpenWrt) 添加开机自启动服务 创建文件 /etc/init.d/saveanybot ,参考 wrt_init 并自行修改: #!/bin/sh /etc/rc.common #This is the OpenWRT init.d script for SaveAnyBot START=99 STOP=10 description="SaveAnyBot" WORKING_DIR="/mnt/mmc1-1/SaveAnyBot" EXEC_PATH="$WORKING_DIR/saveany-bot" start() { echo "Starting SaveAnyBot..." cd $WORKING_DIR $EXEC_PATH & } stop() { echo "Stopping SaveAnyBot..." killall saveany-bot } reload() { stop start } 赋予权限: chmod +x /etc/init.d/saveanybot 然后将文件复制到 /etc/rc.d 并重命名为 S99saveanybot, 同样赋予权限: chmod +x /etc/rc.d/S99saveanybot 添加快捷指令 创建文件 /usr/bin/sabot ,参考 wrt_bin 并自行修改,注意此处文件编码仅支持 ANSI 936 . 随后赋予权限: chmod +x /usr/bin/sabot 使用: sudo sabot start|stop|restart|status|enable|disable 使用 Docker 部署 # Docker Compose # 下载 docker-compose.yml 文件, 在同目录下新建 config.toml 文件, 参考 config.example.toml 编辑配置文件.">安装与更新 | Save Any Bot

安装与更新

安装与更新 @@ -163,10 +163,12 @@ reload() { -v /path/to/config.toml:/app/config.toml \ -v /path/to/downloads:/app/downloads \ ghcr.io/krau/saveany-bot:latest -

更新 -#

向 Bot 发送 /update 指令检查更新并升级, 或者使用 CLI 命令更新:

./saveany-bot up
-

如果是 Docker 部署, 还可以使用以下命令更新:

docker pull ghcr.io/krau/saveany-bot:latest
+
关于 docker 镜像的变体版本
  • 默认版本: 包含所有功能和依赖, 体积较大. 如果没有特殊需要, 请使用此版本
  • micro: 精简版本, 去除部分可选依赖, 体积较小
  • pico: 极简版本, 仅包含核心功能, 体积最小
你可以根据需要, 通过指定不同的标签来拉取合适的版本, 例如: ghcr.io/krau/saveany-bot:micro
关于变体版本的更详细的区别, 请参考项目根目录下的 Dockerfile 文件.

更新 +#

若使用预编译二进制文件部署, 使用以下 CLI 命令更新:

./saveany-bot up
+

如果是 Docker 部署, 使用以下命令更新:

docker:

docker pull ghcr.io/krau/saveany-bot:latest
 docker restart saveany-bot
-
\ No newline at end of file diff --git a/sitemap.xml b/sitemap.xml index 9abd883..dfa97f9 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -1 +1 @@ -https://sabot.unv.app/zh/sitemap.xml2025-12-04T22:59:23+08:00https://sabot.unv.app/en/sitemap.xml2025-12-04T22:59:23+08:00 \ No newline at end of file +https://sabot.unv.app/zh/sitemap.xml2025-12-18T18:44:12+08:00https://sabot.unv.app/en/sitemap.xml2025-12-04T22:59:23+08:00 \ No newline at end of file diff --git a/zh/sitemap.xml b/zh/sitemap.xml index 9811389..6f53b4a 100644 --- a/zh/sitemap.xml +++ b/zh/sitemap.xml @@ -1 +1 @@ -https://sabot.unv.app/deployment/2025-06-16T15:58:03+08:00https://sabot.unv.app/usage/2025-08-23T20:42:51+08:00https://sabot.unv.app/help/2025-06-16T15:58:03+08:00https://sabot.unv.app/contribute/2025-08-23T20:42:51+08:00https://sabot.unv.app/categories/https://sabot.unv.app/tags/https://sabot.unv.app/deployment/installation/2025-08-24T14:47:13+08:00https://sabot.unv.app/deployment/configuration/storages/2025-12-04T22:59:23+08:00https://sabot.unv.app/2025-12-04T22:59:23+08:00https://sabot.unv.app/deployment/configuration/2025-12-04T22:59:23+08:00 \ No newline at end of file +https://sabot.unv.app/deployment/2025-06-16T15:58:03+08:00https://sabot.unv.app/usage/2025-08-23T20:42:51+08:00https://sabot.unv.app/help/2025-06-16T15:58:03+08:00https://sabot.unv.app/contribute/2025-08-23T20:42:51+08:00https://sabot.unv.app/categories/https://sabot.unv.app/tags/https://sabot.unv.app/deployment/installation/2025-12-18T18:43:57+08:00https://sabot.unv.app/deployment/configuration/storages/2025-12-18T18:44:12+08:00https://sabot.unv.app/2025-12-04T22:59:23+08:00https://sabot.unv.app/deployment/configuration/2025-12-18T18:44:12+08:00 \ No newline at end of file