Changeset View
Changeset View
Standalone View
Standalone View
swh/web/assets/src/utils/functions.js
Show All 33 Lines | return fetch(url, { | ||||
headers: headers, | headers: headers, | ||||
method: 'POST', | method: 'POST', | ||||
body: body | body: body | ||||
}); | }); | ||||
} | } | ||||
export function isGitRepoUrl(url, domain) { | export function isGitRepoUrl(url, domain) { | ||||
let endOfPattern = '\\/[\\w\\.-]+\\/?(?!=.git)(?:\\.git(?:\\/?|\\#[\\w\\.\\-_]+)?)?$'; | let endOfPattern = '\\/[\\w\\.-]+\\/?(?!=.git)(?:\\.git(?:\\/?|\\#[\\w\\.\\-_]+)?)?$'; | ||||
let pattern = `(?:git|https?|git@)(?:\\:\\/\\/)?${domain}[/|:][A-Za-z0-9-/]+?` + endOfPattern; | let pattern = `(?:git|https?|git@)(?:\\:\\/\\/)?${domain}[/|:][\\w\\.\\-\\/]+?` + endOfPattern; | ||||
let re = new RegExp(pattern); | let re = new RegExp(pattern); | ||||
return re.test(url); | return re.test(url); | ||||
}; | }; | ||||
export function removeUrlFragment() { | export function removeUrlFragment() { | ||||
history.replaceState('', document.title, window.location.pathname + window.location.search); | history.replaceState('', document.title, window.location.pathname + window.location.search); | ||||
} | } | ||||
Show All 25 Lines |