Esempio n. 1
0
    def get(self, request):
        user_status = [
            NodeOnlineLog.get_all_node_online_user_count(),
            User.get_today_register_user().count(),
            UserCheckInLog.get_today_checkin_user_count(),
            User.get_never_used_user_count(),
        ]
        donate_status = [
            Donate.get_donate_count_by_date(),
            Donate.get_donate_money_by_date(),
            Donate.get_donate_count_by_date(date=pendulum.today()),
            Donate.get_donate_money_by_date(date=pendulum.today()),
        ]

        active_nodes = SSNode.get_active_nodes() + VmessNode.get_active_nodes()

        node_status = {
            "names": [node.name for node in active_nodes],
            "traffics": [
                round(node.used_traffic / settings.GB, 2) for node in active_nodes
            ],
        }
        data = {
            "user_status": user_status,
            "donate_status": donate_status,
            "node_status": node_status,
        }
        return JsonResponse(data)
Esempio n. 2
0
 def get(self, request):
     user = request.user
     # ss node
     ss_node_list = [
         node.to_dict_with_extra_info(user)
         for node in SSNode.get_active_nodes()
     ]
     # vmess node
     vmess_node_list = [
         node.to_dict_with_extra_info(user)
         for node in VmessNode.get_active_nodes()
     ]
     # trojan node
     trojan_node_list = [
         node.to_dict_with_extra_info(user)
         for node in TrojanNode.get_active_nodes()
     ]
     context = {
         "ss_node_list": ss_node_list,
         "vmess_node_list": vmess_node_list,
         "trojan_node_list": trojan_node_list,
         "user": user,
     }
     Announcement.send_first_visit_msg(request)
     return render(request, "sspanel/nodeinfo.html", context=context)
Esempio n. 3
0
 def get(self, request):
     ss_node_list = SSNode.get_active_nodes()
     vmess_node_list = VmessNode.get_active_nodes()
     context = {
         "user": request.user,
         "ss_node_list": ss_node_list,
         "vmess_node_list": vmess_node_list,
     }
     return render(request,
                   "sspanel/user_traffic_log.html",
                   context=context)
Esempio n. 4
0
    def get(self, request):
        user = request.user
        user_ss_config = user.user_ss_config
        # ss node
        ss_node_list = [
            node.to_dict_with_extra_info(user_ss_config)
            for node in SSNode.get_active_nodes()
        ]

        # vmess node
        vmess_node_list = [
            node.to_dict_with_extra_info(user)
            for node in VmessNode.get_active_nodes()
        ]

        context = {
            "ss_node_list": ss_node_list,
            "vmess_node_list": vmess_node_list,
            "user": user,
            "sub_link": user.sub_link,
        }
        Announcement.send_first_visit_msg(request)
        return render(request, "sspanel/nodeinfo.html", context=context)