This commit is contained in:
Rizky 2024-02-04 16:24:09 +07:00
parent 2301d94a0a
commit c2ea5caba8
3 changed files with 44 additions and 38 deletions

View File

@ -28,6 +28,7 @@ export default page({
})();
return <Loading note="init" />;
}
if (!edInitSync(p)) {
return <Loading note="connecting-ws" />;
}

View File

@ -33,7 +33,7 @@ export const edInitSync = (p: PG) => {
p.user.id = "ab1390f5-40d5-448e-a8c3-84b0fb600930";
p.user.username = "anonymous";
}
if (!params.page_id) {
if (location.pathname.startsWith("/vi/")) {
if (page.list.length === 0) {
db.page
@ -54,7 +54,7 @@ export const edInitSync = (p: PG) => {
});
return;
} else {
}
if (!page.route) {
page.route = createRouter();
for (const e of page.list) {
@ -65,6 +65,7 @@ export const edInitSync = (p: PG) => {
const arrpath = location.pathname.split("/");
const pathname = "/" + arrpath.slice(3).join("/");
if (!params.page_id) {
const res = page.route.lookup(pathname);
if (res) {
params.page_id = res.id;
@ -77,7 +78,10 @@ export const edInitSync = (p: PG) => {
}
}
}
} else if (location.pathname.startsWith("/ed")) {
}
if (!params.page_id) {
if (location.pathname.startsWith("/ed")) {
if (!params.site_id) {
db.page
.findFirst({

View File

@ -46,6 +46,7 @@ export const ViPreview = (arg: { pathname: string }) => {
_href = `${w.basepath}${_href}`;
}
if (
location.hostname.split(".").length === 4 ||
location.hostname === "prasi.app" ||
location.hostname === "prasi.avolut.com" ||
location.hostname.includes("ngrok") ||