diff --git a/README.ar_EG.md b/README.ar_EG.md index d2f6dcc3..44330b27 100644 --- a/README.ar_EG.md +++ b/README.ar_EG.md @@ -7,10 +7,10 @@
-[](https://github.com/MHSanaei/3x-ui/releases) -[](https://github.com/MHSanaei/3x-ui/actions) -[](#) -[](https://github.com/MHSanaei/3x-ui/releases/latest) +[](https://github.com/c-villain/3x-ui/releases) +[](https://github.com/c-villain/3x-ui/actions) +[](#) +[](https://github.com/c-villain/3x-ui/releases/latest) [](https://www.gnu.org/licenses/gpl-3.0.en.html) **3X-UI** — لوحة تحكم متقدمة مفتوحة المصدر تعتمد على الويب مصممة لإدارة خادم Xray-core. توفر واجهة سهلة الاستخدام لتكوين ومراقبة بروتوكولات VPN والوكيل المختلفة. @@ -23,10 +23,10 @@ ## البدء السريع ``` -bash <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.sh) +bash <(curl -Ls https://raw.githubusercontent.com/c-villain/3x-ui/master/install.sh) ``` -للحصول على الوثائق الكاملة، يرجى زيارة [ويكي المشروع](https://github.com/MHSanaei/3x-ui/wiki). +للحصول على الوثائق الكاملة، يرجى زيارة [ويكي المشروع](https://github.com/c-villain/3x-ui/wiki). ## شكر خاص إلى @@ -53,4 +53,4 @@ bash <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install. ## النجوم عبر الزمن -[](https://starchart.cc/MHSanaei/3x-ui) +[](https://starchart.cc/c-villain/3x-ui) diff --git a/README.es_ES.md b/README.es_ES.md index 52625664..3c8b2e59 100644 --- a/README.es_ES.md +++ b/README.es_ES.md @@ -7,10 +7,10 @@ -[](https://github.com/MHSanaei/3x-ui/releases) -[](https://github.com/MHSanaei/3x-ui/actions) -[](#) -[](https://github.com/MHSanaei/3x-ui/releases/latest) +[](https://github.com/c-villain/3x-ui/releases) +[](https://github.com/c-villain/3x-ui/actions) +[](#) +[](https://github.com/c-villain/3x-ui/releases/latest) [](https://www.gnu.org/licenses/gpl-3.0.en.html) **3X-UI** — panel de control avanzado basado en web de código abierto diseñado para gestionar el servidor Xray-core. Ofrece una interfaz fácil de usar para configurar y monitorear varios protocolos VPN y proxy. @@ -23,10 +23,10 @@ Como una versión mejorada del proyecto X-UI original, 3X-UI proporciona mayor e ## Inicio Rápido ``` -bash <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.sh) +bash <(curl -Ls https://raw.githubusercontent.com/c-villain/3x-ui/master/install.sh) ``` -Para documentación completa, visita la [Wiki del proyecto](https://github.com/MHSanaei/3x-ui/wiki). +Para documentación completa, visita la [Wiki del proyecto](https://github.com/c-villain/3x-ui/wiki). ## Un Agradecimiento Especial a diff --git a/README.fa_IR.md b/README.fa_IR.md index 2b2dc5ec..8888ffd2 100644 --- a/README.fa_IR.md +++ b/README.fa_IR.md @@ -7,10 +7,10 @@ -[](https://github.com/MHSanaei/3x-ui/releases) -[](https://github.com/MHSanaei/3x-ui/actions) -[](#) -[](https://github.com/MHSanaei/3x-ui/releases/latest) +[](https://github.com/c-villain/3x-ui/releases) +[](https://github.com/c-villain/3x-ui/actions) +[](#) +[](https://github.com/c-villain/3x-ui/releases/latest) [](https://www.gnu.org/licenses/gpl-3.0.en.html) **3X-UI** — یک پنل کنترل پیشرفته مبتنی بر وب با کد باز که برای مدیریت سرور Xray-core طراحی شده است. این پنل یک رابط کاربری آسان برای پیکربندی و نظارت بر پروتکلهای مختلف VPN و پراکسی ارائه میدهد. @@ -23,10 +23,10 @@ ## شروع سریع ``` -bash <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.sh) +bash <(curl -Ls https://raw.githubusercontent.com/c-villain/3x-ui/master/install.sh) ``` -برای مستندات کامل، لطفاً به [ویکی پروژه](https://github.com/MHSanaei/3x-ui/wiki) مراجعه کنید. +برای مستندات کامل، لطفاً به [ویکی پروژه](https://github.com/c-villain/3x-ui/wiki) مراجعه کنید. ## تشکر ویژه از diff --git a/README.md b/README.md index 7cda8370..5cfd2cf6 100644 --- a/README.md +++ b/README.md @@ -7,10 +7,10 @@ -[](https://github.com/MHSanaei/3x-ui/releases) -[](https://github.com/MHSanaei/3x-ui/actions) -[](#) -[](https://github.com/MHSanaei/3x-ui/releases/latest) +[](https://github.com/c-villain/3x-ui/releases) +[](https://github.com/c-villain/3x-ui/actions) +[](#) +[](https://github.com/c-villain/3x-ui/releases/latest) [](https://www.gnu.org/licenses/gpl-3.0.en.html) **3X-UI** — advanced, open-source web-based control panel designed for managing Xray-core server. It offers a user-friendly interface for configuring and monitoring various VPN and proxy protocols. @@ -23,10 +23,10 @@ As an enhanced fork of the original X-UI project, 3X-UI provides improved stabil ## Quick Start ```bash -bash <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.sh) +bash <(curl -Ls https://raw.githubusercontent.com/c-villain/3x-ui/master/install.sh) ``` -For full documentation, please visit the [project Wiki](https://github.com/MHSanaei/3x-ui/wiki). +For full documentation, please visit the [project Wiki](https://github.com/c-villain/3x-ui/wiki). ## A Special Thanks to diff --git a/README.ru_RU.md b/README.ru_RU.md index d971f403..265d8b93 100644 --- a/README.ru_RU.md +++ b/README.ru_RU.md @@ -7,10 +7,10 @@ -[](https://github.com/MHSanaei/3x-ui/releases) -[](https://github.com/MHSanaei/3x-ui/actions) -[](#) -[](https://github.com/MHSanaei/3x-ui/releases/latest) +[](https://github.com/c-villain/3x-ui/releases) +[](https://github.com/c-villain/3x-ui/actions) +[](#) +[](https://github.com/c-villain/3x-ui/releases/latest) [](https://www.gnu.org/licenses/gpl-3.0.en.html) **3X-UI** — продвинутая панель управления с открытым исходным кодом на основе веб-интерфейса, разработанная для управления сервером Xray-core. Предоставляет удобный интерфейс для настройки и мониторинга различных VPN и прокси-протоколов. @@ -23,10 +23,10 @@ ## Быстрый старт ``` -bash <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.sh) +bash <(curl -Ls https://raw.githubusercontent.com/c-villain/3x-ui/master/install.sh) ``` -Полную документацию смотрите в [вики проекта](https://github.com/MHSanaei/3x-ui/wiki). +Полную документацию смотрите в [вики проекта](https://github.com/c-villain/3x-ui/wiki). ## Особая благодарность diff --git a/README.zh_CN.md b/README.zh_CN.md index 75e75603..f380aaeb 100644 --- a/README.zh_CN.md +++ b/README.zh_CN.md @@ -7,10 +7,10 @@ -[](https://github.com/MHSanaei/3x-ui/releases) -[](https://github.com/MHSanaei/3x-ui/actions) -[](#) -[](https://github.com/MHSanaei/3x-ui/releases/latest) +[](https://github.com/c-villain/3x-ui/releases) +[](https://github.com/c-villain/3x-ui/actions) +[](#) +[](https://github.com/c-villain/3x-ui/releases/latest) [](https://www.gnu.org/licenses/gpl-3.0.en.html) **3X-UI** — 一个基于网页的高级开源控制面板,专为管理 Xray-core 服务器而设计。它提供了用户友好的界面,用于配置和监控各种 VPN 和代理协议。 @@ -23,10 +23,10 @@ ## 快速开始 ``` -bash <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.sh) +bash <(curl -Ls https://raw.githubusercontent.com/c-villain/3x-ui/master/install.sh) ``` -完整文档请参阅 [项目Wiki](https://github.com/MHSanaei/3x-ui/wiki)。 +完整文档请参阅 [项目Wiki](https://github.com/c-villain/3x-ui/wiki)。 ## 特别感谢 diff --git a/database/db.go b/database/db.go index c72d28cf..1992a993 100644 --- a/database/db.go +++ b/database/db.go @@ -35,6 +35,7 @@ func initModels() error { &model.InboundClientIps{}, &xray.ClientTraffic{}, &model.HistoryOfSeeders{}, + &model.BlockedDomain{}, } for _, model := range models { if err := db.AutoMigrate(model); err != nil { diff --git a/database/model/model.go b/database/model/model.go index 2e7095d3..230a32d0 100644 --- a/database/model/model.go +++ b/database/model/model.go @@ -105,3 +105,11 @@ type Client struct { Comment string `json:"comment" form:"comment"` Reset int `json:"reset" form:"reset"` } + +type BlockedDomain struct { + Id int `json:"id" gorm:"primaryKey;autoIncrement"` + Domain string `json:"domain" gorm:"unique;not null"` + Comment string `json:"comment"` + CreatedAt int64 `json:"createdAt" gorm:"autoCreateTime:milli"` + UpdatedAt int64 `json:"updatedAt" gorm:"autoUpdateTime:milli"` +} diff --git a/install.sh b/install.sh index 30a0f688..94d786e7 100644 --- a/install.sh +++ b/install.sh @@ -145,13 +145,13 @@ install_x-ui() { cd /usr/local/ if [ $# == 0 ]; then - tag_version=$(curl -Ls "https://api.github.com/repos/MHSanaei/3x-ui/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') + tag_version=$(curl -Ls "https://api.github.com/repos/c-villain/3x-ui/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') if [[ ! -n "$tag_version" ]]; then echo -e "${red}Failed to fetch x-ui version, it may be due to GitHub API restrictions, please try it later${plain}" exit 1 fi echo -e "Got x-ui latest version: ${tag_version}, beginning the installation..." - wget -N -O /usr/local/x-ui-linux-$(arch).tar.gz https://github.com/MHSanaei/3x-ui/releases/download/${tag_version}/x-ui-linux-$(arch).tar.gz + wget -N -O /usr/local/x-ui-linux-$(arch).tar.gz https://github.com/c-villain/3x-ui/releases/download/${tag_version}/x-ui-linux-$(arch).tar.gz if [[ $? -ne 0 ]]; then echo -e "${red}Downloading x-ui failed, please be sure that your server can access GitHub ${plain}" exit 1 @@ -166,7 +166,7 @@ install_x-ui() { exit 1 fi - url="https://github.com/MHSanaei/3x-ui/releases/download/${tag_version}/x-ui-linux-$(arch).tar.gz" + url="https://github.com/c-villain/3x-ui/releases/download/${tag_version}/x-ui-linux-$(arch).tar.gz" echo -e "Beginning to install x-ui $1" wget -N -O /usr/local/x-ui-linux-$(arch).tar.gz ${url} if [[ $? -ne 0 ]]; then @@ -193,7 +193,7 @@ install_x-ui() { chmod +x x-ui bin/xray-linux-$(arch) cp -f x-ui.service /etc/systemd/system/ - wget -O /usr/bin/x-ui https://raw.githubusercontent.com/MHSanaei/3x-ui/main/x-ui.sh + wget -O /usr/bin/x-ui https://raw.githubusercontent.com/c-villain/3x-ui/main/x-ui.sh chmod +x /usr/local/x-ui/x-ui.sh chmod +x /usr/bin/x-ui config_after_install diff --git a/web/controller/blocked_domain.go b/web/controller/blocked_domain.go new file mode 100644 index 00000000..f4e3c986 --- /dev/null +++ b/web/controller/blocked_domain.go @@ -0,0 +1,78 @@ +package controller + +import ( + "net/http" + "strconv" + + "github.com/gin-gonic/gin" + "x-ui/database/model" + "x-ui/web/service" +) + +type BlockedDomainController struct { + service *service.BlockedDomainService +} + +func NewBlockedDomainController(g *gin.RouterGroup) *BlockedDomainController { + ctrl := &BlockedDomainController{service: &service.BlockedDomainService{}} + r := g.Group("/blocked-domains") + r.GET("/", ctrl.List) + r.POST("/", ctrl.Create) + r.PUT("/:id", ctrl.Update) + r.DELETE("/:id", ctrl.Delete) + return ctrl +} + +func (ctrl *BlockedDomainController) List(c *gin.Context) { + domains, err := ctrl.service.GetAll() + if err != nil { + c.JSON(http.StatusInternalServerError, gin.H{"success": false, "msg": err.Error()}) + return + } + c.JSON(http.StatusOK, gin.H{"success": true, "obj": domains}) +} + +func (ctrl *BlockedDomainController) Create(c *gin.Context) { + var domain model.BlockedDomain + if err := c.ShouldBindJSON(&domain); err != nil { + c.JSON(http.StatusBadRequest, gin.H{"success": false, "msg": err.Error()}) + return + } + if err := ctrl.service.Create(&domain); err != nil { + c.JSON(http.StatusInternalServerError, gin.H{"success": false, "msg": err.Error()}) + return + } + c.JSON(http.StatusOK, gin.H{"success": true, "obj": domain}) +} + +func (ctrl *BlockedDomainController) Update(c *gin.Context) { + id, err := strconv.Atoi(c.Param("id")) + if err != nil { + c.JSON(http.StatusBadRequest, gin.H{"success": false, "msg": "invalid id"}) + return + } + var domain model.BlockedDomain + if err := c.ShouldBindJSON(&domain); err != nil { + c.JSON(http.StatusBadRequest, gin.H{"success": false, "msg": err.Error()}) + return + } + domain.Id = id + if err := ctrl.service.Update(&domain); err != nil { + c.JSON(http.StatusInternalServerError, gin.H{"success": false, "msg": err.Error()}) + return + } + c.JSON(http.StatusOK, gin.H{"success": true, "obj": domain}) +} + +func (ctrl *BlockedDomainController) Delete(c *gin.Context) { + id, err := strconv.Atoi(c.Param("id")) + if err != nil { + c.JSON(http.StatusBadRequest, gin.H{"success": false, "msg": "invalid id"}) + return + } + if err := ctrl.service.Delete(id); err != nil { + c.JSON(http.StatusInternalServerError, gin.H{"success": false, "msg": err.Error()}) + return + } + c.JSON(http.StatusOK, gin.H{"success": true}) +} \ No newline at end of file diff --git a/web/controller/xui.go b/web/controller/xui.go index 5b4c0a18..8d2b998f 100644 --- a/web/controller/xui.go +++ b/web/controller/xui.go @@ -26,6 +26,7 @@ func (a *XUIController) initRouter(g *gin.RouterGroup) { g.GET("/inbounds", a.inbounds) g.GET("/settings", a.settings) g.GET("/xray", a.xraySettings) + g.GET("/blocked-domains", a.blockedDomains) a.inboundController = NewInboundController(g) a.settingController = NewSettingController(g) @@ -47,3 +48,7 @@ func (a *XUIController) settings(c *gin.Context) { func (a *XUIController) xraySettings(c *gin.Context) { html(c, "xray.html", "pages.xray.title", nil) } + +func (a *XUIController) blockedDomains(c *gin.Context) { + html(c, "blocked_domains.html", "menu.blocked_domains", nil) +} diff --git a/web/html/blocked_domains.html b/web/html/blocked_domains.html new file mode 100644 index 00000000..cc4f1bb6 --- /dev/null +++ b/web/html/blocked_domains.html @@ -0,0 +1,132 @@ +{{define "page/blocked_domains"}} + +