diff --git a/apps/api/views.py b/apps/api/views.py index 5db3ccd37..da0d832c5 100644 --- a/apps/api/views.py +++ b/apps/api/views.py @@ -88,8 +88,7 @@ def get_user_and_nodes(self, request): node_list = node_list.filter(country=location) if node_list.count() == 0: - return None, HttpResponseBadRequest("no active nodes for you") - + return user, [m.ProxyNode.fake_node("当前没有可用节点")] return user, node_list diff --git a/apps/proxy/models.py b/apps/proxy/models.py index 1fe218c5e..7227572fd 100644 --- a/apps/proxy/models.py +++ b/apps/proxy/models.py @@ -306,6 +306,14 @@ def have_oc_users(self) -> bool: occupancies_query = UserProxyNodeOccupancy.get_node_occupancies(self) return occupancies_query.count() > 0 + @classmethod + def fake_node(cls, name): + node = cls(name=name, node_type=cls.NODE_TYPE_SS, server="0.0.0.0") + SSConfig(method="aes-256-gcm", proxy_node=node) + # here is the magic, set cached_property to False + node.enable_relay = False + return node + def get_node_users(self): # 1. if node is not enable, return empty list if not self.enable: