mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-22 16:48:23 +01:00
pass process id as client id to ws
This commit is contained in:
parent
28f5e9bf05
commit
7867edb8da
@ -75,7 +75,8 @@ app.on('window-all-closed', () => {
|
||||
});
|
||||
|
||||
electron.ipcMain.on("get-id", (event) => {
|
||||
return event.processId;
|
||||
event.returnValue = event.processId;
|
||||
return;
|
||||
});
|
||||
|
||||
|
||||
|
46
src/model.ts
46
src/model.ts
@ -16,6 +16,15 @@ function isBlank(s : string) {
|
||||
return (s == null || s == "");
|
||||
}
|
||||
|
||||
type ElectronApi = {
|
||||
getId : () => string,
|
||||
onCmdT : (callback : () => void) => void,
|
||||
};
|
||||
|
||||
function getApi() : ElectronApi {
|
||||
return (window as any).api;
|
||||
}
|
||||
|
||||
class Cmd {
|
||||
sessionId : string;
|
||||
windowId : string;
|
||||
@ -391,7 +400,7 @@ class Model {
|
||||
remotesLoaded : OV<boolean> = mobx.observable.box(false);
|
||||
|
||||
constructor() {
|
||||
this.clientId = uuidv4();
|
||||
this.clientId = getApi().getId();
|
||||
this.loadRemotes();
|
||||
this.loadSessionList();
|
||||
this.ws = new WSControl(this.clientId, this.onWSMessage.bind(this))
|
||||
@ -575,38 +584,3 @@ GlobalModel = (window as any).GlobalModel;
|
||||
export {Model, Session, Window, GlobalModel, Cmd};
|
||||
|
||||
|
||||
// GlobalWS.registerAndSendGetCmd(getCmdPacket, (dataPacket) => {
|
||||
// let realData = atob(dataPacket.ptydata64);
|
||||
// this.updatePtyData(this.ptyPos, realData, dataPacket.ptydatalen);
|
||||
// });
|
||||
|
||||
|
||||
/*
|
||||
reloadTerminal(startTail : boolean, delayMs : number) {
|
||||
loadPtyOut(this.terminal, this.sessionId, this.cmdId, delayMs, (ptyoutLen) => {
|
||||
mobx.action(() => {
|
||||
this.incRenderVersion();
|
||||
this.ptyPos = ptyoutLen;
|
||||
})();
|
||||
if (startTail) {
|
||||
this.startPtyTail();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
setCmdStatus(status : string) {
|
||||
if (this.cmdStatus == status) {
|
||||
return;
|
||||
}
|
||||
this.cmdStatus = status;
|
||||
if (!this.isRunning() && this.tailReqId) {
|
||||
this.stopPtyTail();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
isRunning() : boolean {
|
||||
return this.cmdStatus == "running" || this.cmdStatus == "detached";
|
||||
}
|
||||
*/
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user