mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2024-11-11 01:10:11 +01:00
refactor spaceKey url pattern for custom domains
This commit is contained in:
parent
cf969adf37
commit
87b41a60e9
@ -19,19 +19,17 @@ function validSpaceUrl(spaceUrl = "") {
|
|||||||
return { valid: true, result: atlassianMatch };
|
return { valid: true, result: atlassianMatch };
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom Confluence URL match
|
let customMatch = null;
|
||||||
const customPattern = new UrlPattern(
|
[
|
||||||
"https\\://(:subdomain.):domain.:tld/wiki/spaces/(:spaceKey)/*"
|
"https\\://(:subdomain.):domain.:tld/wiki/spaces/(:spaceKey)/*", // Custom Confluence space
|
||||||
);
|
"https\\://(:subdomain.):domain.:tld/display/(:spaceKey)/*", // Custom Confluence space + Human-readable space tag.
|
||||||
const customMatch = customPattern.match(spaceUrl);
|
].forEach((matchPattern) => {
|
||||||
|
if (!!customMatch) return;
|
||||||
|
const pattern = new UrlPattern(matchPattern);
|
||||||
|
customMatch = pattern.match(spaceUrl);
|
||||||
|
});
|
||||||
|
|
||||||
// Custom "display" Confluence URL match
|
if (customMatch) {
|
||||||
const customDisplayPattern = new UrlPattern(
|
|
||||||
"https\\://(:subdomain.):domain.:tld/display/(:spaceKey)/*"
|
|
||||||
);
|
|
||||||
const customDisplayMatch = customDisplayPattern.match(spaceUrl);
|
|
||||||
|
|
||||||
if (customMatch || customDisplayMatch) {
|
|
||||||
customMatch.customDomain =
|
customMatch.customDomain =
|
||||||
(customMatch.subdomain ? `${customMatch.subdomain}.` : "") + //
|
(customMatch.subdomain ? `${customMatch.subdomain}.` : "") + //
|
||||||
`${customMatch.domain}.${customMatch.tld}`;
|
`${customMatch.domain}.${customMatch.tld}`;
|
||||||
|
Loading…
Reference in New Issue
Block a user