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 - Support one-click SSL certificate application and automatic renewal
- For more advanced configuration items, please refer to the panel - For more advanced configuration items, please refer to the panel
# Screenshoot from Inbouds page # Screenshot from Inbouds page
![inbounds](./media/inbounds.png) ![inbounds](./media/inbounds.png)
@@ -154,7 +154,7 @@ x-ui v2-ui
# T-Shoots: # 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 : find this in config :
``` json ``` 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=[],) { fallbacks=[],) {
super(protocol); super(protocol);
this.vlesses = vlesses; this.vlesses = vlesses;
this.decryption = decryption; this.decryption = 'none'; // Using decryption is not implemented here
this.fallbacks = fallbacks; this.fallbacks = fallbacks;
} }
@@ -1411,12 +1411,13 @@ Inbound.VLESSSettings = class extends Inbound.Settings {
this.fallbacks.splice(index, 1); this.fallbacks.splice(index, 1);
} }
static fromJson(json={}) { // decryption should be set to static value
static fromJson({clients, decryption, fallbacks}={}) {
return new Inbound.VLESSSettings( return new Inbound.VLESSSettings(
Protocols.VLESS, Protocols.VLESS,
json.clients.map(client => Inbound.VLESSSettings.VLESS.fromJson(client)), clients.map(client => Inbound.VLESSSettings.VLESS.fromJson(client)),
json.decryption, 'none',
Inbound.VLESSSettings.Fallback.fromJson(json.fallbacks), 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( return new Inbound.VLESSSettings.VLESS(
json.id, id,
json.flow, flow,
json.email, email,
json.totalGB, totalGB,
json.fingerprint, fingerprint,
json.expiryTime, expiryTime
); );
} }
get _expiryTime() { get _expiryTime() {
if (this.expiryTime === 0 || this.expiryTime === "") { if (this.expiryTime === 0 || this.expiryTime === "") {
@@ -1547,12 +1547,13 @@ Inbound.TrojanSettings = class extends Inbound.Settings {
} }
}; };
Inbound.TrojanSettings.Trojan = class extends XrayCommonClass { 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(); super();
this.password = password; this.password = password;
this.flow = flow; this.flow = flow;
this.email = email; this.email = email;
this.totalGB = totalGB; this.totalGB = totalGB;
this.fingerprint = fingerprint;
this.expiryTime = expiryTime; this.expiryTime = expiryTime;
} }
@@ -1562,17 +1563,19 @@ Inbound.TrojanSettings.Trojan = class extends XrayCommonClass {
flow: this.flow, flow: this.flow,
email: this.email, email: this.email,
totalGB: this.totalGB, totalGB: this.totalGB,
fingerprint: this.fingerprint,
expiryTime: this.expiryTime, expiryTime: this.expiryTime,
}; };
} }
static fromJson(json={}) { static fromJson({password, flow, email, totalGB, fingerprint, expiryTime} = {}) {
return new Inbound.TrojanSettings.Trojan( return new Inbound.TrojanSettings.Trojan(
json.password, password,
json.flow, flow,
json.email, email,
json.totalGB, totalGB,
json.expiryTime, fingerprint,
expiryTime,
); );
} }

View File

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

View File

@@ -6,7 +6,7 @@
</a-tooltip> </a-tooltip>
<a-tooltip> <a-tooltip>
<template slot="title">{{ i18n "pages.client.edit" }}</template> <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>
<a-tooltip> <a-tooltip>
<template slot="title">{{ i18n "info" }}</template> <template slot="title">{{ i18n "info" }}</template>
@@ -18,7 +18,7 @@
</a-tooltip> </a-tooltip>
<a-tooltip> <a-tooltip>
<template slot="title"><span style="color: #FF4D4F"> {{ i18n "delete"}}</span></template> <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> </a-tooltip>
</template> </template>
<template slot="client" slot-scope="text, client"> <template slot="client" slot-scope="text, client">

View File

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