···240240 XLFormSectionDescriptor *section = [XLFormSectionDescriptor formSection];
241241 [section setTitle:NSLocalizedString(@"Security", nil)];
242242 [form addFormSection:section];
243243+244244+ /* ignore TLS errors */
245245+ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"allow_tls_error_ignore"])
246246+ {
247247+ XLFormRowDescriptor *row = [XLFormRowDescriptor formRowDescriptorWithTag:HOST_SETTINGS_KEY_IGNORE_TLS_ERRORS rowType:XLFormRowDescriptorTypeSelectorActionSheet title:NSLocalizedString(@"Ignore TLS errors", nil)];
248248+249249+ XLFormOptionsObject *yes = [XLFormOptionsObject formOptionsObjectWithValue:HOST_SETTINGS_VALUE_YES displayText:NSLocalizedString(@"Yes", nil)];
250250+ XLFormOptionsObject *no = [XLFormOptionsObject formOptionsObjectWithValue:HOST_SETTINGS_VALUE_NO displayText:NSLocalizedString(@"No", nil)];
251251+252252+ // This value is always "NO", except, when the user set the global setting
253253+ // "allow_tls_error_ignore" to YES *and* they surfed to a site with an error
254254+ // *and* the selected "ignore" on the following error alert.
255255+ [row setSelectorOptions:@[no]];
256256+257257+ NSString *val = [host setting:HOST_SETTINGS_KEY_IGNORE_TLS_ERRORS];
258258+ [row setValue:[val isEqualToString:HOST_SETTINGS_VALUE_YES] ? yes : no];
259259+260260+ [section addFormRow:row];
261261+ }
243262244263 /* tls version */
245264 {
+18
Endless/InAppSettings.bundle/Root.inApp.plist
···172172 </dict>
173173 <dict>
174174 <key>Title</key>
175175+ <string>Security</string>
176176+ <key>Type</key>
177177+ <string>PSGroupSpecifier</string>
178178+ <key>FooterText</key>
179179+ <string>This allows you to ignore TLS errors for specific sites, which may be needed for testing self-signed sites. DANGER: This may expose you to man-in-the-middle attacks! Don't use this, if you don't know, what that is!</string>
180180+ </dict>
181181+ <dict>
182182+ <key>Key</key>
183183+ <string>allow_tls_error_ignore</string>
184184+ <key>Title</key>
185185+ <string>Allow selective ignore of TLS errors</string>
186186+ <key>Type</key>
187187+ <string>PSToggleSwitchSpecifier</string>
188188+ <key>DefaultValue</key>
189189+ <false/>
190190+ </dict>
191191+ <dict>
192192+ <key>Title</key>
175193 <string>Miscellaneous</string>
176194 <key>Type</key>
177195 <string>PSGroupSpecifier</string>
···2020"Rate on App Store" = "Im App Store bewerten";
2121"About" = "Über";
2222"About Endless" = "Über Endless";
2323+"Security" = "Sicherheit";
2424+"This allows you to ignore TLS errors for specific sites, which may be needed for testing self-signed sites. DANGER: This may expose you to man-in-the-middle attacks! Don't use this, if you don't know, what that is!" = "Dies erlaubt, TLS-Fehler für spezifische Seiten zu ignorieren. ACHTUNG: Dies macht Sie anfällig für sog. Man-in-the-Middle-Attacken! Benutzen Sie das nicht, wenn Sie nicht wissen was das ist!";
2525+"Allow selective ignore of TLS errors" = "Erlaube ausgewähltes Ignorieren von TLS-Fehlern";
···2020"Rate on App Store" = "Rate on App Store";
2121"About" = "About";
2222"About Endless" = "About Endless";
2323+"Security" = "Security";
2424+"This allows you to ignore TLS errors for specific sites, which may be needed for testing self-signed sites. DANGER: This may expose you to man-in-the-middle attacks! Don't use this, if you don't know, what that is!" = "This allows you to ignore TLS errors for specific sites, which may be needed for testing self-signed sites. DANGER: This may expose you to man-in-the-middle attacks! Don't use this, if you don't know, what that is!";
2525+"Allow selective ignore of TLS errors" = "Allow selective ignore of TLS errors";
+35-3
Endless/WebViewTab.m
···544544 if ([[error domain] isEqualToString:NSOSStatusErrorDomain]) {
545545 switch (error.code) {
546546 case errSSLProtocol: /* -9800 */
547547- msg = @"SSL protocol error";
547547+ msg = NSLocalizedString(@"TLS protocol error", nil);
548548 break;
549549 case errSSLNegotiation: /* -9801 */
550550- msg = @"SSL handshake failed";
550550+ msg = NSLocalizedString(@"TLS handshake failed", nil);
551551 break;
552552 case errSSLXCertChainInvalid: /* -9807 */
553553- msg = @"SSL certificate chain verification error (self-signed certificate?)";
553553+ msg = NSLocalizedString(@"TLS certificate chain verification error (self-signed certificate?)", nil);
554554 break;
555555 }
556556 }
···576576577577 UIAlertController *uiac = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Error", nil) message:msg preferredStyle:UIAlertControllerStyleAlert];
578578 [uiac addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"OK", nil) style:UIAlertActionStyleDefault handler:nil]];
579579+580580+ if (u != nil && [[NSUserDefaults standardUserDefaults] boolForKey:@"allow_tls_error_ignore"]) {
581581+ [uiac addAction:[UIAlertAction
582582+ actionWithTitle:NSLocalizedString(@"Ignore for this host", nil)
583583+ style:UIAlertActionStyleDestructive
584584+ handler:^(UIAlertAction * _Nonnull action) {
585585+586586+ // self.url will hold the URL of the UIWebView which is the last
587587+ // *successful* request.
588588+ // We need the URL of the *failed* request, which should be in `u`.
589589+ // (From `error`'s `userInfo` dictionary.
590590+ NSURL *url = [[NSURL alloc] initWithString:u];
591591+592592+ // Theoretically, URL string could have been malformed.
593593+ if (url != nil) {
594594+ HostSettings *hs = [HostSettings forHost:url.host];
595595+596596+ if (hs == nil) {
597597+ hs = [[HostSettings alloc] initForHost:url.host withDict:nil];
598598+ }
599599+600600+ [hs setSetting:HOST_SETTINGS_KEY_IGNORE_TLS_ERRORS toValue:HOST_SETTINGS_VALUE_YES];
601601+602602+ [hs save];
603603+ [HostSettings persist];
604604+605605+ // Retry the failed request.
606606+ [self loadURL:url];
607607+ }
608608+ }]];
609609+ }
610610+579611 [[appDelegate webViewController] presentViewController:uiac animated:YES completion:nil];
580612581613 [self webViewDidFinishLoad:__webView];