Skip to content

Commit

Permalink
Handle domains with the word configure in them (#630)
Browse files Browse the repository at this point in the history
  • Loading branch information
timja authored Oct 12, 2024
1 parent 161b33e commit 13107da
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/main/frontend/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,28 @@ document.addEventListener('DOMContentLoaded', () => {
}
}
})
const currentUrl = window.location.href

const origin = window.location.origin
const pathname = window.location.pathname

// GraphProxy is either a root action or at an item level
const endStrippedCurrentUrl = currentUrl
const endStrippedPathname = pathname
.replace('configureSecurity/', '')
.replace('configure', '')
.replace('pipeline-syntax/', '')
.replace('manage/cloud/create', '')
.replace('cloud/create', '')
.replace('computer/createItem', '');

function appendSlashIfRequired(value: string) {
if (!value.endsWith("/")) {
return `${value}/`
}
return value
}

Providers.globalProvider = new ProxyProvider(`${endStrippedCurrentUrl}/GraphProxy`, async () => {
const url = `${origin}${appendSlashIfRequired(endStrippedPathname)}GraphProxy`
Providers.globalProvider = new ProxyProvider(url, async () => {
return {
[document.head.dataset.crumbHeader as string]: document.head.dataset.crumbValue,
};
Expand Down

0 comments on commit 13107da

Please sign in to comment.