diff --git a/README.md b/README.md index 8fe4b6f1d9..80a9e302df 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,9 @@ # x-ui + 支持多协议多用户的 xray 面板 # 功能介绍 + - 系统状态监控 - 支持多用户多协议,网页可视化操作 - 支持的协议:vmess、vless、trojan、shadowsocks、dokodemo-door、socks、http @@ -12,17 +14,18 @@ - 支持一键SSL证书申请且自动续签 - 更多高级配置项,详见面板 - # 安装&升级 + ``` bash <(curl -Ls https://raw.githubusercontent.com/vaxilu/x-ui/master/install.sh) ``` ## 手动安装&升级 -1. 首先从 https://github.com/vaxilu/x-ui/releases 下载最新的压缩包,一般选择`amd64`架构 -2. 然后将这个压缩包上传到服务器的`/root/`目录下,并使用`root`用户登录服务器 -> 如果你的服务器 cpu 架构不是`amd64`,自行将命令中的`amd64`替换为其他架构 +1. 首先从 https://github.com/vaxilu/x-ui/releases 下载最新的压缩包,一般选择 `amd64`架构 +2. 然后将这个压缩包上传到服务器的 `/root/`目录下,并使用 `root`用户登录服务器 + +> 如果你的服务器 cpu 架构不是 `amd64`,自行将命令中的 `amd64`替换为其他架构 ``` cd /root/ @@ -42,10 +45,13 @@ systemctl restart x-ui > 此 docker 教程与 docker 镜像由[Chasing66](https://github.com/Chasing66)提供 1. 安装docker + ```shell curl -fsSL https://get.docker.com | sh ``` + 2. 安装x-ui + ```shell mkdir x-ui && cd x-ui docker run -itd --network=host \ @@ -54,50 +60,64 @@ docker run -itd --network=host \ --name x-ui --restart=unless-stopped \ enwaiax/x-ui:latest ``` ->Build 自己的镜像 + +> Build 自己的镜像 + ```shell docker build -t x-ui . ``` + ## SSL证书申请 ->此功能与教程由[FranzKafkaYu](https://github.com/FranzKafkaYu)提供 -脚本内置SSL证书申请功能,使用该脚本申请证书,需满足以下条件: +> 此功能与教程由[FranzKafkaYu](https://github.com/FranzKafkaYu)提供 + +脚本内置SSL证书申请功能,使用该脚本申请证书,需满足以下条件: + - 知晓Cloudflare 注册邮箱 - 知晓Cloudflare Global API Key -- 域名已通过cloudflare进行解析到当前服务器 +- 域名已通过cloudflare进行解析到当前服务器 获取Cloudflare Global API Key的方法: ![](media/bda84fbc2ede834deaba1c173a932223.png) - ![](media/d13ffd6a73f938d1037d0708e31433bf.png) + ![](media/d13ffd6a73f938d1037d0708e31433bf.png) -使用时只需输入`域名`, `邮箱`, `API KEY`即可,示意图如下: - ![](media/2022-04-04_141259.png) +使用时只需输入 `域名`, `邮箱`, `API KEY`即可,示意图如下: + ![](media/2022-04-04_141259.png) 注意事项: -- 该脚本使用DNS API进行证书申请 + +- 该脚本使用DNS API进行证书申请 - 默认使用Let'sEncrypt作为CA方 -- 证书安装目录为/root/cert目录 +- 证书安装目录为/root/cert目录 - 本脚本申请证书均为泛域名证书 ## Tg机器人使用(开发中,暂不可使用) ->此功能与教程由[FranzKafkaYu](https://github.com/FranzKafkaYu)提供 -X-UI支持通过Tg机器人实现每日流量通知,面板登录提醒等功能,使用Tg机器人,需要自行申请 -具体申请教程可以参考[博客链接](https://coderfan.net/how-to-use-telegram-bot-to-alarm-you-when-someone-login-into-your-vps.html) -使用说明:在面板后台或通过脚本设置机器人相关参数,具体包括 +> 此功能与教程由[FranzKafkaYu](https://github.com/FranzKafkaYu)提供 + +X-UI支持通过Tg机器人实现每日流量通知,面板登录提醒等功能,使用Tg机器人,需要自行申请 +具体申请教程可以参考[博客链接](https://coderfan.net/how-to-use-telegram-bot-to-alarm-you-when-someone-login-into-your-vps.html) +使用说明:在面板后台设置机器人相关参数,具体包括 + - Tg机器人Token - Tg机器人ChatId -- Tg机器人周期运行时间,采用crontab语法 +- Tg机器人周期运行时间,采用crontab语法 + +参考语法: +- 30 * * * * * //每一分的第30s进行通知 +- @hourly //每小时通知 +- @daily //每天通知(凌晨零点整) +- @every 8h //每8小时通知 -参考示例: - 每小时定时通知 - ![](media/2022-04-17_110907.png) - 每分钟的第30s通知 - ![](media/2022-04-17_111321.png) - 效果示意图: - ![](media/2022-04-17_111705.png) +TG通知内容: +- 节点流量使用 +- 面板登录提醒 +- 节点到期提醒 +- 流量预警提醒 +更多功能规划中... ## 建议系统 + - CentOS 7+ - Ubuntu 16+ - Debian 8+ @@ -105,13 +125,17 @@ X-UI支持通过Tg机器人实现每日流量通知,面板登录提醒等功 # 常见问题 ## 从 v2-ui 迁移 -首先在安装了 v2-ui 的服务器上安装最新版 x-ui,然后使用以下命令进行迁移,将迁移本机 v2-ui 的`所有 inbound 账号数据`至 x-ui,`面板设置和用户名密码不会迁移` -> 迁移成功后请`关闭 v2-ui`并且`重启 x-ui`,否则 v2-ui 的 inbound 会与 x-ui 的 inbound 会产生`端口冲突` + +首先在安装了 v2-ui 的服务器上安装最新版 x-ui,然后使用以下命令进行迁移,将迁移本机 v2-ui 的 `所有 inbound 账号数据`至 x-ui,`面板设置和用户名密码不会迁移` + +> 迁移成功后请 `关闭 v2-ui`并且 `重启 x-ui`,否则 v2-ui 的 inbound 会与 x-ui 的 inbound 会产生 `端口冲突` + ``` x-ui v2-ui ``` ## issue 关闭 + 各种小白问题看得血压很高 ## Stargazers over time diff --git a/main.go b/main.go index fb75ffd55a..f5da0704be 100644 --- a/main.go +++ b/main.go @@ -287,7 +287,6 @@ func main() { if show { showSetting(show) } - updateTgbotEnableSts(enabletgbot) if (tgbottoken != "") || (tgbotchatid != 0) || (tgbotRuntime != "") { updateTgbotSetting(tgbottoken, tgbotchatid, tgbotRuntime) } diff --git a/web/html/xui/setting.html b/web/html/xui/setting.html index c48a8ab7cf..46d77637a9 100644 --- a/web/html/xui/setting.html +++ b/web/html/xui/setting.html @@ -76,7 +76,7 @@ - + diff --git a/x-ui.sh b/x-ui.sh index 42724dc823..859067d41c 100644 --- a/x-ui.sh +++ b/x-ui.sh @@ -408,70 +408,6 @@ show_xray_status() { fi } -set_telegram_bot() { - echo -E "" - LOGI "设置Telegram Bot需要知晓Bot的Token与ChatId" - LOGI "使用方法请参考博客https://coderfan.net" - confirm "我已确认以上内容[y/n]" "y" - if [ $? -ne 0 ]; then - show_menu - else - read -p "please input your tg bot token here:" TG_BOT_TOKEN - LOGI "你设置的电报机器人Token:$TG_BOT_TOKEN" - read -p "please input your tg chat id here:" TG_BOT_CHATID - LOGI "你设置的电报机器人ChatId:$TG_BOT_CHATID" - read -p "please input your tg bot runtime here:" TG_BOT_RUNTIME - LOGI "你设置的电报机器人运行周期:$TG_BOT_RUNTIME" - info=$(/usr/local/x-ui/x-ui setting -tgbottoken ${TG_BOT_TOKEN} -tgbotchatid ${TG_BOT_CHATID} -tgbotRuntime "$TG_BOT_RUNTIME") - if [ $? != 0 ]; then - LOGE "$info" - LOGE "设置TelegramBot失败" - exit 1 - else - LOGI "设置TelegramBot成功" - show_menu - fi - fi -} - -enable_telegram_bot() { - echo -E "" - LOGI "该功能会开启Telegram Bot通知" - LOGI "通知内容包括:" - LOGI "1.流量使用情况" - LOGI "2.节点到期提醒,待实现(规划中)" - LOGI "3.面板登录提醒,待完善(规划中)" - confirm "我已确认以上内容[y/n]" "y" - if [ $? -eq 0 ]; then - info=$(/usr/local/x-ui/x-ui setting -enabletgbot=true) - if [ $? == 0 ]; then - LOGI "开启成功,重启X-UI生效,重启中...." - restart - else - LOGE "开启失败,即将退出..." - exit 1 - fi - else - show_menu - fi -} - -disable_telegram_bot() { - confirm "确认是否关闭Tgbot[y/n]" "n" - if [ $? -eq 0 ]; then - info=$(/usr/local/x-ui/x-ui setting -enabletgbot=false) - if [ $? == 0 ]; then - LOGI "关闭成功,重启X-UI生效,重启中...." - restart - else - LOGE "关闭失败,请检查日志..." - exit 1 - fi - else - show_menu - fi -} - ssl_cert_issue() { echo -E "" LOGD "******使用说明******" @@ -577,7 +513,7 @@ show_menu() { ${green}4.${plain} 重置用户名密码 ${green}5.${plain} 重置面板设置 ${green}6.${plain} 设置面板端口 - ${green}7.${plain} 当前面板设置 + ${green}7.${plain} 查看当前面板设置 ———————————————— ${green}8.${plain} 启动 x-ui ${green}9.${plain} 停止 x-ui @@ -590,12 +526,9 @@ show_menu() { ———————————————— ${green}15.${plain} 一键安装 bbr (最新内核) ${green}16.${plain} 一键申请SSL证书(acme申请) - ${green}17.${plain} 开启Telegram通知(TgBot) - ${green}18.${plain} 关闭Telegram通知(TgBot) - ${green}19.${plain} 设置TelegramBot " show_status - echo && read -p "请输入选择 [0-19]: " num + echo && read -p "请输入选择 [0-16]: " num case "${num}" in 0) @@ -649,17 +582,8 @@ show_menu() { 16) ssl_cert_issue ;; - 17) - enable_telegram_bot - ;; - 18) - disable_telegram_bot - ;; - 19) - set_telegram_bot - ;; *) - LOGE "请输入正确的数字 [0-19]" + LOGE "请输入正确的数字 [0-16]" ;; esac }