Plus some fixes and decoration
This commit is contained in:
Alireza Ahmadi
2023-08-25 23:56:50 +02:00
parent da5253d98c
commit a6199526da
10 changed files with 22 additions and 11 deletions

View File

@@ -14,7 +14,7 @@ jobs:
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v4 uses: actions/setup-go@v4
with: with:
go-version: 'stable' go-version: '1.20'
- name: build linux amd64 version - name: build linux amd64 version
run: | run: |
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o xui-release -v main.go CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o xui-release -v main.go

View File

@@ -1 +1 @@
1.5.3 1.5.4

View File

@@ -686,6 +686,7 @@ class SockoptStreamSettings extends XrayCommonClass {
} }
static fromJson(json = {}) { static fromJson(json = {}) {
if (Object.keys(json).length === 0) return undefined;
return new SockoptStreamSettings( return new SockoptStreamSettings(
json.acceptProxyProtocol, json.acceptProxyProtocol,
json.tcpFastOpen, json.tcpFastOpen,
@@ -1458,10 +1459,10 @@ class Inbound extends XrayCommonClass {
JSON.parse(this.settings).clients.forEach((client,index) => { JSON.parse(this.settings).clients.forEach((client,index) => {
if(this.tls && !ObjectUtil.isArrEmpty(this.stream.tls.settings.domains)){ if(this.tls && !ObjectUtil.isArrEmpty(this.stream.tls.settings.domains)){
this.stream.tls.settings.domains.forEach((domain) => { this.stream.tls.settings.domains.forEach((domain) => {
link += this.genLink(domain.domain, remark + '-' + client.email + '-' + domain.remark, index) + '\r\n'; link += this.genLink(domain.domain, [remark, client.email, domain.remark].filter(x => x.length > 0).join('-'), index) + '\r\n';
}); });
} else { } else {
link += this.genLink(address, remark + '-' + client.email, index) + '\r\n'; link += this.genLink(address, [remark, client.email].filter(x => x.length > 0).join('-'), index) + '\r\n';
} }
}); });
return link; return link;

View File

@@ -35,15 +35,16 @@
this.inbound = dbInbound.toInbound(); this.inbound = dbInbound.toInbound();
settings = JSON.parse(this.inbound.settings); settings = JSON.parse(this.inbound.settings);
this.client = settings.clients[clientIndex]; this.client = settings.clients[clientIndex];
remark = this.dbInbound.remark + ( this.client ? "-" + this.client.email : ''); remark = [this.dbInbound.remark, ( this.client ? this.client.email : '')].filter(Boolean).join('-');
address = this.dbInbound.address; address = this.dbInbound.address;
this.subId = ''; this.subId = '';
this.qrcodes = []; this.qrcodes = [];
if (this.inbound.tls && !ObjectUtil.isArrEmpty(this.inbound.stream.tls.settings.domains)) { if (this.inbound.tls && !ObjectUtil.isArrEmpty(this.inbound.stream.tls.settings.domains)) {
this.inbound.stream.tls.settings.domains.forEach((domain) => { this.inbound.stream.tls.settings.domains.forEach((domain) => {
remarkText = [remark, domain.remark].filter(Boolean).join('-');
this.qrcodes.push({ this.qrcodes.push({
remark: remark + "-" + domain.remark, remark: remarkText,
link: this.inbound.genLink(domain.domain, remark + "-" + domain.remark, clientIndex) link: this.inbound.genLink(domain.domain, remarkText, clientIndex)
}); });
}); });
} else { } else {

View File

@@ -1,5 +1,6 @@
{{define "form/sniffing"}} {{define "form/sniffing"}}
<a-form layout="inline"> <a-form layout="inline">
<a-divider dashed style="margin:0;">
<a-form-item> <a-form-item>
<span slot="label"> <span slot="label">
sniffing sniffing
@@ -12,6 +13,7 @@
</span> </span>
<a-switch v-model="inbound.sniffing.enabled"></a-switch> <a-switch v-model="inbound.sniffing.enabled"></a-switch>
</a-form-item> </a-form-item>
</a-divider>
<a-form-item> <a-form-item>
<a-checkbox-group v-model="inbound.sniffing.destOverride" v-if="inbound.sniffing.enabled"> <a-checkbox-group v-model="inbound.sniffing.destOverride" v-if="inbound.sniffing.enabled">
<a-checkbox v-for="key,value in SNIFFING_OPTION" :value="key">[[ value ]]</a-checkbox> <a-checkbox v-for="key,value in SNIFFING_OPTION" :value="key">[[ value ]]</a-checkbox>

View File

@@ -1,6 +1,7 @@
{{define "form/streamSettings"}} {{define "form/streamSettings"}}
<!-- select stream network --> <!-- select stream network -->
<a-form layout="inline"> <a-form layout="inline">
<a-divider dashed style="margin:0;">
<a-form-item label="{{ i18n "transmission" }}"> <a-form-item label="{{ i18n "transmission" }}">
<a-select v-model="inbound.stream.network" @change="streamNetworkChange" <a-select v-model="inbound.stream.network" @change="streamNetworkChange"
:dropdown-class-name="themeSwitcher.darkCardClass"> :dropdown-class-name="themeSwitcher.darkCardClass">
@@ -12,6 +13,7 @@
<a-select-option value="grpc">grpc</a-select-option> <a-select-option value="grpc">grpc</a-select-option>
</a-select> </a-select>
</a-form-item> </a-form-item>
</a-divider>
</a-form> </a-form>
<!-- tcp --> <!-- tcp -->

View File

@@ -1,8 +1,10 @@
{{define "form/streamSockopt"}} {{define "form/streamSockopt"}}
<a-form layout="inline"> <a-form layout="inline">
<a-divider dashed style="margin:0;">
<a-form-item label="Transparent Proxy"> <a-form-item label="Transparent Proxy">
<a-switch v-model="inbound.stream.sockoptSwitch"></a-switch> <a-switch v-model="inbound.stream.sockoptSwitch"></a-switch>
</a-form-item> </a-form-item>
</a-divider>
<table width="100%" class="ant-table-tbody" v-if="inbound.stream.sockoptSwitch"> <table width="100%" class="ant-table-tbody" v-if="inbound.stream.sockoptSwitch">
<tr> <tr>
<td>Accept Proxy Protocol</td> <td>Accept Proxy Protocol</td>

View File

@@ -1,6 +1,7 @@
{{define "form/tlsSettings"}} {{define "form/tlsSettings"}}
<!-- tls enable --> <!-- tls enable -->
<a-form v-if="inbound.canSetTls()" layout="inline"> <a-form v-if="inbound.canSetTls()" layout="inline">
<a-divider dashed style="margin:0;">
<a-form-item label="TLS"> <a-form-item label="TLS">
<a-switch v-model="inbound.tls"> <a-switch v-model="inbound.tls">
</a-switch> </a-switch>
@@ -8,6 +9,7 @@
<a-form-item v-if="inbound.canEnableReality()" label="Reality"> <a-form-item v-if="inbound.canEnableReality()" label="Reality">
<a-switch v-model="inbound.reality"></a-switch> <a-switch v-model="inbound.reality"></a-switch>
</a-form-item> </a-form-item>
</a-divider>
</a-form> </a-form>
<!-- tls settings --> <!-- tls settings -->

View File

@@ -260,14 +260,15 @@
this.clientSettings = this.settings.clients ? Object.values(this.settings.clients)[index] : null; this.clientSettings = this.settings.clients ? Object.values(this.settings.clients)[index] : null;
this.isExpired = this.inbound.isExpiry(index); this.isExpired = this.inbound.isExpiry(index);
this.clientStats = this.settings.clients ? this.dbInbound.clientStats.find(row => row.email === this.clientSettings.email) : []; this.clientStats = this.settings.clients ? this.dbInbound.clientStats.find(row => row.email === this.clientSettings.email) : [];
remark = this.dbInbound.remark + ( this.clientSettings ? "-" + this.clientSettings.email : ''); remark = [this.dbInbound.remark, ( this.clientSettings ? this.clientSettings.email : '')].filter(Boolean).join('-');
address = this.dbInbound.address; address = this.dbInbound.address;
this.links = []; this.links = [];
if (this.inbound.tls && !ObjectUtil.isArrEmpty(this.inbound.stream.tls.settings.domains)) { if (this.inbound.tls && !ObjectUtil.isArrEmpty(this.inbound.stream.tls.settings.domains)) {
this.inbound.stream.tls.settings.domains.forEach((domain) => { this.inbound.stream.tls.settings.domains.forEach((domain) => {
remarkText = [remark, domain.remark].filter(Boolean).join('-');
this.links.push({ this.links.push({
remark: remark + "-" + domain.remark, remark: remarkText,
link: this.inbound.genLink(domain.domain, remark + "-" + domain.remark, index) link: this.inbound.genLink(domain.domain, remarkText, index)
}); });
}); });
} else { } else {

View File

@@ -110,7 +110,7 @@
if (this.inModal.inbound.settings.shadowsockses.length ==0){ if (this.inModal.inbound.settings.shadowsockses.length ==0){
this.inModal.inbound.settings.shadowsockses = [new Inbound.ShadowsocksSettings.Shadowsocks()]; this.inModal.inbound.settings.shadowsockses = [new Inbound.ShadowsocksSettings.Shadowsocks()];
} }
if (["aes-128-gcm", "aes-256-gcm", "chacha20-poly1305", "xchacha20-poly1305"].includes(this.inModal.inbound.settings.method)) { if (!this.inModal.inbound.isSS2022) {
this.inModal.inbound.settings.shadowsockses.forEach(client => { this.inModal.inbound.settings.shadowsockses.forEach(client => {
client.method = this.inModal.inbound.settings.method; client.method = this.inModal.inbound.settings.method;
}) })