mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-21 16:38:23 +01:00
370ea132fe
When a user first launches Wave, we will read the updater config and store the channel as a user setting for use on future launches. This should ensure that if a user on a beta channel gets updated to a latest release, they will still be subscribed to beta releases going forward. If a user manually updates the user setting, it will be honored. --------- Co-authored-by: sawka <mike@commandline.dev>
38 lines
1.4 KiB
TypeScript
38 lines
1.4 KiB
TypeScript
// Copyright 2024, Command Line Inc.
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
import electron from "electron";
|
|
import { RpcResponseHelper, WshClient } from "../frontend/app/store/wshclient";
|
|
import { getWebContentsByBlockId, webGetSelector } from "./emain-web";
|
|
|
|
type WaveBrowserWindow = Electron.BrowserWindow & { waveWindowId: string; readyPromise: Promise<void> };
|
|
|
|
export class ElectronWshClientType extends WshClient {
|
|
constructor() {
|
|
super("electron");
|
|
}
|
|
|
|
async handle_webselector(rh: RpcResponseHelper, data: CommandWebSelectorData): Promise<string[]> {
|
|
if (!data.tabid || !data.blockid || !data.windowid) {
|
|
throw new Error("tabid and blockid are required");
|
|
}
|
|
const windows = electron.BrowserWindow.getAllWindows();
|
|
const win = windows.find((w) => (w as WaveBrowserWindow).waveWindowId === data.windowid);
|
|
if (win == null) {
|
|
throw new Error(`no window found with id ${data.windowid}`);
|
|
}
|
|
const wc = await getWebContentsByBlockId(win, data.tabid, data.blockid);
|
|
if (wc == null) {
|
|
throw new Error(`no webcontents found with blockid ${data.blockid}`);
|
|
}
|
|
const rtn = await webGetSelector(wc, data.selector, data.opts);
|
|
return rtn;
|
|
}
|
|
}
|
|
|
|
export let ElectronWshClient: ElectronWshClientType;
|
|
|
|
export function initElectronWshClient() {
|
|
ElectronWshClient = new ElectronWshClientType();
|
|
}
|