99from app .db import GetDB
1010from app .db .crud .host import get_host_by_id , get_hosts , upsert_inbounds
1111from app .db .models import ProxyHostSecurity
12- from app .models .host import BaseHost
12+ from app .models .host import BaseHost , TransportSettings
1313from app .models .subscription import (
1414 GRPCTransportConfig ,
1515 KCPTransportConfig ,
@@ -36,6 +36,9 @@ async def _prepare_subscription_inbound_data(
3636 protocol = inbound_config ["protocol" ]
3737
3838 ts = host .transport_settings
39+ if isinstance (ts , dict ):
40+ ts = TransportSettings .model_validate (ts ) if ts else None
41+
3942 network = inbound_config .get ("network" , "tcp" )
4043 path = host .path or inbound_config .get ("path" , "" )
4144
@@ -254,7 +257,9 @@ async def _prepare_host_entry(
254257 and (ds_host := host .transport_settings .xhttp_settings .download_settings )
255258 ):
256259 downstream = await get_host_by_id (db , ds_host )
257- downstream_data : SubscriptionInboundData = await _prepare_subscription_inbound_data (downstream )
260+ if downstream :
261+ downstream_base = BaseHost .model_validate (downstream )
262+ downstream_data : SubscriptionInboundData = await _prepare_subscription_inbound_data (downstream_base )
258263 subscription_data = await _prepare_subscription_inbound_data (host , downstream_data )
259264
260265 # Return subscription data directly
0 commit comments