Compare commits

...

7 Commits
0.3.0 ... 0.3.1

Author SHA1 Message Date
Alireza Ahmadi
e1428ff0dc Fix editing a searched client is buggy alireza0/x-ui#24 2023-02-24 14:46:14 +01:00
Alireza Ahmadi
4843c93608 Fix Vless & Trojan fingerprint problem 2023-02-24 13:07:17 +01:00
Alireza Ahmadi
757c2a76f8 Minimize call API for Client 2023-02-24 00:05:53 +01:00
Alireza Ahmadi
fc4f1a4fd3 Fix typos in README 2023-02-23 17:44:16 +01:00
Alireza Ahmadi
c7be137f6d Update screenshot 2023-02-23 17:20:57 +01:00
Alireza Ahmadi
8a07474999 0.3.1 2023-02-23 11:33:42 +01:00
Alireza Ahmadi
7ec68574d0 Fix Bug: Auto restart xray after client update 2023-02-23 11:33:14 +01:00
7 changed files with 53 additions and 53 deletions

View File

@@ -33,7 +33,7 @@ xray panel supporting multi-protocol, **Multi-lang (English,Farsi,Chinese)**
- Support one-click SSL certificate application and automatic renewal
- For more advanced configuration items, please refer to the panel
# Screenshoot from Inbouds page
# Screenshot from Inbouds page
![inbounds](./media/inbounds.png)
@@ -154,7 +154,7 @@ x-ui v2-ui
# T-Shoots:
**If you ygrade from an old version or other forks, for enable traffic for users you should do :**
**If you upgrade from an old version or other forks, for enable traffic for users you should do :**
find this in config :
``` json

View File

@@ -1 +1 @@
0.3.0
0.3.1

Binary file not shown.

Before

Width:  |  Height:  |  Size: 258 KiB

After

Width:  |  Height:  |  Size: 129 KiB

View File

@@ -1399,7 +1399,7 @@ Inbound.VLESSSettings = class extends Inbound.Settings {
fallbacks=[],) {
super(protocol);
this.vlesses = vlesses;
this.decryption = decryption;
this.decryption = 'none'; // Using decryption is not implemented here
this.fallbacks = fallbacks;
}
@@ -1411,12 +1411,13 @@ Inbound.VLESSSettings = class extends Inbound.Settings {
this.fallbacks.splice(index, 1);
}
static fromJson(json={}) {
// decryption should be set to static value
static fromJson({clients, decryption, fallbacks}={}) {
return new Inbound.VLESSSettings(
Protocols.VLESS,
json.clients.map(client => Inbound.VLESSSettings.VLESS.fromJson(client)),
json.decryption,
Inbound.VLESSSettings.Fallback.fromJson(json.fallbacks),
clients.map(client => Inbound.VLESSSettings.VLESS.fromJson(client)),
'none',
Inbound.VLESSSettings.Fallback.fromJson(fallbacks),
);
}
@@ -1442,17 +1443,16 @@ Inbound.VLESSSettings.VLESS = class extends XrayCommonClass {
}
static fromJson(json={}) {
static fromJson({id, flow, email, totalGB, fingerprint, expiryTime} = {}) {
return new Inbound.VLESSSettings.VLESS(
json.id,
json.flow,
json.email,
json.totalGB,
json.fingerprint,
json.expiryTime,
id,
flow,
email,
totalGB,
fingerprint,
expiryTime
);
}
}
get _expiryTime() {
if (this.expiryTime === 0 || this.expiryTime === "") {
@@ -1547,12 +1547,13 @@ Inbound.TrojanSettings = class extends Inbound.Settings {
}
};
Inbound.TrojanSettings.Trojan = class extends XrayCommonClass {
constructor(password=RandomUtil.randomSeq(10), flow='', email=RandomUtil.randomText(), totalGB=0, expiryTime='') {
constructor(password=RandomUtil.randomSeq(10), flow='', email=RandomUtil.randomText(), totalGB=0, fingerprint = UTLS_FINGERPRINT.UTLS_CHROME, expiryTime='') {
super();
this.password = password;
this.flow = flow;
this.email = email;
this.totalGB = totalGB;
this.fingerprint = fingerprint;
this.expiryTime = expiryTime;
}
@@ -1562,17 +1563,19 @@ Inbound.TrojanSettings.Trojan = class extends XrayCommonClass {
flow: this.flow,
email: this.email,
totalGB: this.totalGB,
fingerprint: this.fingerprint,
expiryTime: this.expiryTime,
};
}
static fromJson(json={}) {
static fromJson({password, flow, email, totalGB, fingerprint, expiryTime} = {}) {
return new Inbound.TrojanSettings.Trojan(
json.password,
json.flow,
json.email,
json.totalGB,
json.expiryTime,
password,
flow,
email,
totalGB,
fingerprint,
expiryTime,
);
}

View File

@@ -140,6 +140,9 @@ func (a *InboundController) addInboundClient(c *gin.Context) {
return
}
jsonMsg(c, "Client added", nil)
if err == nil {
a.xrayService.SetToNeedRestart()
}
}
func (a *InboundController) delInboundClient(c *gin.Context) {
@@ -161,6 +164,9 @@ func (a *InboundController) delInboundClient(c *gin.Context) {
return
}
jsonMsg(c, "Client deleted", nil)
if err == nil {
a.xrayService.SetToNeedRestart()
}
}
func (a *InboundController) updateInboundClient(c *gin.Context) {
@@ -183,6 +189,9 @@ func (a *InboundController) updateInboundClient(c *gin.Context) {
return
}
jsonMsg(c, "Client updated", nil)
if err == nil {
a.xrayService.SetToNeedRestart()
}
}
func (a *InboundController) resetClientTraffic(c *gin.Context) {
@@ -194,4 +203,7 @@ func (a *InboundController) resetClientTraffic(c *gin.Context) {
return
}
jsonMsg(c, "traffic reseted", nil)
if err == nil {
a.xrayService.SetToNeedRestart()
}
}

View File

@@ -6,7 +6,7 @@
</a-tooltip>
<a-tooltip>
<template slot="title">{{ i18n "pages.client.edit" }}</template>
<a-icon style="font-size: 24px;" type="edit" @click="openEditClient(record.id,index);"></a-icon>
<a-icon style="font-size: 24px;" type="edit" @click="openEditClient(record.id,client);"></a-icon>
</a-tooltip>
<a-tooltip>
<template slot="title">{{ i18n "info" }}</template>
@@ -18,7 +18,7 @@
</a-tooltip>
<a-tooltip>
<template slot="title"><span style="color: #FF4D4F"> {{ i18n "delete"}}</span></template>
<a-icon style="font-size: 24px;" type="delete" v-if="isRemovable(record.id)" @click="delClient(record.id,index)"></a-icon>
<a-icon style="font-size: 24px;" type="delete" v-if="isRemovable(record.id)" @click="delClient(record.id,client)"></a-icon>
</a-tooltip>
</template>
<template slot="client" slot-scope="text, client">

View File

@@ -363,8 +363,10 @@
isEdit: false
});
},
openEditClient(dbInbound_id, index) {
dbInbound = this.dbInbounds.find(row => row.id === dbInbound_id);
openEditClient(dbInboundId, client) {
dbInbound = this.dbInbounds.find(row => row.id === dbInboundId);
clients = this.getInboundClients(dbInbound);
index = this.findIndexOfClient(clients, client);
clientModal.show({
title: '{{ i18n "pages.client.edit"}}',
okText: '{{ i18n "pages.client.submitEdit"}}',
@@ -378,41 +380,21 @@
isEdit: true
});
},
findIndexOfClient(clients,client) {
firstKey = Object.keys(client)[0];
return clients.findIndex(c => c[firstKey] === client[firstKey]);
},
async addClient(inbound, dbInbound) {
const data = {
id: dbInbound.id,
up: dbInbound.up,
down: dbInbound.down,
total: dbInbound.total,
remark: dbInbound.remark,
enable: dbInbound.enable,
expiryTime: dbInbound.expiryTime,
listen: inbound.listen,
port: inbound.port,
protocol: inbound.protocol,
settings: inbound.settings.toString(),
streamSettings: inbound.stream.toString(),
sniffing: inbound.canSniffing() ? inbound.sniffing.toString() : '{}',
};
await this.submit('/xui/inbound/addClient', data, clientModal);
},
async updateClient(inbound, dbInbound, index) {
const data = {
id: dbInbound.id,
up: dbInbound.up,
down: dbInbound.down,
total: dbInbound.total,
remark: dbInbound.remark,
enable: dbInbound.enable,
expiryTime: dbInbound.expiryTime,
listen: inbound.listen,
port: inbound.port,
protocol: inbound.protocol,
settings: inbound.settings.toString(),
streamSettings: inbound.stream.toString(),
sniffing: inbound.canSniffing() ? inbound.sniffing.toString() : '{}',
};
await this.submit(`/xui/inbound/updateClient/${index}`, data, clientModal);
},
@@ -439,7 +421,10 @@
onOk: () => this.submit('/xui/inbound/del/' + dbInbound.id),
});
},
delClient(dbInboundId,index) {
delClient(dbInboundId,client) {
dbInbound = this.dbInbounds.find(row => row.id === dbInboundId);
clients = this.getInboundClients(dbInbound);
index = this.findIndexOfClient(clients, client);
this.$confirm({
title: '{{ i18n "pages.inbounds.deleteInbound"}}',
content: '{{ i18n "pages.inbounds.deleteInboundContent"}}',