mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-31 04:23:40 +00:00
fix: fix build after minor merged into major
This commit is contained in:
@@ -1021,7 +1021,7 @@ export module Mock {
|
||||
username: 'TestUser',
|
||||
mountable: false,
|
||||
// @TODO Matt Provide mock for startOs
|
||||
startOs: null,
|
||||
startOs: {},
|
||||
},
|
||||
{
|
||||
id: 'ftcvewdnkemfksdm',
|
||||
@@ -1030,7 +1030,7 @@ export module Mock {
|
||||
provider: 'dropbox',
|
||||
path: '/Home/backups',
|
||||
mountable: true,
|
||||
startOs: null,
|
||||
startOs: {},
|
||||
},
|
||||
{
|
||||
id: 'csgashbdjkasnd',
|
||||
@@ -1040,7 +1040,7 @@ export module Mock {
|
||||
path: '/Desktop/embassy-backups-2',
|
||||
username: 'TestUser',
|
||||
mountable: true,
|
||||
startOs: null,
|
||||
startOs: {},
|
||||
},
|
||||
{
|
||||
id: 'powjefhjbnwhdva',
|
||||
|
||||
@@ -418,7 +418,8 @@ export module RR {
|
||||
// marketplace
|
||||
|
||||
export type GetMarketplaceInfoReq = { serverId: string }
|
||||
export type GetMarketplaceInfoRes = StoreInfo
|
||||
// @TODO Matt fix type
|
||||
export type GetMarketplaceInfoRes = any
|
||||
|
||||
export type GetMarketplaceEosReq = { serverId: string }
|
||||
// @TODO Matt fix type
|
||||
|
||||
@@ -3,10 +3,11 @@ import {
|
||||
GetPackagesRes,
|
||||
MarketplacePkg,
|
||||
} from '@start9labs/marketplace'
|
||||
import { RPCOptions } from '@start9labs/shared'
|
||||
import { Log, RPCOptions } from '@start9labs/shared'
|
||||
import { T } from '@start9labs/start-sdk'
|
||||
import { Observable } from 'rxjs'
|
||||
import { BackupTargetType, RR } from './api.types'
|
||||
import { WebSocketSubjectConfig } from 'rxjs/webSocket'
|
||||
import { BackupTargetType, Metrics, RR } from './api.types'
|
||||
|
||||
export abstract class ApiService {
|
||||
// http
|
||||
@@ -84,6 +85,13 @@ export abstract class ApiService {
|
||||
): Promise<RR.FollowServerLogsRes>
|
||||
|
||||
// server
|
||||
abstract openLogsWebsocket$(
|
||||
config: WebSocketSubjectConfig<Log>,
|
||||
): Observable<Log>
|
||||
|
||||
abstract openMetricsWebsocket$(
|
||||
config: WebSocketSubjectConfig<Metrics>,
|
||||
): Observable<Metrics>
|
||||
|
||||
abstract getSystemTime(
|
||||
params: RR.GetSystemTimeReq,
|
||||
|
||||
@@ -3,15 +3,16 @@ import {
|
||||
HttpOptions,
|
||||
HttpService,
|
||||
isRpcError,
|
||||
Log,
|
||||
Method,
|
||||
RpcError,
|
||||
RPCOptions,
|
||||
} from '@start9labs/shared'
|
||||
import { PATCH_CACHE } from 'src/app/services/patch-db/patch-db-source'
|
||||
import { ApiService } from './embassy-api.service'
|
||||
import { BackupTargetType, RR } from './api.types'
|
||||
import { BackupTargetType, Metrics, RR } from './api.types'
|
||||
import { ConfigService } from '../config.service'
|
||||
import { webSocket } from 'rxjs/webSocket'
|
||||
import { webSocket, WebSocketSubjectConfig } from 'rxjs/webSocket'
|
||||
import { Observable, filter, firstValueFrom } from 'rxjs'
|
||||
import { AuthService } from '../auth.service'
|
||||
import { DOCUMENT } from '@angular/common'
|
||||
@@ -92,6 +93,16 @@ export class LiveApiService extends ApiService {
|
||||
}
|
||||
|
||||
// websocket
|
||||
// @TODO Matt which of these 2 APIs should we use?
|
||||
private openWebsocket<T>(config: WebSocketSubjectConfig<T>): Observable<T> {
|
||||
const { location } = this.document.defaultView!
|
||||
const protocol = location.protocol === 'http:' ? 'ws' : 'wss'
|
||||
const host = location.host
|
||||
|
||||
config.url = `${protocol}://${host}/ws${config.url}`
|
||||
|
||||
return webSocket(config)
|
||||
}
|
||||
|
||||
openWebsocket$<T>(
|
||||
guid: string,
|
||||
@@ -210,6 +221,15 @@ export class LiveApiService extends ApiService {
|
||||
}
|
||||
|
||||
// server
|
||||
openLogsWebsocket$(config: WebSocketSubjectConfig<Log>): Observable<Log> {
|
||||
return this.openWebsocket(config)
|
||||
}
|
||||
|
||||
openMetricsWebsocket$(
|
||||
config: WebSocketSubjectConfig<Metrics>,
|
||||
): Observable<Metrics> {
|
||||
return this.openWebsocket(config)
|
||||
}
|
||||
|
||||
async getSystemTime(
|
||||
params: RR.GetSystemTimeReq,
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import {
|
||||
pauseFor,
|
||||
Log,
|
||||
RPCErrorDetails,
|
||||
RPCOptions,
|
||||
} from '@start9labs/shared'
|
||||
import { pauseFor, Log, RPCErrorDetails, RPCOptions } from '@start9labs/shared'
|
||||
import { ApiService } from './embassy-api.service'
|
||||
import {
|
||||
Operation,
|
||||
@@ -281,6 +276,17 @@ export class MockApiService extends ApiService {
|
||||
|
||||
// server
|
||||
|
||||
openLogsWebsocket$(config: WebSocketSubjectConfig<Log>): Observable<Log> {
|
||||
return interval(50).pipe(
|
||||
map((_, index) => {
|
||||
// mock fire open observer
|
||||
if (index === 0) config.openObserver?.next(new Event(''))
|
||||
if (index === 100) throw new Error('HAAHHA')
|
||||
return Mock.ServerLogs[0]
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
openMetricsWebsocket$(
|
||||
config: WebSocketSubjectConfig<Metrics>,
|
||||
): Observable<Metrics> {
|
||||
|
||||
Reference in New Issue
Block a user