mirror of
https://github.com/alireza0/x-ui.git
synced 2026-03-14 05:23:09 +00:00
v1.8.6
This commit is contained in:
@@ -1 +1 @@
|
||||
1.8.5
|
||||
1.8.6
|
||||
@@ -872,15 +872,15 @@ Outbound.FreedomSettings.Fragment = class extends CommonClass {
|
||||
}
|
||||
};
|
||||
Outbound.FreedomSettings.Noise = class extends CommonClass {
|
||||
constructor(packets = '', delay = '') {
|
||||
constructor(packet = '', delay = '') {
|
||||
super();
|
||||
this.packets = packets;
|
||||
this.packet = packet;
|
||||
this.delay = delay;
|
||||
}
|
||||
|
||||
static fromJson(json = {}) {
|
||||
return new Outbound.FreedomSettings.Noise(
|
||||
json.packets,
|
||||
json.packet,
|
||||
json.delay,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -55,8 +55,8 @@
|
||||
</a-switch>
|
||||
</a-form-item>
|
||||
<template v-if="Object.keys(outbound.settings.noise).length >0">
|
||||
<a-form-item label='Packets'>
|
||||
<a-input v-model.trim="outbound.settings.noise.packets"></a-input>
|
||||
<a-form-item label='Packet'>
|
||||
<a-input v-model.trim="outbound.settings.noise.packet"></a-input>
|
||||
</a-form-item>
|
||||
<a-form-item label='Delay'>
|
||||
<a-input v-model.trim="outbound.settings.noise.delay"></a-input>
|
||||
|
||||
@@ -220,7 +220,7 @@
|
||||
<setting-list-item type="text" title='Interval' v-model="fragmentInterval" placeholder="10-20"></setting-list-item>
|
||||
</a-collapse-panel>
|
||||
<a-collapse-panel header='Noise' v-if="enableNoise">
|
||||
<setting-list-item type="text" title='Packets' v-model="noisePackets" placeholder="rand:5-10"></setting-list-item>
|
||||
<setting-list-item type="text" title='Packet' v-model="noisePacket" placeholder="rand:5-10"></setting-list-item>
|
||||
<setting-list-item type="text" title='Delay' v-model="noiseDelay" placeholder="5-10"></setting-list-item>
|
||||
</a-collapse-panel>
|
||||
<a-collapse-panel header='Mux' v-if="enableMux">
|
||||
@@ -307,7 +307,7 @@
|
||||
settings: {
|
||||
domainStrategy: "AsIs",
|
||||
noise: {
|
||||
packets: "rand:5-10",
|
||||
packet: "rand:5-10",
|
||||
delay: "5-10",
|
||||
}
|
||||
},
|
||||
@@ -469,12 +469,12 @@
|
||||
this.allSetting.subJsonNoise = v ? JSON.stringify(this.defaultNoise) : "";
|
||||
}
|
||||
},
|
||||
noisePackets: {
|
||||
get: function () { return this.enableNoise ? JSON.parse(this.allSetting.subJsonNoise).settings.noise.packets : ""; },
|
||||
noisePacket: {
|
||||
get: function () { return this.enableNoise ? JSON.parse(this.allSetting.subJsonNoise).settings.noise.packet : ""; },
|
||||
set: function (v) {
|
||||
if (v != "") {
|
||||
newNoise = JSON.parse(this.allSetting.subJsonNoise);
|
||||
newNoise.settings.noise.packets = v;
|
||||
newNoise.settings.noise.packet = v;
|
||||
this.allSetting.subJsonNoise = JSON.stringify(newNoise);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -518,11 +518,13 @@ func (s *InboundService) DelInboundClient(inboundId int, clientId string) (bool,
|
||||
|
||||
interfaceClients := settings["clients"].([]interface{})
|
||||
var newClients []interface{}
|
||||
needApiDel := false
|
||||
for _, client := range interfaceClients {
|
||||
c := client.(map[string]interface{})
|
||||
c_id := c[client_key].(string)
|
||||
if c_id == clientId {
|
||||
email = c["email"].(string)
|
||||
email, _ = c["email"].(string)
|
||||
needApiDel, _ = c["enable"].(bool)
|
||||
} else {
|
||||
newClients = append(newClients, client)
|
||||
}
|
||||
@@ -541,23 +543,32 @@ func (s *InboundService) DelInboundClient(inboundId int, clientId string) (bool,
|
||||
oldInbound.Settings = string(newSettings)
|
||||
|
||||
db := database.GetDB()
|
||||
err = s.DelClientStat(db, email)
|
||||
if err != nil {
|
||||
logger.Error("Delete stats Data Error")
|
||||
return false, err
|
||||
}
|
||||
needRestart := false
|
||||
|
||||
if len(email) > 0 {
|
||||
s.xrayApi.Init(p.GetAPIPort())
|
||||
err1 := s.xrayApi.RemoveUser(oldInbound.Tag, email)
|
||||
if err1 == nil {
|
||||
logger.Debug("Client deleted by api:", email)
|
||||
needRestart = false
|
||||
} else {
|
||||
logger.Debug("Unable to del client by api:", err1)
|
||||
needRestart = true
|
||||
notDepleted := true
|
||||
err = db.Model(xray.ClientTraffic{}).Select("enable").Where("email = ?", email).First(¬Depleted).Error
|
||||
if err != nil {
|
||||
logger.Error("Get stats error")
|
||||
return false, err
|
||||
}
|
||||
err = s.DelClientStat(db, email)
|
||||
if err != nil {
|
||||
logger.Error("Delete stats Data Error")
|
||||
return false, err
|
||||
}
|
||||
if needApiDel && notDepleted {
|
||||
s.xrayApi.Init(p.GetAPIPort())
|
||||
err1 := s.xrayApi.RemoveUser(oldInbound.Tag, email)
|
||||
if err1 == nil {
|
||||
logger.Debug("Client deleted by api:", email)
|
||||
needRestart = false
|
||||
} else {
|
||||
logger.Debug("Unable to del client by api:", err1)
|
||||
needRestart = true
|
||||
}
|
||||
s.xrayApi.Close()
|
||||
}
|
||||
s.xrayApi.Close()
|
||||
}
|
||||
return needRestart, db.Save(oldInbound).Error
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user