From 99e9c27d2f9f7ad69ce9aefd351b0c69877dc6d8 Mon Sep 17 00:00:00 2001 From: Alireza Ahmadi Date: Thu, 22 Feb 2024 20:35:19 +0100 Subject: [PATCH] small changes --- sub/subJsonService.go | 10 +++------- web/assets/codemirror/codemirror.js | 2 +- web/html/xui/settings.html | 2 +- web/html/xui/xray.html | 6 +++--- web/html/xui/xray_balancer_modal.html | 13 +++++++------ web/service/inbound.go | 2 -- 6 files changed, 15 insertions(+), 20 deletions(-) diff --git a/sub/subJsonService.go b/sub/subJsonService.go index 14db09e5..8bc98dea 100644 --- a/sub/subJsonService.go +++ b/sub/subJsonService.go @@ -117,11 +117,7 @@ func (s *SubJsonService) GetJson(subId string, host string) (string, string, err // Combile outbounds outbounds = append(outbounds, defaultOutbounds...) - var outboundStrings []json_util.RawMessage - for _, outbound := range outbounds { - outboundStrings = append(outboundStrings, outbound) - } - configJson["outbounds"] = outboundStrings + configJson["outbounds"] = outbounds finalJson, _ := json.MarshalIndent(configJson, "", " ") header = fmt.Sprintf("upload=%d; download=%d; total=%d; expire=%d", traffic.Up, traffic.Down, traffic.Total, traffic.ExpiryTime/1000) @@ -193,7 +189,7 @@ func (s *SubJsonService) streamData(stream string) map[string]interface{} { delete(streamSettings, "sockopt") if s.fragmanet != "" { - streamSettings["sockopt"] = json_util.RawMessage(`{"dialerProxy": "fragment", "tcpKeepAliveIdle": 100, "TcpNoDelay": true}`) + streamSettings["sockopt"] = json_util.RawMessage(`{"dialerProxy": "fragment", "tcpKeepAliveIdle": 100, "tcpNoDelay": true}`) } // remove proxy protocol @@ -222,7 +218,7 @@ func (s *SubJsonService) tlsData(tData map[string]interface{}) map[string]interf tlsData["serverName"] = tData["serverName"] tlsData["alpn"] = tData["alpn"] - if allowInsecure, ok := tlsClientSettings["allowInsecure"].(string); ok { + if allowInsecure, ok := tlsClientSettings["allowInsecure"].(bool); ok { tlsData["allowInsecure"] = allowInsecure } if fingerprint, ok := tlsClientSettings["fingerprint"].(string); ok { diff --git a/web/assets/codemirror/codemirror.js b/web/assets/codemirror/codemirror.js index ef1810fa..034ea2f8 100644 --- a/web/assets/codemirror/codemirror.js +++ b/web/assets/codemirror/codemirror.js @@ -538,7 +538,7 @@ var on = function(emitter, type, f) { if (emitter.addEventListener) { - emitter.addEventListener(type, f, false); + emitter.addEventListener(type, f, { passive: true }); } else if (emitter.attachEvent) { emitter.attachEvent("on" + type, f); } else { diff --git a/web/html/xui/settings.html b/web/html/xui/settings.html index 328e1274..10bae141 100644 --- a/web/html/xui/settings.html +++ b/web/html/xui/settings.html @@ -265,7 +265,7 @@ streamSettings: { sockopt: { tcpKeepAliveIdle: 100, - TcpNoDelay: true + tcpNoDelay: true } } }, diff --git a/web/html/xui/xray.html b/web/html/xui/xray.html index 8959e151..0eb81442 100644 --- a/web/html/xui/xray.html +++ b/web/html/xui/xray.html @@ -1,14 +1,14 @@ {{template "head" .}} - + - + @@ -445,7 +445,7 @@ {{ i18n "pages.xray.outbound.addReverse" }} - tag != balancer.tag); this.outboundTags = app.templateSettings.outbounds.filter((o) => !ObjectUtil.isEmpty(o.tag)).map(obj => obj.tag); this.isEdit = isEdit; - this.check() + this.check(); + this.checkSelector(); }, close() { - balancerModal.visible = false; - balancerModal.loading(false); + this.visible = false; + this.loading(false); }, loading(loading=true) { - balancerModal.confirmLoading = loading; + this.confirmLoading = loading; }, check() { - if (balancerModal.balancer.tag == '' || balancerModal.balancerTags.includes(balancerModal.balancer.tag)) { + if (this.balancer.tag == '' || this.balancerTags.includes(this.balancer.tag)) { this.duplicateTag = true; this.isValid = false; } else { @@ -93,7 +94,7 @@ } }, checkSelector() { - balancerModal.emptySelector = balancerModal.balancer.selector.length == 0; + this.emptySelector = this.balancer.selector.length == 0; } }; diff --git a/web/service/inbound.go b/web/service/inbound.go index 1acb2523..596c6158 100644 --- a/web/service/inbound.go +++ b/web/service/inbound.go @@ -1329,8 +1329,6 @@ func (s *InboundService) MigrationRequirements() { } }() - db.Migrator().DropIndex(&model.Inbound{}, "port") - // Fix inbounds based problems var inbounds []*model.Inbound err = tx.Model(model.Inbound{}).Where("protocol IN (?)", []string{"vmess", "vless", "trojan"}).Find(&inbounds).Error