| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  | <!DOCTYPE html> | 
					
						
							|  |  |  | <html lang="en"> | 
					
						
							|  |  |  | {{template "head" .}} | 
					
						
							|  |  |  | <style> | 
					
						
							|  |  |  |     @media (min-width: 769px) { | 
					
						
							|  |  |  |         .ant-layout-content { | 
					
						
							|  |  |  |             margin: 24px 16px; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     .ant-col-sm-24 { | 
					
						
							|  |  |  |         margin-top: 10px; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-08-08 21:28:53 +00:00
										 |  |  |     tr.hideExpandIcon .ant-table-row-expand-icon { | 
					
						
							|  |  |  |         display: none; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  | </style> | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  | <body> | 
					
						
							|  |  |  | <a-layout id="app" v-cloak> | 
					
						
							|  |  |  |     {{ template "commonSider" . }} | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |     <a-layout id="content-layout" :style="themeSwitcher.bgStyle"> | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |         <a-layout-content> | 
					
						
							|  |  |  |             <a-spin :spinning="spinning" :delay="500" tip="loading"> | 
					
						
							|  |  |  |                 <transition name="list" appear> | 
					
						
							|  |  |  |                     <a-tag v-if="false" color="red" style="margin-bottom: 10px"> | 
					
						
							|  |  |  |                         Please go to the panel settings as soon as possible to modify the username and password, otherwise there may be a risk of leaking account information | 
					
						
							|  |  |  |                     </a-tag> | 
					
						
							|  |  |  |                 </transition> | 
					
						
							|  |  |  |                 <transition name="list" appear> | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |                     <a-card hoverable style="margin-bottom: 20px;" :class="themeSwitcher.darkCardClass"> | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                         <a-row> | 
					
						
							|  |  |  |                             <a-col :xs="24" :sm="24" :lg="12"> | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |                                 {{ i18n "pages.inbounds.totalDownUp" }}: | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                                 <a-tag color="green">[[ sizeFormat(total.up) ]] / [[ sizeFormat(total.down) ]]</a-tag> | 
					
						
							|  |  |  |                             </a-col> | 
					
						
							|  |  |  |                             <a-col :xs="24" :sm="24" :lg="12"> | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |                                 {{ i18n "pages.inbounds.totalUsage" }}: | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                                 <a-tag color="green">[[ sizeFormat(total.up + total.down) ]]</a-tag> | 
					
						
							|  |  |  |                             </a-col> | 
					
						
							|  |  |  |                             <a-col :xs="24" :sm="24" :lg="12"> | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |                                 {{ i18n "pages.inbounds.inboundCount" }}: | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                                 <a-tag color="green">[[ dbInbounds.length ]]</a-tag> | 
					
						
							|  |  |  |                             </a-col> | 
					
						
							| 
									
										
										
										
											2023-03-16 22:01:14 +00:00
										 |  |  |                             <a-col :xs="24" :sm="24" :lg="12"> | 
					
						
							|  |  |  |                                 {{ i18n "clients" }}: | 
					
						
							|  |  |  |                                 <a-tag color="green">[[ total.clients ]]</a-tag> | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |                                 <a-popover title='{{ i18n "disabled" }}' :overlay-class-name="themeSwitcher.darkClass"> | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |                                     <template slot="content"> | 
					
						
							|  |  |  |                                         <p v-for="clientEmail in total.deactive">[[ clientEmail ]]</p> | 
					
						
							|  |  |  |                                     </template> | 
					
						
							|  |  |  |                                     <a-tag v-if="total.deactive.length">[[ total.deactive.length ]]</a-tag> | 
					
						
							|  |  |  |                                 </a-popover> | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |                                 <a-popover title='{{ i18n "depleted" }}' :overlay-class-name="themeSwitcher.darkClass"> | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |                                     <template slot="content"> | 
					
						
							|  |  |  |                                         <p v-for="clientEmail in total.depleted">[[ clientEmail ]]</p> | 
					
						
							|  |  |  |                                     </template> | 
					
						
							|  |  |  |                                     <a-tag color="red" v-if="total.depleted.length">[[ total.depleted.length ]]</a-tag> | 
					
						
							|  |  |  |                                 </a-popover> | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |                                 <a-popover title='{{ i18n "depletingSoon" }}' :overlay-class-name="themeSwitcher.darkClass"> | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |                                     <template slot="content"> | 
					
						
							|  |  |  |                                         <p v-for="clientEmail in total.expiring">[[ clientEmail ]]</p> | 
					
						
							|  |  |  |                                     </template> | 
					
						
							|  |  |  |                                     <a-tag color="orange" v-if="total.expiring.length">[[ total.expiring.length ]]</a-tag> | 
					
						
							|  |  |  |                                 </a-popover> | 
					
						
							| 
									
										
										
										
											2023-03-16 22:01:14 +00:00
										 |  |  |                             </a-col> | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                         </a-row> | 
					
						
							|  |  |  |                     </a-card> | 
					
						
							|  |  |  |                 </transition> | 
					
						
							|  |  |  |                 <transition name="list" appear> | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |                     <a-card hoverable :class="themeSwitcher.darkCardClass"> | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                         <div slot="title"> | 
					
						
							| 
									
										
										
										
											2023-04-29 19:03:45 +00:00
										 |  |  |                             <a-row> | 
					
						
							|  |  |  |                                 <a-col :xs="24" :sm="24" :lg="12"> | 
					
						
							|  |  |  |                                     <a-button type="primary" icon="plus" @click="openAddInbound">{{ i18n "pages.inbounds.addInbound" }}</a-button> | 
					
						
							|  |  |  |                                     <a-dropdown :trigger="['click']"> | 
					
						
							|  |  |  |                                         <a-button type="primary" icon="menu">{{ i18n "pages.inbounds.generalActions" }}</a-button> | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |                                         <a-menu slot="overlay" @click="a => generalActions(a)" :theme="themeSwitcher.currentTheme"> | 
					
						
							| 
									
										
										
										
											2023-04-29 19:03:45 +00:00
										 |  |  |                                             <a-menu-item key="export"> | 
					
						
							|  |  |  |                                                 <a-icon type="export"></a-icon> | 
					
						
							|  |  |  |                                                 {{ i18n "pages.inbounds.export" }} | 
					
						
							|  |  |  |                                             </a-menu-item> | 
					
						
							|  |  |  |                                             <a-menu-item key="resetInbounds"> | 
					
						
							|  |  |  |                                                 <a-icon type="reload"></a-icon> | 
					
						
							|  |  |  |                                                 {{ i18n "pages.inbounds.resetAllTraffic" }} | 
					
						
							|  |  |  |                                             </a-menu-item> | 
					
						
							|  |  |  |                                             <a-menu-item key="resetClients"> | 
					
						
							|  |  |  |                                                 <a-icon type="file-done"></a-icon> | 
					
						
							|  |  |  |                                                 {{ i18n "pages.inbounds.resetAllClientTraffics" }} | 
					
						
							|  |  |  |                                             </a-menu-item> | 
					
						
							|  |  |  |                                             <a-menu-item key="delDepletedClients"> | 
					
						
							|  |  |  |                                                 <a-icon type="rest"></a-icon> | 
					
						
							|  |  |  |                                                 {{ i18n "pages.inbounds.delDepletedClients" }} | 
					
						
							|  |  |  |                                             </a-menu-item> | 
					
						
							|  |  |  |                                         </a-menu> | 
					
						
							|  |  |  |                                     </a-dropdown> | 
					
						
							|  |  |  |                                 </a-col> | 
					
						
							|  |  |  |                                 <a-col :xs="24" :sm="24" :lg="12" style="text-align: right;"> | 
					
						
							|  |  |  |                                     <a-select v-model="refreshInterval" | 
					
						
							| 
									
										
										
										
											2023-05-04 17:52:54 +00:00
										 |  |  |                                               style="width: 65px;" | 
					
						
							| 
									
										
										
										
											2023-04-29 19:03:45 +00:00
										 |  |  |                                               v-if="isRefreshEnabled" | 
					
						
							|  |  |  |                                               @change="changeRefreshInterval" | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |                                               :dropdown-class-name="themeSwitcher.darkCardClass"> | 
					
						
							| 
									
										
										
										
											2023-04-29 19:03:45 +00:00
										 |  |  |                                         <a-select-option v-for="key in [5,10,30,60]" :value="key*1000">[[ key ]]s</a-select-option> | 
					
						
							|  |  |  |                                     </a-select> | 
					
						
							| 
									
										
										
										
											2023-05-06 15:50:42 +00:00
										 |  |  |                                     <a-icon type="sync" :spin="refreshing" @click="manualRefresh" style="margin: 0 5px;"></a-icon> | 
					
						
							| 
									
										
										
										
											2023-04-29 19:03:45 +00:00
										 |  |  |                                     <a-switch v-model="isRefreshEnabled" @change="toggleRefresh"></a-switch> | 
					
						
							|  |  |  |                                 </a-col> | 
					
						
							|  |  |  |                             </a-row> | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                         </div> | 
					
						
							| 
									
										
										
										
											2023-05-20 14:27:10 +00:00
										 |  |  |                         <a-switch v-model="enableFilter" | 
					
						
							|  |  |  |                             checked-children='{{ i18n "search" }}' un-checked-children='{{ i18n "filter" }}' | 
					
						
							|  |  |  |                             @change="toggleFilter" style="margin-right: 10px;"> | 
					
						
							|  |  |  |                         </a-switch> | 
					
						
							| 
									
										
										
										
											2023-05-17 12:27:47 +00:00
										 |  |  |                         <a-input v-if="!enableFilter" v-model.lazy="searchKey" placeholder='{{ i18n "search" }}' autofocus style="max-width: 300px"></a-input> | 
					
						
							|  |  |  |                         <a-radio-group v-if="enableFilter" v-model="filterBy" @change="filterInbounds" button-style="solid"> | 
					
						
							|  |  |  |                             <a-radio-button value="">{{ i18n "none" }}</a-radio-button> | 
					
						
							|  |  |  |                             <a-radio-button value="deactive">{{ i18n "disabled" }}</a-radio-button> | 
					
						
							|  |  |  |                             <a-radio-button value="depleted">{{ i18n "depleted" }}</a-radio-button> | 
					
						
							|  |  |  |                             <a-radio-button value="expiring">{{ i18n "depletingSoon" }}</a-radio-button> | 
					
						
							|  |  |  |                         </a-radio-group> | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                         <a-table :columns="columns" :row-key="dbInbound => dbInbound.id" | 
					
						
							| 
									
										
										
										
											2023-02-12 13:50:09 +00:00
										 |  |  |                                  :data-source="searchedInbounds" | 
					
						
							| 
									
										
										
										
											2023-08-08 21:28:53 +00:00
										 |  |  |                                  :loading="spinning" :scroll="{ x: 1200 }" | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                                  :pagination="false" | 
					
						
							| 
									
										
										
										
											2023-08-08 21:28:53 +00:00
										 |  |  |                                  :expand-icon-as-cell="false" | 
					
						
							|  |  |  |                                  :expand-row-by-click="false" | 
					
						
							|  |  |  |                                  :expand-icon-column-index="0" | 
					
						
							|  |  |  |                                  :row-class-name="dbInbound => (dbInbound.isTrojan || dbInbound.isVLess || dbInbound.isVMess || (dbInbound.isSS && dbInbound.toInbound().isSSMultiUser) ? '' : 'hideExpandIcon')" | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                                  style="margin-top: 20px" | 
					
						
							|  |  |  |                                  @change="() => getDBInbounds()"> | 
					
						
							|  |  |  |                             <template slot="action" slot-scope="text, dbInbound"> | 
					
						
							| 
									
										
										
										
											2023-04-25 13:53:38 +00:00
										 |  |  |                                 <a-icon type="edit" style="font-size: 22px" @click="openEditInbound(dbInbound.id);"></a-icon> | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                                 <a-dropdown :trigger="['click']"> | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |                                     <a @click="e => e.preventDefault()">{{ i18n "pages.inbounds.operate" }}</a> | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |                                     <a-menu slot="overlay" @click="a => clickAction(a, dbInbound)" :theme="themeSwitcher.currentTheme"> | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                                         <a-menu-item key="edit"> | 
					
						
							|  |  |  |                                             <a-icon type="edit"></a-icon> | 
					
						
							|  |  |  |                                             {{ i18n "edit" }} | 
					
						
							|  |  |  |                                         </a-menu-item> | 
					
						
							| 
									
										
										
										
											2023-07-17 23:49:01 +00:00
										 |  |  |                                         <a-menu-item key="qrcode" v-if="dbInbound.isSS && !dbInbound.toInbound().isSSMultiUser"> | 
					
						
							|  |  |  |                                             <a-icon type="qrcode"></a-icon> | 
					
						
							|  |  |  |                                             {{ i18n "qrCode" }} | 
					
						
							|  |  |  |                                         </a-menu-item> | 
					
						
							| 
									
										
										
										
											2023-08-08 21:28:53 +00:00
										 |  |  |                                         <template v-if="dbInbound.isTrojan || dbInbound.isVLess || dbInbound.isVMess || (dbInbound.isSS && dbInbound.toInbound().isSSMultiUser)"> | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |                                             <a-menu-item key="addClient"> | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |                                                 <a-icon type="user-add"></a-icon> | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |                                                 {{ i18n "pages.client.add"}} | 
					
						
							|  |  |  |                                             </a-menu-item> | 
					
						
							|  |  |  |                                             <a-menu-item key="addBulkClient"> | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |                                                 <a-icon type="usergroup-add"></a-icon> | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |                                                 {{ i18n "pages.client.bulk"}} | 
					
						
							|  |  |  |                                             </a-menu-item> | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |                                             <a-menu-item key="resetClients"> | 
					
						
							|  |  |  |                                                 <a-icon type="file-done"></a-icon> | 
					
						
							| 
									
										
										
										
											2023-04-25 13:53:38 +00:00
										 |  |  |                                                 {{ i18n "pages.inbounds.resetInboundClientTraffics"}} | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |                                             </a-menu-item> | 
					
						
							| 
									
										
										
										
											2023-03-16 22:01:14 +00:00
										 |  |  |                                             <a-menu-item key="export"> | 
					
						
							|  |  |  |                                                 <a-icon type="export"></a-icon> | 
					
						
							|  |  |  |                                                 {{ i18n "pages.inbounds.export"}} | 
					
						
							|  |  |  |                                             </a-menu-item> | 
					
						
							| 
									
										
										
										
											2023-04-25 15:13:37 +00:00
										 |  |  |                                             <a-menu-item key="delDepletedClients"> | 
					
						
							|  |  |  |                                                 <a-icon type="rest"></a-icon> | 
					
						
							|  |  |  |                                                 {{ i18n "pages.inbounds.delDepletedClients" }} | 
					
						
							|  |  |  |                                             </a-menu-item> | 
					
						
							| 
									
										
										
										
											2023-03-16 22:01:14 +00:00
										 |  |  |                                         </template> | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |                                         <template v-else> | 
					
						
							|  |  |  |                                             <a-menu-item key="showInfo"> | 
					
						
							|  |  |  |                                                 <a-icon type="info-circle"></a-icon> | 
					
						
							|  |  |  |                                                 {{ i18n "info"}} | 
					
						
							|  |  |  |                                             </a-menu-item> | 
					
						
							|  |  |  |                                         </template> | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                                         <a-menu-item key="resetTraffic"> | 
					
						
							|  |  |  |                                             <a-icon type="retweet"></a-icon> {{ i18n "pages.inbounds.resetTraffic" }} | 
					
						
							| 
									
										
										
										
											2023-03-27 16:41:28 +00:00
										 |  |  |                                         </a-menu-item> | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |                                         <a-menu-item key="clone"> | 
					
						
							| 
									
										
										
										
											2023-05-04 17:52:54 +00:00
										 |  |  |                                             <a-icon type="block"></a-icon> {{ i18n "pages.inbounds.clone"}} | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                                         </a-menu-item> | 
					
						
							|  |  |  |                                         <a-menu-item key="delete"> | 
					
						
							|  |  |  |                                             <span style="color: #FF4D4F"> | 
					
						
							|  |  |  |                                                 <a-icon type="delete"></a-icon> {{ i18n "delete"}} | 
					
						
							|  |  |  |                                             </span> | 
					
						
							|  |  |  |                                         </a-menu-item> | 
					
						
							|  |  |  |                                     </a-menu> | 
					
						
							|  |  |  |                                 </a-dropdown> | 
					
						
							|  |  |  |                             </template> | 
					
						
							|  |  |  |                             <template slot="protocol" slot-scope="text, dbInbound"> | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |                                 <a-tag style="margin:0;" color="blue">[[ dbInbound.protocol ]]</a-tag> | 
					
						
							| 
									
										
										
										
											2023-05-22 18:22:35 +00:00
										 |  |  |                                 <template v-if="dbInbound.isVMess || dbInbound.isVLess || dbInbound.isTrojan || dbInbound.isSS"> | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |                                     <a-tag style="margin:0;" color="green">[[ dbInbound.toInbound().stream.network ]]</a-tag> | 
					
						
							|  |  |  |                                     <a-tag style="margin:0;" v-if="dbInbound.toInbound().stream.isTls" color="cyan">TLS</a-tag> | 
					
						
							| 
									
										
										
										
											2023-04-18 18:04:06 +00:00
										 |  |  |                                     <a-tag style="margin:0;" v-if="dbInbound.toInbound().stream.isXtls" color="cyan">XTLS</a-tag> | 
					
						
							| 
									
										
										
										
											2023-04-10 16:28:52 +00:00
										 |  |  |                                     <a-tag style="margin:0;" v-if="dbInbound.toInbound().stream.isReality" color="cyan">Reality</a-tag> | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |                                 </template> | 
					
						
							|  |  |  |                             </template> | 
					
						
							|  |  |  |                             <template slot="clients" slot-scope="text, dbInbound"> | 
					
						
							|  |  |  |                                 <template v-if="clientCount[dbInbound.id]"> | 
					
						
							|  |  |  |                                     <a-tag style="margin:0;" color="green">[[ clientCount[dbInbound.id].clients ]]</a-tag> | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |                                     <a-popover title='{{ i18n "disabled" }}' :overlay-class-name="themeSwitcher.darkClass"> | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |                                         <template slot="content"> | 
					
						
							|  |  |  |                                             <p v-for="clientEmail in clientCount[dbInbound.id].deactive">[[ clientEmail ]]</p> | 
					
						
							|  |  |  |                                         </template> | 
					
						
							|  |  |  |                                         <a-tag style="margin:0; padding: 0 2px;" v-if="clientCount[dbInbound.id].deactive.length">[[ clientCount[dbInbound.id].deactive.length ]]</a-tag> | 
					
						
							|  |  |  |                                     </a-popover> | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |                                     <a-popover title='{{ i18n "depleted" }}' :overlay-class-name="themeSwitcher.darkClass"> | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |                                         <template slot="content"> | 
					
						
							|  |  |  |                                             <p v-for="clientEmail in clientCount[dbInbound.id].depleted">[[ clientEmail ]]</p> | 
					
						
							|  |  |  |                                         </template> | 
					
						
							|  |  |  |                                         <a-tag style="margin:0; padding: 0 2px;" color="red" v-if="clientCount[dbInbound.id].depleted.length">[[ clientCount[dbInbound.id].depleted.length ]]</a-tag> | 
					
						
							|  |  |  |                                     </a-popover> | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |                                     <a-popover title='{{ i18n "depletingSoon" }}' :overlay-class-name="themeSwitcher.darkClass"> | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |                                         <template slot="content"> | 
					
						
							|  |  |  |                                             <p v-for="clientEmail in clientCount[dbInbound.id].expiring">[[ clientEmail ]]</p> | 
					
						
							|  |  |  |                                         </template> | 
					
						
							|  |  |  |                                         <a-tag style="margin:0; padding: 0 2px;" color="orange" v-if="clientCount[dbInbound.id].expiring.length">[[ clientCount[dbInbound.id].expiring.length ]]</a-tag> | 
					
						
							|  |  |  |                                     </a-popover> | 
					
						
							|  |  |  |                                 </template> | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                             </template> | 
					
						
							|  |  |  |                             <template slot="traffic" slot-scope="text, dbInbound"> | 
					
						
							| 
									
										
										
										
											2023-06-21 10:51:34 +00:00
										 |  |  |                                 <a-popover :overlay-class-name="themeSwitcher.darkClass"> | 
					
						
							|  |  |  |                                     <template slot="content"> | 
					
						
							|  |  |  |                                         <table cellpadding="2" width="100%"> | 
					
						
							|  |  |  |                                             <tr> | 
					
						
							|  |  |  |                                                 <td>↑[[ sizeFormat(dbInbound.up) ]]</td> | 
					
						
							|  |  |  |                                                 <td>↓[[ sizeFormat(dbInbound.down) ]]</td> | 
					
						
							|  |  |  |                                             </tr> | 
					
						
							|  |  |  |                                             <tr v-if="dbInbound.total > 0 &&  dbInbound.up + dbInbound.down < dbInbound.total"> | 
					
						
							|  |  |  |                                                 <td>{{ i18n "remained" }}</td> | 
					
						
							|  |  |  |                                                 <td>[[ sizeFormat(dbInbound.total - dbInbound.up - dbInbound.down) ]]</td> | 
					
						
							|  |  |  |                                             </tr> | 
					
						
							|  |  |  |                                         </table> | 
					
						
							|  |  |  |                                     </template> | 
					
						
							|  |  |  |                                     <a-tag :color="dbInbound.total == 0 ? 'green' : dbInbound.up + dbInbound.down < dbInbound.total ? 'cyan' : 'red'"> | 
					
						
							|  |  |  |                                         [[ sizeFormat(dbInbound.up + dbInbound.down) ]] / | 
					
						
							|  |  |  |                                         <template v-if="dbInbound.total > 0"> | 
					
						
							|  |  |  |                                             [[ sizeFormat(dbInbound.total) ]] | 
					
						
							|  |  |  |                                         </template> | 
					
						
							| 
									
										
										
										
											2023-07-01 12:26:43 +00:00
										 |  |  |                                         <template v-else> | 
					
						
							| 
									
										
										
										
											2023-07-01 20:40:39 +00:00
										 |  |  |                                             <svg style="fill: currentColor; height: 10px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><path d="M484.4 96C407 96 349.2 164.1 320 208.5C290.8 164.1 233 96 155.6 96C69.75 96 0 167.8 0 256s69.75 160 155.6 160C233.1 416 290.8 347.9 320 303.5C349.2 347.9 407 416 484.4 416C570.3 416 640 344.2 640 256S570.3 96 484.4 96zM155.6 368C96.25 368 48 317.8 48 256s48.25-112 107.6-112c67.75 0 120.5 82.25 137.1 112C276 285.8 223.4 368 155.6 368zM484.4 368c-67.75 0-120.5-82.25-137.1-112C364 226.2 416.6 144 484.4 144C543.8 144 592 194.2 592 256S543.8 368 484.4 368z"/></svg> | 
					
						
							| 
									
										
										
										
											2023-07-01 12:26:43 +00:00
										 |  |  |                                         </template> | 
					
						
							| 
									
										
										
										
											2023-06-21 10:51:34 +00:00
										 |  |  |                                     </a-tag> | 
					
						
							|  |  |  |                                 </a-popover> | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                             </template> | 
					
						
							|  |  |  |                             <template slot="enable" slot-scope="text, dbInbound"> | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |                                 <a-switch v-model="dbInbound.enable" @change="switchEnable(dbInbound.id)"></a-switch> | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                             </template> | 
					
						
							|  |  |  |                             <template slot="expiryTime" slot-scope="text, dbInbound"> | 
					
						
							|  |  |  |                                 <template v-if="dbInbound.expiryTime > 0"> | 
					
						
							|  |  |  |                                     <a-tag v-if="dbInbound.isExpiry" color="red"> | 
					
						
							|  |  |  |                                         [[ DateUtil.formatMillis(dbInbound.expiryTime) ]] | 
					
						
							|  |  |  |                                     </a-tag> | 
					
						
							|  |  |  |                                     <a-tag v-else color="blue"> | 
					
						
							|  |  |  |                                         [[ DateUtil.formatMillis(dbInbound.expiryTime) ]] | 
					
						
							|  |  |  |                                     </a-tag> | 
					
						
							|  |  |  |                                 </template> | 
					
						
							|  |  |  |                                 <a-tag v-else color="green">{{ i18n "indefinite" }}</a-tag> | 
					
						
							|  |  |  |                             </template> | 
					
						
							|  |  |  |                             <template slot="expandedRowRender" slot-scope="record"> | 
					
						
							|  |  |  |                                 <a-table | 
					
						
							| 
									
										
										
										
											2023-02-12 13:50:09 +00:00
										 |  |  |                                 v-if="(record.protocol === Protocols.VLESS) || (record.protocol === Protocols.VMESS)" | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                                 :row-key="client => client.id" | 
					
						
							|  |  |  |                                 :columns="innerColumns" | 
					
						
							|  |  |  |                                 :data-source="getInboundClients(record)" | 
					
						
							|  |  |  |                                 :pagination="false" | 
					
						
							| 
									
										
										
										
											2023-08-08 21:28:53 +00:00
										 |  |  |                                 style="margin-left: 20px;" | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                                 > | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |                                     {{template "client_table"}} | 
					
						
							| 
									
										
										
										
											2023-02-12 13:50:09 +00:00
										 |  |  |                                 </a-table> | 
					
						
							|  |  |  |                                 <a-table | 
					
						
							| 
									
										
										
										
											2023-07-17 23:49:01 +00:00
										 |  |  |                                 v-else-if="record.protocol === Protocols.TROJAN || record.toInbound().isSSMultiUser" | 
					
						
							| 
									
										
										
										
											2023-02-12 13:50:09 +00:00
										 |  |  |                                 :row-key="client => client.id" | 
					
						
							|  |  |  |                                 :columns="innerTrojanColumns" | 
					
						
							|  |  |  |                                 :data-source="getInboundClients(record)" | 
					
						
							|  |  |  |                                 :pagination="false" | 
					
						
							| 
									
										
										
										
											2023-08-08 21:28:53 +00:00
										 |  |  |                                 style="margin-left: 20px;" | 
					
						
							| 
									
										
										
										
											2023-02-12 13:50:09 +00:00
										 |  |  |                                 > | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |                                     {{template "client_table"}} | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                                 </a-table> | 
					
						
							|  |  |  |                             </template> | 
					
						
							|  |  |  |                         </a-table> | 
					
						
							|  |  |  |                     </a-card> | 
					
						
							|  |  |  |                 </transition> | 
					
						
							|  |  |  |             </a-spin> | 
					
						
							|  |  |  |         </a-layout-content> | 
					
						
							|  |  |  |     </a-layout> | 
					
						
							|  |  |  | </a-layout> | 
					
						
							|  |  |  | {{template "js" .}} | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  | {{template "component/themeSwitcher" .}} | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  | <script> | 
					
						
							|  |  |  |     const columns = [{ | 
					
						
							| 
									
										
										
										
											2023-08-08 21:28:53 +00:00
										 |  |  |         title: "ID", | 
					
						
							|  |  |  |         align: 'right', | 
					
						
							|  |  |  |         dataIndex: "id", | 
					
						
							|  |  |  |         width: 30, | 
					
						
							|  |  |  |     }, { | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |         title: '{{ i18n "pages.inbounds.operate" }}', | 
					
						
							|  |  |  |         align: 'center', | 
					
						
							| 
									
										
										
										
											2023-08-08 21:28:53 +00:00
										 |  |  |         width: 40, | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |         scopedSlots: { customRender: 'action' }, | 
					
						
							|  |  |  |     }, { | 
					
						
							|  |  |  |         title: '{{ i18n "pages.inbounds.enable" }}', | 
					
						
							|  |  |  |         align: 'center', | 
					
						
							|  |  |  |         width: 40, | 
					
						
							|  |  |  |         scopedSlots: { customRender: 'enable' }, | 
					
						
							|  |  |  |     }, { | 
					
						
							|  |  |  |         title: '{{ i18n "pages.inbounds.remark" }}', | 
					
						
							|  |  |  |         align: 'center', | 
					
						
							| 
									
										
										
										
											2023-02-18 15:55:53 +00:00
										 |  |  |         width: 80, | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |         dataIndex: "remark", | 
					
						
							|  |  |  |     }, { | 
					
						
							|  |  |  |         title: '{{ i18n "pages.inbounds.port" }}', | 
					
						
							|  |  |  |         align: 'center', | 
					
						
							|  |  |  |         dataIndex: "port", | 
					
						
							| 
									
										
										
										
											2023-02-12 13:50:09 +00:00
										 |  |  |         width: 40, | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |     }, { | 
					
						
							|  |  |  |         title: '{{ i18n "pages.inbounds.protocol" }}', | 
					
						
							|  |  |  |         align: 'left', | 
					
						
							| 
									
										
										
										
											2023-04-29 18:58:50 +00:00
										 |  |  |         width: 90, | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |         scopedSlots: { customRender: 'protocol' }, | 
					
						
							|  |  |  |     }, { | 
					
						
							|  |  |  |         title: '{{ i18n "clients" }}', | 
					
						
							|  |  |  |         align: 'left', | 
					
						
							| 
									
										
										
										
											2023-06-21 10:51:34 +00:00
										 |  |  |         width: 40, | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |         scopedSlots: { customRender: 'clients' }, | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |     }, { | 
					
						
							| 
									
										
										
										
											2023-06-21 10:51:34 +00:00
										 |  |  |         title: '{{ i18n "pages.inbounds.traffic" }}', | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |         align: 'center', | 
					
						
							| 
									
										
										
										
											2023-06-21 10:51:34 +00:00
										 |  |  |         width: 60, | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |         scopedSlots: { customRender: 'traffic' }, | 
					
						
							|  |  |  |     }, { | 
					
						
							|  |  |  |         title: '{{ i18n "pages.inbounds.expireDate" }}', | 
					
						
							|  |  |  |         align: 'center', | 
					
						
							|  |  |  |         width: 80, | 
					
						
							|  |  |  |         scopedSlots: { customRender: 'expiryTime' }, | 
					
						
							|  |  |  |     }]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const innerColumns = [ | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |         { title: '{{ i18n "pages.inbounds.operate" }}', width: 70, scopedSlots: { customRender: 'actions' } }, | 
					
						
							| 
									
										
										
										
											2023-05-07 11:06:43 +00:00
										 |  |  |         { title: '{{ i18n "pages.inbounds.enable" }}', width: 40, scopedSlots: { customRender: 'enable' } }, | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |         { title: '{{ i18n "pages.inbounds.client" }}', width: 80, scopedSlots: { customRender: 'client' } }, | 
					
						
							| 
									
										
										
										
											2023-06-21 10:51:34 +00:00
										 |  |  |         { title: '{{ i18n "pages.inbounds.traffic" }}', width: 50, scopedSlots: { customRender: 'traffic' } }, | 
					
						
							|  |  |  |         { title: '{{ i18n "pages.inbounds.expireDate" }}', width: 50, scopedSlots: { customRender: 'expiryTime' } }, | 
					
						
							| 
									
										
										
										
											2023-05-30 21:17:07 +00:00
										 |  |  |         { title: 'UUID', width: 120, dataIndex: "id" }, | 
					
						
							| 
									
										
										
										
											2023-02-12 13:50:09 +00:00
										 |  |  |     ]; | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-12 13:50:09 +00:00
										 |  |  |     const innerTrojanColumns = [ | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |         { title: '{{ i18n "pages.inbounds.operate" }}', width: 70, scopedSlots: { customRender: 'actions' } }, | 
					
						
							| 
									
										
										
										
											2023-05-07 11:06:43 +00:00
										 |  |  |         { title: '{{ i18n "pages.inbounds.enable" }}', width: 40, scopedSlots: { customRender: 'enable' } }, | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |         { title: '{{ i18n "pages.inbounds.client" }}', width: 80, scopedSlots: { customRender: 'client' } }, | 
					
						
							| 
									
										
										
										
											2023-06-21 10:51:34 +00:00
										 |  |  |         { title: '{{ i18n "pages.inbounds.traffic" }}', width: 50, scopedSlots: { customRender: 'traffic' } }, | 
					
						
							|  |  |  |         { title: '{{ i18n "pages.inbounds.expireDate" }}', width: 50, scopedSlots: { customRender: 'expiryTime' } }, | 
					
						
							| 
									
										
										
										
											2023-08-08 21:28:53 +00:00
										 |  |  |         { title: '{{ i18n "password" }}', width: 170, dataIndex: "password" }, | 
					
						
							| 
									
										
										
										
											2023-02-12 13:50:09 +00:00
										 |  |  |     ]; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |     const app = new Vue({ | 
					
						
							|  |  |  |         delimiters: ['[[', ']]'], | 
					
						
							|  |  |  |         el: '#app', | 
					
						
							|  |  |  |         data: { | 
					
						
							| 
									
										
										
										
											2023-05-14 01:38:49 +00:00
										 |  |  |             siderDrawer, | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |             themeSwitcher, | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |             spinning: false, | 
					
						
							|  |  |  |             inbounds: [], | 
					
						
							|  |  |  |             dbInbounds: [], | 
					
						
							|  |  |  |             searchKey: '', | 
					
						
							| 
									
										
										
										
											2023-05-17 12:27:47 +00:00
										 |  |  |             enableFilter: false, | 
					
						
							|  |  |  |             filterBy: '', | 
					
						
							| 
									
										
										
										
											2023-02-12 13:50:09 +00:00
										 |  |  |             searchedInbounds: [], | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |             expireDiff: 0, | 
					
						
							|  |  |  |             trafficDiff: 0, | 
					
						
							|  |  |  |             defaultCert: '', | 
					
						
							|  |  |  |             defaultKey: '', | 
					
						
							| 
									
										
										
										
											2023-07-17 23:49:01 +00:00
										 |  |  |             clientCount: [], | 
					
						
							| 
									
										
										
										
											2023-04-29 19:03:45 +00:00
										 |  |  |             isRefreshEnabled: localStorage.getItem("isRefreshEnabled") === "true" ? true : false, | 
					
						
							| 
									
										
										
										
											2023-05-06 15:50:42 +00:00
										 |  |  |             refreshing: false, | 
					
						
							| 
									
										
										
										
											2023-05-22 14:36:34 +00:00
										 |  |  |             refreshInterval: Number(localStorage.getItem("refreshInterval")) || 5000, | 
					
						
							|  |  |  |             subSettings: { | 
					
						
							|  |  |  |                 enable : false, | 
					
						
							|  |  |  |                 port: 0, | 
					
						
							|  |  |  |                 path: '', | 
					
						
							|  |  |  |                 domain: '', | 
					
						
							|  |  |  |                 tls: false | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             tgBotEnable: false | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |         }, | 
					
						
							|  |  |  |         methods: { | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |             loading(spinning = true) { | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                 this.spinning = spinning; | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             async getDBInbounds() { | 
					
						
							| 
									
										
										
										
											2023-05-06 15:50:42 +00:00
										 |  |  |                 this.refreshing = true; | 
					
						
							| 
									
										
										
										
											2023-05-12 18:06:05 +00:00
										 |  |  |                 const msg = await HttpUtil.post('/panel/inbound/list'); | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                 if (!msg.success) { | 
					
						
							| 
									
										
										
										
											2023-05-22 23:45:34 +00:00
										 |  |  |                     this.refreshing = false; | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                     return; | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |                 this.setInbounds(msg.obj); | 
					
						
							| 
									
										
										
										
											2023-05-13 09:54:44 +00:00
										 |  |  |                 setTimeout(() => { | 
					
						
							|  |  |  |                     this.refreshing = false; | 
					
						
							|  |  |  |                 }, 500); | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |             async getDefaultSettings() { | 
					
						
							| 
									
										
										
										
											2023-05-12 18:06:05 +00:00
										 |  |  |                 const msg = await HttpUtil.post('/panel/setting/defaultSettings'); | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |                 if (!msg.success) { | 
					
						
							|  |  |  |                     return; | 
					
						
							|  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2023-05-22 14:36:34 +00:00
										 |  |  |                 with(msg.obj){ | 
					
						
							|  |  |  |                     this.expireDiff = expireDiff * 86400000; | 
					
						
							|  |  |  |                     this.trafficDiff = trafficDiff * 1073741824; | 
					
						
							|  |  |  |                     this.defaultCert = defaultCert; | 
					
						
							|  |  |  |                     this.defaultKey = defaultKey; | 
					
						
							|  |  |  |                     this.tgBotEnable = tgBotEnable; | 
					
						
							|  |  |  |                     this.subSettings = { | 
					
						
							|  |  |  |                         enable : subEnable, | 
					
						
							|  |  |  |                         port: subPort, | 
					
						
							|  |  |  |                         path: subPath, | 
					
						
							|  |  |  |                         domain: subDomain, | 
					
						
							|  |  |  |                         tls: subTLS | 
					
						
							|  |  |  |                     }; | 
					
						
							|  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |             setInbounds(dbInbounds) { | 
					
						
							|  |  |  |                 this.inbounds.splice(0); | 
					
						
							|  |  |  |                 this.dbInbounds.splice(0); | 
					
						
							| 
									
										
										
										
											2023-07-17 23:49:01 +00:00
										 |  |  |                 this.clientCount.splice(0); | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                 for (const inbound of dbInbounds) { | 
					
						
							|  |  |  |                     const dbInbound = new DBInbound(inbound); | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |                     to_inbound = dbInbound.toInbound() | 
					
						
							|  |  |  |                     this.inbounds.push(to_inbound); | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                     this.dbInbounds.push(dbInbound); | 
					
						
							| 
									
										
										
										
											2023-05-17 12:27:47 +00:00
										 |  |  |                     if ([Protocols.VMESS, Protocols.VLESS, Protocols.TROJAN, Protocols.SHADOWSOCKS].includes(inbound.protocol)) { | 
					
						
							| 
									
										
										
										
											2023-07-17 23:49:01 +00:00
										 |  |  |                         if (inbound.protocol === Protocols.SHADOWSOCKS && (!to_inbound.isSSMultiUser)) { | 
					
						
							|  |  |  |                             continue; | 
					
						
							|  |  |  |                         } | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |                         this.clientCount[inbound.id] = this.getClientCounts(inbound, to_inbound); | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |                     } | 
					
						
							|  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2023-05-17 12:27:47 +00:00
										 |  |  |                 if(this.enableFilter){ | 
					
						
							|  |  |  |                     this.filterInbounds(); | 
					
						
							|  |  |  |                 } else { | 
					
						
							|  |  |  |                     this.searchInbounds(this.searchKey); | 
					
						
							|  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |             getClientCounts(dbInbound, inbound) { | 
					
						
							|  |  |  |                 let clientCount = 0, active = [], deactive = [], depleted = [], expiring = []; | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |                 clients = this.getClients(dbInbound.protocol, inbound.settings); | 
					
						
							|  |  |  |                 clientStats = dbInbound.clientStats | 
					
						
							|  |  |  |                 now = new Date().getTime() | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |                 if (clients) { | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |                     clientCount = clients.length; | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |                     if (dbInbound.enable) { | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |                         clients.forEach(client => { | 
					
						
							|  |  |  |                             client.enable ? active.push(client.email) : deactive.push(client.email); | 
					
						
							|  |  |  |                         }); | 
					
						
							|  |  |  |                         clientStats.forEach(client => { | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |                             if (!client.enable) { | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |                                 depleted.push(client.email); | 
					
						
							|  |  |  |                             } else { | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |                                 if ((client.expiryTime > 0 && (client.expiryTime - now < this.expireDiff)) || | 
					
						
							|  |  |  |                                     (client.total > 0 && (client.total - (client.up + client.down) < this.trafficDiff))) expiring.push(client.email); | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |                             } | 
					
						
							|  |  |  |                         }); | 
					
						
							|  |  |  |                     } else { | 
					
						
							|  |  |  |                         clients.forEach(client => { | 
					
						
							|  |  |  |                             deactive.push(client.email); | 
					
						
							|  |  |  |                         }); | 
					
						
							|  |  |  |                     } | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                 } | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |                 return { | 
					
						
							|  |  |  |                     clients: clientCount, | 
					
						
							|  |  |  |                     active: active, | 
					
						
							|  |  |  |                     deactive: deactive, | 
					
						
							|  |  |  |                     depleted: depleted, | 
					
						
							|  |  |  |                     expiring: expiring, | 
					
						
							|  |  |  |                 }; | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |             }, | 
					
						
							|  |  |  |             searchInbounds(key) { | 
					
						
							|  |  |  |                 if (ObjectUtil.isEmpty(key)) { | 
					
						
							|  |  |  |                     this.searchedInbounds = this.dbInbounds.slice(); | 
					
						
							|  |  |  |                 } else { | 
					
						
							|  |  |  |                     this.searchedInbounds.splice(0, this.searchedInbounds.length); | 
					
						
							|  |  |  |                     this.dbInbounds.forEach(inbound => { | 
					
						
							|  |  |  |                         if (ObjectUtil.deepSearch(inbound, key)) { | 
					
						
							| 
									
										
										
										
											2023-02-16 15:58:20 +00:00
										 |  |  |                             const newInbound = new DBInbound(inbound); | 
					
						
							|  |  |  |                             const inboundSettings = JSON.parse(inbound.settings); | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |                             if (inboundSettings.hasOwnProperty('clients')) { | 
					
						
							| 
									
										
										
										
											2023-02-16 15:58:20 +00:00
										 |  |  |                                 const searchedSettings = { "clients": [] }; | 
					
						
							|  |  |  |                                 inboundSettings.clients.forEach(client => { | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |                                     if (ObjectUtil.deepSearch(client, key)) { | 
					
						
							| 
									
										
										
										
											2023-02-16 15:58:20 +00:00
										 |  |  |                                         searchedSettings.clients.push(client); | 
					
						
							|  |  |  |                                     } | 
					
						
							|  |  |  |                                 }); | 
					
						
							|  |  |  |                                 newInbound.settings = Inbound.Settings.fromJson(inbound.protocol, searchedSettings); | 
					
						
							|  |  |  |                             } | 
					
						
							|  |  |  |                             this.searchedInbounds.push(newInbound); | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                         } | 
					
						
							|  |  |  |                     }); | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-05-17 12:27:47 +00:00
										 |  |  |             filterInbounds() { | 
					
						
							|  |  |  |                 if (ObjectUtil.isEmpty(this.filterBy)) { | 
					
						
							|  |  |  |                     this.searchedInbounds = this.dbInbounds.slice(); | 
					
						
							|  |  |  |                 } else { | 
					
						
							|  |  |  |                     this.searchedInbounds.splice(0, this.searchedInbounds.length); | 
					
						
							|  |  |  |                     this.dbInbounds.forEach(inbound => { | 
					
						
							|  |  |  |                         const newInbound = new DBInbound(inbound); | 
					
						
							|  |  |  |                         const inboundSettings = JSON.parse(inbound.settings); | 
					
						
							|  |  |  |                         if (this.clientCount[inbound.id] && this.clientCount[inbound.id].hasOwnProperty(this.filterBy)){ | 
					
						
							|  |  |  |                             const list = this.clientCount[inbound.id][this.filterBy]; | 
					
						
							|  |  |  |                             if (list.length > 0) { | 
					
						
							|  |  |  |                                 const filteredSettings = { "clients": [] }; | 
					
						
							|  |  |  |                                 inboundSettings.clients.forEach(client => { | 
					
						
							|  |  |  |                                     if (list.includes(client.email)) { | 
					
						
							|  |  |  |                                         filteredSettings.clients.push(client); | 
					
						
							|  |  |  |                                     } | 
					
						
							|  |  |  |                                 }); | 
					
						
							|  |  |  |                                 newInbound.settings = Inbound.Settings.fromJson(inbound.protocol, filteredSettings); | 
					
						
							|  |  |  |                                 this.searchedInbounds.push(newInbound); | 
					
						
							|  |  |  |                             } | 
					
						
							|  |  |  |                         } | 
					
						
							|  |  |  |                     }); | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             toggleFilter(){ | 
					
						
							|  |  |  |                 if(this.enableFilter) { | 
					
						
							|  |  |  |                     this.searchKey = ''; | 
					
						
							|  |  |  |                 } else { | 
					
						
							|  |  |  |                     this.filterBy = ''; | 
					
						
							|  |  |  |                     this.searchedInbounds = this.dbInbounds.slice(); | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |             generalActions(action) { | 
					
						
							| 
									
										
										
										
											2023-04-25 13:53:38 +00:00
										 |  |  |                 switch (action.key) { | 
					
						
							|  |  |  |                     case "export": | 
					
						
							|  |  |  |                         this.exportAllLinks(); | 
					
						
							|  |  |  |                         break; | 
					
						
							|  |  |  |                     case "resetInbounds": | 
					
						
							|  |  |  |                         this.resetAllTraffic(); | 
					
						
							|  |  |  |                         break; | 
					
						
							|  |  |  |                     case "resetClients": | 
					
						
							|  |  |  |                         this.resetAllClientTraffics(-1); | 
					
						
							|  |  |  |                         break; | 
					
						
							| 
									
										
										
										
											2023-04-25 15:13:37 +00:00
										 |  |  |                     case "delDepletedClients": | 
					
						
							|  |  |  |                         this.delDepletedClients(-1) | 
					
						
							| 
									
										
										
										
											2023-04-25 13:53:38 +00:00
										 |  |  |                         break; | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |             clickAction(action, dbInbound) { | 
					
						
							|  |  |  |                 switch (action.key) { | 
					
						
							|  |  |  |                     case "qrcode": | 
					
						
							|  |  |  |                         this.showQrcode(dbInbound); | 
					
						
							|  |  |  |                         break; | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |                     case "showInfo": | 
					
						
							|  |  |  |                         this.showInfo(dbInbound); | 
					
						
							| 
									
										
										
										
											2023-03-16 22:01:14 +00:00
										 |  |  |                         break; | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                     case "edit": | 
					
						
							| 
									
										
										
										
											2023-02-18 12:37:32 +00:00
										 |  |  |                         this.openEditInbound(dbInbound.id); | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                         break; | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |                     case "addClient": | 
					
						
							|  |  |  |                         this.openAddClient(dbInbound.id) | 
					
						
							|  |  |  |                         break; | 
					
						
							|  |  |  |                     case "addBulkClient": | 
					
						
							|  |  |  |                         this.openAddBulkClient(dbInbound.id) | 
					
						
							|  |  |  |                         break; | 
					
						
							|  |  |  |                     case "export": | 
					
						
							|  |  |  |                         this.inboundLinks(dbInbound.id); | 
					
						
							|  |  |  |                         break; | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                     case "resetTraffic": | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |                         this.resetTraffic(dbInbound.id); | 
					
						
							| 
									
										
										
										
											2023-03-27 16:41:28 +00:00
										 |  |  |                         break; | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |                     case "resetClients": | 
					
						
							|  |  |  |                         this.resetAllClientTraffics(dbInbound.id); | 
					
						
							|  |  |  |                         break; | 
					
						
							|  |  |  |                     case "clone": | 
					
						
							| 
									
										
										
										
											2023-03-27 16:41:28 +00:00
										 |  |  |                         this.openCloneInbound(dbInbound); | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                         break; | 
					
						
							|  |  |  |                     case "delete": | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |                         this.delInbound(dbInbound.id); | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                         break; | 
					
						
							| 
									
										
										
										
											2023-04-25 15:13:37 +00:00
										 |  |  |                     case "delDepletedClients": | 
					
						
							|  |  |  |                         this.delDepletedClients(dbInbound.id) | 
					
						
							|  |  |  |                         break; | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                 } | 
					
						
							| 
									
										
										
										
											2023-03-27 16:41:28 +00:00
										 |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |             openCloneInbound(dbInbound) { | 
					
						
							| 
									
										
										
										
											2023-03-27 16:41:28 +00:00
										 |  |  |                 this.$confirm({ | 
					
						
							| 
									
										
										
										
											2023-05-04 17:52:54 +00:00
										 |  |  |                     title: '{{ i18n "pages.inbounds.cloneInbound"}} \"' + dbInbound.remark + '\"', | 
					
						
							| 
									
										
										
										
											2023-03-27 16:41:28 +00:00
										 |  |  |                     content: '{{ i18n "pages.inbounds.cloneInboundContent"}}', | 
					
						
							|  |  |  |                     okText: '{{ i18n "pages.inbounds.cloneInboundOk"}}', | 
					
						
							|  |  |  |                     cancelText: '{{ i18n "cancel" }}', | 
					
						
							|  |  |  |                     onOk: () => { | 
					
						
							|  |  |  |                         const baseInbound = dbInbound.toInbound(); | 
					
						
							|  |  |  |                         dbInbound.up = 0; | 
					
						
							|  |  |  |                         dbInbound.down = 0; | 
					
						
							|  |  |  |                         this.cloneInbound(baseInbound, dbInbound); | 
					
						
							|  |  |  |                     }, | 
					
						
							|  |  |  |                 }); | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             async cloneInbound(baseInbound, dbInbound) { | 
					
						
							|  |  |  |                 const data = { | 
					
						
							|  |  |  |                     up: dbInbound.up, | 
					
						
							|  |  |  |                     down: dbInbound.down, | 
					
						
							|  |  |  |                     total: dbInbound.total, | 
					
						
							|  |  |  |                     remark: dbInbound.remark + " - Cloned", | 
					
						
							|  |  |  |                     enable: dbInbound.enable, | 
					
						
							|  |  |  |                     expiryTime: dbInbound.expiryTime, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-13 10:03:13 +00:00
										 |  |  |                     listen: '', | 
					
						
							|  |  |  |                     port: RandomUtil.randomIntRange(10000, 60000), | 
					
						
							| 
									
										
										
										
											2023-03-27 16:41:28 +00:00
										 |  |  |                     protocol: baseInbound.protocol, | 
					
						
							| 
									
										
										
										
											2023-05-13 10:03:13 +00:00
										 |  |  |                     settings: Inbound.Settings.getSettings(baseInbound.protocol).toString(), | 
					
						
							| 
									
										
										
										
											2023-03-27 16:41:28 +00:00
										 |  |  |                     streamSettings: baseInbound.stream.toString(), | 
					
						
							|  |  |  |                     sniffing: baseInbound.canSniffing() ? baseInbound.sniffing.toString() : '{}', | 
					
						
							|  |  |  |                 }; | 
					
						
							| 
									
										
										
										
											2023-05-12 18:06:05 +00:00
										 |  |  |                 await this.submit('/panel/inbound/add', data, inModal); | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |             }, | 
					
						
							|  |  |  |             openAddInbound() { | 
					
						
							|  |  |  |                 inModal.show({ | 
					
						
							|  |  |  |                     title: '{{ i18n "pages.inbounds.addInbound"}}', | 
					
						
							| 
									
										
										
										
											2023-05-04 17:52:54 +00:00
										 |  |  |                     okText: '{{ i18n "pages.inbounds.create"}}', | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                     cancelText: '{{ i18n "close" }}', | 
					
						
							|  |  |  |                     confirm: async (inbound, dbInbound) => { | 
					
						
							|  |  |  |                         inModal.loading(); | 
					
						
							|  |  |  |                         await this.addInbound(inbound, dbInbound); | 
					
						
							|  |  |  |                         inModal.close(); | 
					
						
							|  |  |  |                     }, | 
					
						
							|  |  |  |                     isEdit: false | 
					
						
							|  |  |  |                 }); | 
					
						
							|  |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |             openEditInbound(dbInboundId) { | 
					
						
							|  |  |  |                 dbInbound = this.dbInbounds.find(row => row.id === dbInboundId); | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                 const inbound = dbInbound.toInbound(); | 
					
						
							|  |  |  |                 inModal.show({ | 
					
						
							|  |  |  |                     title: '{{ i18n "pages.inbounds.modifyInbound"}}', | 
					
						
							| 
									
										
										
										
											2023-05-04 17:52:54 +00:00
										 |  |  |                     okText: '{{ i18n "pages.inbounds.update"}}', | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                     cancelText: '{{ i18n "close" }}', | 
					
						
							|  |  |  |                     inbound: inbound, | 
					
						
							|  |  |  |                     dbInbound: dbInbound, | 
					
						
							|  |  |  |                     confirm: async (inbound, dbInbound) => { | 
					
						
							|  |  |  |                         inModal.loading(); | 
					
						
							|  |  |  |                         await this.updateInbound(inbound, dbInbound); | 
					
						
							|  |  |  |                         inModal.close(); | 
					
						
							|  |  |  |                     }, | 
					
						
							|  |  |  |                     isEdit: true | 
					
						
							|  |  |  |                 }); | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             async addInbound(inbound, dbInbound) { | 
					
						
							|  |  |  |                 const data = { | 
					
						
							|  |  |  |                     up: dbInbound.up, | 
					
						
							|  |  |  |                     down: dbInbound.down, | 
					
						
							|  |  |  |                     total: dbInbound.total, | 
					
						
							|  |  |  |                     remark: dbInbound.remark, | 
					
						
							|  |  |  |                     enable: dbInbound.enable, | 
					
						
							|  |  |  |                     expiryTime: dbInbound.expiryTime, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                     listen: inbound.listen, | 
					
						
							|  |  |  |                     port: inbound.port, | 
					
						
							|  |  |  |                     protocol: inbound.protocol, | 
					
						
							|  |  |  |                     settings: inbound.settings.toString(), | 
					
						
							|  |  |  |                 }; | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |                 if (inbound.canEnableStream()) data.streamSettings = inbound.stream.toString(); | 
					
						
							|  |  |  |                 if (inbound.canSniffing()) data.sniffing = inbound.sniffing.toString(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-12 18:06:05 +00:00
										 |  |  |                 await this.submit('/panel/inbound/add', data, inModal); | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |             }, | 
					
						
							|  |  |  |             async updateInbound(inbound, dbInbound) { | 
					
						
							|  |  |  |                 const data = { | 
					
						
							|  |  |  |                     up: dbInbound.up, | 
					
						
							|  |  |  |                     down: dbInbound.down, | 
					
						
							|  |  |  |                     total: dbInbound.total, | 
					
						
							|  |  |  |                     remark: dbInbound.remark, | 
					
						
							|  |  |  |                     enable: dbInbound.enable, | 
					
						
							|  |  |  |                     expiryTime: dbInbound.expiryTime, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                     listen: inbound.listen, | 
					
						
							|  |  |  |                     port: inbound.port, | 
					
						
							|  |  |  |                     protocol: inbound.protocol, | 
					
						
							|  |  |  |                     settings: inbound.settings.toString(), | 
					
						
							|  |  |  |                 }; | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |                 if (inbound.canEnableStream()) data.streamSettings = inbound.stream.toString(); | 
					
						
							|  |  |  |                 if (inbound.canSniffing()) data.sniffing = inbound.sniffing.toString(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-12 18:06:05 +00:00
										 |  |  |                 await this.submit(`/panel/inbound/update/${dbInbound.id}`, data, inModal); | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |             openAddClient(dbInboundId) { | 
					
						
							|  |  |  |                 dbInbound = this.dbInbounds.find(row => row.id === dbInboundId); | 
					
						
							|  |  |  |                 clientModal.show({ | 
					
						
							|  |  |  |                     title: '{{ i18n "pages.client.add"}}', | 
					
						
							|  |  |  |                     okText: '{{ i18n "pages.client.submitAdd"}}', | 
					
						
							|  |  |  |                     dbInbound: dbInbound, | 
					
						
							| 
									
										
										
										
											2023-04-18 18:04:06 +00:00
										 |  |  |                     confirm: async (clients, dbInboundId) => { | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |                         clientModal.loading(); | 
					
						
							| 
									
										
										
										
											2023-04-18 18:04:06 +00:00
										 |  |  |                         await this.addClient(clients, dbInboundId); | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |                         clientModal.close(); | 
					
						
							|  |  |  |                     }, | 
					
						
							|  |  |  |                     isEdit: false | 
					
						
							|  |  |  |                 }); | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             openAddBulkClient(dbInboundId) { | 
					
						
							|  |  |  |                 dbInbound = this.dbInbounds.find(row => row.id === dbInboundId); | 
					
						
							|  |  |  |                 clientsBulkModal.show({ | 
					
						
							|  |  |  |                     title: '{{ i18n "pages.client.bulk"}} ' + dbInbound.remark, | 
					
						
							|  |  |  |                     okText: '{{ i18n "pages.client.bulk"}}', | 
					
						
							|  |  |  |                     dbInbound: dbInbound, | 
					
						
							| 
									
										
										
										
											2023-04-18 18:04:06 +00:00
										 |  |  |                     confirm: async (clients, dbInboundId) => { | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |                         clientsBulkModal.loading(); | 
					
						
							| 
									
										
										
										
											2023-04-18 18:04:06 +00:00
										 |  |  |                         await this.addClient(clients, dbInboundId); | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |                         clientsBulkModal.close(); | 
					
						
							|  |  |  |                     }, | 
					
						
							|  |  |  |                 }); | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             openEditClient(dbInboundId, client) { | 
					
						
							|  |  |  |                 dbInbound = this.dbInbounds.find(row => row.id === dbInboundId); | 
					
						
							|  |  |  |                 clients = this.getInboundClients(dbInbound); | 
					
						
							| 
									
										
										
										
											2023-08-29 19:00:52 +00:00
										 |  |  |                 index = this.findIndexOfClient(dbInbound.protocol, clients, client); | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |                 clientModal.show({ | 
					
						
							|  |  |  |                     title: '{{ i18n "pages.client.edit"}}', | 
					
						
							|  |  |  |                     okText: '{{ i18n "pages.client.submitEdit"}}', | 
					
						
							|  |  |  |                     dbInbound: dbInbound, | 
					
						
							|  |  |  |                     index: index, | 
					
						
							| 
									
										
										
										
											2023-04-25 11:08:35 +00:00
										 |  |  |                     confirm: async (client, dbInboundId, clientId) => { | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |                         clientModal.loading(); | 
					
						
							| 
									
										
										
										
											2023-04-25 11:08:35 +00:00
										 |  |  |                         await this.updateClient(client, dbInboundId, clientId); | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |                         clientModal.close(); | 
					
						
							|  |  |  |                     }, | 
					
						
							|  |  |  |                     isEdit: true | 
					
						
							|  |  |  |                 }); | 
					
						
							|  |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-08-29 19:00:52 +00:00
										 |  |  |             findIndexOfClient(protocol, clients, client) { | 
					
						
							|  |  |  |                 switch (protocol) { | 
					
						
							|  |  |  |                     case Protocols.TROJAN: | 
					
						
							|  |  |  |                     case Protocols.SHADOWSOCKS: | 
					
						
							|  |  |  |                         return clients.findIndex(item => item.password === client.password && item.email === client.email); | 
					
						
							|  |  |  |                     default: return clients.findIndex(item => item.id === client.id && item.email === client.email); | 
					
						
							|  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-04-18 18:04:06 +00:00
										 |  |  |             async addClient(clients, dbInboundId) { | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |                 const data = { | 
					
						
							| 
									
										
										
										
											2023-04-18 18:04:06 +00:00
										 |  |  |                     id: dbInboundId, | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |                     settings: '{"clients": [' + clients.toString() + ']}', | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |                 }; | 
					
						
							| 
									
										
										
										
											2023-05-12 18:06:05 +00:00
										 |  |  |                 await this.submit(`/panel/inbound/addClient`, data); | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-04-25 11:08:35 +00:00
										 |  |  |             async updateClient(client, dbInboundId, clientId) { | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |                 const data = { | 
					
						
							| 
									
										
										
										
											2023-04-18 18:04:06 +00:00
										 |  |  |                     id: dbInboundId, | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |                     settings: '{"clients": [' + client.toString() + ']}', | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |                 }; | 
					
						
							| 
									
										
										
										
											2023-05-12 18:06:05 +00:00
										 |  |  |                 await this.submit(`/panel/inbound/updateClient/${clientId}`, data); | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |             }, | 
					
						
							|  |  |  |             resetTraffic(dbInboundId) { | 
					
						
							|  |  |  |                 dbInbound = this.dbInbounds.find(row => row.id === dbInboundId); | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                 this.$confirm({ | 
					
						
							|  |  |  |                     title: '{{ i18n "pages.inbounds.resetTraffic"}}', | 
					
						
							|  |  |  |                     content: '{{ i18n "pages.inbounds.resetTrafficContent"}}', | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |                     class: themeSwitcher.darkCardClass, | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                     okText: '{{ i18n "reset"}}', | 
					
						
							|  |  |  |                     cancelText: '{{ i18n "cancel"}}', | 
					
						
							|  |  |  |                     onOk: () => { | 
					
						
							|  |  |  |                         const inbound = dbInbound.toInbound(); | 
					
						
							|  |  |  |                         dbInbound.up = 0; | 
					
						
							|  |  |  |                         dbInbound.down = 0; | 
					
						
							|  |  |  |                         this.updateInbound(inbound, dbInbound); | 
					
						
							|  |  |  |                     }, | 
					
						
							|  |  |  |                 }); | 
					
						
							|  |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |             delInbound(dbInboundId) { | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                 this.$confirm({ | 
					
						
							|  |  |  |                     title: '{{ i18n "pages.inbounds.deleteInbound"}}', | 
					
						
							|  |  |  |                     content: '{{ i18n "pages.inbounds.deleteInboundContent"}}', | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |                     class: themeSwitcher.darkCardClass, | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                     okText: '{{ i18n "delete"}}', | 
					
						
							|  |  |  |                     cancelText: '{{ i18n "cancel"}}', | 
					
						
							| 
									
										
										
										
											2023-05-12 18:06:05 +00:00
										 |  |  |                     onOk: () => this.submit('/panel/inbound/del/' + dbInboundId), | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                 }); | 
					
						
							|  |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |             delClient(dbInboundId, client) { | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |                 dbInbound = this.dbInbounds.find(row => row.id === dbInboundId); | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |                 clientId = this.getClientId(dbInbound.protocol, client); | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |                 this.$confirm({ | 
					
						
							|  |  |  |                     title: '{{ i18n "pages.inbounds.deleteInbound"}}', | 
					
						
							|  |  |  |                     content: '{{ i18n "pages.inbounds.deleteInboundContent"}}', | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |                     class: themeSwitcher.darkCardClass, | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |                     okText: '{{ i18n "delete"}}', | 
					
						
							|  |  |  |                     cancelText: '{{ i18n "cancel"}}', | 
					
						
							| 
									
										
										
										
											2023-05-12 18:06:05 +00:00
										 |  |  |                     onOk: () => this.submit(`/panel/inbound/${dbInboundId}/delClient/${clientId}`), | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |                 }); | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             getClients(protocol, clientSettings) { | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |                 switch (protocol) { | 
					
						
							| 
									
										
										
										
											2023-03-16 22:01:14 +00:00
										 |  |  |                     case Protocols.VMESS: return clientSettings.vmesses; | 
					
						
							|  |  |  |                     case Protocols.VLESS: return clientSettings.vlesses; | 
					
						
							|  |  |  |                     case Protocols.TROJAN: return clientSettings.trojans; | 
					
						
							| 
									
										
										
										
											2023-05-06 16:51:14 +00:00
										 |  |  |                     case Protocols.SHADOWSOCKS: return clientSettings.shadowsockses; | 
					
						
							| 
									
										
										
										
											2023-03-16 22:01:14 +00:00
										 |  |  |                     default: return null; | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-05-06 16:51:14 +00:00
										 |  |  |             getClientId(protocol, client) { | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |                 switch (protocol) { | 
					
						
							| 
									
										
										
										
											2023-05-06 16:51:14 +00:00
										 |  |  |                     case Protocols.TROJAN: return client.password; | 
					
						
							|  |  |  |                     case Protocols.SHADOWSOCKS: return client.email; | 
					
						
							|  |  |  |                     default: return client.id; | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-05-22 23:45:34 +00:00
										 |  |  |             checkFallback(dbInbound) { | 
					
						
							|  |  |  |                 newDbInbound = new DBInbound(dbInbound); | 
					
						
							|  |  |  |                 if (dbInbound.listen.startsWith("@")){ | 
					
						
							|  |  |  |                     rootInbound = this.inbounds.find((i) =>  | 
					
						
							|  |  |  |                         i.tls &&  | 
					
						
							|  |  |  |                         ['trojan','vless'].includes(i.protocol) && | 
					
						
							|  |  |  |                         i.settings.fallbacks.find(f => f.dest === dbInbound.listen) | 
					
						
							|  |  |  |                     ); | 
					
						
							|  |  |  |                     if (rootInbound) { | 
					
						
							|  |  |  |                         newDbInbound.listen = rootInbound.listen; | 
					
						
							|  |  |  |                         newDbInbound.port = rootInbound.port; | 
					
						
							|  |  |  |                         newInbound = newDbInbound.toInbound(); | 
					
						
							|  |  |  |                         newInbound.stream.security = 'tls'; | 
					
						
							|  |  |  |                         newInbound.stream.tls = rootInbound.stream.tls; | 
					
						
							|  |  |  |                         newDbInbound.streamSettings = newInbound.stream.toString(); | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |                 return newDbInbound; | 
					
						
							|  |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |             showQrcode(dbInbound, clientIndex) { | 
					
						
							| 
									
										
										
										
											2023-05-22 23:45:34 +00:00
										 |  |  |                 newDbInbound = this.checkFallback(dbInbound); | 
					
						
							|  |  |  |                 qrModal.show('{{ i18n "qrCode"}}', newDbInbound, clientIndex); | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-02-12 13:50:09 +00:00
										 |  |  |             showInfo(dbInbound, index) { | 
					
						
							| 
									
										
										
										
											2023-05-22 23:45:34 +00:00
										 |  |  |                 newDbInbound = this.checkFallback(dbInbound); | 
					
						
							|  |  |  |                 infoModal.show(newDbInbound, index); | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |             switchEnable(dbInboundId) { | 
					
						
							|  |  |  |                 dbInbound = this.dbInbounds.find(row => row.id === dbInboundId); | 
					
						
							| 
									
										
										
										
											2023-05-12 18:06:05 +00:00
										 |  |  |                 this.submit(`/panel/inbound/update/${dbInboundId}`, dbInbound); | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |             async switchEnableClient(dbInboundId, client) { | 
					
						
							|  |  |  |                 this.loading() | 
					
						
							|  |  |  |                 dbInbound = this.dbInbounds.find(row => row.id === dbInboundId); | 
					
						
							|  |  |  |                 inbound = dbInbound.toInbound(); | 
					
						
							|  |  |  |                 clients = this.getClients(dbInbound.protocol, inbound.settings); | 
					
						
							| 
									
										
										
										
											2023-08-29 19:00:52 +00:00
										 |  |  |                 index = this.findIndexOfClient(dbInbound.protocol, clients, client); | 
					
						
							| 
									
										
										
										
											2023-04-19 08:25:38 +00:00
										 |  |  |                 clients[index].enable = !clients[index].enable; | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |                 clientId = this.getClientId(dbInbound.protocol, clients[index]); | 
					
						
							|  |  |  |                 await this.updateClient(clients[index], dbInboundId, clientId); | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |                 this.loading(false); | 
					
						
							|  |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |             async submit(url, data) { | 
					
						
							|  |  |  |                 const msg = await HttpUtil.postWithModal(url, data); | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                 if (msg.success) { | 
					
						
							|  |  |  |                     await this.getDBInbounds(); | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             getInboundClients(dbInbound) { | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |                 if (dbInbound.protocol == Protocols.VLESS) { | 
					
						
							| 
									
										
										
										
											2023-05-06 16:51:14 +00:00
										 |  |  |                     return dbInbound.toInbound().settings.vlesses; | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |                 } else if (dbInbound.protocol == Protocols.VMESS) { | 
					
						
							| 
									
										
										
										
											2023-05-06 16:51:14 +00:00
										 |  |  |                     return dbInbound.toInbound().settings.vmesses; | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |                 } else if (dbInbound.protocol == Protocols.TROJAN) { | 
					
						
							| 
									
										
										
										
											2023-05-06 16:51:14 +00:00
										 |  |  |                     return dbInbound.toInbound().settings.trojans; | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |                 } else if (dbInbound.protocol == Protocols.SHADOWSOCKS) { | 
					
						
							| 
									
										
										
										
											2023-05-06 16:51:14 +00:00
										 |  |  |                     return dbInbound.toInbound().settings.shadowsockses; | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                 } | 
					
						
							|  |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |             resetClientTraffic(client, dbInboundId) { | 
					
						
							| 
									
										
										
										
											2023-02-12 13:50:09 +00:00
										 |  |  |                 this.$confirm({ | 
					
						
							|  |  |  |                     title: '{{ i18n "pages.inbounds.resetTraffic"}}', | 
					
						
							|  |  |  |                     content: '{{ i18n "pages.inbounds.resetTrafficContent"}}', | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |                     class: themeSwitcher.darkCardClass, | 
					
						
							| 
									
										
										
										
											2023-02-12 13:50:09 +00:00
										 |  |  |                     okText: '{{ i18n "reset"}}', | 
					
						
							|  |  |  |                     cancelText: '{{ i18n "cancel"}}', | 
					
						
							| 
									
										
										
										
											2023-05-12 18:06:05 +00:00
										 |  |  |                     onOk: () => this.submit('/panel/inbound/' + dbInboundId + '/resetClientTraffic/' + client.email), | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |                 }) | 
					
						
							| 
									
										
										
										
											2023-02-12 13:50:09 +00:00
										 |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |             resetAllTraffic() { | 
					
						
							|  |  |  |                 this.$confirm({ | 
					
						
							|  |  |  |                     title: '{{ i18n "pages.inbounds.resetAllTrafficTitle"}}', | 
					
						
							|  |  |  |                     content: '{{ i18n "pages.inbounds.resetAllTrafficContent"}}', | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |                     class: themeSwitcher.darkCardClass, | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |                     okText: '{{ i18n "reset"}}', | 
					
						
							|  |  |  |                     cancelText: '{{ i18n "cancel"}}', | 
					
						
							| 
									
										
										
										
											2023-05-12 18:06:05 +00:00
										 |  |  |                     onOk: () => this.submit('/panel/inbound/resetAllTraffics'), | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |                 }); | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             resetAllClientTraffics(dbInboundId) { | 
					
						
							|  |  |  |                 this.$confirm({ | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |                     title: dbInboundId > 0 ? '{{ i18n "pages.inbounds.resetInboundClientTrafficTitle"}}' : '{{ i18n "pages.inbounds.resetAllClientTrafficTitle"}}', | 
					
						
							|  |  |  |                     content: dbInboundId > 0 ? '{{ i18n "pages.inbounds.resetInboundClientTrafficContent"}}' : '{{ i18n "pages.inbounds.resetAllClientTrafficContent"}}', | 
					
						
							|  |  |  |                     class: themeSwitcher.darkCardClass, | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |                     okText: '{{ i18n "reset"}}', | 
					
						
							|  |  |  |                     cancelText: '{{ i18n "cancel"}}', | 
					
						
							| 
									
										
										
										
											2023-05-12 18:06:05 +00:00
										 |  |  |                     onOk: () => this.submit('/panel/inbound/resetAllClientTraffics/' + dbInboundId), | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |                 }) | 
					
						
							|  |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-04-25 15:13:37 +00:00
										 |  |  |             delDepletedClients(dbInboundId) { | 
					
						
							|  |  |  |                 this.$confirm({ | 
					
						
							|  |  |  |                     title: '{{ i18n "pages.inbounds.delDepletedClientsTitle"}}', | 
					
						
							|  |  |  |                     content: '{{ i18n "pages.inbounds.delDepletedClientsContent"}}', | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |                     class: themeSwitcher.darkCardClass, | 
					
						
							| 
									
										
										
										
											2023-04-25 15:13:37 +00:00
										 |  |  |                     okText: '{{ i18n "reset"}}', | 
					
						
							|  |  |  |                     cancelText: '{{ i18n "cancel"}}', | 
					
						
							| 
									
										
										
										
											2023-05-12 18:06:05 +00:00
										 |  |  |                     onOk: () => this.submit('/panel/inbound/delDepletedClients/' + dbInboundId), | 
					
						
							| 
									
										
										
										
											2023-04-25 15:13:37 +00:00
										 |  |  |                 }) | 
					
						
							|  |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |             isExpiry(dbInbound, index) { | 
					
						
							|  |  |  |                 return dbInbound.toInbound().isExpiry(index) | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             getUpStats(dbInbound, email) { | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |                 if (email.length == 0) return 0 | 
					
						
							| 
									
										
										
										
											2023-03-16 22:01:14 +00:00
										 |  |  |                 clientStats = dbInbound.clientStats.find(stats => stats.email === email) | 
					
						
							|  |  |  |                 return clientStats ? clientStats.up : 0 | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |             }, | 
					
						
							|  |  |  |             getDownStats(dbInbound, email) { | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |                 if (email.length == 0) return 0 | 
					
						
							| 
									
										
										
										
											2023-03-16 22:01:14 +00:00
										 |  |  |                 clientStats = dbInbound.clientStats.find(stats => stats.email === email) | 
					
						
							|  |  |  |                 return clientStats ? clientStats.down : 0 | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-05-16 22:31:56 +00:00
										 |  |  |             statsColor(dbInbound, email) { | 
					
						
							|  |  |  |                 if(email.length == 0) return 'blue'; | 
					
						
							|  |  |  |                 clientStats = dbInbound.clientStats.find(stats => stats.email === email); | 
					
						
							|  |  |  |                 return usageColor(clientStats.down + clientStats.up, this.trafficDiff, clientStats.total); | 
					
						
							| 
									
										
										
										
											2023-03-16 22:01:14 +00:00
										 |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |             isClientEnabled(dbInbound, email) { | 
					
						
							|  |  |  |                 clientStats = dbInbound.clientStats ? dbInbound.clientStats.find(stats => stats.email === email) : null | 
					
						
							|  |  |  |                 return clientStats ? clientStats['enable'] : true | 
					
						
							|  |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |             isRemovable(dbInbound_id) { | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |                 return this.getInboundClients(this.dbInbounds.find(row => row.id === dbInbound_id)).length > 1 | 
					
						
							|  |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-03-16 22:01:14 +00:00
										 |  |  |             inboundLinks(dbInboundId) { | 
					
						
							|  |  |  |                 dbInbound = this.dbInbounds.find(row => row.id === dbInboundId); | 
					
						
							| 
									
										
										
										
											2023-05-22 23:45:34 +00:00
										 |  |  |                 newDbInbound = this.checkFallback(dbInbound); | 
					
						
							|  |  |  |                 txtModal.show('{{ i18n "pages.inbounds.export"}}', newDbInbound.genInboundLinks, newDbInbound.remark); | 
					
						
							| 
									
										
										
										
											2023-03-16 22:01:14 +00:00
										 |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |             exportAllLinks() { | 
					
						
							| 
									
										
										
										
											2023-03-16 22:01:14 +00:00
										 |  |  |                 let copyText = ''; | 
					
						
							|  |  |  |                 for (const dbInbound of this.dbInbounds) { | 
					
						
							|  |  |  |                     copyText += dbInbound.genInboundLinks | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                 } | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |                 txtModal.show('{{ i18n "pages.inbounds.export"}}', copyText, 'All-Inbounds'); | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-04-29 19:03:45 +00:00
										 |  |  |             async startDataRefreshLoop() { | 
					
						
							|  |  |  |                 while (this.isRefreshEnabled) { | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |                     try { | 
					
						
							|  |  |  |                         await this.getDBInbounds(); | 
					
						
							|  |  |  |                     } catch (e) { | 
					
						
							|  |  |  |                         console.error(e); | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  |                     await PromiseUtil.sleep(this.refreshInterval); | 
					
						
							| 
									
										
										
										
											2023-04-29 19:03:45 +00:00
										 |  |  |                 } | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             toggleRefresh() { | 
					
						
							|  |  |  |                 localStorage.setItem("isRefreshEnabled", this.isRefreshEnabled); | 
					
						
							|  |  |  |                 if (this.isRefreshEnabled) { | 
					
						
							|  |  |  |                     this.startDataRefreshLoop(); | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |             changeRefreshInterval() { | 
					
						
							| 
									
										
										
										
											2023-04-29 19:03:45 +00:00
										 |  |  |                 localStorage.setItem("refreshInterval", this.refreshInterval); | 
					
						
							|  |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |             async manualRefresh() { | 
					
						
							|  |  |  |                 if (!this.refreshing) { | 
					
						
							| 
									
										
										
										
											2023-05-06 15:50:42 +00:00
										 |  |  |                     this.spinning = true; | 
					
						
							|  |  |  |                     await this.getDBInbounds(); | 
					
						
							|  |  |  |                     this.spinning = false; | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |         }, | 
					
						
							|  |  |  |         watch: { | 
					
						
							| 
									
										
										
										
											2023-02-12 13:50:09 +00:00
										 |  |  |             searchKey: debounce(function (newVal) { | 
					
						
							|  |  |  |                 this.searchInbounds(newVal); | 
					
						
							|  |  |  |             }, 500) | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |         }, | 
					
						
							|  |  |  |         mounted() { | 
					
						
							| 
									
										
										
										
											2023-04-29 19:03:45 +00:00
										 |  |  |             this.loading(); | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |             this.getDefaultSettings(); | 
					
						
							| 
									
										
										
										
											2023-04-29 19:03:45 +00:00
										 |  |  |             if (this.isRefreshEnabled) { | 
					
						
							|  |  |  |                 this.startDataRefreshLoop(); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |             else { | 
					
						
							|  |  |  |                 this.getDBInbounds(); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |             this.loading(false); | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |         }, | 
					
						
							|  |  |  |         computed: { | 
					
						
							|  |  |  |             total() { | 
					
						
							|  |  |  |                 let down = 0, up = 0; | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |                 let clients = 0, deactive = [], depleted = [], expiring = []; | 
					
						
							| 
									
										
										
										
											2023-03-16 22:01:14 +00:00
										 |  |  |                 this.dbInbounds.forEach(dbInbound => { | 
					
						
							|  |  |  |                     down += dbInbound.down; | 
					
						
							|  |  |  |                     up += dbInbound.up; | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |                     if (this.clientCount[dbInbound.id]) { | 
					
						
							|  |  |  |                         clients += this.clientCount[dbInbound.id].clients; | 
					
						
							|  |  |  |                         deactive = deactive.concat(this.clientCount[dbInbound.id].deactive); | 
					
						
							|  |  |  |                         depleted = depleted.concat(this.clientCount[dbInbound.id].depleted); | 
					
						
							|  |  |  |                         expiring = expiring.concat(this.clientCount[dbInbound.id].expiring); | 
					
						
							| 
									
										
										
										
											2023-03-16 22:01:14 +00:00
										 |  |  |                     } | 
					
						
							|  |  |  |                 }); | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                 return { | 
					
						
							|  |  |  |                     down: down, | 
					
						
							|  |  |  |                     up: up, | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |                     clients: clients, | 
					
						
							| 
									
										
										
										
											2023-03-16 22:01:14 +00:00
										 |  |  |                     deactive: deactive, | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |                     depleted: depleted, | 
					
						
							|  |  |  |                     expiring: expiring, | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                 }; | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |     }); | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  | </script> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | {{template "inboundModal"}} | 
					
						
							|  |  |  | {{template "promptModal"}} | 
					
						
							|  |  |  | {{template "qrcodeModal"}} | 
					
						
							|  |  |  | {{template "textModal"}} | 
					
						
							|  |  |  | {{template "inboundInfoModal"}} | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  | {{template "clientsModal"}} | 
					
						
							|  |  |  | {{template "clientsBulkModal"}} | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  | </body> | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  | </html> |