MCPcopy Create free account
hub / github.com/coder/coder / computeUsableURLS

Function computeUsableURLS

site/src/contexts/ProxyContext.tsx:271–294  ·  view source on GitHub ↗
(proxy?: Region)

Source from the content-addressed store, hash-verified

269};
270
271const 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

Callers 1

getPreferredProxyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected