更详细的 config 配置以及更完善的 README (#25)

* Add files via upload

* Add files via upload

* Add OpenWrt auto-start and shortcut script instructions, Optimize file link reference method.

* add more detailed instructions.

* Add files via upload
This commit is contained in:
Twilight
2025-02-24 17:32:53 +08:00
committed by GitHub
parent 28b4585dba
commit 418f9bd2bc
4 changed files with 93 additions and 10 deletions

View File

@@ -1,5 +1,6 @@
<div align="center">
# <img src="docs/logo.jpg" width="45" align="center"> Save Any Bot
**简体中文** | [English](README_EN.md)
@@ -14,6 +15,7 @@ Demo Video:
<div align="center">
[SaveAny-Bot 演示视频 The Demo of SaveAny-Bot.webm](https://github.com/user-attachments/assets/a0de2453-a4d1-4a12-81fb-9d84856dce09)
</div>
@@ -24,7 +26,7 @@ Demo Video:
在 [Release](https://github.com/krau/SaveAny-Bot/releases) 页面下载对应平台的二进制文件.
在解压后目录新建 `config.toml` 文件, 参考 [config.toml.example](https://github.com/krau/SaveAny-Bot/blob/main/config.example.toml) 编辑配置文件.
在解压后目录新建 `config.toml` 文件, 参考 [config.toml.example](./config.example.toml) 编辑配置文件.
运行:
@@ -58,11 +60,30 @@ WantedBy=multi-user.target
systemctl enable --now saveany-bot
```
#### 为OpenWrt及衍生系统添加开机自启动服务
创建文件 ` /etc/init.d/saveanybot` ,参考[saveanybot](./docs/saveanybot)自行修改.
`chmod +x /etc/init.d/saveanybot`
完成后,将文件复制到 `/etc/rc.d`并重命名为`S99saveanybot`.
`chmod +x /etc/rc.d/S99saveanybot`
#### 为OpenWrt及衍生系统添加快捷指令
创建文件` /usr/bin/sabot` ,参考[sabot](./docs/sabot)自行配置修改,注意此处文件编码仅支持 ANSI 936 .
`chmod +x /usr/bin/sabot`
之后,终端输入`sabot start|stop|restart|status|enable|disable`即可.
### 使用 Docker 部署
#### Docker Compose
下载 [docker-compose.yml](https://github.com/krau/SaveAny-Bot/blob/main/docker-compose.yml) 文件, 在同目录下新建 `config.toml` 文件, 参考 [config.toml.example](https://github.com/krau/SaveAny-Bot/blob/main/config.example.toml) 编辑配置文件.
下载 [docker-compose.yml](./docker-compose.yml) 文件, 在同目录下新建 `config.toml` 文件, 参考 [config.toml.example](./config.example.toml) 编辑配置文件.
启动:

View File

@@ -1,3 +1,4 @@
#创建文件时,若需要保留中文注释,请务必确保本文件编码为 UTF-8 ,否则会无法读取。
workers = 4 # 同时下载文件数
retry = 3 # 下载失败重试次数
threads = 4 # 单个任务下载最大线程数
@@ -36,12 +37,12 @@ base_path = "./downloads/2"
[[storages]]
name = "MyAlist"
type = "alist"
enable = false
enable = false #记得启用
base_path = '/'
url = 'https://alist.com'
username = 'admin'
password = 'password'
token_exp = 86400
token_exp = 86400 # 86400--1天 604800--7天 1296000--15天 2592000--30天 15552000--180天
# alist 可直接使用 token 登录, 此时 username, password, token_exp 将被忽略
# 请自行在 alist 侧配置合理的 token 过期时间
# token = ""
@@ -61,17 +62,16 @@ password = 'password'
[[users]]
# telegram user id
id = 114514
# 将过滤模式设为黑名单
# 开启黑名单,开启后下方留空以使用所有存储,反之则为白名单,白名单请在下方输入允许的存储名
blacklist = true
# 存储过滤列表
# 将列表留空并开启黑名单模式以允许使用所有存储
# 将列表留空并开启黑名单模式以允许使用所有存储此处示例为黑名单模式用户114514 可使用所有存储
storages = []
[[users]]
id = 123456
blacklist = false
# 此时该用户只能使用 本机1
blacklist = false #开启白名单模式此时用户123456 仅可使用下方列表中的存储
# 此时该用户只能使用名为 本机1 的存储
storages = ["本机1"]
@@ -89,4 +89,4 @@ storages = ["本机1"]
# cache_ttl = 30
# [db]
# path = "data/data.db" # 数据库文件路径
# path = "data/data.db" # 数据库文件路径

28
docs/sabot Normal file
View File

@@ -0,0 +1,28 @@
#!/bin/sh
case "$1" in
start)
/etc/init.d/saveanybot start
;;
stop)
/etc/init.d/saveanybot stop
;;
restart)
/etc/init.d/saveanybot restart
;;
status)
/etc/init.d/saveanybot status
;;
enable)
/etc/init.d/saveanybot enable
echo "Enable SaveAnyBot auto-start."
;;
disable)
/etc/init.d/saveanybot disable
echo "Disable SaveAnyBot auto-start."
;;
*)
echo "Usage: $0 {start|stop|restart|status|enable|disable}"
exit 1
;;
esac

34
docs/saveanybot Normal file
View File

@@ -0,0 +1,34 @@
#!/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
}