mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-01-02 18:39:05 +01:00
Rename endpoint functions
This commit is contained in:
parent
8971e2feba
commit
4d29dd5b5f
@ -14,7 +14,7 @@ import * as services from "../frontend/app/store/services";
|
||||
import * as keyutil from "../frontend/util/keyutil";
|
||||
import { fireAndForget } from "../frontend/util/util";
|
||||
|
||||
import { getServerWebEndpoint, WebServerEndpointVarName, WSServerEndpointVarName } from "@/util/endpoints";
|
||||
import { getWebServerEndpoint, WebServerEndpointVarName, WSServerEndpointVarName } from "@/util/endpoints";
|
||||
import { WaveDevVarName, WaveDevViteVarName } from "@/util/isdev";
|
||||
import { sprintf } from "sprintf-js";
|
||||
const electronApp = electron.app;
|
||||
@ -268,7 +268,7 @@ function shFrameNavHandler(event: Electron.Event<Electron.WebContentsWillFrameNa
|
||||
}
|
||||
if (
|
||||
event.frame.name == "pdfview" &&
|
||||
(url.startsWith("blob:file:///") || url.startsWith(getServerWebEndpoint() + "/wave/stream-file?"))
|
||||
(url.startsWith("blob:file:///") || url.startsWith(getWebServerEndpoint() + "/wave/stream-file?"))
|
||||
) {
|
||||
// allowed
|
||||
return;
|
||||
@ -480,7 +480,7 @@ electron.ipcMain.on("open-external", (event, url) => {
|
||||
|
||||
electron.ipcMain.on("download", (event, payload) => {
|
||||
const window = electron.BrowserWindow.fromWebContents(event.sender);
|
||||
const streamingUrl = getServerWebEndpoint() + "/wave/stream-file?path=" + encodeURIComponent(payload.filePath);
|
||||
const streamingUrl = getWebServerEndpoint() + "/wave/stream-file?path=" + encodeURIComponent(payload.filePath);
|
||||
window.webContents.downloadURL(streamingUrl);
|
||||
});
|
||||
|
||||
|
@ -6,7 +6,7 @@ import { getLayoutStateAtomForTab } from "@/faraday/lib/layoutAtom";
|
||||
import { layoutTreeStateReducer } from "@/faraday/lib/layoutState";
|
||||
|
||||
import { handleIncomingRpcMessage } from "@/app/store/wshrpc";
|
||||
import { getServerWebEndpoint, getServerWSEndpoint } from "@/util/endpoints";
|
||||
import { getWSServerEndpoint, getWebServerEndpoint } from "@/util/endpoints";
|
||||
import * as layoututil from "@/util/layoututil";
|
||||
import { produce } from "immer";
|
||||
import * as jotai from "jotai";
|
||||
@ -270,7 +270,7 @@ function handleWSMessage(msg: any) {
|
||||
}
|
||||
|
||||
function initWS() {
|
||||
globalWS = new WSControl(getServerWSEndpoint(), globalStore, globalWindowId, "", (msg) => {
|
||||
globalWS = new WSControl(getWSServerEndpoint(), globalStore, globalWindowId, "", (msg) => {
|
||||
handleWSMessage(msg);
|
||||
});
|
||||
globalWS.connectNow("initWS");
|
||||
@ -324,7 +324,7 @@ async function fetchWaveFile(
|
||||
if (offset != null) {
|
||||
usp.set("offset", offset.toString());
|
||||
}
|
||||
const resp = await fetch(getServerWebEndpoint() + "/wave/file?" + usp.toString());
|
||||
const resp = await fetch(getWebServerEndpoint() + "/wave/file?" + usp.toString());
|
||||
if (!resp.ok) {
|
||||
if (resp.status === 404) {
|
||||
return { data: null, fileInfo: null };
|
||||
@ -367,6 +367,8 @@ function getObjectId(obj: any): number {
|
||||
}
|
||||
|
||||
export {
|
||||
PLATFORM,
|
||||
WOS,
|
||||
atoms,
|
||||
createBlock,
|
||||
fetchWaveFile,
|
||||
@ -378,12 +380,10 @@ export {
|
||||
globalStore,
|
||||
globalWS,
|
||||
initWS,
|
||||
PLATFORM,
|
||||
sendWSCommand,
|
||||
setBlockFocus,
|
||||
setPlatform,
|
||||
useBlockAtom,
|
||||
useBlockCache,
|
||||
useSettingsAtom,
|
||||
WOS,
|
||||
};
|
||||
|
@ -4,7 +4,7 @@
|
||||
// WaveObjectStore
|
||||
|
||||
import { sendRpcCommand } from "@/app/store/wshrpc";
|
||||
import { getServerWebEndpoint } from "@/util/endpoints";
|
||||
import { getWebServerEndpoint } from "@/util/endpoints";
|
||||
import * as jotai from "jotai";
|
||||
import * as React from "react";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
@ -79,7 +79,7 @@ function callBackendService(service: string, method: string, args: any[], noUICo
|
||||
const usp = new URLSearchParams();
|
||||
usp.set("service", service);
|
||||
usp.set("method", method);
|
||||
const url = getServerWebEndpoint() + "/wave/service?" + usp.toString();
|
||||
const url = getWebServerEndpoint() + "/wave/service?" + usp.toString();
|
||||
const fetchPromise = fetch(url, {
|
||||
method: "POST",
|
||||
body: JSON.stringify(waveCall),
|
||||
|
@ -6,7 +6,7 @@ import { Markdown } from "@/element/markdown";
|
||||
import { globalStore, useBlockAtom } from "@/store/global";
|
||||
import * as services from "@/store/services";
|
||||
import * as WOS from "@/store/wos";
|
||||
import { getServerWebEndpoint } from "@/util/endpoints";
|
||||
import { getWebServerEndpoint } from "@/util/endpoints";
|
||||
import * as util from "@/util/util";
|
||||
import clsx from "clsx";
|
||||
import * as jotai from "jotai";
|
||||
@ -275,7 +275,7 @@ function MarkdownPreview({ contentAtom }: { contentAtom: jotai.Atom<Promise<stri
|
||||
|
||||
function StreamingPreview({ fileInfo }: { fileInfo: FileInfo }) {
|
||||
const filePath = fileInfo.path;
|
||||
const streamingUrl = getServerWebEndpoint() + "/wave/stream-file?path=" + encodeURIComponent(filePath);
|
||||
const streamingUrl = getWebServerEndpoint() + "/wave/stream-file?path=" + encodeURIComponent(filePath);
|
||||
if (fileInfo.mimetype == "application/pdf") {
|
||||
return (
|
||||
<div className="view-preview view-preview-pdf">
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
import { WshServer } from "@/app/store/wshserver";
|
||||
import { createBlock } from "@/store/global";
|
||||
import { getServerWebEndpoint } from "@/util/endpoints";
|
||||
import { getWebServerEndpoint } from "@/util/endpoints";
|
||||
import clsx from "clsx";
|
||||
import * as jotai from "jotai";
|
||||
import * as React from "react";
|
||||
@ -117,7 +117,7 @@ function TermSticker({ sticker, config }: { sticker: StickerType; config: Sticke
|
||||
if (sticker.imgsrc == null) {
|
||||
return null;
|
||||
}
|
||||
const streamingUrl = getServerWebEndpoint() + "/wave/stream-file?path=" + encodeURIComponent(sticker.imgsrc);
|
||||
const streamingUrl = getWebServerEndpoint() + "/wave/stream-file?path=" + encodeURIComponent(sticker.imgsrc);
|
||||
return (
|
||||
<div className="term-sticker term-sticker-image" style={style} onClick={clickHandler}>
|
||||
<img src={streamingUrl} />
|
||||
|
@ -4,6 +4,6 @@ import { lazy } from "./util";
|
||||
export const WebServerEndpointVarName = "WAVE_SERVER_WEB_ENDPOINT";
|
||||
export const WSServerEndpointVarName = "WAVE_SERVER_WS_ENDPOINT";
|
||||
|
||||
export const getServerWebEndpoint = lazy(() => `http://${getEnv(WebServerEndpointVarName)}`);
|
||||
export const getWebServerEndpoint = lazy(() => `http://${getEnv(WebServerEndpointVarName)}`);
|
||||
|
||||
export const getServerWSEndpoint = lazy(() => `ws://${getEnv(WSServerEndpointVarName)}`);
|
||||
export const getWSServerEndpoint = lazy(() => `ws://${getEnv(WSServerEndpointVarName)}`);
|
||||
|
Loading…
Reference in New Issue
Block a user