|
|
|
|
@@ -4,7 +4,7 @@ import { AppModel, AppStatus } from '../../models/app-model'
|
|
|
|
|
import { AppAvailablePreview, AppAvailableFull, AppInstalledFull, AppInstalledPreview, DependentBreakage, AppAvailableVersionSpecificInfo, ServiceAction } from '../../models/app-types'
|
|
|
|
|
import { S9Notification, SSHFingerprint, ServerModel, DiskInfo } from '../../models/server-model'
|
|
|
|
|
import { ApiService, ReqRes } from './api.service'
|
|
|
|
|
import { ApiAppInstalledPreview, ApiServer, Unit } from './api-types'
|
|
|
|
|
import { ApiAppInstalledPreview, ApiServer, Unit, V1Status } from './api-types'
|
|
|
|
|
import { HttpErrorResponse } from '@angular/common/http'
|
|
|
|
|
import { isUnauthorized } from 'src/app/util/web.util'
|
|
|
|
|
import { Replace } from 'src/app/util/types.util'
|
|
|
|
|
@@ -17,7 +17,7 @@ import { ConfigService } from '../config.service'
|
|
|
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
|
export class LiveApiService extends ApiService {
|
|
|
|
|
constructor(
|
|
|
|
|
constructor (
|
|
|
|
|
private readonly http: HttpService,
|
|
|
|
|
// TODO remove app + server model from here. updates to state should be done in a separate class wrapping ApiService + App/ServerModel
|
|
|
|
|
private readonly appModel: AppModel,
|
|
|
|
|
@@ -25,40 +25,40 @@ export class LiveApiService extends ApiService {
|
|
|
|
|
private readonly config: ConfigService,
|
|
|
|
|
) { super() }
|
|
|
|
|
|
|
|
|
|
testConnection(url: string): Promise<true> {
|
|
|
|
|
testConnection (url: string): Promise<true> {
|
|
|
|
|
return this.http.raw.get(url).pipe(mapTo(true as true), catchError(e => catchHttpStatusError(e))).toPromise()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Used to check whether password or key is valid. If so, it will be used implicitly by all other calls.
|
|
|
|
|
async getCheckAuth(): Promise<Unit> {
|
|
|
|
|
async getCheckAuth (): Promise<Unit> {
|
|
|
|
|
return this.http.serverRequest<Unit>({ method: Method.GET, url: '/authenticate' }, { version: '' })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async postLogin(password: string): Promise<Unit> {
|
|
|
|
|
async postLogin (password: string): Promise<Unit> {
|
|
|
|
|
return this.http.serverRequest<Unit>({ method: Method.POST, url: '/auth/login', data: { password } }, { version: '' })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async postLogout(): Promise<Unit> {
|
|
|
|
|
return this.http.serverRequest<Unit>({ method: Method.POST, url: '/auth/logout' }, { version: '' }).then(() => { this.authenticatedRequestsEnabled = false; return {} })
|
|
|
|
|
async postLogout (): Promise<Unit> {
|
|
|
|
|
return this.http.serverRequest<Unit>({ method: Method.POST, url: '/auth/logout' }, { version: '' }).then(() => { this.authenticatedRequestsEnabled = false; return { } })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async getServer(timeout?: number): Promise<ApiServer> {
|
|
|
|
|
async getServer (timeout?: number): Promise<ApiServer> {
|
|
|
|
|
return this.authRequest<ReqRes.GetServerRes>({ method: Method.GET, url: '/', readTimeout: timeout })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async acknowledgeOSWelcome(version: string): Promise<Unit> {
|
|
|
|
|
async acknowledgeOSWelcome (version: string): Promise<Unit> {
|
|
|
|
|
return this.authRequest<Unit>({ method: Method.POST, url: `/welcome/${version}` })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async getVersionLatest(): Promise<ReqRes.GetVersionLatestRes> {
|
|
|
|
|
async getVersionLatest (): Promise<ReqRes.GetVersionLatestRes> {
|
|
|
|
|
return this.authRequest<ReqRes.GetVersionLatestRes>({ method: Method.GET, url: '/versionLatest' }, { version: '' })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async getServerMetrics(): Promise<ReqRes.GetServerMetricsRes> {
|
|
|
|
|
async getServerMetrics (): Promise<ReqRes.GetServerMetricsRes> {
|
|
|
|
|
return this.authRequest<ReqRes.GetServerMetricsRes>({ method: Method.GET, url: `/metrics` })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async getNotifications(page: number, perPage: number): Promise<S9Notification[]> {
|
|
|
|
|
async getNotifications (page: number, perPage: number): Promise<S9Notification[]> {
|
|
|
|
|
const params: ReqRes.GetNotificationsReq = {
|
|
|
|
|
page: String(page),
|
|
|
|
|
perPage: String(perPage),
|
|
|
|
|
@@ -66,27 +66,27 @@ export class LiveApiService extends ApiService {
|
|
|
|
|
return this.authRequest<ReqRes.GetNotificationsRes>({ method: Method.GET, url: `/notifications`, params })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async deleteNotification(id: string): Promise<Unit> {
|
|
|
|
|
async deleteNotification (id: string): Promise<Unit> {
|
|
|
|
|
return this.authRequest({ method: Method.DELETE, url: `/notifications/${id}` })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async getExternalDisks(): Promise<DiskInfo[]> {
|
|
|
|
|
async getExternalDisks (): Promise<DiskInfo[]> {
|
|
|
|
|
return this.authRequest<ReqRes.GetExternalDisksRes>({ method: Method.GET, url: `/disks` })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO: EJECT-DISKS
|
|
|
|
|
async ejectExternalDisk(logicalName: string): Promise<Unit> {
|
|
|
|
|
async ejectExternalDisk (logicalName: string): Promise<Unit> {
|
|
|
|
|
return this.authRequest({ method: Method.POST, url: `/disks/eject`, data: { logicalName } })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async updateAgent(version: string): Promise<Unit> {
|
|
|
|
|
async updateAgent (version: string): Promise<Unit> {
|
|
|
|
|
const data: ReqRes.PostUpdateAgentReq = {
|
|
|
|
|
version: `=${version}`,
|
|
|
|
|
}
|
|
|
|
|
return this.authRequest({ method: Method.POST, url: '/update', data })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async getAvailableAppVersionSpecificInfo(appId: string, versionSpec: string): Promise<AppAvailableVersionSpecificInfo> {
|
|
|
|
|
async getAvailableAppVersionSpecificInfo (appId: string, versionSpec: string): Promise<AppAvailableVersionSpecificInfo> {
|
|
|
|
|
return this
|
|
|
|
|
.authRequest<Replace<ReqRes.GetAppAvailableVersionInfoRes, 'versionViewing', 'version'>>({ method: Method.GET, url: `/apps/${appId}/store/${versionSpec}` })
|
|
|
|
|
.then(res => ({ ...res, versionViewing: res.version }))
|
|
|
|
|
@@ -96,7 +96,7 @@ export class LiveApiService extends ApiService {
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async getAvailableApps(): Promise<AppAvailablePreview[]> {
|
|
|
|
|
async getAvailableApps (): Promise<AppAvailablePreview[]> {
|
|
|
|
|
const res = await this.authRequest<ReqRes.GetAppsAvailableRes>({ method: Method.GET, url: '/apps/store' })
|
|
|
|
|
return res.map(a => {
|
|
|
|
|
const latestVersionTimestamp = new Date(a.latestVersionTimestamp)
|
|
|
|
|
@@ -105,7 +105,7 @@ export class LiveApiService extends ApiService {
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async getAvailableApp(appId: string): Promise<AppAvailableFull> {
|
|
|
|
|
async getAvailableApp (appId: string): Promise<AppAvailableFull> {
|
|
|
|
|
return this.authRequest<ReqRes.GetAppAvailableRes>({ method: Method.GET, url: `/apps/${appId}/store` })
|
|
|
|
|
.then(res => {
|
|
|
|
|
return {
|
|
|
|
|
@@ -115,7 +115,7 @@ export class LiveApiService extends ApiService {
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async getInstalledApp(appId: string): Promise<AppInstalledFull> {
|
|
|
|
|
async getInstalledApp (appId: string): Promise<AppInstalledFull> {
|
|
|
|
|
return this.authRequest<ReqRes.GetAppInstalledRes>({ method: Method.GET, url: `/apps/${appId}/installed` })
|
|
|
|
|
.then(app => {
|
|
|
|
|
return {
|
|
|
|
|
@@ -127,7 +127,7 @@ export class LiveApiService extends ApiService {
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async getInstalledApps(): Promise<AppInstalledPreview[]> {
|
|
|
|
|
async getInstalledApps (): Promise<AppInstalledPreview[]> {
|
|
|
|
|
return this.authRequest<ReqRes.GetAppsInstalledRes>({ method: Method.GET, url: `/apps/installed` })
|
|
|
|
|
.then(apps => {
|
|
|
|
|
return apps.map(app => {
|
|
|
|
|
@@ -140,24 +140,24 @@ export class LiveApiService extends ApiService {
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async getAppConfig(appId: string): Promise<ReqRes.GetAppConfigRes> {
|
|
|
|
|
async getAppConfig (appId: string): Promise<ReqRes.GetAppConfigRes> {
|
|
|
|
|
return this.authRequest<ReqRes.GetAppConfigRes>({ method: Method.GET, url: `/apps/${appId}/config` })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async getAppLogs(appId: string, params: ReqRes.GetAppLogsReq = {}): Promise<string[]> {
|
|
|
|
|
async getAppLogs (appId: string, params: ReqRes.GetAppLogsReq = { }): Promise<string[]> {
|
|
|
|
|
return this.authRequest<ReqRes.GetAppLogsRes>({ method: Method.GET, url: `/apps/${appId}/logs`, params: params as any })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async getServerLogs(): Promise<string[]> {
|
|
|
|
|
async getServerLogs (): Promise<string[]> {
|
|
|
|
|
return this.authRequest<ReqRes.GetServerLogsRes>({ method: Method.GET, url: `/logs` })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async getAppMetrics(appId: string): Promise<AppMetrics> {
|
|
|
|
|
async getAppMetrics (appId: string): Promise<AppMetrics> {
|
|
|
|
|
return this.authRequest<ReqRes.GetAppMetricsRes | string>({ method: Method.GET, url: `/apps/${appId}/metrics` })
|
|
|
|
|
.then(parseMetricsPermissive)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async installApp(appId: string, version: string, dryRun: boolean = false): Promise<AppInstalledFull & { breakages: DependentBreakage[] }> {
|
|
|
|
|
async installApp (appId: string, version: string, dryRun: boolean = false): Promise<AppInstalledFull & { breakages: DependentBreakage[] }> {
|
|
|
|
|
const data: ReqRes.PostInstallAppReq = {
|
|
|
|
|
version,
|
|
|
|
|
}
|
|
|
|
|
@@ -172,94 +172,94 @@ export class LiveApiService extends ApiService {
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async uninstallApp(appId: string, dryRun: boolean = false): Promise<{ breakages: DependentBreakage[] }> {
|
|
|
|
|
async uninstallApp (appId: string, dryRun: boolean = false): Promise<{ breakages: DependentBreakage[] }> {
|
|
|
|
|
return this.authRequest({ method: Method.POST, url: `/apps/${appId}/uninstall${dryRunParam(dryRun, true)}`, readTimeout: 60000 })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async startApp(appId: string): Promise<Unit> {
|
|
|
|
|
async startApp (appId: string): Promise<Unit> {
|
|
|
|
|
return this.authRequest({ method: Method.POST, url: `/apps/${appId}/start`, readTimeout: 60000 })
|
|
|
|
|
.then(() => this.appModel.update({ id: appId, status: AppStatus.RUNNING }))
|
|
|
|
|
.then(() => ({}))
|
|
|
|
|
.then(() => ({ }))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async stopApp(appId: string, dryRun: boolean = false): Promise<{ breakages: DependentBreakage[] }> {
|
|
|
|
|
async stopApp (appId: string, dryRun: boolean = false): Promise<{ breakages: DependentBreakage[] }> {
|
|
|
|
|
const res = await this.authRequest<{ breakages: DependentBreakage[] }>({ method: Method.POST, url: `/apps/${appId}/stop${dryRunParam(dryRun, true)}`, readTimeout: 60000 })
|
|
|
|
|
if (!dryRun) this.appModel.update({ id: appId, status: AppStatus.STOPPING }, modulateTime(new Date(), 5, 'seconds'))
|
|
|
|
|
return res
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async restartApp(appId: string): Promise<Unit> {
|
|
|
|
|
async restartApp (appId: string): Promise<Unit> {
|
|
|
|
|
return this.authRequest({ method: Method.POST, url: `/apps/${appId}/restart`, readTimeout: 60000 })
|
|
|
|
|
.then(() => ({} as any))
|
|
|
|
|
.then(() => ({ } as any))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async createAppBackup(appId: string, logicalname: string, password?: string): Promise<Unit> {
|
|
|
|
|
async createAppBackup (appId: string, logicalname: string, password?: string): Promise<Unit> {
|
|
|
|
|
const data: ReqRes.PostAppBackupCreateReq = {
|
|
|
|
|
password: password || undefined,
|
|
|
|
|
logicalname,
|
|
|
|
|
}
|
|
|
|
|
return this.authRequest<ReqRes.PostAppBackupCreateRes>({ method: Method.POST, url: `/apps/${appId}/backup`, data, readTimeout: 60000 })
|
|
|
|
|
.then(() => this.appModel.update({ id: appId, status: AppStatus.CREATING_BACKUP }))
|
|
|
|
|
.then(() => ({}))
|
|
|
|
|
.then(() => ({ }))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async stopAppBackup(appId: string): Promise<Unit> {
|
|
|
|
|
async stopAppBackup (appId: string): Promise<Unit> {
|
|
|
|
|
return this.authRequest<ReqRes.PostAppBackupStopRes>({ method: Method.POST, url: `/apps/${appId}/backup/stop`, readTimeout: 60000 })
|
|
|
|
|
.then(() => this.appModel.update({ id: appId, status: AppStatus.STOPPED }))
|
|
|
|
|
.then(() => ({}))
|
|
|
|
|
.then(() => ({ }))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async restoreAppBackup(appId: string, logicalname: string, password?: string): Promise<Unit> {
|
|
|
|
|
async restoreAppBackup (appId: string, logicalname: string, password?: string): Promise<Unit> {
|
|
|
|
|
const data: ReqRes.PostAppBackupRestoreReq = {
|
|
|
|
|
password: password || undefined,
|
|
|
|
|
logicalname,
|
|
|
|
|
}
|
|
|
|
|
return this.authRequest<ReqRes.PostAppBackupRestoreRes>({ method: Method.POST, url: `/apps/${appId}/backup/restore`, data, readTimeout: 60000 })
|
|
|
|
|
.then(() => this.appModel.update({ id: appId, status: AppStatus.RESTORING_BACKUP }))
|
|
|
|
|
.then(() => ({}))
|
|
|
|
|
.then(() => ({ }))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async patchAppConfig(app: AppInstalledPreview, config: object, dryRun = false): Promise<{ breakages: DependentBreakage[] }> {
|
|
|
|
|
async patchAppConfig (app: AppInstalledPreview, config: object, dryRun = false): Promise<{ breakages: DependentBreakage[] }> {
|
|
|
|
|
const data: ReqRes.PatchAppConfigReq = {
|
|
|
|
|
config,
|
|
|
|
|
}
|
|
|
|
|
return this.authRequest({ method: Method.PATCH, url: `/apps/${app.id}/config${dryRunParam(dryRun, true)}`, data, readTimeout: 60000 })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async postConfigureDependency(dependencyId: string, dependentId: string, dryRun?: boolean): Promise<{ config: object, breakages: DependentBreakage[] }> {
|
|
|
|
|
async postConfigureDependency (dependencyId: string, dependentId: string, dryRun?: boolean): Promise<{ config: object, breakages: DependentBreakage[] }> {
|
|
|
|
|
return this.authRequest({ method: Method.POST, url: `/apps/${dependencyId}/autoconfig/${dependentId}${dryRunParam(dryRun, true)}`, readTimeout: 60000 })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async patchServerConfig(attr: string, value: any): Promise<Unit> {
|
|
|
|
|
async patchServerConfig (attr: string, value: any): Promise<Unit> {
|
|
|
|
|
const data: ReqRes.PatchServerConfigReq = {
|
|
|
|
|
value,
|
|
|
|
|
}
|
|
|
|
|
return this.authRequest({ method: Method.PATCH, url: `/${attr}`, data, readTimeout: 60000 })
|
|
|
|
|
.then(() => this.serverModel.update({ [attr]: value }))
|
|
|
|
|
.then(() => ({}))
|
|
|
|
|
.then(() => ({ }))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async wipeAppData(app: AppInstalledPreview): Promise<Unit> {
|
|
|
|
|
async wipeAppData (app: AppInstalledPreview): Promise<Unit> {
|
|
|
|
|
return this.authRequest({ method: Method.POST, url: `/apps/${app.id}/wipe`, readTimeout: 60000 }).then((res) => {
|
|
|
|
|
this.appModel.update({ id: app.id, status: AppStatus.NEEDS_CONFIG })
|
|
|
|
|
return res
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async toggleAppLAN(appId: string, toggle: 'enable' | 'disable'): Promise<Unit> {
|
|
|
|
|
async toggleAppLAN (appId: string, toggle: 'enable' | 'disable'): Promise<Unit> {
|
|
|
|
|
return this.authRequest({ method: Method.POST, url: `/apps/${appId}/lan/${toggle}` })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async addSSHKey(sshKey: string): Promise<Unit> {
|
|
|
|
|
async addSSHKey (sshKey: string): Promise<Unit> {
|
|
|
|
|
const data: ReqRes.PostAddSSHKeyReq = {
|
|
|
|
|
sshKey,
|
|
|
|
|
}
|
|
|
|
|
const fingerprint = await this.authRequest<ReqRes.PostAddSSHKeyRes>({ method: Method.POST, url: `/sshKeys`, data })
|
|
|
|
|
this.serverModel.update({ ssh: [...this.serverModel.peek().ssh, fingerprint] })
|
|
|
|
|
return {}
|
|
|
|
|
return { }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async addWifi(ssid: string, password: string, country: string, connect: boolean): Promise<Unit> {
|
|
|
|
|
async addWifi (ssid: string, password: string, country: string, connect: boolean): Promise<Unit> {
|
|
|
|
|
const data: ReqRes.PostAddWifiReq = {
|
|
|
|
|
ssid,
|
|
|
|
|
password,
|
|
|
|
|
@@ -269,30 +269,30 @@ export class LiveApiService extends ApiService {
|
|
|
|
|
return this.authRequest({ method: Method.POST, url: `/wifi`, data })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async connectWifi(ssid: string): Promise<Unit> {
|
|
|
|
|
async connectWifi (ssid: string): Promise<Unit> {
|
|
|
|
|
return this.authRequest({ method: Method.POST, url: encodeURI(`/wifi/${ssid}`) })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async deleteWifi(ssid: string): Promise<Unit> {
|
|
|
|
|
async deleteWifi (ssid: string): Promise<Unit> {
|
|
|
|
|
return this.authRequest({ method: Method.DELETE, url: encodeURI(`/wifi/${ssid}`) })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async deleteSSHKey(fingerprint: SSHFingerprint): Promise<Unit> {
|
|
|
|
|
async deleteSSHKey (fingerprint: SSHFingerprint): Promise<Unit> {
|
|
|
|
|
await this.authRequest({ method: Method.DELETE, url: `/sshKeys/${fingerprint.hash}` })
|
|
|
|
|
const ssh = this.serverModel.peek().ssh
|
|
|
|
|
this.serverModel.update({ ssh: ssh.filter(s => s !== fingerprint) })
|
|
|
|
|
return {}
|
|
|
|
|
return { }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async restartServer(): Promise<Unit> {
|
|
|
|
|
async restartServer (): Promise<Unit> {
|
|
|
|
|
return this.authRequest({ method: Method.POST, url: '/restart', readTimeout: 60000 })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async shutdownServer(): Promise<Unit> {
|
|
|
|
|
async shutdownServer (): Promise<Unit> {
|
|
|
|
|
return this.authRequest({ method: Method.POST, url: '/shutdown', readTimeout: 60000 })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async serviceAction(appId: string, s: ServiceAction): Promise<ReqRes.ServiceActionResponse> {
|
|
|
|
|
async serviceAction (appId: string, s: ServiceAction): Promise<ReqRes.ServiceActionResponse> {
|
|
|
|
|
const data: ReqRes.ServiceActionRequest = {
|
|
|
|
|
jsonrpc: '2.0',
|
|
|
|
|
id: uuid.v4(),
|
|
|
|
|
@@ -301,11 +301,15 @@ export class LiveApiService extends ApiService {
|
|
|
|
|
return this.authRequest({ method: Method.POST, url: `/apps/${appId}/actions`, data, readTimeout: 300000 })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async refreshLAN(): Promise<Unit> {
|
|
|
|
|
async refreshLAN (): Promise<Unit> {
|
|
|
|
|
return this.authRequest({ method: Method.POST, url: '/network/lan/reset' })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async authRequest<T>(opts: HttpOptions, overrides: Partial<{ version: string }> = {}): Promise<T> {
|
|
|
|
|
async checkV1Status (): Promise<V1Status> {
|
|
|
|
|
return this.http.request({ method: Method.GET, url: 'https://registry.start9labs.com/sys/status' })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async authRequest<T> (opts: HttpOptions, overrides: Partial<{ version: string }> = { }): Promise<T> {
|
|
|
|
|
if (!this.authenticatedRequestsEnabled) throw new Error(`Authenticated requests are not enabled. Do you need to login?`)
|
|
|
|
|
|
|
|
|
|
opts.withCredentials = true
|
|
|
|
|
@@ -324,7 +328,7 @@ const dryRunParam = (dryRun: boolean, first: boolean) => {
|
|
|
|
|
return first ? `?dryrun` : `&dryrun`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function catchHttpStatusError(error: HttpErrorResponse): Observable<true> {
|
|
|
|
|
function catchHttpStatusError (error: HttpErrorResponse): Observable<true> {
|
|
|
|
|
if (error.error instanceof ErrorEvent) {
|
|
|
|
|
// A client-side or network error occurred. Handle it accordingly.
|
|
|
|
|
return throwError('Not Connected')
|
|
|
|
|
|