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

View File

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