Skip to content

Commit

Permalink
Online users enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
alireza0 authored and somebodywashere committed Oct 27, 2023
1 parent ccad1bf commit 0117a82
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 6 deletions.
18 changes: 17 additions & 1 deletion web/html/xui/inbound_client_table.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,24 @@
</template>
<template slot="enable" slot-scope="text, client, index">
<a-switch v-model="client.enable" @change="switchEnableClient(record.id,client)"></a-switch>
</template>
</template>
<template slot="online" slot-scope="text, client, index">
<template v-if="isClientOnline(client.email)">
<a-tag color="green">{{ i18n "online" }}</a-tag>
</template>
<template v-else>
<a-tag>{{ i18n "offline" }}</a-tag>
</template>
</template>
<template slot="client" slot-scope="text, client">
<a-tooltip>
<template slot="title">
<template v-if="!isClientEnabled(record, client.email)">{{ i18n "depleted" }}</template>
<template v-else-if="isClientOnline(client.email)">{{ i18n "online" }}</template>
</template>
<a-badge :status="isClientOnline(client.email)? 'processing' : ''" :color="statsExpColor(record, client.email)">
</a-badge>
</a-tooltip>
[[ client.email ]]
<a-tag v-if="!isClientEnabled(record, client.email)" color="red">{{ i18n "depleted" }}</a-tag>
</template>
Expand Down
7 changes: 5 additions & 2 deletions web/service/inbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -750,8 +750,11 @@ func (s *InboundService) addClientTraffic(tx *gorm.DB, traffics []*xray.ClientTr
if dbClientTraffics[dbTraffic_index].Email == traffics[traffic_index].Email {
dbClientTraffics[dbTraffic_index].Up += traffics[traffic_index].Up
dbClientTraffics[dbTraffic_index].Down += traffics[traffic_index].Down
// Add user in onlineUsers array on download
onlineClients = append(onlineClients, traffics[traffic_index].Email)

// Add user in onlineUsers array on traffic
if traffics[traffic_index].Up+traffics[traffic_index].Down > 0 {
onlineClients = append(onlineClients, traffics[traffic_index].Email)
}
break
}
}
Expand Down
4 changes: 3 additions & 1 deletion web/translation/translate.en_US.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@
"enabled" = "Enabled"
"disabled" = "Disabled"
"depleted" = "Depleted"
"depletingSoon" = "Depleting soon"
"depletingSoon" = "Depleting"
"offline" = "Offline"
"online" = "Online"
"domainName" = "Domain name"
"monitor" = "Listening IP"
"certificate" = "Certificate"
Expand Down
2 changes: 2 additions & 0 deletions web/translation/translate.fa_IR.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
"disabled" = "غیرفعال"
"depleted" = "منقضی"
"depletingSoon" = "در حال انقضا"
"offline" = "آفلاین"
"online" = "آنلاین"
"domainName" = "آدرس دامنه"
"monitor" = "آی پی اتصال"
"certificate" = "گواهی دیجیتال"
Expand Down
6 changes: 4 additions & 2 deletions web/translation/translate.ru_RU.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@
"status" = "Статус"
"enabled" = "Включено"
"disabled" = "Отключено"
"depleted" = "Исчерпано"
"depletingSoon" = "Почти исчерпано"
"depleted" = "Отключены"
"depletingSoon" = "Почти отключены"
"offline" = "Офлайн"
"online" = "Онлайн"
"domainName" = "Домен"
"monitor" = "Порт IP"
"certificate" = "Сертификат"
Expand Down
2 changes: 2 additions & 0 deletions web/translation/translate.zh_Hans.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
"disabled" = "关闭"
"depleted" = "耗尽"
"depletingSoon" = "即将耗尽"
"offline" = "离线"
"online" = "在线"
"domainName" = "域名"
"monitor" = "监听"
"certificate" = "证书"
Expand Down

0 comments on commit 0117a82

Please sign in to comment.