diff options
| author | MHSanaei <ho3ein.sanaei@gmail.com> | 2023-03-17 19:07:49 +0300 |
|---|---|---|
| committer | MHSanaei <ho3ein.sanaei@gmail.com> | 2023-03-17 19:07:49 +0300 |
| commit | 96786c94189f3d2f3f04c1915529c786228bdf42 (patch) | |
| tree | 879085e09a3cd485f3246f46be907fe77eb84a1a /web/html/xui/client_bulk_modal.html | |
| parent | bc56e637376142c370c31b17558fc3778a863bd2 (diff) | |
alireza
Diffstat (limited to 'web/html/xui/client_bulk_modal.html')
| -rw-r--r-- | web/html/xui/client_bulk_modal.html | 160 |
1 files changed, 160 insertions, 0 deletions
diff --git a/web/html/xui/client_bulk_modal.html b/web/html/xui/client_bulk_modal.html new file mode 100644 index 00000000..19fd4b18 --- /dev/null +++ b/web/html/xui/client_bulk_modal.html @@ -0,0 +1,160 @@ +{{define "clientsBulkModal"}} +<a-modal id="client-bulk-modal" v-model="clientsBulkModal.visible" :title="clientsBulkModal.title" @ok="clientsBulkModal.ok" + :confirm-loading="clientsBulkModal.confirmLoading" :closable="true" :mask-closable="false" + :class="siderDrawer.isDarkTheme ? darkClass : ''" + :ok-text="clientsBulkModal.okText" cancel-text='{{ i18n "close" }}'> + <a-form layout="inline"> + <a-form-item label='{{ i18n "pages.client.method" }}'> + <a-select v-model="clientsBulkModal.emailMethod" buttonStyle="solid" style="width: 350px" :dropdown-class-name="siderDrawer.isDarkTheme ? 'ant-card-dark' : ''"> + <a-select-option :value="0">Random</a-select-option> + <a-select-option :value="1">Random_Prefix</a-select-option> + <a-select-option :value="2">Random_Prefix+Num</a-select-option> + <a-select-option :value="3">Random_Prefix+Num+Postfix</a-select-option> + <a-select-option :value="4">Random_Prefix+Num@Telegram Username</a-select-option> + </a-select> + </a-form-item><br /> + <a-form-item v-if="clientsBulkModal.emailMethod>1"> + <span slot="label">{{ i18n "pages.client.first" }}</span> + <a-input-number v-model="clientsBulkModal.firstNum" :min="1"></a-input-number> + </a-form-item> + <a-form-item v-if="clientsBulkModal.emailMethod>1"> + <span slot="label">{{ i18n "pages.client.last" }}</span> + <a-input-number v-model="clientsBulkModal.lastNum" :min="clientsBulkModal.firstNum"></a-input-number> + </a-form-item> + <a-form-item v-if="clientsBulkModal.emailMethod>0"> + <span slot="label">{{ i18n "pages.client.prefix" }}</span> + <a-input v-model="clientsBulkModal.emailPrefix" style="width: 120px"></a-input> + </a-form-item> + <a-form-item v-if="clientsBulkModal.emailMethod>2"> + <span slot="label" v-if="clientsBulkModal.emailMethod == 4">tg_uname</span> + <span slot="label" v-else>{{ i18n "pages.client.postfix" }}</span> + <a-input v-model="clientsBulkModal.emailPostfix" style="width: 120px"></a-input> + </a-form-item> + + <a-form-item v-if="clientsBulkModal.emailMethod < 2"> + <span slot="label">{{ i18n "pages.client.clientCount" }}</span> + <a-input-number v-model="clientsBulkModal.quantity" :min="1" :max="100"></a-input-number> + </a-form-item> + <a-form-item> + <span slot="label"> + <span >{{ i18n "pages.inbounds.totalFlow" }}</span>(GB) + <a-tooltip> + <template slot="title"> + 0 <span>{{ i18n "pages.inbounds.meansNoLimit" }}</span> + </template> + <a-icon type="question-circle" theme="filled"></a-icon> + </a-tooltip> + </span> + <a-input-number v-model="clientsBulkModal.totalGB" :min="0"></a-input-number> + </a-form-item> + <a-form-item> + <span slot="label"> + <span >{{ i18n "pages.inbounds.expireDate" }}</span> + <a-tooltip> + <template slot="title"> + <span>{{ i18n "pages.inbounds.leaveBlankToNeverExpire" }}</span> + </template> + <a-icon type="question-circle" theme="filled"></a-icon> + </a-tooltip> + </span> + <a-date-picker :show-time="{ format: 'HH:mm' }" format="YYYY-MM-DD HH:mm" + :dropdown-class-name="siderDrawer.isDarkTheme ? 'ant-card-dark' : ''" + v-model="clientsBulkModal.expiryTime" style="width: 300px;"></a-date-picker> + </a-form-item> + </a-form> +</a-modal> +<script> + + const clientsBulkModal = { + visible: false, + confirmLoading: false, + title: '', + okText: '', + confirm: null, + dbInbound: new DBInbound(), + inbound: new Inbound(), + clients: [], + quantity: 1, + totalGB: 0, + expiryTime: '', + emailMethod: 0, + firstNum: 1, + lastNum: 1, + emailPrefix: "", + emailPostfix: "", + ok() { + method=clientsBulkModal.emailMethod; + if(method>1){ + start=clientsBulkModal.firstNum; + end=clientsBulkModal.lastNum + 1; + } else { + start=0; + end=clientsBulkModal.quantity; + } + prefix = (method>0 && clientsBulkModal.emailPrefix.length>0) ? "_" + clientsBulkModal.emailPrefix : ""; + useNum=(method>1); + postfix = (method>2 && clientsBulkModal.emailPostfix.length>0) ? (method == 4 ? "@" : "") + clientsBulkModal.emailPostfix : ""; + for (let i = start; i < end; i++) { + newClient = clientsBulkModal.newClient(clientsBulkModal.dbInbound.protocol); + newClient.email += useNum ? prefix + i.toString() + postfix : prefix + postfix; + newClient._totalGB = clientsBulkModal.totalGB; + newClient._expiryTime = clientsBulkModal.expiryTime; + clientsBulkModal.clients.push(newClient); + } + ObjectUtil.execute(clientsBulkModal.confirm, clientsBulkModal.inbound, clientsBulkModal.dbInbound); + }, + show({ title='', okText='{{ i18n "sure" }}', dbInbound=null, confirm=(inbound, dbInbound)=>{} }) { + this.visible = true; + this.title = title; + this.okText = okText; + this.confirm = confirm; + this.quantity = 1; + this.totalGB = 0; + this.expiryTime = ''; + this.emailMethod= 0; + this.firstNum= 1; + this.lastNum= 1; + this.emailPrefix= ""; + this.emailPostfix= ""; + + this.dbInbound = new DBInbound(dbInbound); + this.inbound = dbInbound.toInbound(); + this.clients = this.getClients(this.inbound.protocol, this.inbound.settings); + }, + getClients(protocol, clientSettings) { + switch(protocol){ + case Protocols.VMESS: return clientSettings.vmesses; + case Protocols.VLESS: return clientSettings.vlesses; + case Protocols.TROJAN: return clientSettings.trojans; + default: return null; + } + }, + newClient(protocol) { + switch (protocol) { + case Protocols.VMESS: return new Inbound.VmessSettings.Vmess(); + case Protocols.VLESS: return new Inbound.VLESSSettings.VLESS(); + case Protocols.TROJAN: return new Inbound.TrojanSettings.Trojan(); + default: return null; + } + }, + close() { + clientsBulkModal.visible = false; + clientsBulkModal.loading(false); + }, + loading(loading) { + clientsBulkModal.confirmLoading = loading; + }, + }; + + const clientsBulkModalApp = new Vue({ + delimiters: ['[[', ']]'], + el: '#client-bulk-modal', + data: { + clientsBulkModal, + get inbound() { + return this.clientsBulkModal.inbound; + }, + }, + }); +</script> +{{end}}
\ No newline at end of file |
