📝 add user documentation.
This commit is contained in:
commit
6960c46f3b
11
README.md
Normal file
11
README.md
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# 简介
|
||||||
|
|
||||||
|
Pagermaid-modify 是一个开源的 Telegram 人形自走 Bot 方案,功能强大而丰富,可以帮助你打造专属的便利功能。
|
||||||
|
|
||||||
|
本 Wiki 主要详细说明搭建的流程和注意事项,以便各位用户依此搭建属于自己的 Userbot 。
|
||||||
|
|
||||||
|
由于资金有限和部分依赖包的安装方便性,这里主要提供 `ubuntu 16.04` 的安装过程。(欢迎其他用户提供其他系统的搭建方法)
|
||||||
|
|
||||||
|
## 手动搭建
|
||||||
|
|
||||||
|
欢迎加入 [讨论群](https://t.me/joinchat/FLV4ZFXq9nUFLLe0HDxfQQ) 探讨你的疑问。
|
18
_coverpage.md
Normal file
18
_coverpage.md
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<!-- _coverpage.md -->
|
||||||
|
|
||||||
|
![logo](circle-cropped.png)
|
||||||
|
|
||||||
|
# PagerMaid-Modify <small>1.0</small>
|
||||||
|
|
||||||
|
> 一个帮助 Telegram 用户提升网上冲浪体验的程序。
|
||||||
|
|
||||||
|
- 轻便
|
||||||
|
- 多功能
|
||||||
|
- 可扩展
|
||||||
|
|
||||||
|
[GitHub](https://github.com/Xtao-Labs/PagerMaid-Modify)
|
||||||
|
[Get Started](#%e7%ae%80%e4%bb%8b)
|
||||||
|
|
||||||
|
<!-- 背景图片 -->
|
||||||
|
|
||||||
|
![](bg.jpg)
|
5
_sidebar.md
Normal file
5
_sidebar.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<!-- docs/_sidebar.md -->
|
||||||
|
|
||||||
|
* [开始](README)
|
||||||
|
* 手动安装
|
||||||
|
* [Ubuntu 16.04](ubuntu)
|
BIN
circle-cropped.png
Normal file
BIN
circle-cropped.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 71 KiB |
BIN
favicon.ico
Normal file
BIN
favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
50
index.html
Normal file
50
index.html
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Document</title>
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||||
|
<meta name="description" content="Description">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
|
||||||
|
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/lib/themes/dark.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="app">加载中</div>
|
||||||
|
<script>
|
||||||
|
window.$docsify = {
|
||||||
|
name: 'PagerMaid-Modify 用户文档',
|
||||||
|
repo: 'https://github.com/Xtao-Labs/PagerMaid-Modify',
|
||||||
|
loadSidebar: true,
|
||||||
|
subMaxLevel: 4,
|
||||||
|
coverpage: true,
|
||||||
|
auto2top: true,
|
||||||
|
logo: 'circle-cropped.png',
|
||||||
|
onlyCover: false,
|
||||||
|
search: {
|
||||||
|
placeholder: '搜索',
|
||||||
|
noData: '找不到结果!',
|
||||||
|
depth: 3
|
||||||
|
},
|
||||||
|
count:{
|
||||||
|
countable:true,
|
||||||
|
fontsize:'0.9em',
|
||||||
|
color:'rgb(90,90,90)',
|
||||||
|
language:'chinese'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<!-- Docsify v4 -->
|
||||||
|
<script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/search.min.js"></script>
|
||||||
|
<script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/zoom-image.min.js"></script>
|
||||||
|
<script src="//cdn.jsdelivr.net/npm/docsify-copy-code/dist/docsify-copy-code.min.js"></script>
|
||||||
|
<script src="//unpkg.com/docsify-count/dist/countable.js"></script>
|
||||||
|
<script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-bash.min.js"></script>
|
||||||
|
<script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-python.min.js"></script>
|
||||||
|
<script>
|
||||||
|
if (typeof navigator.serviceWorker !== 'undefined') {
|
||||||
|
navigator.serviceWorker.register('sw.js')
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<script src="//cdn.jsdelivr.net/npm/docsify@4"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
83
sw.js
Normal file
83
sw.js
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
/* ===========================================================
|
||||||
|
* docsify sw.js
|
||||||
|
* ===========================================================
|
||||||
|
* Copyright 2016 @huxpro
|
||||||
|
* Licensed under Apache 2.0
|
||||||
|
* Register service worker.
|
||||||
|
* ========================================================== */
|
||||||
|
|
||||||
|
const RUNTIME = 'docsify'
|
||||||
|
const HOSTNAME_WHITELIST = [
|
||||||
|
self.location.hostname,
|
||||||
|
'fonts.gstatic.com',
|
||||||
|
'fonts.googleapis.com',
|
||||||
|
'cdn.jsdelivr.net'
|
||||||
|
]
|
||||||
|
|
||||||
|
// The Util Function to hack URLs of intercepted requests
|
||||||
|
const getFixedUrl = (req) => {
|
||||||
|
var now = Date.now()
|
||||||
|
var url = new URL(req.url)
|
||||||
|
|
||||||
|
// 1. fixed http URL
|
||||||
|
// Just keep syncing with location.protocol
|
||||||
|
// fetch(httpURL) belongs to active mixed content.
|
||||||
|
// And fetch(httpRequest) is not supported yet.
|
||||||
|
url.protocol = self.location.protocol
|
||||||
|
|
||||||
|
// 2. add query for caching-busting.
|
||||||
|
// Github Pages served with Cache-Control: max-age=600
|
||||||
|
// max-age on mutable content is error-prone, with SW life of bugs can even extend.
|
||||||
|
// Until cache mode of Fetch API landed, we have to workaround cache-busting with query string.
|
||||||
|
// Cache-Control-Bug: https://bugs.chromium.org/p/chromium/issues/detail?id=453190
|
||||||
|
if (url.hostname === self.location.hostname) {
|
||||||
|
url.search += (url.search ? '&' : '?') + 'cache-bust=' + now
|
||||||
|
}
|
||||||
|
return url.href
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Lifecycle Activate
|
||||||
|
* New one activated when old isnt being used.
|
||||||
|
*
|
||||||
|
* waitUntil(): activating ====> activated
|
||||||
|
*/
|
||||||
|
self.addEventListener('activate', event => {
|
||||||
|
event.waitUntil(self.clients.claim())
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Functional Fetch
|
||||||
|
* All network requests are being intercepted here.
|
||||||
|
*
|
||||||
|
* void respondWith(Promise<Response> r)
|
||||||
|
*/
|
||||||
|
self.addEventListener('fetch', event => {
|
||||||
|
// Skip some of cross-origin requests, like those for Google Analytics.
|
||||||
|
if (HOSTNAME_WHITELIST.indexOf(new URL(event.request.url).hostname) > -1) {
|
||||||
|
// Stale-while-revalidate
|
||||||
|
// similar to HTTP's stale-while-revalidate: https://www.mnot.net/blog/2007/12/12/stale
|
||||||
|
// Upgrade from Jake's to Surma's: https://gist.github.com/surma/eb441223daaedf880801ad80006389f1
|
||||||
|
const cached = caches.match(event.request)
|
||||||
|
const fixedUrl = getFixedUrl(event.request)
|
||||||
|
const fetched = fetch(fixedUrl, { cache: 'no-store' })
|
||||||
|
const fetchedCopy = fetched.then(resp => resp.clone())
|
||||||
|
|
||||||
|
// Call respondWith() with whatever we get first.
|
||||||
|
// If the fetch fails (e.g disconnected), wait for the cache.
|
||||||
|
// If there’s nothing in cache, wait for the fetch.
|
||||||
|
// If neither yields a response, return offline pages.
|
||||||
|
event.respondWith(
|
||||||
|
Promise.race([fetched.catch(_ => cached), cached])
|
||||||
|
.then(resp => resp || fetched)
|
||||||
|
.catch(_ => { /* eat any errors */ })
|
||||||
|
)
|
||||||
|
|
||||||
|
// Update the cache with the version we fetched (only for ok status)
|
||||||
|
event.waitUntil(
|
||||||
|
Promise.all([fetchedCopy, caches.open(RUNTIME)])
|
||||||
|
.then(([response, cache]) => response.ok && cache.put(event.request, response))
|
||||||
|
.catch(_ => { /* eat any errors */ })
|
||||||
|
)
|
||||||
|
}
|
||||||
|
})
|
136
ubuntu.md
Normal file
136
ubuntu.md
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
# Ubuntu16.04
|
||||||
|
|
||||||
|
一个经典的老牌系统。
|
||||||
|
|
||||||
|
# 拉取项目
|
||||||
|
|
||||||
|
本项目托管在 `github` ,所以您首先需要检查您是否已经安装 `git` 软件包。并且我们发现当 `git` 软件包版本过低时,无法实现程序的自动更新,所以您需要首先升级 `git` 软件包:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo apt-get install --only-upgrade git -y
|
||||||
|
```
|
||||||
|
|
||||||
|
从仓库拉取项目
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd /var/lib && git clone https://github.com/xtaodada/PagerMaid-Modify.git pagermaid && cd pagermaid
|
||||||
|
```
|
||||||
|
|
||||||
|
# 安装软件包
|
||||||
|
|
||||||
|
## imagemagick
|
||||||
|
|
||||||
|
?> 此软件包用于处理图片,如您没有图片处理需求,您可以无需安装此软件包。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo apt-get install imagemagick -y
|
||||||
|
```
|
||||||
|
|
||||||
|
## neofetch:
|
||||||
|
|
||||||
|
?> 此软件包用于显示系统信息,如您没有显示系统信息需求,您可以无需安装此软件包。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
apt-get install software-properties-common && sudo add-apt-repository ppa:dawidd0811/neofetch && sudo apt-get update && sudo apt-get install neofetch
|
||||||
|
```
|
||||||
|
|
||||||
|
## zbar
|
||||||
|
|
||||||
|
?> 此软件包用于处理二维码信息,如您没有处理二维码信息需求,您可以无需安装此软件包。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo apt-get install libzbar-dev -y
|
||||||
|
```
|
||||||
|
|
||||||
|
## tesseract
|
||||||
|
|
||||||
|
?> 此软件包用于图片光学字符识别,如你没有处理此方面的需求,你可以无需安装此软件包。
|
||||||
|
|
||||||
|
## 最大化安装
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo apt-get install tesseract-ocr tesseract-ocr-all -y
|
||||||
|
```
|
||||||
|
|
||||||
|
## 最小化安装
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo apt-get install tesseract-ocr tesseract-ocr-eng tesseract-ocr-chi-sim -y
|
||||||
|
```
|
||||||
|
|
||||||
|
## Redis
|
||||||
|
|
||||||
|
?> 此软件包用于记录信息,以方便软件重启后仍然可以进行上一次未完成的任务,你也可以无需安装此软件包。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo apt-get install redis-server -y
|
||||||
|
```
|
||||||
|
|
||||||
|
# 安装依赖包
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip3 install -r requirements.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
# 修改配置文件
|
||||||
|
|
||||||
|
将配置 `config.gen.yml` 文件复制一份并且命名为 `config.yml`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cp config.gen.yml config.yml
|
||||||
|
```
|
||||||
|
|
||||||
|
然后去 [telegram 官网](https://my.telegram.org/) 生成 api 填入配置文件内,我们只需要复制 `api id` 和 `api_hash` 值 填入 `api_key` 和 `api_hash` 。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
vi config.yml
|
||||||
|
```
|
||||||
|
|
||||||
|
> 按 i 进入编辑模式,粘贴好后,按下 esc 输入 shift 加冒号,输入 wq 保存退出
|
||||||
|
|
||||||
|
# 登录账号
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python3 -m pagermaid
|
||||||
|
```
|
||||||
|
|
||||||
|
此步需要填入完整的电话号码(eg:`+12569986522`)然后 tg 会发给你的其他客户端发送验证码,填入验证码后,回车,如有两步验证密码,则再输入两步验证密码即可。
|
||||||
|
|
||||||
|
停止运行:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ctrl + c
|
||||||
|
```
|
||||||
|
|
||||||
|
有时(或大部分时间),当您在服务器部署 `PagerMaid-modify` 时,登录会有问题,当出现了问题,请在应用程序的配置步骤配置唯一的 `api_key` 和 `api_hash` ,然后在您的本地电脑上执行 `python3 utils/mksession.py` ,在账号登录成功以后,将生成的 `pagermaid.session` 文件复制到服务器对应目录即可。
|
||||||
|
|
||||||
|
!> 请注意保护好您已登录的 `pagermaid.session` 。此文件可以进行账号所有操作,请不要分享给他人使用。
|
||||||
|
|
||||||
|
# 进程守护
|
||||||
|
|
||||||
|
此步骤可以方便 `pagermaid` 的自动运行,您无需在 `pagermaid` 意外退出后重新登录主机进行操作。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cat <<'TEXT' > /etc/systemd/system/pagermaid.service
|
||||||
|
[Unit]
|
||||||
|
Description=PagerMaid-Modify telegram utility daemon
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
WorkingDirectory=/var/lib/pagermaid
|
||||||
|
ExecStart=/usr/bin/python3 -m pagermaid
|
||||||
|
Restart=always
|
||||||
|
TEXT
|
||||||
|
```
|
||||||
|
|
||||||
|
# 常用指令
|
||||||
|
|
||||||
|
启动程序:`systemctl start pagermaid`
|
||||||
|
|
||||||
|
设置为开机自启:`systemctl enable pagermaid`
|
||||||
|
|
||||||
|
停止程序:`systemctl stop pagermaid`
|
Loading…
Reference in New Issue
Block a user