| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  | <!DOCTYPE html> | 
					
						
							|  |  |  | <html lang="en"> | 
					
						
							|  |  |  | {{template "head" .}} | 
					
						
							|  |  |  | <style> | 
					
						
							| 
									
										
										
										
											2024-04-20 18:45:36 +00:00
										 |  |  |   .ant-table:not(.ant-table-expanded-row .ant-table) { | 
					
						
							|  |  |  |     outline: 1px solid #f0f0f0; | 
					
						
							|  |  |  |     outline-offset: -1px; | 
					
						
							|  |  |  |     border-radius: 1rem; | 
					
						
							|  |  |  |     overflow-x: hidden; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   .dark .ant-table:not(.ant-table-expanded-row .ant-table) { | 
					
						
							|  |  |  |     outline-color: var(--dark-color-table-ring); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   .ant-table .ant-table-content .ant-table-scroll .ant-table-body { | 
					
						
							|  |  |  |     overflow-y: hidden; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   .ant-table .ant-table-content .ant-table-tbody tr:last-child .ant-table-wrapper { | 
					
						
							| 
									
										
										
										
											2024-11-11 21:58:00 +00:00
										 |  |  | 	  margin:-10px 22px !important; | 
					
						
							| 
									
										
										
										
											2024-04-20 18:45:36 +00:00
										 |  |  |   } | 
					
						
							|  |  |  |   .ant-table .ant-table-content .ant-table-tbody tr:last-child .ant-table-wrapper .ant-table { | 
					
						
							|  |  |  |     border-bottom-left-radius: 1rem; | 
					
						
							|  |  |  |     border-bottom-right-radius: 1rem; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   .ant-table .ant-table-content .ant-table-tbody tr:last-child tr:last-child td { | 
					
						
							|  |  |  | 	  border-bottom-color: transparent; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   .ant-table .ant-table-tbody tr:last-child.ant-table-expanded-row .ant-table-wrapper .ant-table-tbody>tr:last-child>td:first-child { | 
					
						
							|  |  |  |     border-bottom-left-radius: 6px; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   .ant-table .ant-table-tbody tr:last-child.ant-table-expanded-row .ant-table-wrapper .ant-table-tbody>tr:last-child>td:last-child { | 
					
						
							|  |  |  |     border-bottom-right-radius: 6px; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2024-03-20 10:43:37 +00:00
										 |  |  |   @media (min-width: 769px) { | 
					
						
							|  |  |  |     .ant-layout-content { | 
					
						
							|  |  |  |       margin: 24px 16px; | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2024-03-20 10:43:37 +00:00
										 |  |  |   } | 
					
						
							|  |  |  |   @media (max-width: 768px) { | 
					
						
							|  |  |  |     .ant-card-body { | 
					
						
							|  |  |  |       padding: .5rem; | 
					
						
							| 
									
										
										
										
											2023-12-04 18:17:38 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2024-04-20 18:45:36 +00:00
										 |  |  |     .ant-table .ant-table-content .ant-table-tbody tr:last-child .ant-table-wrapper { | 
					
						
							| 
									
										
										
										
											2024-11-11 21:58:00 +00:00
										 |  |  | 	    margin:-10px 2px !important; | 
					
						
							| 
									
										
										
										
											2024-04-20 18:45:36 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2024-03-20 10:43:37 +00:00
										 |  |  |   } | 
					
						
							|  |  |  |   .ant-col-sm-24 { | 
					
						
							|  |  |  |     margin: 0.5rem -2rem 0.5rem 2rem; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   tr.hideExpandIcon .ant-table-row-expand-icon { | 
					
						
							|  |  |  |     display: none; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   .infinite-tag { | 
					
						
							|  |  |  |     padding: 0 5px; | 
					
						
							|  |  |  |     border-radius: 2rem; | 
					
						
							|  |  |  |     min-width: 50px; | 
					
						
							| 
									
										
										
										
											2024-04-20 18:45:36 +00:00
										 |  |  |     min-height: 22px; | 
					
						
							| 
									
										
										
										
											2024-03-20 10:43:37 +00:00
										 |  |  |   } | 
					
						
							|  |  |  |   .infinite-bar .ant-progress-inner .ant-progress-bg { | 
					
						
							|  |  |  |     background-color: #F2EAF1; | 
					
						
							|  |  |  |     border: #D5BED2 solid 1px; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   .dark .infinite-bar .ant-progress-inner .ant-progress-bg { | 
					
						
							| 
									
										
										
										
											2024-04-20 18:45:36 +00:00
										 |  |  |     background-color: #7a316f !important; | 
					
						
							| 
									
										
										
										
											2024-03-20 10:43:37 +00:00
										 |  |  |     border: #7a316f solid 1px; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   .ant-collapse { | 
					
						
							|  |  |  |     margin: 5px 0; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   .info-large-tag { | 
					
						
							|  |  |  |     max-width: 200px; | 
					
						
							|  |  |  |     overflow: hidden; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   .online-animation .ant-badge-status-dot { | 
					
						
							|  |  |  |     animation: onlineAnimation 1.2s linear infinite; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   @keyframes onlineAnimation { | 
					
						
							|  |  |  |     0%, | 
					
						
							|  |  |  |     50%, | 
					
						
							|  |  |  |     100% { | 
					
						
							|  |  |  |       transform: scale(1); | 
					
						
							|  |  |  |       opacity: 1; | 
					
						
							| 
									
										
										
										
											2023-12-04 18:17:38 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2024-03-20 10:43:37 +00:00
										 |  |  |     10% { | 
					
						
							|  |  |  |       transform: scale(1.5); | 
					
						
							|  |  |  |       opacity: .2; | 
					
						
							| 
									
										
										
										
											2023-12-13 15:57:36 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2024-03-20 10:43:37 +00:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2024-04-20 18:45:36 +00:00
										 |  |  |   .tr-table-box { | 
					
						
							|  |  |  |     display: flex; | 
					
						
							|  |  |  |     gap: 4px; | 
					
						
							|  |  |  |     justify-content: center; | 
					
						
							|  |  |  |     align-items: center; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   .tr-table-rt { | 
					
						
							|  |  |  |     flex-basis: 70px; | 
					
						
							|  |  |  |     min-width: 70px; | 
					
						
							|  |  |  |     text-align: end; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   .tr-table-lt { | 
					
						
							|  |  |  |     flex-basis: 70px; | 
					
						
							|  |  |  |     min-width: 70px; | 
					
						
							|  |  |  |     text-align: start; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   .tr-table-bar { | 
					
						
							|  |  |  |     flex-basis: 160px; | 
					
						
							|  |  |  |     min-width: 60px; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   .tr-infinity-ch { | 
					
						
							|  |  |  |     font-size: 14pt; | 
					
						
							|  |  |  |     max-height: 24px; | 
					
						
							|  |  |  |     display: inline-flex; | 
					
						
							|  |  |  |     align-items: center; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   .ant-table-expanded-row .ant-table .ant-table-body { | 
					
						
							|  |  |  |     overflow-x: hidden; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   .ant-table-expanded-row .ant-table-tbody>tr>td { | 
					
						
							|  |  |  |     padding: 10px 2px; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   .ant-table-expanded-row .ant-table-thead>tr>th { | 
					
						
							|  |  |  |     padding: 12px 2px; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											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> | 
					
						
							| 
									
										
										
										
											2023-12-04 18:17:38 +00:00
										 |  |  | <a-layout id="app" v-cloak :class="themeSwitcher.currentTheme"> | 
					
						
							| 
									
										
										
										
											2024-03-20 10:43:37 +00:00
										 |  |  |   {{ template "commonSider" . }} | 
					
						
							|  |  |  |   <a-layout id="content-layout"> | 
					
						
							|  |  |  |     <a-layout-content> | 
					
						
							|  |  |  |       <a-spin :spinning="spinning" :delay="500" tip='{{ i18n "loading"}}'> | 
					
						
							|  |  |  |         <transition name="list" appear> | 
					
						
							|  |  |  |           <a-alert type="error" v-if="showAlert" style="margin-bottom: 10px" | 
					
						
							|  |  |  |             message='{{ i18n "secAlertTitle" }}' | 
					
						
							|  |  |  |             color="red" | 
					
						
							|  |  |  |             description='{{ i18n "secAlertSsl" }}' | 
					
						
							|  |  |  |             show-icon closable> | 
					
						
							|  |  |  |           </a-alert> | 
					
						
							|  |  |  |         </transition> | 
					
						
							|  |  |  |         <transition name="list" appear> | 
					
						
							|  |  |  |           <a-card hoverable> | 
					
						
							|  |  |  |             <a-row> | 
					
						
							|  |  |  |               <a-col :xs="24" :sm="24" :lg="12"> | 
					
						
							|  |  |  |                 {{ i18n "pages.inbounds.totalDownUp" }}: | 
					
						
							|  |  |  |                 <a-tag color="green">[[ sizeFormat(total.up) ]] / [[ sizeFormat(total.down) ]]</a-tag> | 
					
						
							|  |  |  |               </a-col> | 
					
						
							|  |  |  |               <a-col :xs="24" :sm="24" :lg="12"> | 
					
						
							|  |  |  |                 {{ i18n "pages.inbounds.totalUsage" }}: | 
					
						
							|  |  |  |                 <a-tag color="green">[[ sizeFormat(total.up + total.down) ]]</a-tag> | 
					
						
							|  |  |  |               </a-col> | 
					
						
							|  |  |  |               <a-col :xs="24" :sm="24" :lg="12"> | 
					
						
							|  |  |  |                 {{ i18n "pages.inbounds.inboundCount" }}: | 
					
						
							|  |  |  |                 <a-tag color="green">[[ dbInbounds.length ]]</a-tag> | 
					
						
							|  |  |  |               </a-col> | 
					
						
							|  |  |  |               <a-col :xs="24" :sm="24" :lg="12"> | 
					
						
							|  |  |  |                 <template> | 
					
						
							|  |  |  |                   <div> | 
					
						
							|  |  |  |                     <a-back-top :target="() => document.getElementById('content-layout')" visibility-height="200"></a-back-top> | 
					
						
							|  |  |  |                     {{ i18n "clients" }}: | 
					
						
							|  |  |  |                     <a-tag color="green">[[ total.clients ]]</a-tag> | 
					
						
							|  |  |  |                     <a-popover title='{{ i18n "disabled" }}' :overlay-class-name="themeSwitcher.currentTheme"> | 
					
						
							|  |  |  |                       <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> | 
					
						
							|  |  |  |                     <a-popover title='{{ i18n "depleted" }}' :overlay-class-name="themeSwitcher.currentTheme"> | 
					
						
							|  |  |  |                       <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> | 
					
						
							|  |  |  |                     <a-popover title='{{ i18n "depletingSoon" }}' :overlay-class-name="themeSwitcher.currentTheme"> | 
					
						
							|  |  |  |                       <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> | 
					
						
							|  |  |  |                     <a-popover title='{{ i18n "online" }}' :overlay-class-name="themeSwitcher.currentTheme"> | 
					
						
							|  |  |  |                       <template slot="content"> | 
					
						
							|  |  |  |                         <p v-for="clientEmail in onlineClients">[[ clientEmail ]]</p> | 
					
						
							|  |  |  |                       </template> | 
					
						
							|  |  |  |                       <a-tag color="blue" v-if="onlineClients.length">[[ onlineClients.length ]]</a-tag> | 
					
						
							|  |  |  |                     </a-popover> | 
					
						
							|  |  |  |                   </div> | 
					
						
							|  |  |  |                 </template> | 
					
						
							|  |  |  |               </a-col> | 
					
						
							|  |  |  |             </a-row> | 
					
						
							|  |  |  |           </a-card> | 
					
						
							|  |  |  |         </transition> | 
					
						
							|  |  |  |         <transition name="list" appear> | 
					
						
							|  |  |  |           <a-card hoverable> | 
					
						
							|  |  |  |             <div slot="title"> | 
					
						
							|  |  |  |               <a-row> | 
					
						
							|  |  |  |                 <a-col :xs="12" :sm="12" :lg="12"> | 
					
						
							|  |  |  |                   <a-button type="primary" icon="plus" @click="openAddInbound"> | 
					
						
							|  |  |  |                     <template v-if="!isMobile">{{ i18n "pages.inbounds.addInbound" }}</template> | 
					
						
							|  |  |  |                   </a-button> | 
					
						
							|  |  |  |                   <a-dropdown :trigger="['click']"> | 
					
						
							|  |  |  |                     <a-button type="primary" icon="menu"> | 
					
						
							|  |  |  |                       <template v-if="!isMobile">{{ i18n "pages.inbounds.generalActions" }}</template> | 
					
						
							|  |  |  |                     </a-button> | 
					
						
							|  |  |  |                     <a-menu slot="overlay" @click="a => generalActions(a)" :theme="themeSwitcher.currentTheme"> | 
					
						
							|  |  |  |                       <a-menu-item key="import"> | 
					
						
							|  |  |  |                         <a-icon type="import"></a-icon> | 
					
						
							|  |  |  |                         {{ i18n "pages.inbounds.importInbound" }} | 
					
						
							|  |  |  |                       </a-menu-item> | 
					
						
							|  |  |  |                       <a-menu-item key="export"> | 
					
						
							|  |  |  |                         <a-icon type="export"></a-icon> | 
					
						
							|  |  |  |                         {{ i18n "pages.inbounds.export" }} | 
					
						
							|  |  |  |                       </a-menu-item> | 
					
						
							|  |  |  |                       <a-menu-item key="subs" v-if="subSettings.enable"> | 
					
						
							|  |  |  |                         <a-icon type="export"></a-icon> | 
					
						
							|  |  |  |                         {{ i18n "pages.inbounds.export" }} - {{ i18n "pages.settings.subSettings" }} | 
					
						
							|  |  |  |                       </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" style="color: #FF4D4F;"> | 
					
						
							|  |  |  |                         <a-icon type="rest"></a-icon> | 
					
						
							|  |  |  |                         {{ i18n "pages.inbounds.delDepletedClients" }} | 
					
						
							|  |  |  |                       </a-menu-item> | 
					
						
							|  |  |  |                     </a-menu> | 
					
						
							|  |  |  |                   </a-dropdown> | 
					
						
							|  |  |  |                 </a-col> | 
					
						
							|  |  |  |                 <a-col :xs="12" :sm="12" :lg="12" style="text-align: right;"> | 
					
						
							|  |  |  |                   <a-select v-model="refreshInterval" | 
					
						
							|  |  |  |                       style="width: 65px;" | 
					
						
							|  |  |  |                       v-if="isRefreshEnabled" | 
					
						
							|  |  |  |                       @change="changeRefreshInterval" | 
					
						
							|  |  |  |                       :dropdown-class-name="themeSwitcher.currentTheme"> | 
					
						
							|  |  |  |                     <a-select-option v-for="key in [5,10,30,60]" :value="key*1000">[[ key ]]s</a-select-option> | 
					
						
							|  |  |  |                   </a-select> | 
					
						
							|  |  |  |                   <a-icon type="sync" :spin="refreshing" @click="manualRefresh" style="margin: 0 5px;"></a-icon> | 
					
						
							|  |  |  |                   <a-switch v-model="isRefreshEnabled" @change="toggleRefresh"></a-switch> | 
					
						
							|  |  |  |                 </a-col> | 
					
						
							|  |  |  |               </a-row> | 
					
						
							|  |  |  |             </div> | 
					
						
							|  |  |  |             <div :style="isMobile ? '' : 'display: flex; align-items: center; justify-content: flex-start;'"> | 
					
						
							|  |  |  |               <a-switch v-model="enableFilter" | 
					
						
							|  |  |  |                   :style="isMobile ? 'margin-bottom: .5rem; display: flex;' : 'margin-right: .5rem;'" | 
					
						
							|  |  |  |                   @change="toggleFilter"> | 
					
						
							|  |  |  |                 <a-icon slot="checkedChildren" type="search"></a-icon> | 
					
						
							|  |  |  |                 <a-icon slot="unCheckedChildren" type="filter"></a-icon> | 
					
						
							|  |  |  |               </a-switch> | 
					
						
							|  |  |  |               <a-input v-if="!enableFilter" v-model.lazy="searchKey" placeholder='{{ i18n "search" }}' autofocus style="max-width: 300px" :size="isMobile ? 'small' : ''"></a-input> | 
					
						
							|  |  |  |               <a-radio-group v-if="enableFilter" v-model="filterBy" @change="filterInbounds" button-style="solid" :size="isMobile ? 'small' : ''"> | 
					
						
							|  |  |  |                 <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-button value="online">{{ i18n "online" }}</a-radio-button> | 
					
						
							|  |  |  |               </a-radio-group> | 
					
						
							|  |  |  |             </div> | 
					
						
							|  |  |  |             <a-back-top></a-back-top> | 
					
						
							|  |  |  |             <a-table :columns="isMobile ? mobileColumns : columns" :row-key="dbInbound => dbInbound.id" | 
					
						
							|  |  |  |                 :data-source="searchedInbounds" | 
					
						
							|  |  |  |                 :scroll="isMobile ? {} : { x: 1000 }" | 
					
						
							|  |  |  |                 :pagination=pagination(searchedInbounds) | 
					
						
							|  |  |  |                 :expand-icon-as-cell="false" | 
					
						
							|  |  |  |                 :expand-row-by-click="false" | 
					
						
							|  |  |  |                 :expand-icon-column-index="0" | 
					
						
							|  |  |  |                 :indent-size="0" | 
					
						
							|  |  |  |                 :row-class-name="dbInbound => (dbInbound.isMultiUser() ? '' : 'hideExpandIcon')" | 
					
						
							|  |  |  |                 style="margin-top: 10px"> | 
					
						
							|  |  |  |               <template slot="action" slot-scope="text, dbInbound"> | 
					
						
							|  |  |  |                 <a-dropdown :trigger="['click']"> | 
					
						
							|  |  |  |                   <a-icon @click="e => e.preventDefault()" type="more" style="font-size: 20px; text-decoration: solid;"></a-icon> | 
					
						
							|  |  |  |                   <a-menu slot="overlay" @click="a => clickAction(a, dbInbound)" :theme="themeSwitcher.currentTheme"> | 
					
						
							|  |  |  |                     <a-menu-item key="edit"> | 
					
						
							|  |  |  |                       <a-icon type="edit"></a-icon> | 
					
						
							|  |  |  |                       {{ i18n "edit" }} | 
					
						
							|  |  |  |                     </a-menu-item> | 
					
						
							|  |  |  |                     <a-menu-item key="qrcode" v-if="(dbInbound.isSS && !dbInbound.toInbound().isSSMultiUser) || dbInbound.isWireguard"> | 
					
						
							|  |  |  |                       <a-icon type="qrcode"></a-icon> | 
					
						
							|  |  |  |                       {{ i18n "qrCode" }} | 
					
						
							|  |  |  |                     </a-menu-item> | 
					
						
							|  |  |  |                     <template v-if="dbInbound.isMultiUser()"> | 
					
						
							|  |  |  |                       <a-menu-item key="addClient"> | 
					
						
							|  |  |  |                         <a-icon type="user-add"></a-icon> | 
					
						
							|  |  |  |                         {{ i18n "pages.client.add"}} | 
					
						
							|  |  |  |                       </a-menu-item> | 
					
						
							|  |  |  |                       <a-menu-item key="addBulkClient"> | 
					
						
							|  |  |  |                         <a-icon type="usergroup-add"></a-icon> | 
					
						
							|  |  |  |                         {{ i18n "pages.client.bulk"}} | 
					
						
							|  |  |  |                       </a-menu-item> | 
					
						
							|  |  |  |                       <a-menu-item key="resetClients"> | 
					
						
							|  |  |  |                         <a-icon type="file-done"></a-icon> | 
					
						
							|  |  |  |                         {{ i18n "pages.inbounds.resetInboundClientTraffics"}} | 
					
						
							|  |  |  |                       </a-menu-item> | 
					
						
							|  |  |  |                       <a-menu-item key="export"> | 
					
						
							|  |  |  |                         <a-icon type="export"></a-icon> | 
					
						
							|  |  |  |                         {{ i18n "pages.inbounds.export"}} | 
					
						
							|  |  |  |                       </a-menu-item> | 
					
						
							|  |  |  |                       <a-menu-item key="subs" v-if="subSettings.enable"> | 
					
						
							|  |  |  |                         <a-icon type="export"></a-icon> | 
					
						
							|  |  |  |                         {{ i18n "pages.inbounds.export"}} - {{ i18n "pages.settings.subSettings" }} | 
					
						
							|  |  |  |                       </a-menu-item> | 
					
						
							|  |  |  |                       <a-menu-item key="delDepletedClients" style="color: #FF4D4F;"> | 
					
						
							|  |  |  |                         <a-icon type="rest"></a-icon> | 
					
						
							|  |  |  |                         {{ i18n "pages.inbounds.delDepletedClients" }} | 
					
						
							|  |  |  |                       </a-menu-item> | 
					
						
							|  |  |  |                     </template> | 
					
						
							|  |  |  |                     <template v-else> | 
					
						
							|  |  |  |                       <a-menu-item key="showInfo"> | 
					
						
							|  |  |  |                         <a-icon type="info-circle"></a-icon> | 
					
						
							|  |  |  |                         {{ i18n "info"}} | 
					
						
							|  |  |  |                       </a-menu-item> | 
					
						
							|  |  |  |                     </template> | 
					
						
							|  |  |  |                     <a-menu-item key="clipboard"> | 
					
						
							|  |  |  |                       <a-icon type="copy"></a-icon> | 
					
						
							|  |  |  |                       {{ i18n "pages.inbounds.exportInbound" }} | 
					
						
							|  |  |  |                     </a-menu-item> | 
					
						
							|  |  |  |                     <a-menu-item key="resetTraffic"> | 
					
						
							|  |  |  |                       <a-icon type="retweet"></a-icon> {{ i18n "pages.inbounds.resetTraffic" }} | 
					
						
							|  |  |  |                     </a-menu-item> | 
					
						
							|  |  |  |                     <a-menu-item key="clone"> | 
					
						
							|  |  |  |                       <a-icon type="block"></a-icon> {{ i18n "pages.inbounds.clone"}} | 
					
						
							|  |  |  |                     </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-item v-if="isMobile"> | 
					
						
							|  |  |  |                       <a-switch size="small" v-model="dbInbound.enable" @change="switchEnable(dbInbound.id,dbInbound.enable)"></a-switch> | 
					
						
							|  |  |  |                       {{ i18n "pages.inbounds.enable" }} | 
					
						
							|  |  |  |                     </a-menu-item> | 
					
						
							|  |  |  |                   </a-menu> | 
					
						
							|  |  |  |                 </a-dropdown> | 
					
						
							|  |  |  |               </template> | 
					
						
							|  |  |  |               <template slot="protocol" slot-scope="text, dbInbound"> | 
					
						
							|  |  |  |                 <a-tag style="margin:0;" color="purple">[[ dbInbound.protocol ]]</a-tag> | 
					
						
							|  |  |  |                 <template v-if="dbInbound.isVMess || dbInbound.isVLess || dbInbound.isTrojan || dbInbound.isSS"> | 
					
						
							|  |  |  |                   <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="blue">TLS</a-tag> | 
					
						
							|  |  |  |                   <a-tag style="margin:0;" v-if="dbInbound.toInbound().stream.isReality" color="blue">Reality</a-tag> | 
					
						
							|  |  |  |                 </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> | 
					
						
							|  |  |  |                   <a-popover title='{{ i18n "disabled" }}' :overlay-class-name="themeSwitcher.currentTheme"> | 
					
						
							|  |  |  |                     <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> | 
					
						
							|  |  |  |                   <a-popover title='{{ i18n "depleted" }}' :overlay-class-name="themeSwitcher.currentTheme"> | 
					
						
							|  |  |  |                     <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> | 
					
						
							|  |  |  |                   <a-popover title='{{ i18n "depletingSoon" }}' :overlay-class-name="themeSwitcher.currentTheme"> | 
					
						
							|  |  |  |                     <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> | 
					
						
							|  |  |  |                   <a-popover title='{{ i18n "online" }}' :overlay-class-name="themeSwitcher.currentTheme"> | 
					
						
							|  |  |  |                     <template slot="content"> | 
					
						
							|  |  |  |                       <p v-for="clientEmail in clientCount[dbInbound.id].online">[[ clientEmail ]]</p> | 
					
						
							|  |  |  |                     </template> | 
					
						
							|  |  |  |                     <a-tag style="margin:0; padding: 0 2px;" color="blue" v-if="clientCount[dbInbound.id].online.length">[[ clientCount[dbInbound.id].online.length ]]</a-tag> | 
					
						
							|  |  |  |                   </a-popover> | 
					
						
							|  |  |  |                 </template> | 
					
						
							|  |  |  |               </template> | 
					
						
							|  |  |  |               <template slot="traffic" slot-scope="text, dbInbound"> | 
					
						
							|  |  |  |                 <a-popover :overlay-class-name="themeSwitcher.currentTheme"> | 
					
						
							|  |  |  |                   <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="usageColor(dbInbound.up + dbInbound.down, app.trafficDiff, dbInbound.total)"> | 
					
						
							|  |  |  |                     [[ sizeFormat(dbInbound.up + dbInbound.down) ]] / | 
					
						
							|  |  |  |                     <template v-if="dbInbound.total > 0"> | 
					
						
							|  |  |  |                         [[ sizeFormat(dbInbound.total) ]] | 
					
						
							|  |  |  |                     </template> | 
					
						
							|  |  |  |                     <template v-else> | 
					
						
							| 
									
										
										
										
											2024-04-20 18:45:36 +00:00
										 |  |  |                       <svg height="10px" width="14px" viewBox="0 0 640 512" fill="currentColor"> | 
					
						
							|  |  |  |                         <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" fill="currentColor"></path> | 
					
						
							| 
									
										
										
										
											2024-03-20 10:43:37 +00:00
										 |  |  |                       </svg> | 
					
						
							|  |  |  |                     </template> | 
					
						
							|  |  |  |                   </a-tag> | 
					
						
							|  |  |  |                 </a-popover> | 
					
						
							|  |  |  |               </template> | 
					
						
							|  |  |  |               <template slot="enable" slot-scope="text, dbInbound"> | 
					
						
							|  |  |  |                 <a-switch v-model="dbInbound.enable" @change="switchEnable(dbInbound.id,dbInbound.enable)"></a-switch> | 
					
						
							|  |  |  |               </template> | 
					
						
							|  |  |  |               <template slot="expiryTime" slot-scope="text, dbInbound"> | 
					
						
							|  |  |  |                 <a-popover v-if="dbInbound.expiryTime > 0" :overlay-class-name="themeSwitcher.currentTheme"> | 
					
						
							| 
									
										
										
										
											2024-07-12 23:38:51 +00:00
										 |  |  |                   <template slot="content" v-if="app.datepicker === 'gregorian'"> | 
					
						
							| 
									
										
										
										
											2024-03-20 10:43:37 +00:00
										 |  |  |                     [[ DateUtil.formatMillis(dbInbound.expiryTime) ]] | 
					
						
							|  |  |  |                   </template> | 
					
						
							| 
									
										
										
										
											2024-07-12 23:38:51 +00:00
										 |  |  |                   <template v-else slot="content"> | 
					
						
							|  |  |  |                     [[ DateUtil.convertToJalalian(moment(dbInbound.expiryTime)) ]] | 
					
						
							|  |  |  |                   </template> | 
					
						
							| 
									
										
										
										
											2024-03-20 10:43:37 +00:00
										 |  |  |                   <a-tag style="min-width: 50px;" :color="usageColor(new Date().getTime(), app.expireDiff, dbInbound._expiryTime)"> | 
					
						
							|  |  |  |                     [[ remainedDays(dbInbound._expiryTime) ]] | 
					
						
							|  |  |  |                   </a-tag> | 
					
						
							|  |  |  |                 </a-popover> | 
					
						
							| 
									
										
										
										
											2024-04-20 18:45:36 +00:00
										 |  |  |                 <a-tag v-else color="purple" class="infinite-tag"> | 
					
						
							|  |  |  |                   <svg height="10px" width="14px" viewBox="0 0 640 512" fill="currentColor"> | 
					
						
							|  |  |  |                     <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" fill="currentColor"></path> | 
					
						
							|  |  |  |                   </svg> | 
					
						
							|  |  |  |                 </a-tag> | 
					
						
							| 
									
										
										
										
											2024-03-20 10:43:37 +00:00
										 |  |  |               </template> | 
					
						
							|  |  |  |               <template slot="info" slot-scope="text, dbInbound"> | 
					
						
							|  |  |  |                 <a-popover placement="bottomRight" :overlay-class-name="themeSwitcher.currentTheme" trigger="click"> | 
					
						
							|  |  |  |                   <template slot="content"> | 
					
						
							|  |  |  |                     <table cellpadding="2"> | 
					
						
							|  |  |  |                       <tr> | 
					
						
							|  |  |  |                         <td>{{ i18n "pages.inbounds.protocol" }}</td> | 
					
						
							|  |  |  |                         <td> | 
					
						
							|  |  |  |                           <a-tag style="margin:0;" color="purple">[[ dbInbound.protocol ]]</a-tag> | 
					
						
							|  |  |  |                           <template v-if="dbInbound.isVMess || dbInbound.isVLess || dbInbound.isTrojan || dbInbound.isSS"> | 
					
						
							|  |  |  |                             <a-tag style="margin:0;" color="blue">[[ dbInbound.toInbound().stream.network ]]</a-tag> | 
					
						
							|  |  |  |                             <a-tag style="margin:0;" v-if="dbInbound.toInbound().stream.isTls" color="green">tls</a-tag> | 
					
						
							|  |  |  |                             <a-tag style="margin:0;" v-if="dbInbound.toInbound().stream.isReality" color="green">reality</a-tag> | 
					
						
							|  |  |  |                           </template> | 
					
						
							|  |  |  |                         </td> | 
					
						
							|  |  |  |                       </tr> | 
					
						
							|  |  |  |                       <tr> | 
					
						
							|  |  |  |                         <td>{{ i18n "pages.inbounds.port" }}</td> | 
					
						
							|  |  |  |                         <td><a-tag>[[ dbInbound.port ]]</a-tag></td> | 
					
						
							|  |  |  |                       </tr> | 
					
						
							|  |  |  |                       <tr v-if="clientCount[dbInbound.id]"> | 
					
						
							|  |  |  |                         <td>{{ i18n "clients" }}</td> | 
					
						
							|  |  |  |                         <td> | 
					
						
							|  |  |  |                           <a-tag style="margin:0;" color="blue">[[ clientCount[dbInbound.id].clients ]]</a-tag> | 
					
						
							|  |  |  |                           <a-popover title='{{ i18n "disabled" }}' :overlay-class-name="themeSwitcher.currentTheme"> | 
					
						
							|  |  |  |                             <template slot="content"> | 
					
						
							|  |  |  |                               <p v-for="clientEmail in clientCount[dbInbound.id].deactive">[[ clientEmail ]]</p> | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                             </template> | 
					
						
							| 
									
										
										
										
											2024-03-20 10:43:37 +00:00
										 |  |  |                             <a-tag style="margin:0; padding: 0 2px;" v-if="clientCount[dbInbound.id].deactive.length">[[ clientCount[dbInbound.id].deactive.length ]]</a-tag> | 
					
						
							|  |  |  |                           </a-popover> | 
					
						
							|  |  |  |                           <a-popover title='{{ i18n "depleted" }}' :overlay-class-name="themeSwitcher.currentTheme"> | 
					
						
							|  |  |  |                             <template slot="content"> | 
					
						
							|  |  |  |                               <p v-for="clientEmail in clientCount[dbInbound.id].depleted">[[ clientEmail ]]</p> | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                             </template> | 
					
						
							| 
									
										
										
										
											2024-03-20 10:43:37 +00:00
										 |  |  |                             <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> | 
					
						
							|  |  |  |                           <a-popover title='{{ i18n "depletingSoon" }}' :overlay-class-name="themeSwitcher.currentTheme"> | 
					
						
							|  |  |  |                             <template slot="content"> | 
					
						
							|  |  |  |                               <p v-for="clientEmail in clientCount[dbInbound.id].expiring">[[ clientEmail ]]</p> | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                             </template> | 
					
						
							| 
									
										
										
										
											2024-03-20 10:43:37 +00:00
										 |  |  |                             <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> | 
					
						
							|  |  |  |                           <a-popover title='{{ i18n "online" }}' :overlay-class-name="themeSwitcher.currentTheme"> | 
					
						
							|  |  |  |                             <template slot="content"> | 
					
						
							|  |  |  |                               <p v-for="clientEmail in clientCount[dbInbound.id].online">[[ clientEmail ]]</p> | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                             </template> | 
					
						
							| 
									
										
										
										
											2024-03-20 10:43:37 +00:00
										 |  |  |                             <a-tag style="margin:0; padding: 0 2px;" color="green" v-if="clientCount[dbInbound.id].online.length">[[ clientCount[dbInbound.id].online.length ]]</a-tag> | 
					
						
							|  |  |  |                           </a-popover> | 
					
						
							|  |  |  |                         </td> | 
					
						
							|  |  |  |                       </tr> | 
					
						
							|  |  |  |                       <tr> | 
					
						
							|  |  |  |                         <td>{{ i18n "pages.inbounds.traffic" }}</td> | 
					
						
							|  |  |  |                         <td> | 
					
						
							|  |  |  |                           <a-popover :overlay-class-name="themeSwitcher.currentTheme"> | 
					
						
							|  |  |  |                             <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> | 
					
						
							| 
									
										
										
										
											2023-12-04 18:17:38 +00:00
										 |  |  |                             </template> | 
					
						
							| 
									
										
										
										
											2024-03-20 10:43:37 +00:00
										 |  |  |                             <a-tag :color="usageColor(dbInbound.up + dbInbound.down, app.trafficDiff, dbInbound.total)"> | 
					
						
							|  |  |  |                                 [[ sizeFormat(dbInbound.up + dbInbound.down) ]] / | 
					
						
							|  |  |  |                                 <template v-if="dbInbound.total > 0"> | 
					
						
							|  |  |  |                                     [[ sizeFormat(dbInbound.total) ]] | 
					
						
							|  |  |  |                                 </template> | 
					
						
							| 
									
										
										
										
											2024-04-20 18:45:36 +00:00
										 |  |  |                               <template v-else> | 
					
						
							|  |  |  |                                 <svg height="10px" width="14px" viewBox="0 0 640 512" fill="currentColor"> | 
					
						
							|  |  |  |                                   <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" fill="currentColor"></path> | 
					
						
							|  |  |  |                                 </svg> | 
					
						
							|  |  |  |                               </template> | 
					
						
							| 
									
										
										
										
											2024-03-20 10:43:37 +00:00
										 |  |  |                             </a-tag> | 
					
						
							|  |  |  |                           </a-popover> | 
					
						
							|  |  |  |                         </td> | 
					
						
							|  |  |  |                       </tr> | 
					
						
							|  |  |  |                       <tr> | 
					
						
							|  |  |  |                         <td>{{ i18n "pages.inbounds.expireDate" }}</td> | 
					
						
							|  |  |  |                         <td> | 
					
						
							| 
									
										
										
										
											2024-07-12 23:38:51 +00:00
										 |  |  |                           <a-tag style="min-width: 50px; text-align: center;" v-if="dbInbound.expiryTime > 0" | 
					
						
							|  |  |  |                             :color="dbInbound.isExpiry? 'red': 'blue'"> | 
					
						
							|  |  |  |                             <template v-if="app.datepicker === 'gregorian'"> | 
					
						
							|  |  |  |                               [[ DateUtil.formatMillis(dbInbound.expiryTime) ]] | 
					
						
							|  |  |  |                             </template> | 
					
						
							|  |  |  |                             <template v-else> | 
					
						
							|  |  |  |                               [[ DateUtil.convertToJalalian(moment(dbInbound.expiryTime)) ]] | 
					
						
							|  |  |  |                             </template> | 
					
						
							| 
									
										
										
										
											2024-03-20 10:43:37 +00:00
										 |  |  |                           </a-tag> | 
					
						
							| 
									
										
										
										
											2024-04-20 18:45:36 +00:00
										 |  |  |                           <a-tag v-else style="text-align: center;" color="purple" class="infinite-tag"> | 
					
						
							|  |  |  |                             <svg height="10px" width="14px" viewBox="0 0 640 512" fill="currentColor"> | 
					
						
							|  |  |  |                               <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" fill="currentColor"></path> | 
					
						
							|  |  |  |                             </svg> | 
					
						
							|  |  |  |                           </a-tag> | 
					
						
							| 
									
										
										
										
											2024-03-20 10:43:37 +00:00
										 |  |  |                         </td> | 
					
						
							|  |  |  |                       </tr> | 
					
						
							|  |  |  |                     </table> | 
					
						
							|  |  |  |                   </template> | 
					
						
							|  |  |  |                   <a-badge> | 
					
						
							|  |  |  |                     <a-icon v-if="!dbInbound.enable" slot="count" type="pause-circle" :style="'color: ' + themeSwitcher.isDarkTheme ? '#2c3950' : '#bcbcbc'"></a-icon> | 
					
						
							|  |  |  |                     <a-button shape="round" size="small" style="font-size: 14px; padding: 0 10px;"> | 
					
						
							|  |  |  |                       <a-icon type="info"></a-icon> | 
					
						
							|  |  |  |                     </a-button> | 
					
						
							|  |  |  |                   </a-badge> | 
					
						
							|  |  |  |                 </a-popover> | 
					
						
							|  |  |  |               </template> | 
					
						
							|  |  |  |               <template slot="expandedRowRender" slot-scope="record"> | 
					
						
							|  |  |  |                 <a-table | 
					
						
							|  |  |  |                   :row-key="client => client.id" | 
					
						
							|  |  |  |                   :columns="isMobile ? innerMobileColumns : innerColumns" | 
					
						
							|  |  |  |                   :data-source="getInboundClients(record)" | 
					
						
							|  |  |  |                   :pagination=pagination(getInboundClients(record)) | 
					
						
							| 
									
										
										
										
											2024-04-20 18:45:36 +00:00
										 |  |  |                   :style="isMobile ? 'margin: -10px 2px -11px;' : 'margin: -10px 22px -11px;'"> | 
					
						
							| 
									
										
										
										
											2024-03-20 10:43:37 +00:00
										 |  |  |                   {{template "client_table"}} | 
					
						
							|  |  |  |                 </a-table> | 
					
						
							|  |  |  |               </template> | 
					
						
							|  |  |  |             </a-table> | 
					
						
							|  |  |  |           </a-card> | 
					
						
							|  |  |  |         </transition> | 
					
						
							|  |  |  |       </a-spin> | 
					
						
							|  |  |  |     </a-layout-content> | 
					
						
							|  |  |  |   </a-layout> | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  | </a-layout> | 
					
						
							|  |  |  | {{template "js" .}} | 
					
						
							| 
									
										
										
										
											2023-12-05 17:13:36 +00:00
										 |  |  | <script src="{{ .base_path }}assets/base64/base64.min.js"></script> | 
					
						
							| 
									
										
										
										
											2024-04-17 13:56:33 +00:00
										 |  |  | <script src="{{ .base_path }}assets/qrcode/qrious2.min.js?{{ .cur_ver }}"></script> | 
					
						
							|  |  |  | <script src="{{ .base_path }}assets/clipboard/clipboard.min.js?{{ .cur_ver }}"></script> | 
					
						
							|  |  |  | <script src="{{ .base_path }}assets/uri/URI.min.js?{{ .cur_ver }}"></script> | 
					
						
							| 
									
										
										
										
											2024-10-30 13:40:41 +00:00
										 |  |  | <script src="{{ .base_path }}assets/js/model/inbound.js?{{ .cur_ver }}"></script> | 
					
						
							| 
									
										
										
										
											2023-12-05 17:13:36 +00:00
										 |  |  | <script src="{{ .base_path }}assets/js/model/dbinbound.js?{{ .cur_ver }}"></script> | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  | {{template "component/themeSwitcher" .}} | 
					
						
							| 
									
										
										
										
											2024-01-02 08:32:21 +00:00
										 |  |  | {{template "component/persianDatepicker" .}} | 
					
						
							| 
									
										
										
										
											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", | 
					
						
							| 
									
										
										
										
											2024-01-15 09:37:01 +00:00
										 |  |  |         width: 30, | 
					
						
							| 
									
										
										
										
											2023-12-04 18:17:38 +00:00
										 |  |  |         responsive: ["xs"], | 
					
						
							| 
									
										
										
										
											2023-08-08 21:28:53 +00:00
										 |  |  |     }, { | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |         title: '{{ i18n "pages.inbounds.operate" }}', | 
					
						
							|  |  |  |         align: 'center', | 
					
						
							| 
									
										
										
										
											2024-01-15 09:37:01 +00:00
										 |  |  |         width: 30, | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |         scopedSlots: { customRender: 'action' }, | 
					
						
							|  |  |  |     }, { | 
					
						
							|  |  |  |         title: '{{ i18n "pages.inbounds.enable" }}', | 
					
						
							|  |  |  |         align: 'center', | 
					
						
							| 
									
										
										
										
											2024-01-15 09:37:01 +00:00
										 |  |  |         width: 30, | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |         scopedSlots: { customRender: 'enable' }, | 
					
						
							|  |  |  |     }, { | 
					
						
							|  |  |  |         title: '{{ i18n "pages.inbounds.remark" }}', | 
					
						
							|  |  |  |         align: 'center', | 
					
						
							| 
									
										
										
										
											2024-01-15 09:37:01 +00:00
										 |  |  |         width: 60, | 
					
						
							| 
									
										
										
										
											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', | 
					
						
							| 
									
										
										
										
											2024-01-15 09:37:01 +00:00
										 |  |  |         width: 70, | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |         scopedSlots: { customRender: 'protocol' }, | 
					
						
							|  |  |  |     }, { | 
					
						
							|  |  |  |         title: '{{ i18n "clients" }}', | 
					
						
							|  |  |  |         align: 'left', | 
					
						
							| 
									
										
										
										
											2023-12-04 18:17:38 +00:00
										 |  |  |         width: 50, | 
					
						
							| 
									
										
										
										
											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', | 
					
						
							| 
									
										
										
										
											2024-01-15 09:37:01 +00:00
										 |  |  |         width: 40, | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |         scopedSlots: { customRender: 'expiryTime' }, | 
					
						
							|  |  |  |     }]; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-02-22 19:42:26 +00:00
										 |  |  |     const mobileColumns = [{ | 
					
						
							| 
									
										
										
										
											2023-12-04 18:17:38 +00:00
										 |  |  |         title: "ID", | 
					
						
							|  |  |  |         align: 'right', | 
					
						
							|  |  |  |         dataIndex: "id", | 
					
						
							|  |  |  |         width: 10, | 
					
						
							|  |  |  |         responsive: ["s"], | 
					
						
							|  |  |  |     }, { | 
					
						
							|  |  |  |         title: '{{ i18n "pages.inbounds.operate" }}', | 
					
						
							|  |  |  |         align: 'center', | 
					
						
							|  |  |  |         width: 25, | 
					
						
							|  |  |  |         scopedSlots: { customRender: 'action' }, | 
					
						
							|  |  |  |     }, { | 
					
						
							|  |  |  |         title: '{{ i18n "pages.inbounds.remark" }}', | 
					
						
							|  |  |  |         align: 'left', | 
					
						
							|  |  |  |         width: 70, | 
					
						
							|  |  |  |         dataIndex: "remark", | 
					
						
							|  |  |  |     }, { | 
					
						
							|  |  |  |         title: '{{ i18n "pages.inbounds.info" }}', | 
					
						
							|  |  |  |         align: 'center', | 
					
						
							|  |  |  |         width: 10, | 
					
						
							|  |  |  |         scopedSlots: { customRender: 'info' }, | 
					
						
							|  |  |  |     }]; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |     const innerColumns = [ | 
					
						
							| 
									
										
										
										
											2023-12-10 15:37:16 +00:00
										 |  |  |         { title: '{{ i18n "pages.inbounds.operate" }}', width: 65, scopedSlots: { customRender: 'actions' } }, | 
					
						
							|  |  |  |         { title: '{{ i18n "pages.inbounds.enable" }}', width: 30, scopedSlots: { customRender: 'enable' } }, | 
					
						
							|  |  |  |         { title: '{{ i18n "online" }}', width: 30, scopedSlots: { customRender: 'online' } }, | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |         { title: '{{ i18n "pages.inbounds.client" }}', width: 80, scopedSlots: { customRender: 'client' } }, | 
					
						
							| 
									
										
										
										
											2023-12-04 18:17:38 +00:00
										 |  |  |         { title: '{{ i18n "pages.inbounds.traffic" }}', width: 80, align: 'center', scopedSlots: { customRender: 'traffic' } }, | 
					
						
							| 
									
										
										
										
											2024-04-20 18:45:36 +00:00
										 |  |  |         { title: '{{ i18n "pages.inbounds.expireDate" }}', width: 80, align: 'center', scopedSlots: { customRender: 'expiryTime' } }, | 
					
						
							| 
									
										
										
										
											2023-02-12 13:50:09 +00:00
										 |  |  |     ]; | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-04 18:17:38 +00:00
										 |  |  |     const innerMobileColumns = [ | 
					
						
							|  |  |  |         { title: '{{ i18n "pages.inbounds.operate" }}', width: 10, align: 'center', scopedSlots: { customRender: 'actionMenu' } }, | 
					
						
							|  |  |  |         { title: '{{ i18n "pages.inbounds.client" }}', width: 90, align: 'left', scopedSlots: { customRender: 'client' } }, | 
					
						
							|  |  |  |         { title: '{{ i18n "pages.inbounds.info" }}', width: 10, align: 'center', scopedSlots: { customRender: 'info' } }, | 
					
						
							| 
									
										
										
										
											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, | 
					
						
							| 
									
										
										
										
											2024-01-02 08:32:21 +00:00
										 |  |  |             persianDatepicker, | 
					
						
							| 
									
										
										
										
											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-12-04 18:17:38 +00:00
										 |  |  |             onlineClients: [], | 
					
						
							| 
									
										
										
										
											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, | 
					
						
							| 
									
										
										
										
											2024-02-21 10:47:52 +00:00
										 |  |  |                 subURI : '', | 
					
						
							|  |  |  |                 subJsonURI : '', | 
					
						
							| 
									
										
										
										
											2023-05-22 14:36:34 +00:00
										 |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-12-08 19:31:17 +00:00
										 |  |  |             remarkModel: '-ieo', | 
					
						
							| 
									
										
										
										
											2024-01-02 08:32:21 +00:00
										 |  |  |             datepicker: 'gregorian', | 
					
						
							| 
									
										
										
										
											2023-12-04 18:17:38 +00:00
										 |  |  |             tgBotEnable: false, | 
					
						
							| 
									
										
										
										
											2024-02-21 08:36:49 +00:00
										 |  |  |             showAlert: false, | 
					
						
							| 
									
										
										
										
											2024-03-12 20:53:32 +00:00
										 |  |  |             ipLimitEnable: false, | 
					
						
							| 
									
										
										
										
											2024-07-01 19:11:42 +00:00
										 |  |  |             pageSize: 50, | 
					
						
							| 
									
										
										
										
											2023-12-04 18:17:38 +00:00
										 |  |  |             isMobile: window.innerWidth <= 768, | 
					
						
							| 
									
										
										
										
											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; | 
					
						
							|  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2024-02-17 18:08:22 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-04 18:17:38 +00:00
										 |  |  |                 await this.getOnlineUsers(); | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                 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-12-04 18:17:38 +00:00
										 |  |  |             async getOnlineUsers() { | 
					
						
							|  |  |  |                 const msg = await HttpUtil.post('/panel/inbound/onlines'); | 
					
						
							|  |  |  |                 if (!msg.success) { | 
					
						
							|  |  |  |                     return; | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |                 this.onlineClients = msg.obj != null ? msg.obj : []; | 
					
						
							|  |  |  |             }, | 
					
						
							| 
									
										
										
										
											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, | 
					
						
							| 
									
										
										
										
											2024-02-21 10:47:52 +00:00
										 |  |  |                         subURI: subURI, | 
					
						
							|  |  |  |                         subJsonURI: subJsonURI | 
					
						
							| 
									
										
										
										
											2023-05-22 14:36:34 +00:00
										 |  |  |                     }; | 
					
						
							| 
									
										
										
										
											2023-12-08 16:18:51 +00:00
										 |  |  |                     this.pageSize = pageSize; | 
					
						
							| 
									
										
										
										
											2023-12-08 19:31:17 +00:00
										 |  |  |                     this.remarkModel = remarkModel; | 
					
						
							| 
									
										
										
										
											2024-01-02 08:32:21 +00:00
										 |  |  |                     this.datepicker = datepicker; | 
					
						
							| 
									
										
										
										
											2024-03-12 20:53:32 +00:00
										 |  |  |                     this.ipLimitEnable = ipLimitEnable; | 
					
						
							| 
									
										
										
										
											2023-05-22 14:36:34 +00:00
										 |  |  |                 } | 
					
						
							| 
									
										
										
										
											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)) { | 
					
						
							| 
									
										
										
										
											2024-09-16 14:49:00 +00:00
										 |  |  |                         if (dbInbound.isSS && (!to_inbound.isSSMultiUser)) { | 
					
						
							| 
									
										
										
										
											2023-07-17 23:49:01 +00:00
										 |  |  |                             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) { | 
					
						
							| 
									
										
										
										
											2023-12-04 18:17:38 +00:00
										 |  |  |                 let clientCount = 0, active = [], deactive = [], depleted = [], expiring = [], online = []; | 
					
						
							| 
									
										
										
										
											2023-12-08 17:45:21 +00:00
										 |  |  |                 clients = inbound.clients; | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |                 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 => { | 
					
						
							| 
									
										
										
										
											2024-02-19 14:28:32 +00:00
										 |  |  |                             if (client.enable) { | 
					
						
							| 
									
										
										
										
											2024-02-17 18:08:22 +00:00
										 |  |  |                                 active.push(client.email); | 
					
						
							| 
									
										
										
										
											2024-02-19 14:28:32 +00:00
										 |  |  |                                 if (this.isClientOnline(client.email)) online.push(client.email); | 
					
						
							| 
									
										
										
										
											2024-02-17 18:08:22 +00:00
										 |  |  |                             } else { | 
					
						
							|  |  |  |                                 deactive.push(client.email); | 
					
						
							|  |  |  |                             } | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |                         }); | 
					
						
							|  |  |  |                         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-12-04 18:17:38 +00:00
										 |  |  |                     online: online, | 
					
						
							| 
									
										
										
										
											2023-04-09 19:43:18 +00:00
										 |  |  |                 }; | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |             }, | 
					
						
							| 
									
										
										
										
											2024-02-17 18:08:22 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											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) { | 
					
						
							| 
									
										
										
										
											2023-12-08 19:08:44 +00:00
										 |  |  |                     case "import": | 
					
						
							|  |  |  |                         this.importInbound(); | 
					
						
							|  |  |  |                         break; | 
					
						
							| 
									
										
										
										
											2023-04-25 13:53:38 +00:00
										 |  |  |                     case "export": | 
					
						
							|  |  |  |                         this.exportAllLinks(); | 
					
						
							|  |  |  |                         break; | 
					
						
							| 
									
										
										
										
											2024-02-17 18:08:22 +00:00
										 |  |  |                     case "subs": | 
					
						
							|  |  |  |                         this.exportAllSubs(); | 
					
						
							|  |  |  |                         break; | 
					
						
							| 
									
										
										
										
											2023-04-25 13:53:38 +00:00
										 |  |  |                     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": | 
					
						
							| 
									
										
										
										
											2023-12-04 18:17:38 +00:00
										 |  |  |                         this.showQrcode(dbInbound.id); | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                         break; | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |                     case "showInfo": | 
					
						
							| 
									
										
										
										
											2023-12-04 18:17:38 +00:00
										 |  |  |                         this.showInfo(dbInbound.id); | 
					
						
							| 
									
										
										
										
											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; | 
					
						
							| 
									
										
										
										
											2024-02-17 18:08:22 +00:00
										 |  |  |                     case "subs": | 
					
						
							|  |  |  |                         this.exportSubs(dbInbound.id); | 
					
						
							|  |  |  |                         break; | 
					
						
							| 
									
										
										
										
											2023-12-08 19:08:44 +00:00
										 |  |  |                     case "clipboard": | 
					
						
							|  |  |  |                         this.copyToClipboard(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"}}', | 
					
						
							| 
									
										
										
										
											2023-12-04 18:17:38 +00:00
										 |  |  |                     class: themeSwitcher.currentTheme, | 
					
						
							| 
									
										
										
										
											2023-03-27 16:41:28 +00:00
										 |  |  |                     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(), | 
					
						
							| 
									
										
										
										
											2024-02-19 17:35:24 +00:00
										 |  |  |                     sniffing: baseInbound.sniffing.toString(), | 
					
						
							| 
									
										
										
										
											2024-09-16 09:41:21 +00:00
										 |  |  |                     allocate: baseInbound.allocate.toString(), | 
					
						
							| 
									
										
										
										
											2023-03-27 16:41:28 +00:00
										 |  |  |                 }; | 
					
						
							| 
									
										
										
										
											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) => { | 
					
						
							| 
									
										
										
										
											2024-02-27 12:31:20 +00:00
										 |  |  |                         await this.addInbound(inbound, dbInbound, inModal); | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                     }, | 
					
						
							|  |  |  |                     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) => { | 
					
						
							|  |  |  |                         await this.updateInbound(inbound, dbInbound); | 
					
						
							|  |  |  |                     }, | 
					
						
							|  |  |  |                     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(); | 
					
						
							| 
									
										
										
										
											2024-02-19 17:35:24 +00:00
										 |  |  |                 data.sniffing = inbound.sniffing.toString(); | 
					
						
							| 
									
										
										
										
											2024-09-16 09:41:21 +00:00
										 |  |  |                 data.allocate = inbound.allocate.toString(); | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											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(); | 
					
						
							| 
									
										
										
										
											2024-02-19 17:35:24 +00:00
										 |  |  |                 data.sniffing = inbound.sniffing.toString(); | 
					
						
							| 
									
										
										
										
											2024-09-16 09:41:21 +00:00
										 |  |  |                 data.allocate = inbound.allocate.toString(); | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											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) => { | 
					
						
							| 
									
										
										
										
											2024-02-27 12:31:20 +00:00
										 |  |  |                         await this.addClient(clients, dbInboundId, clientModal); | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |                     }, | 
					
						
							|  |  |  |                     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) => { | 
					
						
							| 
									
										
										
										
											2024-02-27 12:31:20 +00:00
										 |  |  |                         await this.addClient(clients, dbInboundId, clientsBulkModal); | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |                     }, | 
					
						
							|  |  |  |                 }); | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             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
										 |  |  |             }, | 
					
						
							| 
									
										
										
										
											2024-02-27 12:31:20 +00:00
										 |  |  |             async addClient(clients, dbInboundId, modal) { | 
					
						
							| 
									
										
										
										
											2024-01-22 11:36:01 +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() + ']}', | 
					
						
							| 
									
										
										
										
											2024-01-22 11:36:01 +00:00
										 |  |  |                 }; | 
					
						
							| 
									
										
										
										
											2024-02-27 12:31:20 +00:00
										 |  |  |                 await this.submit(`/panel/inbound/addClient`, data, modal); | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-04-25 11:08:35 +00:00
										 |  |  |             async updateClient(client, dbInboundId, clientId) { | 
					
						
							| 
									
										
										
										
											2024-01-26 18:37:15 +00:00
										 |  |  |                 const data = { | 
					
						
							|  |  |  |                     id: dbInboundId, | 
					
						
							|  |  |  |                     settings: '{"clients": [' + client.toString() + ']}', | 
					
						
							|  |  |  |                 }; | 
					
						
							| 
									
										
										
										
											2024-02-27 12:31:20 +00:00
										 |  |  |                 await this.submit(`/panel/inbound/updateClient/${clientId}`, data, clientModal); | 
					
						
							| 
									
										
										
										
											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({ | 
					
						
							| 
									
										
										
										
											2024-06-17 19:55:09 +00:00
										 |  |  |                     title: '{{ i18n "pages.inbounds.resetTraffic"}}' + ' #' + dbInboundId, | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                     content: '{{ i18n "pages.inbounds.resetTrafficContent"}}', | 
					
						
							| 
									
										
										
										
											2023-12-04 18:17:38 +00:00
										 |  |  |                     class: themeSwitcher.currentTheme, | 
					
						
							| 
									
										
										
										
											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({ | 
					
						
							| 
									
										
										
										
											2024-02-21 10:47:52 +00:00
										 |  |  |                     title: '{{ i18n "pages.inbounds.deleteInbound"}}' + ' #' + dbInboundId, | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                     content: '{{ i18n "pages.inbounds.deleteInboundContent"}}', | 
					
						
							| 
									
										
										
										
											2023-12-04 18:17:38 +00:00
										 |  |  |                     class: themeSwitcher.currentTheme, | 
					
						
							| 
									
										
										
										
											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-12-04 18:17:38 +00:00
										 |  |  |             delClient(dbInboundId, client,confirmation = true) { | 
					
						
							| 
									
										
										
										
											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-12-04 18:17:38 +00:00
										 |  |  |                 if (confirmation){ | 
					
						
							|  |  |  |                     this.$confirm({ | 
					
						
							| 
									
										
										
										
											2024-02-21 10:47:52 +00:00
										 |  |  |                         title: '{{ i18n "pages.inbounds.deleteClient"}}' + ' ' + client.email, | 
					
						
							| 
									
										
										
										
											2023-12-04 18:17:38 +00:00
										 |  |  |                         content: '{{ i18n "pages.inbounds.deleteClientContent"}}', | 
					
						
							|  |  |  |                         class: themeSwitcher.currentTheme, | 
					
						
							|  |  |  |                         okText: '{{ i18n "delete"}}', | 
					
						
							|  |  |  |                         cancelText: '{{ i18n "cancel"}}', | 
					
						
							| 
									
										
										
										
											2023-12-04 19:03:18 +00:00
										 |  |  |                         onOk: () => this.submit(`/panel/inbound/${dbInboundId}/delClient/${clientId}`), | 
					
						
							| 
									
										
										
										
											2023-12-04 18:17:38 +00:00
										 |  |  |                     }); | 
					
						
							|  |  |  |                 } else { | 
					
						
							| 
									
										
										
										
											2023-12-04 19:03:18 +00:00
										 |  |  |                     this.submit(`/panel/inbound/${dbInboundId}/delClient/${clientId}`); | 
					
						
							| 
									
										
										
										
											2023-12-04 18:17:38 +00:00
										 |  |  |                 } | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |             }, | 
					
						
							| 
									
										
										
										
											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("@")){ | 
					
						
							| 
									
										
										
										
											2024-01-26 18:37:15 +00:00
										 |  |  |                     rootInbound = this.inbounds.find((i) =>  | 
					
						
							|  |  |  |                         i.isTcp &&  | 
					
						
							| 
									
										
										
										
											2023-05-22 23:45:34 +00:00
										 |  |  |                         ['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(); | 
					
						
							| 
									
										
										
										
											2023-12-08 17:45:21 +00:00
										 |  |  |                         newInbound.stream.security = rootInbound.stream.security; | 
					
						
							| 
									
										
										
										
											2023-05-22 23:45:34 +00:00
										 |  |  |                         newInbound.stream.tls = rootInbound.stream.tls; | 
					
						
							| 
									
										
										
										
											2023-12-08 17:45:21 +00:00
										 |  |  |                         newInbound.stream.externalProxy = rootInbound.stream.externalProxy; | 
					
						
							| 
									
										
										
										
											2023-05-22 23:45:34 +00:00
										 |  |  |                         newDbInbound.streamSettings = newInbound.stream.toString(); | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |                 return newDbInbound; | 
					
						
							|  |  |  |             }, | 
					
						
							| 
									
										
										
										
											2024-01-26 18:37:15 +00:00
										 |  |  |             showQrcode(dbInboundId, client) { | 
					
						
							| 
									
										
										
										
											2023-12-04 20:06:04 +00:00
										 |  |  |                 dbInbound = this.dbInbounds.find(row => row.id === dbInboundId); | 
					
						
							| 
									
										
										
										
											2023-05-22 23:45:34 +00:00
										 |  |  |                 newDbInbound = this.checkFallback(dbInbound); | 
					
						
							| 
									
										
										
										
											2024-01-26 18:37:15 +00:00
										 |  |  |                 qrModal.show('{{ i18n "qrCode"}}', newDbInbound, client); | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-12-04 20:06:04 +00:00
										 |  |  |             showInfo(dbInboundId, client) { | 
					
						
							|  |  |  |                 dbInbound = this.dbInbounds.find(row => row.id === dbInboundId); | 
					
						
							| 
									
										
										
										
											2023-12-08 17:45:21 +00:00
										 |  |  |                 index=0; | 
					
						
							|  |  |  |                 if (dbInbound.isMultiUser()){ | 
					
						
							|  |  |  |                     inbound = dbInbound.toInbound(); | 
					
						
							|  |  |  |                     clients = inbound.clients; | 
					
						
							|  |  |  |                     index = this.findIndexOfClient(dbInbound.protocol, clients, client); | 
					
						
							|  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2023-05-22 23:45:34 +00:00
										 |  |  |                 newDbInbound = this.checkFallback(dbInbound); | 
					
						
							|  |  |  |                 infoModal.show(newDbInbound, index); | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |             }, | 
					
						
							| 
									
										
										
										
											2024-01-12 15:49:32 +00:00
										 |  |  |             switchEnable(dbInboundId,state) { | 
					
						
							| 
									
										
										
										
											2024-06-17 19:55:09 +00:00
										 |  |  |               dbInbound = this.dbInbounds.find(row => row.id === dbInboundId); | 
					
						
							|  |  |  |               dbInbound.enable = state; | 
					
						
							|  |  |  |               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(); | 
					
						
							| 
									
										
										
										
											2023-12-08 17:45:21 +00:00
										 |  |  |                 clients = inbound.clients; | 
					
						
							| 
									
										
										
										
											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); | 
					
						
							|  |  |  |             }, | 
					
						
							| 
									
										
										
										
											2024-02-27 12:31:20 +00:00
										 |  |  |             async submit(url, data, modal) { | 
					
						
							|  |  |  |                 const msg = await HttpUtil.postWithModal(url, data, modal); | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                 if (msg.success) { | 
					
						
							|  |  |  |                     await this.getDBInbounds(); | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             getInboundClients(dbInbound) { | 
					
						
							| 
									
										
										
										
											2023-12-08 17:45:21 +00:00
										 |  |  |                 return dbInbound.toInbound().clients; | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-12-04 18:17:38 +00:00
										 |  |  |             resetClientTraffic(client, dbInboundId, confirmation = true) { | 
					
						
							|  |  |  |                 if (confirmation){ | 
					
						
							|  |  |  |                     this.$confirm({ | 
					
						
							| 
									
										
										
										
											2024-06-17 19:55:09 +00:00
										 |  |  |                         title: '{{ i18n "pages.inbounds.resetTraffic"}}' + ' ' + client.email, | 
					
						
							| 
									
										
										
										
											2023-12-04 18:17:38 +00:00
										 |  |  |                         content: '{{ i18n "pages.inbounds.resetTrafficContent"}}', | 
					
						
							|  |  |  |                         class: themeSwitcher.currentTheme, | 
					
						
							|  |  |  |                         okText: '{{ i18n "reset"}}', | 
					
						
							|  |  |  |                         cancelText: '{{ i18n "cancel"}}', | 
					
						
							| 
									
										
										
										
											2023-12-04 19:03:18 +00:00
										 |  |  |                         onOk: () => this.submit('/panel/inbound/' + dbInboundId + '/resetClientTraffic/' + client.email), | 
					
						
							| 
									
										
										
										
											2023-12-04 18:17:38 +00:00
										 |  |  |                     }) | 
					
						
							|  |  |  |                 } else { | 
					
						
							| 
									
										
										
										
											2023-12-04 19:03:18 +00:00
										 |  |  |                     this.submit('/panel/inbound/' + dbInboundId + '/resetClientTraffic/' + client.email); | 
					
						
							| 
									
										
										
										
											2023-12-04 18:17:38 +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-12-04 18:17:38 +00:00
										 |  |  |                     class: themeSwitcher.currentTheme, | 
					
						
							| 
									
										
										
										
											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"}}', | 
					
						
							| 
									
										
										
										
											2023-12-04 18:17:38 +00:00
										 |  |  |                     class: themeSwitcher.currentTheme, | 
					
						
							| 
									
										
										
										
											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-12-04 18:17:38 +00:00
										 |  |  |                     class: themeSwitcher.currentTheme, | 
					
						
							| 
									
										
										
										
											2023-12-10 17:13:48 +00:00
										 |  |  |                     okText: '{{ i18n "delete"}}', | 
					
						
							| 
									
										
										
										
											2023-04-25 15:13:37 +00:00
										 |  |  |                     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) { | 
					
						
							| 
									
										
										
										
											2023-12-04 18:17:38 +00:00
										 |  |  |                 return dbInbound.toInbound().isExpiry(index); | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |             }, | 
					
						
							|  |  |  |             getUpStats(dbInbound, email) { | 
					
						
							| 
									
										
										
										
											2023-12-04 18:17:38 +00:00
										 |  |  |                 if (email.length == 0) return 0; | 
					
						
							|  |  |  |                 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-12-04 18:17:38 +00:00
										 |  |  |                 if (email.length == 0) return 0; | 
					
						
							|  |  |  |                 clientStats = dbInbound.clientStats.find(stats => stats.email === email); | 
					
						
							|  |  |  |                 return clientStats ? clientStats.down : 0; | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             getSumStats(dbInbound, email) { | 
					
						
							|  |  |  |                 if (email.length == 0) return 0; | 
					
						
							|  |  |  |                 clientStats = dbInbound.clientStats.find(stats => stats.email === email); | 
					
						
							|  |  |  |                 return clientStats ? clientStats.up + clientStats.down : 0; | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             getRemStats(dbInbound, email) { | 
					
						
							|  |  |  |                 if (email.length == 0) return 0; | 
					
						
							|  |  |  |                 clientStats = dbInbound.clientStats.find(stats => stats.email === email); | 
					
						
							|  |  |  |                 if (!clientStats) return 0; | 
					
						
							| 
									
										
										
										
											2023-12-04 20:22:56 +00:00
										 |  |  |                 remained = clientStats.total - (clientStats.up + clientStats.down); | 
					
						
							| 
									
										
										
										
											2023-12-04 18:17:38 +00:00
										 |  |  |                 return remained>0 ? remained : 0; | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-12-04 20:21:14 +00:00
										 |  |  |             clientStatsColor(dbInbound, email) { | 
					
						
							|  |  |  |                 if (email.length == 0) return clientUsageColor(); | 
					
						
							| 
									
										
										
										
											2023-12-04 18:17:38 +00:00
										 |  |  |                 clientStats = dbInbound.clientStats.find(stats => stats.email === email); | 
					
						
							| 
									
										
										
										
											2023-12-04 20:21:14 +00:00
										 |  |  |                 return clientUsageColor(clientStats, app.trafficDiff) | 
					
						
							| 
									
										
										
										
											2023-12-04 18:17:38 +00:00
										 |  |  |             }, | 
					
						
							|  |  |  |             statsProgress(dbInbound, email) { | 
					
						
							|  |  |  |                 if (email.length == 0) return 100; | 
					
						
							|  |  |  |                 clientStats = dbInbound.clientStats.find(stats => stats.email === email); | 
					
						
							|  |  |  |                 if (!clientStats) return 0; | 
					
						
							|  |  |  |                 if (clientStats.total == 0) return 100; | 
					
						
							|  |  |  |                 return 100*(clientStats.down + clientStats.up)/clientStats.total; | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             expireProgress(expTime, reset) { | 
					
						
							|  |  |  |                 now = new Date().getTime(); | 
					
						
							|  |  |  |                 remainedSeconds = expTime < 0 ? -expTime/1000 : (expTime-now)/1000; | 
					
						
							|  |  |  |                 resetSeconds = reset * 86400; | 
					
						
							|  |  |  |                 if (remainedSeconds >= resetSeconds) return 0; | 
					
						
							|  |  |  |                 return 100*(1-(remainedSeconds/resetSeconds)); | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             remainedDays(expTime){ | 
					
						
							|  |  |  |                 if (expTime == 0) return null; | 
					
						
							|  |  |  |                 if (expTime < 0) return formatSecond(expTime/-1000); | 
					
						
							|  |  |  |                 now = new Date().getTime(); | 
					
						
							|  |  |  |                 if (expTime < now) return '{{ i18n "depleted" }}'; | 
					
						
							|  |  |  |                 return formatSecond((expTime-now)/1000); | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             statsExpColor(dbInbound, email){ | 
					
						
							|  |  |  |                 if (email.length == 0) return '#7a316f'; | 
					
						
							| 
									
										
										
										
											2023-05-16 22:31:56 +00:00
										 |  |  |                 clientStats = dbInbound.clientStats.find(stats => stats.email === email); | 
					
						
							| 
									
										
										
										
											2023-12-04 18:17:38 +00:00
										 |  |  |                 if (!clientStats) return '#7a316f'; | 
					
						
							|  |  |  |                 statsColor = usageColor(clientStats.down + clientStats.up, this.trafficDiff, clientStats.total); | 
					
						
							|  |  |  |                 expColor = usageColor(new Date().getTime(), this.expireDiff, clientStats.expiryTime); | 
					
						
							|  |  |  |                 switch (true) { | 
					
						
							|  |  |  |                     case statsColor == "red" || expColor == "red": | 
					
						
							| 
									
										
										
										
											2023-12-09 12:59:48 +00:00
										 |  |  |                         return "#cf3c3c"; // Red | 
					
						
							| 
									
										
										
										
											2023-12-04 18:17:38 +00:00
										 |  |  |                     case statsColor == "orange" || expColor == "orange": | 
					
						
							| 
									
										
										
										
											2023-12-09 12:59:48 +00:00
										 |  |  |                         return "#f37b24"; // Orange | 
					
						
							|  |  |  |                     case statsColor == "green" || expColor == "green": | 
					
						
							|  |  |  |                         return "#008771"; // Green | 
					
						
							| 
									
										
										
										
											2023-12-04 18:17:38 +00:00
										 |  |  |                     default: | 
					
						
							| 
									
										
										
										
											2023-12-09 12:59:48 +00:00
										 |  |  |                         return "#7a316f"; // purple | 
					
						
							| 
									
										
										
										
											2023-12-04 18:17:38 +00:00
										 |  |  |                 } | 
					
						
							| 
									
										
										
										
											2023-03-16 22:01:14 +00:00
										 |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |             isClientEnabled(dbInbound, email) { | 
					
						
							| 
									
										
										
										
											2023-12-04 18:17:38 +00:00
										 |  |  |                 clientStats = dbInbound.clientStats ? dbInbound.clientStats.find(stats => stats.email === email) : null; | 
					
						
							|  |  |  |                 return clientStats ? clientStats['enable'] : true; | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             isClientOnline(email) { | 
					
						
							|  |  |  |                 return this.onlineClients.includes(email); | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-12-04 20:06:04 +00:00
										 |  |  |             isRemovable(dbInboundId) { | 
					
						
							| 
									
										
										
										
											2024-06-17 19:55:09 +00:00
										 |  |  |                 return this.getInboundClients(this.dbInbounds.find(row => row.id === dbInboundId)).length > 1; | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  |             }, | 
					
						
							| 
									
										
										
										
											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); | 
					
						
							| 
									
										
										
										
											2024-06-17 19:55:09 +00:00
										 |  |  |                 txtModal.show('{{ i18n "pages.inbounds.export"}}', newDbInbound.genInboundLinks(this.remarkModel), newDbInbound.remark); | 
					
						
							| 
									
										
										
										
											2023-03-16 22:01:14 +00:00
										 |  |  |             }, | 
					
						
							| 
									
										
										
										
											2024-02-17 18:08:22 +00:00
										 |  |  |             exportSubs(dbInboundId) { | 
					
						
							|  |  |  |                 const dbInbound = this.dbInbounds.find(row => row.id === dbInboundId); | 
					
						
							|  |  |  |                 const clients = this.getInboundClients(dbInbound); | 
					
						
							|  |  |  |                 let subLinks = [] | 
					
						
							|  |  |  |                 if (clients != null){ | 
					
						
							|  |  |  |                     clients.forEach(c => { | 
					
						
							|  |  |  |                         if (c.subId && c.subId.length>0){ | 
					
						
							|  |  |  |                             subLinks.push(this.subSettings.subURI + c.subId + "?name=" + c.subId) | 
					
						
							|  |  |  |                         } | 
					
						
							|  |  |  |                     }) | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |                 txtModal.show( | 
					
						
							|  |  |  |                     '{{ i18n "pages.inbounds.export"}} - {{ i18n "pages.settings.subSettings" }}', | 
					
						
							|  |  |  |                     [...new Set(subLinks)].join('\n'), | 
					
						
							|  |  |  |                     dbInbound.remark + "-Subs"); | 
					
						
							|  |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-12-08 19:08:44 +00:00
										 |  |  |             importInbound() { | 
					
						
							|  |  |  |                 promptModal.open({ | 
					
						
							|  |  |  |                     title: '{{ i18n "pages.inbounds.importInbound" }}', | 
					
						
							|  |  |  |                     type: 'textarea', | 
					
						
							|  |  |  |                     value: '', | 
					
						
							|  |  |  |                     okText: '{{ i18n "pages.inbounds.import" }}', | 
					
						
							|  |  |  |                     confirm: async (dbInboundText) => { | 
					
						
							| 
									
										
										
										
											2024-01-26 18:37:15 +00:00
										 |  |  |                         await this.submit('/panel/inbound/import', {data: dbInboundText}, promptModal); | 
					
						
							| 
									
										
										
										
											2023-12-08 19:08:44 +00:00
										 |  |  |                     }, | 
					
						
							|  |  |  |                 }); | 
					
						
							|  |  |  |             }, | 
					
						
							| 
									
										
										
										
											2024-02-17 18:08:22 +00:00
										 |  |  |             exportAllSubs() { | 
					
						
							|  |  |  |                 let subLinks = [] | 
					
						
							|  |  |  |                 for (const dbInbound of this.dbInbounds) { | 
					
						
							|  |  |  |                     const clients = this.getInboundClients(dbInbound); | 
					
						
							|  |  |  |                     if (clients != null){ | 
					
						
							|  |  |  |                         clients.forEach(c => { | 
					
						
							|  |  |  |                             if (c.subId && c.subId.length>0){ | 
					
						
							|  |  |  |                                 subLinks.push(this.subSettings.subURI + c.subId + "?name=" + c.subId) | 
					
						
							|  |  |  |                             } | 
					
						
							|  |  |  |                         }) | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |                 txtModal.show( | 
					
						
							|  |  |  |                     '{{ i18n "pages.inbounds.export"}} - {{ i18n "pages.settings.subSettings" }}', | 
					
						
							|  |  |  |                     [...new Set(subLinks)].join('\r\n'), | 
					
						
							|  |  |  |                     'All-Inbounds-Subs'); | 
					
						
							|  |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-05-08 14:44:22 +00:00
										 |  |  |             exportAllLinks() { | 
					
						
							| 
									
										
										
										
											2023-12-08 17:45:21 +00:00
										 |  |  |                 let copyText = []; | 
					
						
							| 
									
										
										
										
											2023-03-16 22:01:14 +00:00
										 |  |  |                 for (const dbInbound of this.dbInbounds) { | 
					
						
							| 
									
										
										
										
											2023-12-08 19:31:17 +00:00
										 |  |  |                     copyText.push(dbInbound.genInboundLinks(this.remarkModel)); | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |                 } | 
					
						
							| 
									
										
										
										
											2023-12-08 17:45:21 +00:00
										 |  |  |                 txtModal.show('{{ i18n "pages.inbounds.export"}}', copyText.join('\r\n'), 'All-Inbounds'); | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-12-08 19:08:44 +00:00
										 |  |  |             copyToClipboard(dbInboundId) { | 
					
						
							|  |  |  |                 dbInbound = this.dbInbounds.find(row => row.id === dbInboundId); | 
					
						
							|  |  |  |                 txtModal.show('{{ i18n "pages.inbounds.inboundData" }}', JSON.stringify(dbInbound, null, 2)); | 
					
						
							|  |  |  |             }, | 
					
						
							| 
									
										
										
										
											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-12-08 16:18:51 +00:00
										 |  |  |             pagination(obj){ | 
					
						
							|  |  |  |                 if (this.pageSize > 0 && obj.length>this.pageSize) { | 
					
						
							|  |  |  |                     // Set page options based on object size | 
					
						
							| 
									
										
										
										
											2024-02-21 10:47:52 +00:00
										 |  |  |                     sizeOptions = []; | 
					
						
							| 
									
										
										
										
											2023-12-08 16:18:51 +00:00
										 |  |  |                     for (i=this.pageSize;i<=obj.length;i=i+this.pageSize) { | 
					
						
							|  |  |  |                         sizeOptions.push(i.toString()); | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  |                     // Add option to see all in one page | 
					
						
							|  |  |  |                     sizeOptions.push(i.toString()); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                     p = { | 
					
						
							|  |  |  |                         showSizeChanger: true, | 
					
						
							|  |  |  |                         size: 'small', | 
					
						
							|  |  |  |                         position: 'bottom', | 
					
						
							|  |  |  |                         pageSize: this.pageSize, | 
					
						
							|  |  |  |                         pageSizeOptions: sizeOptions | 
					
						
							| 
									
										
										
										
											2024-02-21 10:47:52 +00:00
										 |  |  |                     }; | 
					
						
							|  |  |  |                     return p; | 
					
						
							| 
									
										
										
										
											2023-12-08 16:18:51 +00:00
										 |  |  |                 } | 
					
						
							|  |  |  |                 return false | 
					
						
							|  |  |  |             }, | 
					
						
							| 
									
										
										
										
											2023-12-04 18:17:38 +00:00
										 |  |  |             onResize() { | 
					
						
							|  |  |  |                 this.isMobile = window.innerWidth <= 768; | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											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() { | 
					
						
							| 
									
										
										
										
											2024-02-21 08:36:49 +00:00
										 |  |  |             if (window.location.protocol !== "https:") { | 
					
						
							|  |  |  |                 this.showAlert = true; | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2023-12-04 18:17:38 +00:00
										 |  |  |             window.addEventListener('resize', this.onResize); | 
					
						
							|  |  |  |             this.onResize(); | 
					
						
							| 
									
										
										
										
											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
										 |  |  |                 }; | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | </script> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | {{template "inboundModal"}} | 
					
						
							|  |  |  | {{template "promptModal"}} | 
					
						
							|  |  |  | {{template "qrcodeModal"}} | 
					
						
							|  |  |  | {{template "textModal"}} | 
					
						
							|  |  |  | {{template "inboundInfoModal"}} | 
					
						
							| 
									
										
										
										
											2023-03-17 16:07:49 +00:00
										 |  |  | {{template "clientsModal"}} | 
					
						
							|  |  |  | {{template "clientsBulkModal"}} | 
					
						
							| 
									
										
										
										
											2023-02-09 19:18:06 +00:00
										 |  |  | </body> | 
					
						
							| 
									
										
										
										
											2023-12-14 13:14:45 +00:00
										 |  |  | </html> |