mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 20:14:49 +00:00
window supports websockets
This commit is contained in:
committed by
Aiden McClelland
parent
b04892f5f4
commit
2a7f1a6eb7
@@ -62,7 +62,7 @@ export class SSHKeysPage {
|
|||||||
await loader.present()
|
await loader.present()
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const key = await this.embassyApi.addSshKey({ pubkey })
|
const key = await this.embassyApi.addSshKey({ key: pubkey })
|
||||||
this.sshKeys = { ...this.sshKeys, ...key }
|
this.sshKeys = { ...this.sshKeys, ...key }
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.errToast.present(e)
|
this.errToast.present(e)
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ export module RR {
|
|||||||
|
|
||||||
// server
|
// server
|
||||||
|
|
||||||
export type SetShareStatsReq = WithExpire<{ value: boolean }> // server.config.share-stats
|
export type SetShareStatsReq = WithExpire<{ value: boolean }> // server.config.share_stats
|
||||||
export type SetShareStatsRes = WithRevision<null>
|
export type SetShareStatsRes = WithRevision<null>
|
||||||
|
|
||||||
export type GetServerLogsReq = { cursor?: string, before_flag?: boolean, limit?: number }
|
export type GetServerLogsReq = { cursor?: string, before_flag?: boolean, limit?: number }
|
||||||
@@ -110,7 +110,7 @@ export module RR {
|
|||||||
export type GetSSHKeysReq = { } // ssh.list
|
export type GetSSHKeysReq = { } // ssh.list
|
||||||
export type GetSSHKeysRes = SSHKeys
|
export type GetSSHKeysRes = SSHKeys
|
||||||
|
|
||||||
export type AddSSHKeyReq = { pubkey: string } // ssh.add
|
export type AddSSHKeyReq = { key: string } // ssh.add
|
||||||
export type AddSSHKeyRes = SSHKeys
|
export type AddSSHKeyRes = SSHKeys
|
||||||
|
|
||||||
export type DeleteSSHKeyReq = { hash: string } // ssh.delete
|
export type DeleteSSHKeyReq = { hash: string } // ssh.delete
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ export class LiveApiService extends ApiService {
|
|||||||
// server
|
// server
|
||||||
|
|
||||||
async setShareStatsRaw (params: RR.SetShareStatsReq): Promise<RR.SetShareStatsRes> {
|
async setShareStatsRaw (params: RR.SetShareStatsReq): Promise<RR.SetShareStatsRes> {
|
||||||
return this.http.rpcRequest( { method: 'server.config.share-stats', params })
|
return this.http.rpcRequest( { method: 'server.config.share_stats', params })
|
||||||
}
|
}
|
||||||
|
|
||||||
async getServerLogs (params: RR.GetServerLogsReq): Promise<RR.GetServerLogsRes> {
|
async getServerLogs (params: RR.GetServerLogsReq): Promise<RR.GetServerLogsRes> {
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ export class ConfigService {
|
|||||||
mocks = mocks
|
mocks = mocks
|
||||||
|
|
||||||
skipStartupAlerts = mocks.enabled && mocks.skipStartupAlerts
|
skipStartupAlerts = mocks.enabled && mocks.skipStartupAlerts
|
||||||
isConsulate = window['platform'] === 'ios'
|
supportsWebSockets = 'WebSocket' in window || 'MozWebSocket' in window
|
||||||
|
|
||||||
isTor (): boolean {
|
isTor (): boolean {
|
||||||
return (mocks.enabled && mocks.maskAs === 'tor') || this.origin.endsWith('.onion')
|
return (mocks.enabled && mocks.maskAs === 'tor') || this.origin.endsWith('.onion')
|
||||||
@@ -46,11 +46,11 @@ export class ConfigService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
usePoll (): boolean {
|
usePoll (): boolean {
|
||||||
return this.isConsulate || (mocks.enabled && mocks.connection === 'poll')
|
return this.supportsWebSockets || (mocks.enabled && mocks.connection === 'poll')
|
||||||
}
|
}
|
||||||
|
|
||||||
isLaunchable (state: PackageState, status: PackageMainStatus, interfaces: { [id: string]: InterfaceDef }): boolean {
|
isLaunchable (state: PackageState, status: PackageMainStatus, interfaces: { [id: string]: InterfaceDef }): boolean {
|
||||||
if (this.isConsulate || state !== PackageState.Installed) {
|
if (this.supportsWebSockets || state !== PackageState.Installed) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export function PatchDbServiceFactory (
|
|||||||
embassyApi: ApiService,
|
embassyApi: ApiService,
|
||||||
): PatchDbService {
|
): PatchDbService {
|
||||||
|
|
||||||
const { mocks, patchDb: { poll }, isConsulate } = config
|
const { mocks, patchDb: { poll }, supportsWebSockets } = config
|
||||||
|
|
||||||
let source: Source<DataModel>
|
let source: Source<DataModel>
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ export function PatchDbServiceFactory (
|
|||||||
source = new WebsocketSource(`ws://localhost:${config.mocks.wsPort}/db`)
|
source = new WebsocketSource(`ws://localhost:${config.mocks.wsPort}/db`)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (isConsulate) {
|
if (supportsWebSockets) {
|
||||||
source = new PollSource({ ...poll }, embassyApi)
|
source = new PollSource({ ...poll }, embassyApi)
|
||||||
} else {
|
} else {
|
||||||
const protocol = window.location.protocol === 'http:' ? 'ws' : 'wss'
|
const protocol = window.location.protocol === 'http:' ? 'ws' : 'wss'
|
||||||
|
|||||||
Reference in New Issue
Block a user