diff --git a/common/windows/delphi/general/Upload_Settings.pas b/common/windows/delphi/general/Upload_Settings.pas index e1e8ce4294..8811ec6f10 100644 --- a/common/windows/delphi/general/Upload_Settings.pas +++ b/common/windows/delphi/general/Upload_Settings.pas @@ -66,11 +66,11 @@ const URLPath_Community = '/go/'+SKeymanVersion+'/community'; // Keyboard download and installation - URLPath_RegEx_MatchKeyboardsInstall = '^http(?:s)?://keyman(?:-staging)?\.com(?:\.local)?/keyboards/install/([^?/]+)(?:\?(.+))?$'; + URLPath_RegEx_MatchKeyboardsInstall = '^http(?:s)?://keyman(?:-staging)?\.com(?:\.localhost)?/keyboards/install/([^?/]+)(?:\?(.+))?$'; // e.g. https://keyman.com/keyboards/install/foo - UrlPath_RegEx_MatchKeyboardsRoot = '^http(?:s)?://keyman(?:-staging)?\.com(?:\.local)?/keyboards([/?].*)?$'; - // e.g. http://keyman.com.local/keyboards/foo - UrlPath_RegEx_MatchKeyboardsGo = '^http(?:s)?://keyman(?:-staging)?\.com(?:\.local)?/go/windows/[^/]+/download-keyboards'; + UrlPath_RegEx_MatchKeyboardsRoot = '^http(?:s)?://keyman(?:-staging)?\.com(?:\.localhost)?/keyboards([/?].*)?$'; + // e.g. http://keyman.com.localhost/keyboards/foo + UrlPath_RegEx_MatchKeyboardsGo = '^http(?:s)?://keyman(?:-staging)?\.com(?:\.localhost)?/go/windows/[^/]+/download-keyboards'; // e.g. https://keyman-staging.com/go/windows/14.0/download-keyboards?version=14.0.146.0 // Cloning keyboards - Keyman Developer diff --git a/ios/engine/KMEI/KeymanEngine/Classes/KeymanHosts.swift b/ios/engine/KMEI/KeymanEngine/Classes/KeymanHosts.swift index 897b162a5e..65ce860dcc 100644 --- a/ios/engine/KMEI/KeymanEngine/Classes/KeymanHosts.swift +++ b/ios/engine/KMEI/KeymanEngine/Classes/KeymanHosts.swift @@ -16,7 +16,7 @@ import Foundation */ public enum KeymanHosts { /** - * Used to enable '.local' variants of the endpoints for use in local development testing. + * Used to enable '.localhost' variants of the endpoints for use in local development testing. */ internal static let useLocal = false @@ -24,7 +24,7 @@ public enum KeymanHosts { // save for use in automated testing. internal static func getApiSiteURL(forTier: Version.Tier, useLocal: Bool) -> URL { if useLocal { - return URL.init(string: "http://api.keyman.com.local")! + return URL.init(string: "http://api.keyman.com.localhost")! } else { switch forTier { case .alpha: @@ -48,7 +48,7 @@ public enum KeymanHosts { // save for use in automated testing. internal static func getHelpSiteURL(forTier: Version.Tier, useLocal: Bool) -> URL { if useLocal { - return URL.init(string: "http://help.keyman.com.local")! + return URL.init(string: "http://help.keyman.com.localhost")! } else { switch forTier { case .alpha: @@ -72,7 +72,7 @@ public enum KeymanHosts { // save for use in automated testing. internal static func getMainSiteURL(forTier: Version.Tier, useLocal: Bool) -> URL { if useLocal { - return URL.init(string: "http://keyman.com.local")! + return URL.init(string: "http://keyman.com.localhost")! } else { switch forTier { case .alpha: diff --git a/ios/engine/KMEI/KeymanEngine/Classes/UniversalLinks.swift b/ios/engine/KMEI/KeymanEngine/Classes/UniversalLinks.swift index 842592e69f..e179de30e6 100644 --- a/ios/engine/KMEI/KeymanEngine/Classes/UniversalLinks.swift +++ b/ios/engine/KMEI/KeymanEngine/Classes/UniversalLinks.swift @@ -25,11 +25,11 @@ public class UniversalLinks { public static var externalLinkLauncher: ((URL) -> Void)? = nil // e.g. https://keyman.com/keyboards/install/foo - private static let KEYBOARD_INSTALL_LINK_REGEX = try! NSRegularExpression(pattern: "^http(?:s)?://keyman(?:-staging)?\\.com(?:\\.local)?/keyboards/install/([^?/]+)(?:\\?(.+))?$") - // e.g. http://keyman.com.local/keyboards/foo - private static let KEYBOARD_MATCH_ROOT_REGEX = try! NSRegularExpression(pattern: "^http(?:s)?://keyman(?:-staging)?\\.com(?:\\.local)?/keyboards([/?].*)?$"); + private static let KEYBOARD_INSTALL_LINK_REGEX = try! NSRegularExpression(pattern: "^http(?:s)?://keyman(?:-staging)?\\.com(?:\\.localhost)?/keyboards/install/([^?/]+)(?:\\?(.+))?$") + // e.g. http://keyman.com.localhost/keyboards/foo + private static let KEYBOARD_MATCH_ROOT_REGEX = try! NSRegularExpression(pattern: "^http(?:s)?://keyman(?:-staging)?\\.com(?:\\.localhost)?/keyboards([/?].*)?$"); // e.g. https://keyman-staging.com/go/windows/14.0/download-keyboards?version=14.0.146.0 - private static let KEYBOARD_MATCH_GO_REGEX = try! NSRegularExpression(pattern: "^http(?:s)?://keyman(?:-staging)?\\.com(?:\\.local)?/go/windows/[^/]+/download-keyboards") + private static let KEYBOARD_MATCH_GO_REGEX = try! NSRegularExpression(pattern: "^http(?:s)?://keyman(?:-staging)?\\.com(?:\\.localhost)?/go/windows/[^/]+/download-keyboards") public static func tryParseKeyboardInstallLink(_ link: URL) -> ParsedKeyboardInstallLink? { let linkString = link.absoluteString diff --git a/ios/engine/KMEI/KeymanEngineTests/KeymanHostTests.swift b/ios/engine/KMEI/KeymanEngineTests/KeymanHostTests.swift index 83cc6c9582..6ce6722835 100644 --- a/ios/engine/KMEI/KeymanEngineTests/KeymanHostTests.swift +++ b/ios/engine/KMEI/KeymanEngineTests/KeymanHostTests.swift @@ -18,14 +18,14 @@ class KeymanHostTests: XCTestCase { } /** - * Ensures no accidental permanent edits to the .local variant URLs occur. + * Ensures no accidental permanent edits to the .localhost variant URLs occur. */ func testLocalSitesUnchanged() { XCTAssertEqual(KeymanHosts.getApiSiteURL(forTier: .stable, useLocal: true), - URL.init(string: "http://api.keyman.com.local")) + URL.init(string: "http://api.keyman.com.localhost")) XCTAssertEqual(KeymanHosts.getHelpSiteURL(forTier: .stable, useLocal: true), - URL.init(string: "http://help.keyman.com.local")) + URL.init(string: "http://help.keyman.com.localhost")) XCTAssertEqual(KeymanHosts.getMainSiteURL(forTier: .stable, useLocal: true), - URL.init(string: "http://keyman.com.local")) + URL.init(string: "http://keyman.com.localhost")) } } diff --git a/mac/Keyman4MacIM/Keyman4MacIM/KMDownloadKeyboard/KMDownloadKBWindowController.m b/mac/Keyman4MacIM/Keyman4MacIM/KMDownloadKeyboard/KMDownloadKBWindowController.m index 4b5ce44dea..93b5b1eef9 100644 --- a/mac/Keyman4MacIM/Keyman4MacIM/KMDownloadKeyboard/KMDownloadKBWindowController.m +++ b/mac/Keyman4MacIM/Keyman4MacIM/KMDownloadKeyboard/KMDownloadKBWindowController.m @@ -22,15 +22,15 @@ - (void)windowDidLoad { [super windowDidLoad]; - + [self.webView setFrameLoadDelegate:(id)self]; [self.webView setGroupName:@"KMDownloadKB"]; [self.webView setPolicyDelegate:(id)self]; - + NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]; KeymanVersionInfo keymanVersionInfo = [[self AppDelegate] versionInfo]; NSString *url = [NSString stringWithFormat:@"https://%@/go/macos/14.0/download-keyboards/?version=%@", keymanVersionInfo.keymanCom, version]; - + os_log_debug([KMLogs uiLog], "KMDownloadKBWindowController opening url = %@, version = '%@'", url, version); [self.webView.mainFrame loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]]; } @@ -45,21 +45,21 @@ os_log_debug([KMLogs uiLog], "decidePolicyForNavigationAction, navigating to %@", url); // The pattern for matching links matches work in #3602 - NSString* urlPathMatchKeyboardsInstall = @"^http(?:s)?://keyman(?:-staging)?\\.com(?:\\.local)?/keyboards/install/([^?/]+)(?:\\?(.+))?$"; + NSString* urlPathMatchKeyboardsInstall = @"^http(?:s)?://keyman(?:-staging)?\\.com(?:\\.localhost)?/keyboards/install/([^?/]+)(?:\\?(.+))?$"; // e.g. https://keyman.com/keyboards/install/foo - NSString* urlPathMatchKeyboardsRoot = @"^http(?:s)?://keyman(?:-staging)?\\.com(?:\\.local)?/keyboards([/?].*)?$"; - // http://keyman.com.local/keyboards/foo - NSString* urlPathMatchKeyboardsGo = @"^http(?:s)?://keyman(?:-staging)?\\.com(?:\\.local)?/go/macos/[^/]+/download-keyboards"; + NSString* urlPathMatchKeyboardsRoot = @"^http(?:s)?://keyman(?:-staging)?\\.com(?:\\.localhost)?/keyboards([/?].*)?$"; + // http://keyman.com.localhost/keyboards/foo + NSString* urlPathMatchKeyboardsGo = @"^http(?:s)?://keyman(?:-staging)?\\.com(?:\\.localhost)?/go/macos/[^/]+/download-keyboards"; // https://keyman-staging.com/go/macos/14.0/download-keyboards?version=14.0.146.0 NSRange range = NSMakeRange(0, url.length); - + NSError* error; NSRegularExpression* regexInstall = [NSRegularExpression regularExpressionWithPattern: urlPathMatchKeyboardsInstall options: 0 error: &error]; NSRegularExpression* regexRoot = [NSRegularExpression regularExpressionWithPattern: urlPathMatchKeyboardsRoot options: 0 error: &error]; NSRegularExpression* regexGo = [NSRegularExpression regularExpressionWithPattern: urlPathMatchKeyboardsGo options: 0 error: &error]; - + NSArray* matchesInstall = [regexInstall matchesInString:url options:0 range:range]; - + if(matchesInstall.count > 0) { os_log_debug([KMLogs uiLog], "Delegating download to app delegate."); [listener ignore];