From 1b71d49733ffecf9720a707596833e128e5c6143 Mon Sep 17 00:00:00 2001 From: tzmax <71716824+tzmax@users.noreply.github.com> Date: Sun, 2 Apr 2023 13:11:39 +0800 Subject: [PATCH] fix: support for importing base64 encoded strings #39 --- V2RayX/ConfigImporter.m | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/V2RayX/ConfigImporter.m b/V2RayX/ConfigImporter.m index ba0368e..b7680db 100644 --- a/V2RayX/ConfigImporter.m +++ b/V2RayX/ConfigImporter.m @@ -335,6 +335,11 @@ + (NSMutableDictionary*)importFromHTTPSubscription: (NSString*)httpLink { } + (ServerProfile*)importFromVmessOfV2RayN:(NSString*)vmessStr { + // decode base64String + NSString *base64String = [self decodeBase64String:vmessStr]; + if(base64String != nil && ![base64String isEqual: @""]) { + vmessStr = base64String; + } if ([vmessStr length] < 9 || ![[[vmessStr substringToIndex:8] lowercaseString] isEqualToString:@"vmess://"]) { return nil; } @@ -430,6 +435,12 @@ + (ServerProfile*)importFromVmessOfV2RayN:(NSString*)vmessStr { // 目前为初步提案, 详情请见 VMessAEAD / VLESS 分享链接标准提案 https://github.com/XTLS/Xray-core/issues/91 + (ServerProfile*)importFromVLESSOfXray:(NSString*)vlessStr { + // decode base64String + NSString *base64String = [self decodeBase64String:vlessStr]; + if(base64String != nil && ![base64String isEqual: @""]) { + vlessStr = base64String; + } + if ([vlessStr length] < 9 || ![[[vlessStr substringToIndex:8] lowercaseString] isEqualToString:@"vless://"]) { return nil; }