Skip to content

Commit

Permalink
fix outbound socks/http
Browse files Browse the repository at this point in the history
Co-Authored-By: Alireza Ahmadi <alireza7@gmail.com>
  • Loading branch information
MHSanaei and alireza0 committed Dec 23, 2023
1 parent 9261f9c commit 4f3b931
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
16 changes: 8 additions & 8 deletions web/assets/js/model/outbound.js
Original file line number Diff line number Diff line change
Expand Up @@ -839,12 +839,12 @@ Outbound.ShadowsocksSettings = class extends CommonClass {
}
};
Outbound.SocksSettings = class extends CommonClass {
constructor(address, port, user, password) {
constructor(address, port, user, pass) {
super();
this.address = address;
this.port = port;
this.user = user;
this.password = password;
this.pass = pass;
}

static fromJson(json={}) {
Expand All @@ -854,7 +854,7 @@ Outbound.SocksSettings = class extends CommonClass {
servers[0].address,
servers[0].port,
ObjectUtil.isArrEmpty(servers[0].users) ? '' : servers[0].users[0].user,
ObjectUtil.isArrEmpty(servers[0].password) ? '' : servers[0].users[0].password,
ObjectUtil.isArrEmpty(servers[0].pass) ? '' : servers[0].users[0].pass,
);
}

Expand All @@ -863,18 +863,18 @@ Outbound.SocksSettings = class extends CommonClass {
servers: [{
address: this.address,
port: this.port,
users: ObjectUtil.isEmpty(this.user) ? [] : [{user: this.user, password: this.password}],
users: ObjectUtil.isEmpty(this.user) ? [] : [{user: this.user, pass: this.pass}],
}],
};
}
};
Outbound.HttpSettings = class extends CommonClass {
constructor(address, port, user, password) {
constructor(address, port, user, pass) {
super();
this.address = address;
this.port = port;
this.user = user;
this.password = password;
this.pass = pass;
}

static fromJson(json={}) {
Expand All @@ -884,7 +884,7 @@ Outbound.HttpSettings = class extends CommonClass {
servers[0].address,
servers[0].port,
ObjectUtil.isArrEmpty(servers[0].users) ? '' : servers[0].users[0].user,
ObjectUtil.isArrEmpty(servers[0].password) ? '' : servers[0].users[0].password,
ObjectUtil.isArrEmpty(servers[0].pass) ? '' : servers[0].users[0].pass,
);
}

Expand All @@ -893,7 +893,7 @@ Outbound.HttpSettings = class extends CommonClass {
servers: [{
address: this.address,
port: this.port,
users: ObjectUtil.isEmpty(this.user) ? [] : [{user: this.user, password: this.password}],
users: ObjectUtil.isEmpty(this.user) ? [] : [{user: this.user, pass: this.pass}],
}],
};
}
Expand Down
3 changes: 2 additions & 1 deletion web/html/xui/form/outbound.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,13 @@

<!-- Servers (trojan/shadowsocks/socks/http) settings -->
<template v-if="outbound.hasServers()">
<!-- http / socks -->
<template v-if="outbound.hasUsername()">
<a-form-item label='{{ i18n "username" }}'>
<a-input v-model.trim="outbound.settings.user"></a-input>
</a-form-item>
<a-form-item label='{{ i18n "password" }}'>
<a-input v-model.trim="outbound.settings.password"></a-input>
<a-input v-model.trim="outbound.settings.pass"></a-input>
</a-form-item>
</template>
<!-- shadowsocks -->
Expand Down

0 comments on commit 4f3b931

Please sign in to comment.