Skip to content

Commit

Permalink
Client: Comment
Browse files Browse the repository at this point in the history
now you can add Comment and write anything you want to remember
  • Loading branch information
MHSanaei committed Dec 27, 2024
1 parent 2ab1a17 commit 04c658f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions database/model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,6 @@ type Client struct {
Enable bool `json:"enable" form:"enable"`
TgID int64 `json:"tgId" form:"tgId"`
SubID string `json:"subId" form:"subId"`
Comment string `json:"comment" form:"comment"`
Reset int `json:"reset" form:"reset"`
}
14 changes: 14 additions & 0 deletions web/assets/js/model/inbound.js
Original file line number Diff line number Diff line change
Expand Up @@ -1778,6 +1778,7 @@ Inbound.VmessSettings.VMESS = class extends XrayCommonClass {
enable = true,
tgId = '',
subId = RandomUtil.randomLowerAndNum(16),
comment = '',
reset = 0
) {
super();
Expand All @@ -1790,6 +1791,7 @@ Inbound.VmessSettings.VMESS = class extends XrayCommonClass {
this.enable = enable;
this.tgId = tgId;
this.subId = subId;
this.comment = comment;
this.reset = reset;
}

Expand All @@ -1804,6 +1806,7 @@ Inbound.VmessSettings.VMESS = class extends XrayCommonClass {
json.enable,
json.tgId,
json.subId,
json.comment,
json.reset,
);
}
Expand Down Expand Up @@ -1884,6 +1887,7 @@ Inbound.VLESSSettings.VLESS = class extends XrayCommonClass {
enable = true,
tgId = '',
subId = RandomUtil.randomLowerAndNum(16),
comment = '',
reset = 0
) {
super();
Expand All @@ -1896,6 +1900,7 @@ Inbound.VLESSSettings.VLESS = class extends XrayCommonClass {
this.enable = enable;
this.tgId = tgId;
this.subId = subId;
this.comment = comment;
this.reset = reset;
}

Expand All @@ -1910,6 +1915,7 @@ Inbound.VLESSSettings.VLESS = class extends XrayCommonClass {
json.enable,
json.tgId,
json.subId,
json.comment,
json.reset,
);
}
Expand Down Expand Up @@ -2020,6 +2026,7 @@ Inbound.TrojanSettings.Trojan = class extends XrayCommonClass {
enable = true,
tgId = '',
subId = RandomUtil.randomLowerAndNum(16),
comment = '',
reset = 0
) {
super();
Expand All @@ -2031,6 +2038,7 @@ Inbound.TrojanSettings.Trojan = class extends XrayCommonClass {
this.enable = enable;
this.tgId = tgId;
this.subId = subId;
this.comment = comment;
this.reset = reset;
}

Expand All @@ -2044,6 +2052,7 @@ Inbound.TrojanSettings.Trojan = class extends XrayCommonClass {
enable: this.enable,
tgId: this.tgId,
subId: this.subId,
comment: this.comment,
reset: this.reset,
};
}
Expand All @@ -2058,6 +2067,7 @@ Inbound.TrojanSettings.Trojan = class extends XrayCommonClass {
json.enable,
json.tgId,
json.subId,
json.comment,
json.reset,
);
}
Expand Down Expand Up @@ -2177,6 +2187,7 @@ Inbound.ShadowsocksSettings.Shadowsocks = class extends XrayCommonClass {
enable = true,
tgId = '',
subId = RandomUtil.randomLowerAndNum(16),
comment = '',
reset = 0
) {
super();
Expand All @@ -2189,6 +2200,7 @@ Inbound.ShadowsocksSettings.Shadowsocks = class extends XrayCommonClass {
this.enable = enable;
this.tgId = tgId;
this.subId = subId;
this.comment = comment;
this.reset = reset;
}

Expand All @@ -2203,6 +2215,7 @@ Inbound.ShadowsocksSettings.Shadowsocks = class extends XrayCommonClass {
enable: this.enable,
tgId: this.tgId,
subId: this.subId,
comment: this.comment,
reset: this.reset,
};
}
Expand All @@ -2218,6 +2231,7 @@ Inbound.ShadowsocksSettings.Shadowsocks = class extends XrayCommonClass {
json.enable,
json.tgId,
json.subId,
json.comment,
json.reset,
);
}
Expand Down
3 changes: 3 additions & 0 deletions web/html/xui/form/client.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@
</template>
<a-input-number style="width: 50%" v-model="client.tgId" min="0"></a-input-number>
</a-form-item>
<a-form-item v-if="client.email" label='Comment'>
<a-input v-model.trim="client.comment"></a-input>
</a-form-item>
<a-form-item v-if="app.ipLimitEnable">
<template slot="label">
<a-tooltip>
Expand Down
8 changes: 8 additions & 0 deletions web/html/xui/inbound_info_modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,14 @@
<a-tag>↑ [[ sizeFormat(infoModal.clientStats.up) ]] / [[ sizeFormat(infoModal.clientStats.down) ]] ↓</a-tag>
</td>
</tr>
<tr v-if="infoModal.clientSettings.comment">
<td>Comment</td>
<td>
<a-tooltip :title="[[ infoModal.clientSettings.comment ]]">
<a-tag class="info-large-tag">[[ infoModal.clientSettings.comment ]]</a-tag>
</a-tooltip>
</td>
</tr>
<tr v-if="app.ipLimitEnable">
<td>{{ i18n "pages.inbounds.IPLimit" }}</td>
<td>
Expand Down

1 comment on commit 04c658f

@mohsenrahmani145
Copy link

@mohsenrahmani145 mohsenrahmani145 commented on 04c658f Dec 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

سلام وقت بخیر
برای کامنت نوشتن از طریق API هم امکانش هست؟
اگه امکانش هست با چه سمپلی باید درخواست ارسال بشه داخل داکیومنت API نبود چک کردم

curl --location 'http://localhost:2053/panel/api/inbounds/addClient' \
--header 'Accept: application/json' \
--data '{
	"id": 5,
	"settings": "{\"clients\": [{\"id\": \"bbfad557-28f2-47e5-9f3d-e3c7f532fbda\",\"flow\": \"\",\"email\": \"dp1plmlt8\",\"limitIp\": 0,\"totalGB\": 0,\"expiryTime\": 0,\"enable\": true,\"tgId\": \"\",\"subId\": \"2rv0gb458kbfl532\",\"reset\": 0}]}"
}'

Please sign in to comment.