Update host names for main service.

This commit is contained in:
Matthew Chen 2021-08-12 11:17:17 -03:00
parent 63019922f5
commit f32064dcdb
6 changed files with 23 additions and 15 deletions

View File

@ -1,5 +1,5 @@
//
// Copyright (c) 2020 Open Whisper Systems. All rights reserved.
// Copyright (c) 2021 Open Whisper Systems. All rights reserved.
//
import Foundation
@ -16,7 +16,8 @@ public class ProvisioningSocket {
public init() {
// TODO: Will this work with censorship circumvention?
let serviceBaseURL = URL(string: TSConstants.textSecureWebSocketAPI)!
// TODO: Should we (sometimes?) use the unidentified service?
let serviceBaseURL = URL(string: TSConstants.mainServiceWebSocketAPI_identified)!
let socketURL = URL(string: "/v1/websocket/provisioning/?agent=\(OWSUserAgent)",
relativeTo: serviceBaseURL)!

View File

@ -144,7 +144,7 @@ extension HTTPUtils {
// * etc.
//
// TODO: Will this work with censorship circumvention?
if requestUrl.absoluteString.hasPrefix(TSConstants.textSecureServerURL),
if requestUrl.absoluteString.hasPrefix(TSConstants.mainServiceURL),
request.shouldHaveAuthorizationHeaders {
DispatchQueue.main.async {
if Self.tsAccountManager.isRegisteredAndReady {

View File

@ -41,7 +41,7 @@ fileprivate extension OWSSignalService {
func signalServiceInfo(for signalServiceType: SignalServiceType) -> SignalServiceInfo {
switch signalServiceType {
case .mainSignalService:
return SignalServiceInfo(baseUrl: URL(string: TSConstants.textSecureServerURL)!,
return SignalServiceInfo(baseUrl: URL(string: TSConstants.mainServiceURL)!,
censorshipCircumventionPathPrefix: TSConstants.serviceCensorshipPrefix,
requestSerializerType: .json,
responseSerializerType: .json,

View File

@ -161,7 +161,7 @@ public class SSKReachabilityManagerImpl: NSObject, SSKReachabilityManager {
Logger.info("Scheduling wakeup request for pending message sends.")
backgroundSession.urlDownloadTaskPromise(TSConstants.textSecureServerURL, method: .get).done { _ in
backgroundSession.urlDownloadTaskPromise(TSConstants.mainServiceURL, method: .get).done { _ in
Logger.info("Finished wakeup request.")
}.catch { error in
Logger.info("Failed wakeup request \(error)")

View File

@ -309,8 +309,10 @@ NSString *NSStringForOWSWebSocketType(OWSWebSocketType value)
[self resetSocket];
// Create a new web socket.
NSString *webSocketConnect =
[TSConstants.textSecureWebSocketAPI stringByAppendingString:[self webSocketAuthenticationString]];
//
// TODO: Use the unidentified URL for unidentified websockets.
NSString *webSocketConnect = [TSConstants.mainServiceWebSocketAPI_identified
stringByAppendingString:[self webSocketAuthenticationString]];
NSURL *webSocketConnectURL = [NSURL URLWithString:webSocketConnect];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:webSocketConnectURL];
[request setValue:OWSURLSession.signalIosUserAgent forHTTPHeaderField:OWSURLSession.kUserAgentHeader];

View File

@ -3,8 +3,9 @@
//
private protocol TSConstantsProtocol: AnyObject {
var textSecureWebSocketAPI: String { get }
var textSecureServerURL: String { get }
var mainServiceWebSocketAPI_identified: String { get }
var mainServiceWebSocketAPI_unidentified: String { get }
var mainServiceURL: String { get }
var textSecureCDN0ServerURL: String { get }
var textSecureCDN2ServerURL: String { get }
var contactDiscoveryURL: String { get }
@ -52,9 +53,11 @@ public class TSConstants: NSObject {
private override init() {}
@objc
public static var textSecureWebSocketAPI: String { return shared.textSecureWebSocketAPI }
public static var mainServiceWebSocketAPI_identified: String { return shared.mainServiceWebSocketAPI_identified }
@objc
public static var textSecureServerURL: String { return shared.textSecureServerURL }
public static var mainServiceWebSocketAPI_unidentified: String { return shared.mainServiceWebSocketAPI_unidentified }
@objc
public static var mainServiceURL: String { return shared.mainServiceURL }
@objc
public static var textSecureCDN0ServerURL: String { return shared.textSecureCDN0ServerURL }
@objc
@ -157,8 +160,9 @@ public class TSConstants: NSObject {
private class TSConstantsProduction: TSConstantsProtocol {
public let textSecureWebSocketAPI = "wss://textsecure-service.whispersystems.org/v1/websocket/"
public let textSecureServerURL = "https://textsecure-service.whispersystems.org/"
public let mainServiceWebSocketAPI_identified = "wss://chat.signal.org/v1/websocket/"
public let mainServiceWebSocketAPI_unidentified = "wss://ud-chat.signal.org/v1/websocket/"
public let mainServiceURL = "https://chat.signal.org/"
public let textSecureCDN0ServerURL = "https://cdn.signal.org"
public let textSecureCDN2ServerURL = "https://cdn2.signal.org"
public let contactDiscoveryURL = "https://api.directory.signal.org"
@ -205,8 +209,9 @@ private class TSConstantsProduction: TSConstantsProtocol {
private class TSConstantsStaging: TSConstantsProtocol {
public let textSecureWebSocketAPI = "wss://textsecure-service-staging.whispersystems.org/v1/websocket/"
public let textSecureServerURL = "https://textsecure-service-staging.whispersystems.org/"
public let mainServiceWebSocketAPI_identified = "wss://chat.staging.signal.org/v1/websocket/"
public let mainServiceWebSocketAPI_unidentified = "wss://ud-chat.staging.signal.org/v1/websocket/"
public let mainServiceURL = "https://chat.staging.signal.org/"
public let textSecureCDN0ServerURL = "https://cdn-staging.signal.org"
public let textSecureCDN2ServerURL = "https://cdn2-staging.signal.org"
public let contactDiscoveryURL = "https://api-staging.directory.signal.org"