| 269 | }; |
| 270 | |
| 271 | const computeUsableURLS = (proxy?: Region): PreferredProxy => { |
| 272 | if (!proxy) { |
| 273 | // By default use relative links for the primary proxy. |
| 274 | // This is the default, and we should not change it. |
| 275 | return { |
| 276 | proxy: undefined, |
| 277 | preferredPathAppURL: "", |
| 278 | preferredWildcardHostname: "", |
| 279 | }; |
| 280 | } |
| 281 | |
| 282 | let pathAppURL = proxy?.path_app_url.replace(/\/$/, ""); |
| 283 | // Primary proxy uses relative paths. It's the only exception. |
| 284 | if (proxy.name === "primary") { |
| 285 | pathAppURL = ""; |
| 286 | } |
| 287 | |
| 288 | return { |
| 289 | proxy: proxy, |
| 290 | // Trim trailing slashes to be consistent |
| 291 | preferredPathAppURL: pathAppURL, |
| 292 | preferredWildcardHostname: proxy.wildcard_hostname, |
| 293 | }; |
| 294 | }; |
| 295 | |
| 296 | // Local storage functions |
| 297 | |