remove tauri again from others adding in fixes to tauri
This commit is contained in:
@ -71,7 +71,7 @@ export function ModelingSidebar({ paneOpacity }: ModelingSidebarProps) {
|
||||
(action) =>
|
||||
(!action.hide || (action.hide instanceof Function && !action.hide())) &&
|
||||
(!action.hideOnPlatform ||
|
||||
(isTauri()
|
||||
(isDesktop()
|
||||
? action.hideOnPlatform === 'web'
|
||||
: action.hideOnPlatform === 'desktop'))
|
||||
)
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { Popover } from '@headlessui/react'
|
||||
import Tooltip from './Tooltip'
|
||||
import { machineManager } from 'lib/machineManager'
|
||||
import { isTauri } from 'lib/isTauri'
|
||||
import { isDesktop } from 'lib/isDesktop'
|
||||
import { CustomIcon } from './CustomIcon'
|
||||
|
||||
export const NetworkMachineIndicator = ({
|
||||
@ -10,7 +10,7 @@ export const NetworkMachineIndicator = ({
|
||||
className?: string
|
||||
}) => {
|
||||
const machineCount = Object.keys(machineManager.machines).length
|
||||
return isTauri() ? (
|
||||
return isDesktop() ? (
|
||||
<Popover className="relative">
|
||||
<Popover.Button
|
||||
className={
|
||||
|
@ -149,7 +149,7 @@ function ProjectMenuPopover({
|
||||
{
|
||||
id: 'make',
|
||||
Element: 'button',
|
||||
className: !isTauri() ? 'hidden' : '',
|
||||
className: !isDesktop() ? 'hidden' : '',
|
||||
children: (
|
||||
<>
|
||||
<span>Make current part</span>
|
||||
|
@ -531,8 +531,7 @@ class EngineConnection extends EventTarget {
|
||||
* This will attempt the full handshake, and retry if the connection
|
||||
* did not establish.
|
||||
*/
|
||||
connect(reconnecting?: boolean): Promise<void> {
|
||||
return new Promise((resolve) => {
|
||||
connect(reconnecting?: boolean) {
|
||||
if (this.isConnecting() || this.isReady()) {
|
||||
return
|
||||
}
|
||||
@ -916,79 +915,6 @@ class EngineConnection extends EventTarget {
|
||||
}
|
||||
this.websocket.addEventListener('error', this.onWebSocketError)
|
||||
|
||||
this.onWebSocketMessage = (event) => {
|
||||
// In the EngineConnection, we're looking for messages to/from
|
||||
// the server that relate to the ICE handshake, or WebRTC
|
||||
// negotiation. There may be other messages (including ArrayBuffer
|
||||
// messages) that are intended for the GUI itself, so be careful
|
||||
// when assuming we're the only consumer or that all messages will
|
||||
// be carefully formatted here.
|
||||
|
||||
if (typeof event.data !== 'string') {
|
||||
return
|
||||
}
|
||||
|
||||
const message: Models['WebSocketResponse_type'] = JSON.parse(
|
||||
event.data
|
||||
)
|
||||
|
||||
const createWebSocketConnection = () => {
|
||||
this.state = {
|
||||
type: EngineConnectionStateType.Connecting,
|
||||
value: {
|
||||
type: ConnectingType.WebSocketConnecting,
|
||||
},
|
||||
}
|
||||
|
||||
this.websocket = new WebSocket(this.url, [])
|
||||
this.websocket.binaryType = 'arraybuffer'
|
||||
|
||||
this.onWebSocketOpen = (event) => {
|
||||
this.state = {
|
||||
type: EngineConnectionStateType.Connecting,
|
||||
value: {
|
||||
type: ConnectingType.WebSocketOpen,
|
||||
},
|
||||
}
|
||||
|
||||
// This is required for when KCMA is running stand-alone / within desktop.
|
||||
// Otherwise when run in a browser, the token is sent implicitly via
|
||||
// the Cookie header.
|
||||
if (this.token) {
|
||||
this.send({
|
||||
type: 'headers',
|
||||
headers: { Authorization: `Bearer ${this.token}` },
|
||||
})
|
||||
}
|
||||
|
||||
// Send an initial ping
|
||||
this.send({ type: 'ping' })
|
||||
this.pingPongSpan.ping = new Date()
|
||||
}
|
||||
this.websocket.addEventListener('open', this.onWebSocketOpen)
|
||||
|
||||
this.onWebSocketClose = (event) => {
|
||||
this.disconnectAll()
|
||||
this.finalizeIfAllConnectionsClosed()
|
||||
}
|
||||
this.websocket.addEventListener('close', this.onWebSocketClose)
|
||||
|
||||
this.onWebSocketError = (event) => {
|
||||
this.disconnectAll()
|
||||
|
||||
this.state = {
|
||||
type: EngineConnectionStateType.Disconnecting,
|
||||
value: {
|
||||
type: DisconnectingType.Error,
|
||||
value: {
|
||||
error: ConnectionError.WebSocketError,
|
||||
context: event,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
this.websocket.addEventListener('error', this.onWebSocketError)
|
||||
|
||||
this.onWebSocketMessage = (event) => {
|
||||
// In the EngineConnection, we're looking for messages to/from
|
||||
// the server that relate to the ICE handshake, or WebRTC
|
||||
@ -1280,7 +1206,6 @@ class EngineConnection extends EventTarget {
|
||||
this.onNetworkStatusReady
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
// Do not change this back to an object or any, we should only be sending the
|
||||
// WebSocketRequest type!
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { isTauri } from './isTauri'
|
||||
import { isDesktop } from './isDesktop'
|
||||
import { components } from './machine-api'
|
||||
import { getMachineApiIp, listMachines } from './tauri'
|
||||
|
||||
export class MachineManager {
|
||||
private _isTauri: boolean = isTauri()
|
||||
private _isDesktop: boolean = isDesktop()
|
||||
private _machines: {
|
||||
[key: string]: components['schemas']['Machine']
|
||||
} = {}
|
||||
@ -11,7 +11,7 @@ export class MachineManager {
|
||||
private _currentMachine: components['schemas']['Machine'] | null = null
|
||||
|
||||
constructor() {
|
||||
if (!this._isTauri) {
|
||||
if (!this._isDesktop) {
|
||||
return
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ export class MachineManager {
|
||||
}
|
||||
|
||||
start() {
|
||||
if (!this._isTauri) {
|
||||
if (!this._isDesktop) {
|
||||
return
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ export class MachineManager {
|
||||
}
|
||||
|
||||
private async updateMachines(): Promise<void> {
|
||||
if (!this._isTauri) {
|
||||
if (!this._isDesktop) {
|
||||
return
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ export class MachineManager {
|
||||
}
|
||||
|
||||
private async updateMachineApiIp(): Promise<void> {
|
||||
if (!this._isTauri) {
|
||||
if (!this._isDesktop) {
|
||||
return
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user