handle public ip

This commit is contained in:
True Zhuanjia
2024-08-03 20:57:32 +08:00
parent a8b45851cc
commit c7700904e0
3 changed files with 30 additions and 6 deletions
@@ -579,6 +579,16 @@ static NSMutableSet* hostList;
[alertController addAction:[UIAlertAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"Cancel"] style:UIAlertActionStyleCancel handler:nil]];
[alertController addAction:[UIAlertAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"Ok"] style:UIAlertActionStyleDefault handler:^(UIAlertAction* action){
NSString* hostAddress = [((UITextField*)[[alertController textFields] objectAtIndex:0]).text trim];
//handles public IP
NSString *publicIpBackdoor = @"-666";
if ([hostAddress rangeOfString:publicIpBackdoor].location != NSNotFound) {
hostAddress = [hostAddress stringByReplacingOccurrencesOfString:publicIpBackdoor withString:@""];
[DiscoveryManager setBackdoorHostAddress:hostAddress];
} else {
[DiscoveryManager setBackdoorHostAddress:nil];
}
[self showLoadingFrame:^{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
[self->_discMan discoverHost:hostAddress withCallback:^(TemporaryHost* host, NSString* error){