wip fix vi

This commit is contained in:
Rizky 2024-03-18 13:53:37 +07:00
parent 32f35b4c63
commit c2f85a5735
1 changed files with 16 additions and 14 deletions

View File

@ -52,23 +52,25 @@ export const Vi: FC<{
w.siteurl = (pathname: string, forceOriginal?: boolean) => {
if (pathname.startsWith("http://") || pathname.startsWith("https://"))
return pathname;
if (["prasi.avolut.com", "localhost"].includes(location.hostname)) {
if (vi.site.api_url) {
try {
if (["prasi.avolut.com", "localhost"].includes(location.hostname)) {
if (vi.site.api_url) {
if (!vi.site_url) {
vi.site_url = new URL(vi.site.api_url);
}
}
} else {
if (!vi.site_url) {
vi.site_url = new URL(vi.site.api_url);
if (forceOriginal && vi.site.api_url) {
vi.site_url = new URL(vi.site.api_url);
} else {
vi.site_url = new URL(location.href);
}
vi.site_url.pathname = "";
}
}
} else {
if (!vi.site_url) {
if (forceOriginal && vi.site.api_url) {
vi.site_url = new URL(vi.site.api_url);
} else {
vi.site_url = new URL(location.href);
}
vi.site_url.pathname = "";
}
}
} catch (e) {}
if (vi.site_url) {
const u = vi.site_url;