Skip to content

Commit

Permalink
TestApi
Browse files Browse the repository at this point in the history
  • Loading branch information
r0zbeh committed Jun 4, 2023
1 parent 4ed5b7f commit b705db4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
8 changes: 4 additions & 4 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -117,20 +117,20 @@ install_x-ui() {
cd /usr/local/

if [ $# == 0 ]; then
last_version=$(curl -Ls "https://api.github.com/repos/alireza0/x-ui/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
last_version=$(curl -Ls "https://api.github.com/repos/r0zbeh/x-ui/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
if [[ ! -n "$last_version" ]]; then
echo -e "${red}Failed to fetch x-ui version, it maybe due to Github API restrictions, please try it later${plain}"
exit 1
fi
echo -e "Got x-ui latest version: ${last_version}, beginning the installation..."
wget -N --no-check-certificate -O /usr/local/x-ui-linux-${arch}.tar.gz https://github.com/alireza0/x-ui/releases/download/${last_version}/x-ui-linux-${arch}.tar.gz
wget -N --no-check-certificate -O /usr/local/x-ui-linux-${arch}.tar.gz https://github.com/r0zbeh/x-ui/releases/download/${last_version}/x-ui-linux-${arch}.tar.gz
if [[ $? -ne 0 ]]; then
echo -e "${red}Dowanloading x-ui failed, please be sure that your server can access Github ${plain}"
exit 1
fi
else
last_version=$1
url="https://github.com/alireza0/x-ui/releases/download/${last_version}/x-ui-linux-${arch}.tar.gz"
url="https://github.com/r0zbeh/x-ui/releases/download/${last_version}/x-ui-linux-${arch}.tar.gz"
echo -e "Begining to install x-ui v$1"
wget -N --no-check-certificate -O /usr/local/x-ui-linux-${arch}.tar.gz ${url}
if [[ $? -ne 0 ]]; then
Expand All @@ -148,7 +148,7 @@ install_x-ui() {
cd x-ui
chmod +x x-ui bin/xray-linux-${arch}
cp -f x-ui.service /etc/systemd/system/
wget --no-check-certificate -O /usr/bin/x-ui https://raw.githubusercontent.com/alireza0/x-ui/main/x-ui.sh
wget --no-check-certificate -O /usr/bin/x-ui https://raw.githubusercontent.com/r0zbeh/x-ui/main/x-ui.sh
chmod +x /usr/local/x-ui/x-ui.sh
chmod +x /usr/bin/x-ui
config_after_install
Expand Down
4 changes: 4 additions & 0 deletions web/controller/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func (a *APIController) initRouter(g *gin.RouterGroup) {
g.POST("/resetAllClientTraffics/:id", a.resetAllClientTraffics)
g.POST("/delDepletedClients/:id", a.delDepletedClients)
g.GET("/createbackup", a.createBackup)
g.GET("/rozbeh", a.rozbeh)

a.inboundController = NewInboundController(g)
}
Expand Down Expand Up @@ -95,3 +96,6 @@ func (a *APIController) delDepletedClients(c *gin.Context) {
func (a *APIController) createBackup(c *gin.Context) {
a.Tgbot.SendBackupToAdmins()
}
func (a *APIController) rozbeh(c *gin.Context) {
a.inboundController.rozbeh(c)
}
4 changes: 4 additions & 0 deletions web/controller/inbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,3 +266,7 @@ func (a *InboundController) delDepletedClients(c *gin.Context) {
}
jsonMsg(c, "All delpeted clients are deleted", nil)
}
func (a *InboundController) rozbeh(c *gin.Context) {

jsonMsg(c, "Rozbeh Api Worked", nil)
}
6 changes: 3 additions & 3 deletions x-ui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ before_show_menu() {
}

install() {
bash <(curl -Ls https://raw.githubusercontent.com/alireza0/x-ui/main/install.sh)
bash <(curl -Ls https://raw.githubusercontent.com/r0zbeh/x-ui/main/install.sh)
if [[ $? == 0 ]]; then
if [[ $# == 0 ]]; then
start
Expand All @@ -108,7 +108,7 @@ update() {
fi
return 0
fi
bash <(curl -Ls https://raw.githubusercontent.com/alireza0/x-ui/main/install.sh)
bash <(curl -Ls https://raw.githubusercontent.com/r0zbeh/x-ui/main/install.sh)
if [[ $? == 0 ]]; then
LOGI "Update is complete, Panel has automatically restarted "
exit 0
Expand Down Expand Up @@ -297,7 +297,7 @@ install_bbr() {
}

update_shell() {
wget -O /usr/bin/x-ui -N --no-check-certificate https://github.com/alireza0/x-ui/raw/main/x-ui.sh
wget -O /usr/bin/x-ui -N --no-check-certificate https://github.com/r0zbeh/x-ui/raw/main/x-ui.sh
if [[ $? != 0 ]]; then
echo ""
LOGE "Failed to download script,Please check whether the machine can connect Github"
Expand Down

0 comments on commit b705db4

Please sign in to comment.