feat: direct subscription fetching, URI parser, FLClashX compatibility
- Fetch subscriptions directly via httpx (mihomo UA → YAML, xray-checker → base64 URI list) - Add uri_parser.py: vless/vmess/ss/trojan/hysteria2 URI → Mihomo proxy dicts - Fix YAML quoting for Go parser (strings starting with special chars) - Remove hidden:true and proxy-providers from delivered configs - Inject all service groups into GLOBAL proxies for FLClashX group discovery - Strip placeholder proxy-providers (e.g. "subscription") not in DB - Fix Mihomo healthcheck: add Bearer auth header - Add README Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -219,11 +219,12 @@ async def test_add_subscription(http_client, db_session):
|
||||
db_session.add(config)
|
||||
await db_session.commit()
|
||||
|
||||
resp = await http_client.post(
|
||||
f"/configs/{config.id}/subscriptions/new",
|
||||
data={"name": "mysub", "url": "https://example.com/sub"},
|
||||
follow_redirects=False,
|
||||
)
|
||||
with patch("main.write_and_reload_mihomo", new_callable=AsyncMock):
|
||||
resp = await http_client.post(
|
||||
f"/configs/{config.id}/subscriptions/new",
|
||||
data={"name": "mysub", "url": "https://example.com/sub"},
|
||||
follow_redirects=False,
|
||||
)
|
||||
assert resp.status_code == 303
|
||||
|
||||
result = await db_session.execute(
|
||||
@@ -246,7 +247,8 @@ async def test_delete_subscription(http_client, db_session):
|
||||
await db_session.commit()
|
||||
sub_id = sub.id
|
||||
|
||||
resp = await http_client.post(f"/subscriptions/{sub_id}/delete", follow_redirects=False)
|
||||
with patch("main.write_and_reload_mihomo", new_callable=AsyncMock):
|
||||
resp = await http_client.post(f"/subscriptions/{sub_id}/delete", follow_redirects=False)
|
||||
assert resp.status_code == 303
|
||||
|
||||
result = await db_session.execute(select(Subscription).where(Subscription.id == sub_id))
|
||||
|
||||
Reference in New Issue
Block a user