Skip to content

Commit 1e71239

Browse files
committed
feat(subscription): add allow_browser_config field to Subscription model
1 parent 4a61fbc commit 1e71239

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

app/models/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ class Subscription(BaseModel):
262262
rules: list[SubRule]
263263
manual_sub_request: SubFormatEnable = Field(default_factory=SubFormatEnable)
264264
applications: list[Application] = Field(default_factory=list)
265+
allow_browser_config: bool = Field(default=True)
265266

266267
@field_validator("applications")
267268
@classmethod

app/operation/subscription.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,14 +145,18 @@ async def user_subscription(
145145
if db_user.admin and db_user.admin.sub_template
146146
else SUBSCRIPTION_PAGE_TEMPLATE
147147
)
148-
conf, media_type = await self.fetch_config(user, ConfigFormat.links)
148+
149+
links = []
150+
if sub_settings.allow_browser_config:
151+
conf, media_type = await self.fetch_config(user, ConfigFormat.links)
152+
links = conf.split("\n")
149153

150154
return HTMLResponse(
151155
render_template(
152156
template,
153157
{
154158
"user": user,
155-
"links": conf.split("\n"),
159+
"links": links,
156160
"apps": self._make_apps_import_urls(request_url, sub_settings.applications),
157161
},
158162
)

0 commit comments

Comments
 (0)