Skip to content

Commit 28428af

Browse files
fix: next plan data error send next plan data separated
1 parent 70971d9 commit 28428af

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

app/operation/subscription.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -154,25 +154,26 @@ async def user_subscription(
154154
links = conf.splitlines()
155155

156156
format_variables = await self.get_format_variables(user)
157+
next_plan = user.next_plan.model_dump(mode="json") if user.next_plan else None
157158

158159
return HTMLResponse(
159160
render_template(
160161
template,
161162
{
162163
"user": user,
164+
"next_plan": next_plan,
163165
"links": links,
164166
"apps": self._make_apps_import_urls(sub_settings.applications, format_variables),
165167
},
166168
)
167169
)
168-
else:
169-
client_type = await self.detect_client_type(user_agent, sub_settings.rules)
170-
if client_type == ConfigFormat.block or not client_type:
171-
await self.raise_error(message="Client not supported", code=406)
172-
173-
# Update user subscription info
174-
await user_sub_update(db, db_user.id, user_agent)
175-
conf, media_type = await self.fetch_config(user, client_type)
170+
client_type = await self.detect_client_type(user_agent, sub_settings.rules)
171+
if client_type == ConfigFormat.block or not client_type:
172+
await self.raise_error(message="Client not supported", code=406)
173+
174+
# Update user subscription info
175+
await user_sub_update(db, db_user.id, user_agent)
176+
conf, media_type = await self.fetch_config(user, client_type)
176177

177178
# Create response with appropriate headers
178179
return Response(content=conf, media_type=media_type, headers=response_headers)

0 commit comments

Comments
 (0)