fix broadcast
This commit is contained in:
parent
883aca22c6
commit
d84feffc21
|
|
@ -6,7 +6,7 @@ import {
|
||||||
} from "../../../web/src/render/ed/logic/ed-global";
|
} from "../../../web/src/render/ed/logic/ed-global";
|
||||||
import { IItem } from "../../../web/src/utils/types/item";
|
import { IItem } from "../../../web/src/utils/types/item";
|
||||||
import { site_group } from "./actions/site_group";
|
import { site_group } from "./actions/site_group";
|
||||||
import { Activity } from "./entity/actstore";
|
import { Activity } from "./type";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
WARNING:
|
WARNING:
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { validate } from "uuid";
|
import { validate } from "uuid";
|
||||||
import { SAction } from "../actions";
|
import { SAction } from "../actions";
|
||||||
import { Activity, actstore, broadcastActivity } from "../entity/actstore";
|
import { actstore, broadcastActivity } from "../entity/actstore";
|
||||||
import { SyncConnection } from "../type";
|
import { Activity, SyncConnection } from "../type";
|
||||||
|
|
||||||
export const activity: SAction["activity"] = async function (
|
export const activity: SAction["activity"] = async function (
|
||||||
this: SyncConnection,
|
this: SyncConnection,
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@ import { snapshot } from "../entity/snapshot";
|
||||||
import { user } from "../entity/user";
|
import { user } from "../entity/user";
|
||||||
import { gzipAsync } from "../entity/zlib";
|
import { gzipAsync } from "../entity/zlib";
|
||||||
import { sendWS } from "../sync-handler";
|
import { sendWS } from "../sync-handler";
|
||||||
import { SyncConnection, SyncType } from "../type";
|
import { Activity, SyncConnection, SyncType } from "../type";
|
||||||
import { Activity, actstore, broadcastActivity } from "../entity/actstore";
|
import { actstore, broadcastActivity } from "../entity/actstore";
|
||||||
|
|
||||||
export const page_load: SAction["page"]["load"] = async function (
|
export const page_load: SAction["page"]["load"] = async function (
|
||||||
this: SyncConnection,
|
this: SyncConnection,
|
||||||
|
|
@ -34,12 +34,6 @@ export const page_load: SAction["page"]["load"] = async function (
|
||||||
load.root[this.client_id] = Activity.Open;
|
load.root[this.client_id] = Activity.Open;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
broadcastActivity(
|
|
||||||
{
|
|
||||||
page_id: id,
|
|
||||||
},
|
|
||||||
[this.client_id]
|
|
||||||
);
|
|
||||||
|
|
||||||
const createUndoManager = async (root: Y.Map<any>) => {
|
const createUndoManager = async (root: Y.Map<any>) => {
|
||||||
const um = new Y.UndoManager(root, {
|
const um = new Y.UndoManager(root, {
|
||||||
|
|
@ -112,6 +106,10 @@ export const page_load: SAction["page"]["load"] = async function (
|
||||||
page_id: page.id,
|
page_id: page.id,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
broadcastActivity({
|
||||||
|
page_id: id,
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: id,
|
id: id,
|
||||||
url: page.url,
|
url: page.url,
|
||||||
|
|
@ -142,6 +140,10 @@ export const page_load: SAction["page"]["load"] = async function (
|
||||||
page_id: snap.id,
|
page_id: snap.id,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
broadcastActivity({
|
||||||
|
page_id: id,
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: id,
|
id: id,
|
||||||
url: snap.url,
|
url: snap.url,
|
||||||
|
|
@ -157,6 +159,10 @@ export const page_load: SAction["page"]["load"] = async function (
|
||||||
page_id: snap.id,
|
page_id: snap.id,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
broadcastActivity({
|
||||||
|
page_id: id,
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: snap.id,
|
id: snap.id,
|
||||||
url: snap.url,
|
url: snap.url,
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { ServerWebSocket } from "bun";
|
import { ServerWebSocket } from "bun";
|
||||||
import { WSData } from "../../../../../pkgs/core/server/create";
|
import { WSData } from "../../../../../pkgs/core/server/create";
|
||||||
import { sendWS } from "../sync-handler";
|
import { sendWS } from "../sync-handler";
|
||||||
import { SyncType } from "../type";
|
import { Activity, SyncType } from "../type";
|
||||||
import { conns } from "./conn";
|
import { conns } from "./conn";
|
||||||
import { user } from "./user";
|
import { user } from "./user";
|
||||||
|
|
||||||
|
|
@ -10,10 +10,6 @@ type COMP_ID = string;
|
||||||
type ITEM_ID = string;
|
type ITEM_ID = string;
|
||||||
type CLIENT_ID = string;
|
type CLIENT_ID = string;
|
||||||
|
|
||||||
export enum Activity {
|
|
||||||
Open,
|
|
||||||
Null,
|
|
||||||
}
|
|
||||||
export type ActivityKind = "root" | "js" | "css" | "html" | "text";
|
export type ActivityKind = "root" | "js" | "css" | "html" | "text";
|
||||||
export type ActivityList = Record<
|
export type ActivityList = Record<
|
||||||
ITEM_ID,
|
ITEM_ID,
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,11 @@ import { UserConf } from "./entity/user";
|
||||||
import { WSData } from "../../../../pkgs/core/server/create";
|
import { WSData } from "../../../../pkgs/core/server/create";
|
||||||
import { user } from "../../../db/db";
|
import { user } from "../../../db/db";
|
||||||
|
|
||||||
|
export enum Activity {
|
||||||
|
Open,
|
||||||
|
Null,
|
||||||
|
}
|
||||||
|
|
||||||
export enum SyncType {
|
export enum SyncType {
|
||||||
ClientID,
|
ClientID,
|
||||||
UserID,
|
UserID,
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import { EdMonaco } from "./monaco/monaco";
|
||||||
import { EDGlobal, active } from "../../logic/ed-global";
|
import { EDGlobal, active } from "../../logic/ed-global";
|
||||||
import { compress } from "wasm-gzip";
|
import { compress } from "wasm-gzip";
|
||||||
import { jscript } from "../../../../utils/script/jscript";
|
import { jscript } from "../../../../utils/script/jscript";
|
||||||
import { Activity } from "../../../../../../srv/ws/sync/entity/actstore";
|
import { Activity } from "../../../../../../srv/ws/sync/type";
|
||||||
|
|
||||||
export const EdScriptSite = () => {
|
export const EdScriptSite = () => {
|
||||||
const p = useGlobal(EDGlobal, "EDITOR");
|
const p = useGlobal(EDGlobal, "EDITOR");
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { useGlobal } from "web-utils";
|
import { useGlobal } from "web-utils";
|
||||||
import { TopBtn } from "../top-btn";
|
import { TopBtn } from "../top-btn";
|
||||||
import { EDGlobal, active } from "../../../logic/ed-global";
|
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 = () => {
|
export const EdSiteJS = () => {
|
||||||
const p = useGlobal(EDGlobal, "EDITOR");
|
const p = useGlobal(EDGlobal, "EDITOR");
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,6 @@ const connect = (
|
||||||
const ws = new WebSocket(url.toString());
|
const ws = new WebSocket(url.toString());
|
||||||
|
|
||||||
ws.onopen = () => {
|
ws.onopen = () => {
|
||||||
console.clear();
|
|
||||||
sendWs(ws, { type: SyncType.UserID, user_id, site_id, page_id });
|
sendWs(ws, { type: SyncType.UserID, user_id, site_id, page_id });
|
||||||
conf.ws = ws;
|
conf.ws = ws;
|
||||||
event.connected();
|
event.connected();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue