Federation progress

This commit is contained in:
Zef Hemel
2023-07-29 23:41:37 +02:00
parent 272bd90ee6
commit fe4887dc78
11 changed files with 112 additions and 49 deletions
+20
View File
@@ -0,0 +1,20 @@
export function resolvePath(
currentPage: string,
pathToResolve: string,
fullUrl = false,
): string {
if (currentPage.startsWith("!") && !pathToResolve.startsWith("!")) {
let domainPart = currentPage.split("/")[0];
if (fullUrl) {
domainPart = domainPart.substring(1);
if (domainPart.startsWith("localhost")) {
domainPart = "http://" + domainPart;
} else {
domainPart = "https://" + domainPart;
}
}
return `${domainPart}/${pathToResolve}`;
} else {
return pathToResolve;
}
}