Skip to content

Commit 6d28c39

Browse files
author
MHSanaei
committed
en lang edit, new designed
1 parent 920259b commit 6d28c39

22 files changed

+296
-200
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
.idea
22
tmp
3-
bin/xray-darwin-arm64
4-
bin/config.json
3+
bin/
54
dist/
65
x-ui-*.tar.gz
76
/x-ui

config/version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.5.3
1+
1.0.4

web/assets/js/model/models.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,9 @@ class DBInbound {
151151
}
152152
}
153153

154-
genLink() {
154+
genLink(clientIndex) {
155155
const inbound = this.toInbound();
156-
return inbound.genLink(this.address, this.remark);
156+
return inbound.genLink(this.address, this.remark, clientIndex);
157157
}
158158
}
159159

web/assets/js/model/xray.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,6 @@ class Inbound extends XrayCommonClass {
10401040
}
10411041
}
10421042

1043-
remark = this.settings.vmesses[clientIndex].email ?? remark;
10441043
let obj = {
10451044
v: '2',
10461045
ps: remark,
@@ -1063,7 +1062,6 @@ class Inbound extends XrayCommonClass {
10631062
const port = this.port;
10641063
const type = this.stream.network;
10651064
const params = new Map();
1066-
remark = settings.vlesses[clientIndex].email ?? remark;
10671065
params.set("type", this.stream.network);
10681066
if (this.xtls) {
10691067
params.set("security", "xtls");
@@ -1156,7 +1154,6 @@ class Inbound extends XrayCommonClass {
11561154
const port = this.port;
11571155
const type = this.stream.network;
11581156
const params = new Map();
1159-
remark = settings.trojans[clientIndex].email ?? remark;
11601157
params.set("type", this.stream.network);
11611158
if (this.xtls) {
11621159
params.set("security", "xtls");
@@ -1229,10 +1226,22 @@ class Inbound extends XrayCommonClass {
12291226

12301227
genLink(address='', remark='', clientIndex=0) {
12311228
switch (this.protocol) {
1232-
case Protocols.VMESS: return this.genVmessLink(address, remark, clientIndex);
1233-
case Protocols.VLESS: return this.genVLESSLink(address, remark, clientIndex);
1229+
case Protocols.VMESS:
1230+
if (this.settings.vmesses[clientIndex].email != ""){
1231+
remark += '-' + this.settings.vmesses[clientIndex].email
1232+
}
1233+
return this.genVmessLink(address, remark, clientIndex);
1234+
case Protocols.VLESS:
1235+
if (this.settings.vlesses[clientIndex].email != ""){
1236+
remark += '-' + this.settings.vlesses[clientIndex].email
1237+
}
1238+
return this.genVLESSLink(address, remark, clientIndex);
12341239
case Protocols.SHADOWSOCKS: return this.genSSLink(address, remark);
1235-
case Protocols.TROJAN: return this.genTrojanLink(address, remark, clientIndex);
1240+
case Protocols.TROJAN:
1241+
if (this.settings.trojans[clientIndex].email != ""){
1242+
remark += '-' + this.settings.trojans[clientIndex].email
1243+
}
1244+
return this.genTrojanLink(address, remark, clientIndex);
12361245
default: return '';
12371246
}
12381247
}

web/assets/js/util/common.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,16 @@ function addZero(num) {
5454
function toFixed(num, n) {
5555
n = Math.pow(10, n);
5656
return Math.round(num * n) / n;
57-
}
57+
}
58+
59+
function debounce (fn, delay) {
60+
var timeoutID = null
61+
return function () {
62+
clearTimeout(timeoutID)
63+
var args = arguments
64+
var that = this
65+
timeoutID = setTimeout(function () {
66+
fn.apply(that, args)
67+
}, delay)
68+
}
69+
}

web/html/common/qrcode_modal.html

Lines changed: 1 addition & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,7 @@
22
<a-modal id="qrcode-modal" v-model="qrModal.visible" :title="qrModal.title"
33
:closable="true" width="300px" :ok-text="qrModal.okText"
44
cancel-text='{{ i18n "close" }}' :ok-button-props="{attrs:{id:'qr-modal-ok-btn'}}">
5-
<a-tag color="green" style="margin-bottom: 10px;display: block;text-align: center;" >click on QR Code to Copy</a-tag>
6-
<canvas v-if="qrModal.inbound.protocol != Protocols.VMESS && qrModal.inbound.protocol != Protocols.VLESS && qrModal.inbound.protocol != Protocols.TROJAN" id="qrCode" style="width: 100%; height: 100%;"></canvas>
7-
8-
<template v-if="qrModal.inbound.protocol === Protocols.VMESS" v-for="(vmess, index) in qrModal.inbound.settings.vmesses">
9-
<a-tag color="red" style="margin-bottom: 10px;display: block;text-align: center;" v-text="vmess.email"></a-tag>
10-
<canvas @click="copyTextToClipboard(`qrCode-vmess-${vmess.id}`,index)" :id="`qrCode-vmess-${vmess.id}`" style="width: 100%; height: 100%;"></canvas>
11-
<a-divider style="height: 2px; background-color: #7e7e7e" />
12-
</template>
13-
14-
<template v-if="qrModal.inbound.protocol === Protocols.VLESS" v-for="(vless, index) in qrModal.inbound.settings.vlesses">
15-
<a-tag color="red" style="margin-bottom: 10px;display: block;text-align: center;" v-text="vless.email"></a-tag>
16-
<canvas @click="copyTextToClipboard(`qrCode-vless-${vless.id}`,index)" :id="`qrCode-vless-${vless.id}`" style="width: 100%; height: 100%;"></canvas>
17-
<a-divider style="height: 2px; background-color: #7e7e7e" />
18-
</template>
19-
20-
<template v-if="qrModal.inbound.protocol === Protocols.TROJAN" v-for="(trojan, index) in qrModal.inbound.settings.trojans">
21-
<a-tag color="red" style="margin-bottom: 10px;display: block;text-align: center;" v-text="trojan.email"></a-tag>
22-
<canvas @click="copyTextToClipboard(`qrCode-trojan-${trojan.password}`,index)" :id="`qrCode-trojan-${trojan.password}`" style="width: 100%; height: 100%;"></canvas>
23-
<a-divider style="height: 2px; background-color: #7e7e7e" />
24-
</template>
5+
<canvas id="qrCode" style="width: 100%; height: 100%;"></canvas>
256
</a-modal>
267

278
<script>
@@ -76,57 +57,6 @@
7657
data: {
7758
qrModal: qrModal,
7859
},
79-
methods: {
80-
setQrCode(elmentId,index) {
81-
content = qrModal.inbound.genLink(qrModal.dbInbound.address,qrModal.dbInbound.remark,index)
82-
83-
new QRious({
84-
element: document.querySelector('#'+elmentId),
85-
size: 260,
86-
value: content,
87-
});
88-
},
89-
copyTextToClipboard(elmentId,index) {
90-
link = qrModal.inbound.genLink(qrModal.dbInbound.address,qrModal.dbInbound.remark,index)
91-
this.qrModal.copyText = link
92-
93-
this.qrModal.clipboard = new ClipboardJS('#' + elmentId, {
94-
text: () => link,
95-
});
96-
this.qrModal.clipboard.on('success', () => {
97-
app.$message.success('{{ i18n "copied" }}')
98-
this.qrModal.clipboard.destroy();
99-
});
100-
101-
102-
}
103-
},
104-
updated() {
105-
switch (qrModal.inbound.protocol) {
106-
case Protocols.VMESS:
107-
vmesses = qrModal.inbound.settings.vmesses
108-
for (const index in vmesses) {
109-
this.setQrCode("qrCode-vmess-" + vmesses[index].id ,index)
110-
}
111-
break;
112-
case Protocols.VLESS:
113-
vlesses = qrModal.inbound.settings.vlesses
114-
115-
for (const index in vlesses) {
116-
this.setQrCode("qrCode-vless-" + vlesses[index].id ,index)
117-
}
118-
break;
119-
case Protocols.TROJAN:
120-
trojans = qrModal.inbound.settings.trojans
121-
122-
for (const index in trojans) {
123-
this.setQrCode("qrCode-trojan-" + trojans[index].password ,index)
124-
}
125-
break;
126-
default: return null;
127-
}
128-
129-
}
13060
});
13161

13262
</script>

web/html/xui/form/protocol/trojan.html

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
Email
1313
<a-tooltip>
1414
<template slot="title">
15-
The email must be completely unique
15+
The Email Must Be Completely Unique
1616
</template>
1717
<!--Renew Svg Icon-->
1818
<svg
@@ -23,10 +23,10 @@
2323
<a-input v-model.trim="trojan.email"></a-input>
2424
</a-form-item>
2525
</a-form>
26-
<a-form-item label="password">
26+
<a-form-item label="Password">
2727
<a-input v-model.trim="trojan.password"></a-input>
2828
</a-form-item>
29-
<a-form-item v-if="inbound.xtls" label="flow">
29+
<a-form-item v-if="inbound.xtls" label="Flow">
3030
<a-select v-model="inbound.settings.trojans[index].flow" style="width: 150px">
3131
<a-select-option value="" selected>none</a-select-option>
3232
<a-select-option v-for="key in XTLS_FLOW_CONTROL" :value="key">[[ key ]]</a-select-option>
@@ -60,7 +60,7 @@
6060
<a-form layout="inline">
6161
<a-tooltip v-if="trojan._totalGB > 0">
6262
<template slot="title">
63-
reset traffic
63+
{{ i18n "pages.inbounds.resetTraffic" }}
6464
</template>
6565
<span style="color: #FF4D4F">
6666
<a-icon type="delete" @click="resetClientTraffic(trojan,$event)"></a-icon>
@@ -104,7 +104,7 @@
104104
</a-form>
105105
</a-form>
106106
<a-form layout="inline">
107-
<a-form-item label="fallbacks">
107+
<a-form-item label="Fallbacks">
108108
<a-row>
109109
<a-button type="primary" size="small"
110110
@click="inbound.settings.addTrojanFallback()">
@@ -121,19 +121,19 @@
121121
<a-icon type="delete" @click="() => inbound.settings.delTrojanFallback(index)"
122122
style="color: rgb(255, 77, 79);cursor: pointer;"/>
123123
</a-divider>
124-
<a-form-item label="name">
124+
<a-form-item label="Name">
125125
<a-input v-model="fallback.name"></a-input>
126126
</a-form-item>
127-
<a-form-item label="alpn">
127+
<a-form-item label="Alpn">
128128
<a-input v-model="fallback.alpn"></a-input>
129129
</a-form-item>
130-
<a-form-item label="path">
130+
<a-form-item label="Path">
131131
<a-input v-model="fallback.path"></a-input>
132132
</a-form-item>
133-
<a-form-item label="dest">
133+
<a-form-item label="Dest">
134134
<a-input v-model="fallback.dest"></a-input>
135135
</a-form-item>
136-
<a-form-item label="xver">
136+
<a-form-item label="xVer">
137137
<a-input type="number" v-model.number="fallback.xver"></a-input>
138138
</a-form-item>
139139
<a-divider v-if="inbound.settings.fallbacks.length - 1 === index"/>

web/html/xui/form/protocol/vless.html

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
Email
1313
<a-tooltip>
1414
<template slot="title">
15-
The email must be completely unique
15+
The Email Must Be Completely Unique
1616
</template>
1717
<!--Renew Svg Icon-->
1818
<svg
@@ -23,7 +23,7 @@
2323
<a-input v-model.trim="vless.email"></a-input>
2424
</a-form-item>
2525
</a-form>
26-
<a-form-item label="id">
26+
<a-form-item label="ID">
2727
<a-input v-model.trim="vless.id"></a-input>
2828
</a-form-item>
2929
<a-form-item v-if="inbound.xtls" label="flow">
@@ -71,7 +71,7 @@
7171
<a-form layout="inline">
7272
<a-tooltip v-if="vless._totalGB > 0">
7373
<template slot="title">
74-
reset traffic
74+
{{ i18n "pages.inbounds.resetTraffic" }}
7575
</template>
7676
<span style="color: #FF4D4F">
7777
<a-icon type="delete" @click="resetClientTraffic(vless,$event)"></a-icon>
@@ -118,7 +118,7 @@
118118
</a-form>
119119

120120
<a-form layout="inline">
121-
<a-form-item label="fallbacks">
121+
<a-form-item label="Fallbacks">
122122
<a-row>
123123
<a-button type="primary" size="small"
124124
@click="inbound.settings.addFallback()">
@@ -135,19 +135,19 @@
135135
<a-icon type="delete" @click="() => inbound.settings.delFallback(index)"
136136
style="color: rgb(255, 77, 79);cursor: pointer;"/>
137137
</a-divider>
138-
<a-form-item label="name">
138+
<a-form-item label="Name">
139139
<a-input v-model="fallback.name"></a-input>
140140
</a-form-item>
141-
<a-form-item label="alpn">
141+
<a-form-item label="Alpn">
142142
<a-input v-model="fallback.alpn"></a-input>
143143
</a-form-item>
144-
<a-form-item label="path">
144+
<a-form-item label="Path">
145145
<a-input v-model="fallback.path"></a-input>
146146
</a-form-item>
147-
<a-form-item label="dest">
147+
<a-form-item label="Dest">
148148
<a-input v-model="fallback.dest"></a-input>
149149
</a-form-item>
150-
<a-form-item label="xver">
150+
<a-form-item label="xVer">
151151
<a-input type="number" v-model.number="fallback.xver"></a-input>
152152
</a-form-item>
153153
<a-divider v-if="inbound.settings.fallbacks.length - 1 === index"/>

web/html/xui/form/protocol/vmess.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
Email
1212
<a-tooltip>
1313
<template slot="title">
14-
The email must be completely unique
14+
The Email Must Be Completely Unique
1515
</template>
1616
<!--Renew Svg Icon-->
1717
<svg
@@ -22,7 +22,7 @@
2222
<a-input v-model.trim="vmess.email"></a-input>
2323
</a-form-item>
2424
</a-form>
25-
<a-form-item label="id">
25+
<a-form-item label="ID">
2626
<a-input v-model.trim="vmess.id"></a-input>
2727
</a-form-item>
2828
<a-form-item label='{{ i18n "additional" }} ID'>
@@ -56,7 +56,7 @@
5656
<a-form layout="inline">
5757
<a-tooltip v-if="vmess._totalGB > 0">
5858
<template slot="title">
59-
reset traffic
59+
{{ i18n "pages.inbounds.resetTraffic" }}
6060
</template>
6161
<span style="color: #FF4D4F">
6262
<a-icon type="delete" @click="resetClientTraffic(vmess,$event)"></a-icon>

web/html/xui/form/sniffing.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<a-form layout="inline">
33
<a-form-item>
44
<span slot="label">
5-
sniffing
5+
Sniffing
66
<a-tooltip>
77
<template slot="title">
88
<span >{{ i18n "pages.inbounds.noRecommendKeepDefault" }}</span>

0 commit comments

Comments
 (0)