Skip to content

Commit

Permalink
fix: support for importing base64 encoded strings #39
Browse files Browse the repository at this point in the history
  • Loading branch information
tzmax committed Apr 2, 2023
1 parent 01796ac commit 1b71d49
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions V2RayX/ConfigImporter.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 1b71d49

Please sign in to comment.