Skip to content

Commit 580dca2

Browse files
committed
Delete Tg Bot Control Part in Shell Scripts
1 parent c06ccba commit 580dca2

File tree

4 files changed

+55
-108
lines changed

4 files changed

+55
-108
lines changed

README.md

+51-27
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# x-ui
2+
23
支持多协议多用户的 xray 面板
34

45
# 功能介绍
6+
57
- 系统状态监控
68
- 支持多用户多协议,网页可视化操作
79
- 支持的协议:vmess、vless、trojan、shadowsocks、dokodemo-door、socks、http
@@ -12,17 +14,18 @@
1214
- 支持一键SSL证书申请且自动续签
1315
- 更多高级配置项,详见面板
1416

15-
1617
# 安装&升级
18+
1719
```
1820
bash <(curl -Ls https://raw.githubusercontent.com/vaxilu/x-ui/master/install.sh)
1921
```
2022

2123
## 手动安装&升级
22-
1. 首先从 https://github.com/vaxilu/x-ui/releases 下载最新的压缩包,一般选择`amd64`架构
23-
2. 然后将这个压缩包上传到服务器的`/root/`目录下,并使用`root`用户登录服务器
2424

25-
> 如果你的服务器 cpu 架构不是`amd64`,自行将命令中的`amd64`替换为其他架构
25+
1. 首先从 https://github.com/vaxilu/x-ui/releases 下载最新的压缩包,一般选择 `amd64`架构
26+
2. 然后将这个压缩包上传到服务器的 `/root/`目录下,并使用 `root`用户登录服务器
27+
28+
> 如果你的服务器 cpu 架构不是 `amd64`,自行将命令中的 `amd64`替换为其他架构
2629
2730
```
2831
cd /root/
@@ -42,10 +45,13 @@ systemctl restart x-ui
4245
> 此 docker 教程与 docker 镜像由[Chasing66](https://github.com/Chasing66)提供
4346
4447
1. 安装docker
48+
4549
```shell
4650
curl -fsSL https://get.docker.com | sh
4751
```
52+
4853
2. 安装x-ui
54+
4955
```shell
5056
mkdir x-ui && cd x-ui
5157
docker run -itd --network=host \
@@ -54,64 +60,82 @@ docker run -itd --network=host \
5460
--name x-ui --restart=unless-stopped \
5561
enwaiax/x-ui:latest
5662
```
57-
>Build 自己的镜像
63+
64+
> Build 自己的镜像
65+
5866
```shell
5967
docker build -t x-ui .
6068
```
69+
6170
## SSL证书申请
62-
>此功能与教程由[FranzKafkaYu](https://github.com/FranzKafkaYu)提供
6371

64-
脚本内置SSL证书申请功能,使用该脚本申请证书,需满足以下条件:
72+
> 此功能与教程由[FranzKafkaYu](https://github.com/FranzKafkaYu)提供
73+
74+
脚本内置SSL证书申请功能,使用该脚本申请证书,需满足以下条件:
75+
6576
- 知晓Cloudflare 注册邮箱
6677
- 知晓Cloudflare Global API Key
67-
- 域名已通过cloudflare进行解析到当前服务器
78+
- 域名已通过cloudflare进行解析到当前服务器
6879

6980
获取Cloudflare Global API Key的方法:
7081
![](media/bda84fbc2ede834deaba1c173a932223.png)
71-
![](media/d13ffd6a73f938d1037d0708e31433bf.png)
82+
![](media/d13ffd6a73f938d1037d0708e31433bf.png)
7283

73-
使用时只需输入`域名`, `邮箱`, `API KEY`即可,示意图如下:
74-
![](media/2022-04-04_141259.png)
84+
使用时只需输入 `域名`, `邮箱`, `API KEY`即可,示意图如下:
85+
![](media/2022-04-04_141259.png)
7586

7687
注意事项:
77-
- 该脚本使用DNS API进行证书申请
88+
89+
- 该脚本使用DNS API进行证书申请
7890
- 默认使用Let'sEncrypt作为CA方
79-
- 证书安装目录为/root/cert目录
91+
- 证书安装目录为/root/cert目录
8092
- 本脚本申请证书均为泛域名证书
8193

8294
## Tg机器人使用(开发中,暂不可使用)
83-
>此功能与教程由[FranzKafkaYu](https://github.com/FranzKafkaYu)提供
8495

85-
X-UI支持通过Tg机器人实现每日流量通知,面板登录提醒等功能,使用Tg机器人,需要自行申请
86-
具体申请教程可以参考[博客链接](https://coderfan.net/how-to-use-telegram-bot-to-alarm-you-when-someone-login-into-your-vps.html)
87-
使用说明:在面板后台或通过脚本设置机器人相关参数,具体包括
96+
> 此功能与教程由[FranzKafkaYu](https://github.com/FranzKafkaYu)提供
97+
98+
X-UI支持通过Tg机器人实现每日流量通知,面板登录提醒等功能,使用Tg机器人,需要自行申请
99+
具体申请教程可以参考[博客链接](https://coderfan.net/how-to-use-telegram-bot-to-alarm-you-when-someone-login-into-your-vps.html)
100+
使用说明:在面板后台设置机器人相关参数,具体包括
101+
88102
- Tg机器人Token
89103
- Tg机器人ChatId
90-
- Tg机器人周期运行时间,采用crontab语法
104+
- Tg机器人周期运行时间,采用crontab语法
105+
106+
参考语法:
107+
- 30 * * * * * //每一分的第30s进行通知
108+
- @hourly //每小时通知
109+
- @daily //每天通知(凌晨零点整)
110+
- @every 8h //每8小时通知
91111

92-
参考示例:
93-
每小时定时通知
94-
![](media/2022-04-17_110907.png)
95-
每分钟的第30s通知
96-
![](media/2022-04-17_111321.png)
97-
效果示意图:
98-
![](media/2022-04-17_111705.png)
112+
TG通知内容:
113+
- 节点流量使用
114+
- 面板登录提醒
115+
- 节点到期提醒
116+
- 流量预警提醒
99117

118+
更多功能规划中...
100119
## 建议系统
120+
101121
- CentOS 7+
102122
- Ubuntu 16+
103123
- Debian 8+
104124

105125
# 常见问题
106126

107127
## 从 v2-ui 迁移
108-
首先在安装了 v2-ui 的服务器上安装最新版 x-ui,然后使用以下命令进行迁移,将迁移本机 v2-ui 的`所有 inbound 账号数据`至 x-ui,`面板设置和用户名密码不会迁移`
109-
> 迁移成功后请`关闭 v2-ui`并且`重启 x-ui`,否则 v2-ui 的 inbound 会与 x-ui 的 inbound 会产生`端口冲突`
128+
129+
首先在安装了 v2-ui 的服务器上安装最新版 x-ui,然后使用以下命令进行迁移,将迁移本机 v2-ui 的 `所有 inbound 账号数据`至 x-ui,`面板设置和用户名密码不会迁移`
130+
131+
> 迁移成功后请 `关闭 v2-ui`并且 `重启 x-ui`,否则 v2-ui 的 inbound 会与 x-ui 的 inbound 会产生 `端口冲突`
132+
110133
```
111134
x-ui v2-ui
112135
```
113136

114137
## issue 关闭
138+
115139
各种小白问题看得血压很高
116140

117141
## Stargazers over time

main.go

-1
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,6 @@ func main() {
287287
if show {
288288
showSetting(show)
289289
}
290-
updateTgbotEnableSts(enabletgbot)
291290
if (tgbottoken != "") || (tgbotchatid != 0) || (tgbotRuntime != "") {
292291
updateTgbotSetting(tgbottoken, tgbotchatid, tgbotRuntime)
293292
}

web/html/xui/setting.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
<setting-list-item type="switch" title="启用电报机器人" desc="重启面板生效" v-model="allSetting.tgBotEnable"></setting-list-item>
7777
<setting-list-item type="text" title="电报机器人TOKEN" desc="重启面板生效" v-model="allSetting.tgBotToken"></setting-list-item>
7878
<setting-list-item type="number" title="电报机器人ChatId" desc="重启面板生效" v-model.number="allSetting.tgBotChatId"></setting-list-item>
79-
<setting-list-item type="text" title="电报机器人通知时间" desc="采用Crontab定时格式重启面板生效" v-model="allSetting.tgRunTime"></setting-list-item>
79+
<setting-list-item type="text" title="电报机器人通知时间" desc="采用Crontab定时格式,重启面板生效" v-model="allSetting.tgRunTime"></setting-list-item>
8080
</a-list>
8181
</a-tab-pane>
8282
<a-tab-pane key="5" tab="其他设置">

x-ui.sh

+3-79
Original file line numberDiff line numberDiff line change
@@ -408,70 +408,6 @@ show_xray_status() {
408408
fi
409409
}
410410

411-
set_telegram_bot() {
412-
echo -E ""
413-
LOGI "设置Telegram Bot需要知晓Bot的Token与ChatId"
414-
LOGI "使用方法请参考博客https://coderfan.net"
415-
confirm "我已确认以上内容[y/n]" "y"
416-
if [ $? -ne 0 ]; then
417-
show_menu
418-
else
419-
read -p "please input your tg bot token here:" TG_BOT_TOKEN
420-
LOGI "你设置的电报机器人Token:$TG_BOT_TOKEN"
421-
read -p "please input your tg chat id here:" TG_BOT_CHATID
422-
LOGI "你设置的电报机器人ChatId:$TG_BOT_CHATID"
423-
read -p "please input your tg bot runtime here:" TG_BOT_RUNTIME
424-
LOGI "你设置的电报机器人运行周期:$TG_BOT_RUNTIME"
425-
info=$(/usr/local/x-ui/x-ui setting -tgbottoken ${TG_BOT_TOKEN} -tgbotchatid ${TG_BOT_CHATID} -tgbotRuntime "$TG_BOT_RUNTIME")
426-
if [ $? != 0 ]; then
427-
LOGE "$info"
428-
LOGE "设置TelegramBot失败"
429-
exit 1
430-
else
431-
LOGI "设置TelegramBot成功"
432-
show_menu
433-
fi
434-
fi
435-
}
436-
437-
enable_telegram_bot() {
438-
echo -E ""
439-
LOGI "该功能会开启Telegram Bot通知"
440-
LOGI "通知内容包括:"
441-
LOGI "1.流量使用情况"
442-
LOGI "2.节点到期提醒,待实现(规划中)"
443-
LOGI "3.面板登录提醒,待完善(规划中)"
444-
confirm "我已确认以上内容[y/n]" "y"
445-
if [ $? -eq 0 ]; then
446-
info=$(/usr/local/x-ui/x-ui setting -enabletgbot=true)
447-
if [ $? == 0 ]; then
448-
LOGI "开启成功,重启X-UI生效,重启中...."
449-
restart
450-
else
451-
LOGE "开启失败,即将退出..."
452-
exit 1
453-
fi
454-
else
455-
show_menu
456-
fi
457-
}
458-
459-
disable_telegram_bot() {
460-
confirm "确认是否关闭Tgbot[y/n]" "n"
461-
if [ $? -eq 0 ]; then
462-
info=$(/usr/local/x-ui/x-ui setting -enabletgbot=false)
463-
if [ $? == 0 ]; then
464-
LOGI "关闭成功,重启X-UI生效,重启中...."
465-
restart
466-
else
467-
LOGE "关闭失败,请检查日志..."
468-
exit 1
469-
fi
470-
else
471-
show_menu
472-
fi
473-
}
474-
475411
ssl_cert_issue() {
476412
echo -E ""
477413
LOGD "******使用说明******"
@@ -577,7 +513,7 @@ show_menu() {
577513
${green}4.${plain} 重置用户名密码
578514
${green}5.${plain} 重置面板设置
579515
${green}6.${plain} 设置面板端口
580-
${green}7.${plain} 当前面板设置
516+
${green}7.${plain} 查看当前面板设置
581517
————————————————
582518
${green}8.${plain} 启动 x-ui
583519
${green}9.${plain} 停止 x-ui
@@ -590,12 +526,9 @@ show_menu() {
590526
————————————————
591527
${green}15.${plain} 一键安装 bbr (最新内核)
592528
${green}16.${plain} 一键申请SSL证书(acme申请)
593-
${green}17.${plain} 开启Telegram通知(TgBot)
594-
${green}18.${plain} 关闭Telegram通知(TgBot)
595-
${green}19.${plain} 设置TelegramBot
596529
"
597530
show_status
598-
echo && read -p "请输入选择 [0-19]: " num
531+
echo && read -p "请输入选择 [0-16]: " num
599532

600533
case "${num}" in
601534
0)
@@ -649,17 +582,8 @@ show_menu() {
649582
16)
650583
ssl_cert_issue
651584
;;
652-
17)
653-
enable_telegram_bot
654-
;;
655-
18)
656-
disable_telegram_bot
657-
;;
658-
19)
659-
set_telegram_bot
660-
;;
661585
*)
662-
LOGE "请输入正确的数字 [0-19]"
586+
LOGE "请输入正确的数字 [0-16]"
663587
;;
664588
esac
665589
}

0 commit comments

Comments
 (0)