@@ -31,11 +31,12 @@ import features.proxy.server.usecase.withImportedProxyServers
3131import features.proxy.server.usecase.withUpdatedSubscriptionServers
3232import features.subscription.DefaultSubscriptionGroupId
3333import features.subscription.SubscriptionInstallConfigUseCase
34+ import features.subscription.runtime.AndroidSubscriptionFetchOptions
3435import features.subscription.runtime.AndroidSubscriptionFetcher
3536import features.subscription.usecase.subscriptionUpdateMessage
3637import features.subscription.usecase.toSubscriptionFetchOptions
3738import features.subscription.usecase.updateSubscriptions
38- import features.subscription.toRawHttpsSubscriptionInstallConfigOrNull
39+ import features.subscription.toSubscriptionInstallConfigOrNull
3940import kotlinx.coroutines.CoroutineScope
4041import kotlinx.coroutines.launch
4142import top.yukonga.miuix.kmp.basic.ScrollBehavior
@@ -173,6 +174,7 @@ private fun handleProxyServerListAddAction(
173174 text = scanText,
174175 source = ProxyServerImportSource .QrCode ,
175176 groupState = groupState,
177+ subscriptionFetcher = subscriptionFetcher,
176178 updateAppState = updateAppState,
177179 tipNotifier = tipNotifier,
178180 messages = messages,
@@ -200,6 +202,7 @@ private fun handleProxyServerListAddAction(
200202 text = text,
201203 source = ProxyServerImportSource .Clipboard ,
202204 groupState = groupState,
205+ subscriptionFetcher = subscriptionFetcher,
203206 updateAppState = updateAppState,
204207 tipNotifier = tipNotifier,
205208 messages = messages,
@@ -226,6 +229,7 @@ private fun handleProxyServerListAddAction(
226229 text = text,
227230 source = ProxyServerImportSource .File ,
228231 groupState = groupState,
232+ subscriptionFetcher = subscriptionFetcher,
229233 updateAppState = updateAppState,
230234 tipNotifier = tipNotifier,
231235 messages = messages,
@@ -262,7 +266,7 @@ private suspend fun installSubscriptionFromText(
262266 tipNotifier : AndroidToastTipNotifier ,
263267 messages : ProxyServerListMessages ,
264268): Boolean {
265- val config = text.toRawHttpsSubscriptionInstallConfigOrNull () ? : return false
269+ val config = text.toSubscriptionInstallConfigOrNull () ? : return false
266270 runCatching {
267271 SubscriptionInstallConfigUseCase (
268272 stateStore = stateStore,
@@ -286,6 +290,7 @@ private suspend fun importProxyServers(
286290 text : String ,
287291 source : ProxyServerImportSource ,
288292 groupState : ProxyServerListGroups ,
293+ subscriptionFetcher : AndroidSubscriptionFetcher ,
289294 updateAppState : ((AppState ) -> AppState ) -> Unit ,
290295 tipNotifier : AndroidToastTipNotifier ,
291296 messages : ProxyServerListMessages ,
@@ -298,6 +303,13 @@ private suspend fun importProxyServers(
298303 val importResult = importProxyServersFromText(
299304 text = text,
300305 source = source,
306+ providerUrlFetcher = { providerUrl ->
307+ subscriptionFetcher.fetch(
308+ url = providerUrl,
309+ userAgent = " " ,
310+ options = AndroidSubscriptionFetchOptions (),
311+ )
312+ },
301313 )
302314 if (importResult.servers.isNotEmpty()) {
303315 updateAppState { state -> state.withImportedProxyServers(importResult, targetGroupId) }
0 commit comments