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) =>
|
||||||
(!action.hide || (action.hide instanceof Function && !action.hide())) &&
|
(!action.hide || (action.hide instanceof Function && !action.hide())) &&
|
||||||
(!action.hideOnPlatform ||
|
(!action.hideOnPlatform ||
|
||||||
(isTauri()
|
(isDesktop()
|
||||||
? action.hideOnPlatform === 'web'
|
? action.hideOnPlatform === 'web'
|
||||||
: action.hideOnPlatform === 'desktop'))
|
: action.hideOnPlatform === 'desktop'))
|
||||||
)
|
)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { Popover } from '@headlessui/react'
|
import { Popover } from '@headlessui/react'
|
||||||
import Tooltip from './Tooltip'
|
import Tooltip from './Tooltip'
|
||||||
import { machineManager } from 'lib/machineManager'
|
import { machineManager } from 'lib/machineManager'
|
||||||
import { isTauri } from 'lib/isTauri'
|
import { isDesktop } from 'lib/isDesktop'
|
||||||
import { CustomIcon } from './CustomIcon'
|
import { CustomIcon } from './CustomIcon'
|
||||||
|
|
||||||
export const NetworkMachineIndicator = ({
|
export const NetworkMachineIndicator = ({
|
||||||
@ -10,7 +10,7 @@ export const NetworkMachineIndicator = ({
|
|||||||
className?: string
|
className?: string
|
||||||
}) => {
|
}) => {
|
||||||
const machineCount = Object.keys(machineManager.machines).length
|
const machineCount = Object.keys(machineManager.machines).length
|
||||||
return isTauri() ? (
|
return isDesktop() ? (
|
||||||
<Popover className="relative">
|
<Popover className="relative">
|
||||||
<Popover.Button
|
<Popover.Button
|
||||||
className={
|
className={
|
||||||
|
@ -149,7 +149,7 @@ function ProjectMenuPopover({
|
|||||||
{
|
{
|
||||||
id: 'make',
|
id: 'make',
|
||||||
Element: 'button',
|
Element: 'button',
|
||||||
className: !isTauri() ? 'hidden' : '',
|
className: !isDesktop() ? 'hidden' : '',
|
||||||
children: (
|
children: (
|
||||||
<>
|
<>
|
||||||
<span>Make current part</span>
|
<span>Make current part</span>
|
||||||
|
@ -531,8 +531,7 @@ class EngineConnection extends EventTarget {
|
|||||||
* This will attempt the full handshake, and retry if the connection
|
* This will attempt the full handshake, and retry if the connection
|
||||||
* did not establish.
|
* did not establish.
|
||||||
*/
|
*/
|
||||||
connect(reconnecting?: boolean): Promise<void> {
|
connect(reconnecting?: boolean) {
|
||||||
return new Promise((resolve) => {
|
|
||||||
if (this.isConnecting() || this.isReady()) {
|
if (this.isConnecting() || this.isReady()) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -916,79 +915,6 @@ class EngineConnection extends EventTarget {
|
|||||||
}
|
}
|
||||||
this.websocket.addEventListener('error', this.onWebSocketError)
|
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) => {
|
this.onWebSocketMessage = (event) => {
|
||||||
// In the EngineConnection, we're looking for messages to/from
|
// In the EngineConnection, we're looking for messages to/from
|
||||||
// the server that relate to the ICE handshake, or WebRTC
|
// the server that relate to the ICE handshake, or WebRTC
|
||||||
@ -1280,7 +1206,6 @@ class EngineConnection extends EventTarget {
|
|||||||
this.onNetworkStatusReady
|
this.onNetworkStatusReady
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
})
|
|
||||||
}
|
}
|
||||||
// Do not change this back to an object or any, we should only be sending the
|
// Do not change this back to an object or any, we should only be sending the
|
||||||
// WebSocketRequest type!
|
// WebSocketRequest type!
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { isTauri } from './isTauri'
|
import { isDesktop } from './isDesktop'
|
||||||
import { components } from './machine-api'
|
import { components } from './machine-api'
|
||||||
import { getMachineApiIp, listMachines } from './tauri'
|
import { getMachineApiIp, listMachines } from './tauri'
|
||||||
|
|
||||||
export class MachineManager {
|
export class MachineManager {
|
||||||
private _isTauri: boolean = isTauri()
|
private _isDesktop: boolean = isDesktop()
|
||||||
private _machines: {
|
private _machines: {
|
||||||
[key: string]: components['schemas']['Machine']
|
[key: string]: components['schemas']['Machine']
|
||||||
} = {}
|
} = {}
|
||||||
@ -11,7 +11,7 @@ export class MachineManager {
|
|||||||
private _currentMachine: components['schemas']['Machine'] | null = null
|
private _currentMachine: components['schemas']['Machine'] | null = null
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
if (!this._isTauri) {
|
if (!this._isDesktop) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ export class MachineManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
if (!this._isTauri) {
|
if (!this._isDesktop) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ export class MachineManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async updateMachines(): Promise<void> {
|
private async updateMachines(): Promise<void> {
|
||||||
if (!this._isTauri) {
|
if (!this._isDesktop) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ export class MachineManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async updateMachineApiIp(): Promise<void> {
|
private async updateMachineApiIp(): Promise<void> {
|
||||||
if (!this._isTauri) {
|
if (!this._isDesktop) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user