Skip to content
This repository was archived by the owner on Mar 27, 2025. It is now read-only.

Commit c1fed29

Browse files
committed
fix html
1 parent ed4a46d commit c1fed29

File tree

3 files changed

+22
-32
lines changed

3 files changed

+22
-32
lines changed

apps/proxy/models.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -461,10 +461,6 @@ def ehco_relay_port(self):
461461
def relay_count(self):
462462
return self.relay_rules.all().count()
463463

464-
@property
465-
def is_shared_node(self):
466-
return not OccupancyConfig.objects.filter(proxy_node=self).exists()
467-
468464
@cached_property
469465
def online_info(self):
470466
return UserTrafficLog.get_latest_online_log_info(self)
@@ -1107,6 +1103,10 @@ def get_user_occupancies(cls, user: User, out_of_usage=False, limit=None):
11071103
query = query[:limit]
11081104
return query
11091105

1106+
@classmethod
1107+
def check_node_occupied_by_user(cls, node: ProxyNode, user: User):
1108+
return cls._valid_occupancy_query().filter(proxy_node=node, user=user).exists()
1109+
11101110
def human_total_traffic(self):
11111111
return utils.traffic_format(self.total_traffic)
11121112

apps/sspanel/views.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,10 @@ def get(self, request):
218218
shared_node_count = 0
219219
occupied_node_count = 0
220220
for node in user_active_nodes:
221-
if node.is_shared_node:
222-
shared_node_count += 1
223-
else:
221+
if UserProxyNodeOccupancy.check_node_occupied_by_user(node, user):
224222
occupied_node_count += 1
223+
else:
224+
shared_node_count += 1
225225

226226
context = {
227227
"user": user,

templates/web/node_occupancy.html

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
{% extends 'base.html' %}
22
{% block authed %}
33
<div class="column is-12">
4-
<section class="hero is-warning is-smaill">
4+
<section class="hero is-warning is-small">
55
<div class="hero-body">
66
<div class="container">
77
<h1 class="title">独享节点</h1>
88
<ul>
99
<li>流量和共享节点分开计算</li>
10-
<li>
11-
购买后,可在当前页面观察到流量的使用情况
12-
</li>
13-
<li>
14-
购买后,直接从订阅连接里就能拉取到所有的独享节点
15-
</li>
10+
<li>购买后,可在当前页面观察到流量的使用情况</li>
11+
<li>购买后,直接从订阅连接里就能拉取到所有的独享节点</li>
1612
</ul>
1713
</div>
1814
</div>
@@ -46,9 +42,9 @@ <h1 class="title">独享节点</h1>
4642
</li>
4743
</ul>
4844
</div>
49-
<div class="pricing-table" id="id-pricing-table-purchasable">
45+
<div class="pricing-table is-active" id="id-pricing-table-purchasable">
5046
{% for node in purchasable_proxy_nodes %}
51-
<div class="pricing-plan {{ node.occupancy_config.color }} {{ node.occupancy_config.bulma_is_active }} ">
47+
<div class="pricing-plan {{ node.occupancy_config.color }} {{ node.occupancy_config.bulma_is_active }}">
5248
<div class="plan-header">{{ node.name }}</div>
5349
<div class="plan-price">
5450
<span class="plan-price-amount">
@@ -84,7 +80,7 @@ <h1 class="title">独享节点</h1>
8480
</div>
8581
<div class="pricing-table is-hidden" id="id-pricing-table-renewable">
8682
{% for node in renewable_proxy_nodes %}
87-
<div class="pricing-plan {{ node.occupancy_config.color }} {{ node.occupancy_config.bulma_is_active }} ">
83+
<div class="pricing-plan {{ node.occupancy_config.color }} {{ node.occupancy_config.bulma_is_active }}">
8884
<div class="plan-header">{{ node.name }}</div>
8985
<div class="plan-price">
9086
<span class="plan-price-amount">
@@ -126,15 +122,13 @@ <h1 class="title">独享节点</h1>
126122
<a class="is-active" id="tab-usable">可使用</a>
127123
<a id="tab-outdated">已过期</a>
128124
</p>
129-
<a class="panel-block" id="block-usable">
125+
<div class="panel-block is-active" id="block-usable">
130126
<table class="table is-striped is-fullwidth">
131127
<thead>
132128
<tr>
133129
<th>节点</th>
134130
<th>开始时间</th>
135131
<th>到期时间</th>
136-
<th>已用流量</th>
137-
<th>总流量</th>
138132
<th>流量进度</th>
139133
</tr>
140134
</thead>
@@ -144,27 +138,24 @@ <h1 class="title">独享节点</h1>
144138
<td>{{ o.proxy_node.name }}</td>
145139
<td>{{ o.start_time }}</td>
146140
<td>{{ o.end_time }}</td>
147-
<td>{{ o.human_used_traffic }}</td>
148-
<td>{{ o.human_total_traffic }}</td>
149141
<td>
150142
<progress class="progress {{ o.progress_color }}"
151143
value="{{ o.used_traffic }}"
152-
max="{{ o.total_traffic }}"></progress>{{ o.used_percentage }}%
144+
max="{{ o.total_traffic }}"></progress>{{ o.used_percentage }}{{ o.used_percentage }}
145+
<span>{{ o.human_used_traffic }} / {{ o.human_total_traffic }}</span>
153146
</td>
154147
</tr>
155148
{% endfor %}
156149
</tbody>
157150
</table>
158-
</a>
159-
<a class="panel-block is-hidden" id="block-outdated">
151+
</div>
152+
<div class="panel-block is-hidden" id="block-outdated">
160153
<table class="table is-striped is-fullwidth">
161154
<thead>
162155
<tr>
163156
<th>节点</th>
164157
<th>开始时间</th>
165158
<th>到期时间</th>
166-
<th>已用流量</th>
167-
<th>总流量</th>
168159
<th>流量进度</th>
169160
</tr>
170161
</thead>
@@ -174,18 +165,17 @@ <h1 class="title">独享节点</h1>
174165
<td>{{ o.proxy_node.name }}</td>
175166
<td>{{ o.start_time }}</td>
176167
<td>{{ o.end_time }}</td>
177-
<td>{{ o.human_used_traffic }}</td>
178-
<td>{{ o.human_total_traffic }}</td>
179168
<td>
180169
<progress class="progress {{ o.progress_color }}"
181-
value="{{ o.used_traffic }}"
182-
max="{{ o.total_traffic }}"></progress>{{ o.used_percentage }}%
170+
value="{{ o.used_traffic }}"
171+
max="{{ o.total_traffic }}"></progress>{{ o.used_percentage }}{{ o.used_percentage }}
172+
<span>{{ o.human_used_traffic }} / {{ o.human_total_traffic }}</span>
183173
</td>
184174
</tr>
185175
{% endfor %}
186176
</tbody>
187177
</table>
188-
</a>
178+
</div>
189179
</nav>
190180
</div>
191181
</div>

0 commit comments

Comments
 (0)