|
1 |
| -# ManyACG |
| 1 | +# ManyACG |
| 2 | + |
| 3 | +Kawaii is All You Need! ᕕ(◠ڼ◠)ᕗ |
| 4 | + |
| 5 | +Demo: |
| 6 | + |
| 7 | +- [Telegram @KirakaBot](https://t.me/kirakabot) |
| 8 | +- [Telegram @MoreACG Channel](https://t.me/MoreACG) |
| 9 | +- [ManyACG Website](https://manyacg.top) |
| 10 | + |
| 11 | +## 特性 |
| 12 | + |
| 13 | +- **多图源支持** |
| 14 | + - [x] [Pixiv](https://www.pixiv.net/) |
| 15 | + - [x] [Twitter](https://twitter.com/) |
| 16 | + - [x] [Danbooru](https://danbooru.donmai.us/) |
| 17 | + - [x] [Bilibili](https://www.bilibili.com/) |
| 18 | + - [x] [Kemono](https://www.kemono.su/) |
| 19 | +- **可选的存储原图**, 多存储端支持 |
| 20 | + - [x] 本地存储 |
| 21 | + - [x] WebDAV |
| 22 | + - [x] [Alist](https://alistgo.com/) |
| 23 | +- 基于图像哈希的去重与以图搜图 |
| 24 | +- 带有逻辑控制的关键词搜图 |
| 25 | +- 以 Telegram 所接受的最高质量发送图片 |
| 26 | +- Web API |
| 27 | +- 轻量, 原生跨平台, 部署简单 (大概) |
| 28 | + ... |
| 29 | + |
| 30 | +## 部署 |
| 31 | + |
| 32 | +项目需要启用了副本集的 MongoDB 作为数据库, [MongoDB Cloud](https://www.mongodb.com/) 提供的免费实例足够使用, 也可以选择自行搭建. |
| 33 | + |
| 34 | +项目使用 [FFmpeg](https://ffmpeg.org/) 进行一些图像处理, 请在自己的系统上安装, 以下是一些系统的安装示例: |
| 35 | + |
| 36 | +Ubuntu/Debian: |
| 37 | + |
| 38 | +```bash |
| 39 | +sudo apt install ffmpeg -y |
| 40 | +``` |
| 41 | + |
| 42 | +[其他/任意 Linux 发行版安装 FFmepg 参考](https://krau.top/posts/linux-install-ffmpeg) |
| 43 | + |
| 44 | +Windows: |
| 45 | + |
| 46 | +1. 在 [gyan.dev](https://www.gyan.dev/ffmpeg/builds/) 下载 [ffmpeg-release-full.7z](https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-essentials.7z) |
| 47 | +2. 解压并将 `bin` 目录添加到环境变量 `PATH` |
| 48 | + |
| 49 | +完成数据库和 FFmpeg 的安装后, 在 [release](https://github.com/krau/ManyACG/releases) 页面下载与自己系统和架构对应的文件, 解压. |
| 50 | + |
| 51 | +在与解压出的二进制文件的相同目录下创建 `config.toml` 文件, 参考以下内容修改各项配置: |
| 52 | + |
| 53 | +```toml |
| 54 | +# 数据库 |
| 55 | +[database] |
| 56 | +# 数据库名 |
| 57 | +database = "manyacg" |
| 58 | +# 连接 uri |
| 59 | +uri = "mongodb+srv://user:pass@mongodb.com/" |
| 60 | +# 当未配置 uri 时使用下列四项配置连接数据库 |
| 61 | +host = "mongodb.com" |
| 62 | +port = 27017 |
| 63 | +user = "user" |
| 64 | +password = "pass" |
| 65 | + |
| 66 | +# 日志 |
| 67 | +[log] |
| 68 | +# 等级 |
| 69 | +level = "DEBUG" |
| 70 | +# 输出文件 |
| 71 | +file_path = "logs/trace.log" |
| 72 | +# 日志备份份数 |
| 73 | +backup_num = 5 |
| 74 | + |
| 75 | +# 图源配置 |
| 76 | +[source] |
| 77 | +# 请求代理, 支持 http(s), socks5 |
| 78 | +proxy = "http://user:pass@127.0.0.1:7890" |
| 79 | + |
| 80 | +# pixiv |
| 81 | +[source.pixiv] |
| 82 | +enable = true |
| 83 | +# 用于解决防盗链的代理 |
| 84 | +proxy = "pixiv.re" |
| 85 | +# 自动从此连接列表中爬图, 兼容 rsshub pixiv 相关路由 |
| 86 | +urls = [ |
| 87 | + 'https://rsshub.app/pixiv/user/bookmarks/114514', |
| 88 | + 'https://rsshub.app/pixiv/user/illustfollows', |
| 89 | +] |
| 90 | +# 爬取间隔, 单位: 分钟 |
| 91 | +intervel = 120 |
| 92 | +# 单个作品请求间隔, 单位: 秒 |
| 93 | +sleep = 1 |
| 94 | +# pixiv cookies 配置, 可选 |
| 95 | +# 若不配置无法请求成功部分作品 |
| 96 | +[[source.pixiv.cookies]] |
| 97 | +name = "PHPSESSID" |
| 98 | +value = "value" |
| 99 | +[[source.pixiv.cookies]] |
| 100 | +name = "yuid_b" |
| 101 | +value = "value" |
| 102 | + |
| 103 | +# twitter |
| 104 | +[source.twitter] |
| 105 | +enable = true |
| 106 | +# FxTwitter 主域名 |
| 107 | +fx_twitter_domain = "fxtwitter.com" |
| 108 | +# 自动从此连接列表中爬图, 兼容 rsshub twitter 相关路由 |
| 109 | +urls = [] |
| 110 | + |
| 111 | +intervel = 120 |
| 112 | +sleep = 1 |
| 113 | + |
| 114 | +# bilibili, 无需额外配置 |
| 115 | +[source.bilibili] |
| 116 | +enable = true |
| 117 | + |
| 118 | +# danbooru |
| 119 | +[source.danbooru] |
| 120 | +enable = true |
| 121 | + |
| 122 | +# kemono |
| 123 | +[source.kemono] |
| 124 | +enable = true |
| 125 | + |
| 126 | +# 抓取配置, 建议都保持默认 |
| 127 | +[fetcher] |
| 128 | +# 最大并发数, 影响自动爬图 |
| 129 | +max_concurrent = 1 |
| 130 | +# 单次爬取限制量 |
| 131 | +limit = 50 |
| 132 | + |
| 133 | +# 存储端配置, 可选 |
| 134 | +[storage] |
| 135 | +# 原图存储类型 |
| 136 | +original_type = "webdav" |
| 137 | +# 普通尺寸图片存储类型 |
| 138 | +regular_type = "alist" |
| 139 | +# 缩略图存储类型 |
| 140 | +thumb_type = "local" |
| 141 | +# 缓存目录 |
| 142 | +cache_dir = "./cache" |
| 143 | +# 缓存文件过期时间, 单位: 秒 |
| 144 | +# 不建议设置过短 |
| 145 | +cache_ttl = 3600 |
| 146 | + |
| 147 | +# webdav |
| 148 | +[storage.webdav] |
| 149 | +enable = true |
| 150 | +url = "https://example.com/dav" |
| 151 | +username = "user" |
| 152 | +password = "password" |
| 153 | +# 存储 base 路径 |
| 154 | +path = "" |
| 155 | + |
| 156 | +# 本地存储 |
| 157 | +[storage.local] |
| 158 | +enable = true |
| 159 | +# 存储 base 路径 |
| 160 | +path = "./downloads" |
| 161 | + |
| 162 | +# Alist |
| 163 | +[storage.alist] |
| 164 | +enable = true |
| 165 | +username = "krau" |
| 166 | +password = "password" |
| 167 | +url = "https://alist.example.com" |
| 168 | +# alist 的 token 过期时间, 用于自动刷新 token |
| 169 | +token_expire = 86400 |
| 170 | +# 存储 base 路径 |
| 171 | +path = "/manyacg" |
| 172 | + |
| 173 | +# Telegram 相关配置 |
| 174 | +[telegram] |
| 175 | +# Bot API |
| 176 | +api_url = "https://api.telegram.org" |
| 177 | +token="bot_token" |
| 178 | +# bot 管理员 user id |
| 179 | +admins = [777000] |
| 180 | +# 启用图片发布到频道 |
| 181 | +channel = true |
| 182 | +# 频道 username |
| 183 | +username = "@moreacg" |
| 184 | +# 频道 chat_id , 支持私有频道, 与 username 配置至少一项即可 |
| 185 | +chat_id = -1000721 |
| 186 | +# 可选, 评论组 id |
| 187 | +group_id = -100114514 |
| 188 | +# 图片发布间隔, 单位: 秒 |
| 189 | +# 过小的间隔会导致 Flood Limit 而无法成功发送图片 |
| 190 | +sleep = 5 |
| 191 | + |
| 192 | +# Web API 配置 |
| 193 | +[api] |
| 194 | +# 启用 Web API |
| 195 | +enable = false |
| 196 | +# 监听地址 |
| 197 | +address = "127.0.0.1:39088" |
| 198 | +# CORS 相关 |
| 199 | +allowed_origins = ["https://manyacg.top"] |
| 200 | +realm = "manyacg" |
| 201 | +# API Key |
| 202 | +key = "5LiA5Liq5aSN5p2C55qE5a+G56CB" |
| 203 | +# JWT 相关 |
| 204 | +secret = "5LiA5Liq5b6I6Zq+55qE5py65a+G" |
| 205 | +token_expire = 43200 # 单位: 秒 |
| 206 | +refresh_token_expire = 43200 |
| 207 | +# API 缓存 |
| 208 | +[api.cache] |
| 209 | +# 启用缓存 |
| 210 | +enable = false |
| 211 | +# 使用 redis 而不是直接使用内存 |
| 212 | +redis = false |
| 213 | +# 全局默认过期时间, 单位: 秒 |
| 214 | +memory_ttl = 10 |
| 215 | +# 为路由配置独立过期时间, 单位: 秒 |
| 216 | +[api.cache.ttl] |
| 217 | +"/atom" = 600 |
| 218 | +"/artwork/random" = 5 |
| 219 | +"/artwork/:id" = 600 |
| 220 | +"/artwork/list" = 10 |
| 221 | +"/artwork/count" = 5 |
| 222 | + |
| 223 | +# Auth 相关配置, 暂时只有 resend 作为邮件服务 |
| 224 | +[auth] |
| 225 | +[auth.resend] |
| 226 | +api_key = "resend_api_key" |
| 227 | +subject = "您的 ManyACG 验证码" |
| 228 | +from = "ManyACG <i@manyacg.top>" |
| 229 | +``` |
| 230 | + |
| 231 | +更详细的配置可以参考 `config` 目录源码 |
| 232 | + |
| 233 | +赋予二进制文件执行权限并运行即可: |
| 234 | + |
| 235 | +```bash |
| 236 | +chmod +x manyacg |
| 237 | +./manyacg |
| 238 | +``` |
0 commit comments