diff --git a/app/srv/ws/sync/actions.ts b/app/srv/ws/sync/actions.ts index 73f7c74a..acbc849c 100644 --- a/app/srv/ws/sync/actions.ts +++ b/app/srv/ws/sync/actions.ts @@ -6,7 +6,7 @@ import { } from "../../../web/src/render/ed/logic/ed-global"; import { IItem } from "../../../web/src/utils/types/item"; import { site_group } from "./actions/site_group"; -import { Activity } from "./entity/actstore"; +import { Activity } from "./type"; /* WARNING: diff --git a/app/srv/ws/sync/actions/activity.ts b/app/srv/ws/sync/actions/activity.ts index 2a9a4fdf..14bccd21 100644 --- a/app/srv/ws/sync/actions/activity.ts +++ b/app/srv/ws/sync/actions/activity.ts @@ -1,7 +1,7 @@ import { validate } from "uuid"; import { SAction } from "../actions"; -import { Activity, actstore, broadcastActivity } from "../entity/actstore"; -import { SyncConnection } from "../type"; +import { actstore, broadcastActivity } from "../entity/actstore"; +import { Activity, SyncConnection } from "../type"; export const activity: SAction["activity"] = async function ( this: SyncConnection, diff --git a/app/srv/ws/sync/actions/page_load.ts b/app/srv/ws/sync/actions/page_load.ts index e141761c..7ff083c6 100644 --- a/app/srv/ws/sync/actions/page_load.ts +++ b/app/srv/ws/sync/actions/page_load.ts @@ -6,8 +6,8 @@ import { snapshot } from "../entity/snapshot"; import { user } from "../entity/user"; import { gzipAsync } from "../entity/zlib"; import { sendWS } from "../sync-handler"; -import { SyncConnection, SyncType } from "../type"; -import { Activity, actstore, broadcastActivity } from "../entity/actstore"; +import { Activity, SyncConnection, SyncType } from "../type"; +import { actstore, broadcastActivity } from "../entity/actstore"; export const page_load: SAction["page"]["load"] = async function ( this: SyncConnection, @@ -34,12 +34,6 @@ export const page_load: SAction["page"]["load"] = async function ( load.root[this.client_id] = Activity.Open; } } - broadcastActivity( - { - page_id: id, - }, - [this.client_id] - ); const createUndoManager = async (root: Y.Map) => { const um = new Y.UndoManager(root, { @@ -112,6 +106,10 @@ export const page_load: SAction["page"]["load"] = async function ( page_id: page.id, }); + broadcastActivity({ + page_id: id, + }); + return { id: id, url: page.url, @@ -142,6 +140,10 @@ export const page_load: SAction["page"]["load"] = async function ( page_id: snap.id, }); + broadcastActivity({ + page_id: id, + }); + return { id: id, url: snap.url, @@ -157,6 +159,10 @@ export const page_load: SAction["page"]["load"] = async function ( page_id: snap.id, }); + broadcastActivity({ + page_id: id, + }); + return { id: snap.id, url: snap.url, diff --git a/app/srv/ws/sync/entity/actstore.ts b/app/srv/ws/sync/entity/actstore.ts index 73122a2a..927833af 100644 --- a/app/srv/ws/sync/entity/actstore.ts +++ b/app/srv/ws/sync/entity/actstore.ts @@ -1,7 +1,7 @@ import { ServerWebSocket } from "bun"; import { WSData } from "../../../../../pkgs/core/server/create"; import { sendWS } from "../sync-handler"; -import { SyncType } from "../type"; +import { Activity, SyncType } from "../type"; import { conns } from "./conn"; import { user } from "./user"; @@ -10,10 +10,6 @@ type COMP_ID = string; type ITEM_ID = string; type CLIENT_ID = string; -export enum Activity { - Open, - Null, -} export type ActivityKind = "root" | "js" | "css" | "html" | "text"; export type ActivityList = Record< ITEM_ID, diff --git a/app/srv/ws/sync/type.ts b/app/srv/ws/sync/type.ts index 133ecc39..f8238b1c 100644 --- a/app/srv/ws/sync/type.ts +++ b/app/srv/ws/sync/type.ts @@ -3,6 +3,11 @@ import { UserConf } from "./entity/user"; import { WSData } from "../../../../pkgs/core/server/create"; import { user } from "../../../db/db"; +export enum Activity { + Open, + Null, +} + export enum SyncType { ClientID, UserID, diff --git a/app/web/src/render/ed/panel/script/site.tsx b/app/web/src/render/ed/panel/script/site.tsx index a877fe85..c1ca023a 100644 --- a/app/web/src/render/ed/panel/script/site.tsx +++ b/app/web/src/render/ed/panel/script/site.tsx @@ -3,7 +3,7 @@ import { EdMonaco } from "./monaco/monaco"; import { EDGlobal, active } from "../../logic/ed-global"; import { compress } from "wasm-gzip"; import { jscript } from "../../../../utils/script/jscript"; -import { Activity } from "../../../../../../srv/ws/sync/entity/actstore"; +import { Activity } from "../../../../../../srv/ws/sync/type"; export const EdScriptSite = () => { const p = useGlobal(EDGlobal, "EDITOR"); diff --git a/app/web/src/render/ed/panel/top/left/js.tsx b/app/web/src/render/ed/panel/top/left/js.tsx index 9eae9c4a..47ac60f5 100644 --- a/app/web/src/render/ed/panel/top/left/js.tsx +++ b/app/web/src/render/ed/panel/top/left/js.tsx @@ -1,7 +1,7 @@ import { useGlobal } from "web-utils"; import { TopBtn } from "../top-btn"; import { EDGlobal, active } from "../../../logic/ed-global"; -import { Activity } from "../../../../../../../srv/ws/sync/entity/actstore"; +import { Activity } from "../../../../../../../srv/ws/sync/type"; export const EdSiteJS = () => { const p = useGlobal(EDGlobal, "EDITOR"); diff --git a/app/web/src/utils/sync/ws-client.ts b/app/web/src/utils/sync/ws-client.ts index 29de54c1..ca7aa96d 100644 --- a/app/web/src/utils/sync/ws-client.ts +++ b/app/web/src/utils/sync/ws-client.ts @@ -153,7 +153,6 @@ const connect = ( const ws = new WebSocket(url.toString()); ws.onopen = () => { - console.clear(); sendWs(ws, { type: SyncType.UserID, user_id, site_id, page_id }); conf.ws = ws; event.connected(); diff --git a/bun.lockb b/bun.lockb index ba8ae03d..91ef701c 100755 Binary files a/bun.lockb and b/bun.lockb differ