mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 12:11:56 +00:00
Merge branch 'next/minor' of github.com:Start9Labs/start-os into next/minor
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Url } from '@start9labs/shared'
|
||||
import { Manifest } from '../../../../core/startos/bindings/Manifest'
|
||||
import { T } from '@start9labs/start-sdk'
|
||||
|
||||
export type StoreURL = string
|
||||
export type StoreName = string
|
||||
@@ -26,7 +26,7 @@ export interface MarketplacePkg {
|
||||
icon: Url
|
||||
license: Url
|
||||
instructions: Url
|
||||
manifest: Manifest
|
||||
manifest: T.Manifest
|
||||
categories: string[]
|
||||
versions: string[]
|
||||
dependencyMetadata: {
|
||||
|
||||
@@ -18,7 +18,7 @@ import { ActionSuccessPage } from 'src/app/modals/action-success/action-success.
|
||||
import { hasCurrentDeps } from 'src/app/util/has-deps'
|
||||
import { getAllPackages, getManifest } from 'src/app/util/get-package-data'
|
||||
import { ActionMetadata } from '@start9labs/start-sdk/cjs/sdk/lib/types'
|
||||
import { Status } from '../../../../../../../../core/startos/bindings/Status'
|
||||
import { T } from '@start9labs/start-sdk'
|
||||
|
||||
@Component({
|
||||
selector: 'app-actions',
|
||||
@@ -42,7 +42,7 @@ export class AppActionsPage {
|
||||
) {}
|
||||
|
||||
async handleAction(
|
||||
status: Status,
|
||||
status: T.Status,
|
||||
action: { key: string; value: ActionMetadata },
|
||||
) {
|
||||
if (
|
||||
|
||||
@@ -7,11 +7,9 @@ import { DataModel } from 'src/app/services/patch-db/data-model'
|
||||
import { PatchDB } from 'patch-db-client'
|
||||
import { QRComponent } from 'src/app/components/qr/qr.component'
|
||||
import { map } from 'rxjs'
|
||||
import { types as T } from '@start9labs/start-sdk'
|
||||
import { ServiceInterface } from '../../../../../../../../core/startos/bindings/ServiceInterface'
|
||||
import { ServiceInterfaceWithHostInfo } from '../../../../../../../../core/startos/bindings/ServiceInterfaceWithHostInfo'
|
||||
import { T } from '@start9labs/start-sdk'
|
||||
|
||||
type MappedInterface = ServiceInterface & {
|
||||
type MappedInterface = T.ServiceInterface & {
|
||||
addresses: MappedAddress[]
|
||||
}
|
||||
type MappedAddress = {
|
||||
@@ -101,7 +99,7 @@ export class AppInterfacesItemComponent {
|
||||
}
|
||||
|
||||
function getAddresses(
|
||||
serviceInterface: ServiceInterfaceWithHostInfo,
|
||||
serviceInterface: T.ServiceInterfaceWithHostInfo,
|
||||
): MappedAddress[] {
|
||||
const host = serviceInterface.hostInfo
|
||||
const addressInfo = serviceInterface.addressInfo
|
||||
|
||||
@@ -2,7 +2,7 @@ import { ChangeDetectionStrategy, Component, Input } from '@angular/core'
|
||||
import { PackageDataEntry } from 'src/app/services/patch-db/data-model'
|
||||
import { PkgInfo } from 'src/app/util/get-package-info'
|
||||
import { UiLauncherService } from 'src/app/services/ui-launcher.service'
|
||||
import { MainStatus } from '../../../../../../../../../core/startos/bindings/MainStatus'
|
||||
import { T } from '@start9labs/start-sdk'
|
||||
|
||||
@Component({
|
||||
selector: 'app-list-pkg',
|
||||
@@ -15,7 +15,7 @@ export class AppListPkgComponent {
|
||||
|
||||
constructor(private readonly launcherService: UiLauncherService) {}
|
||||
|
||||
get pkgMainStatus(): MainStatus {
|
||||
get pkgMainStatus(): T.MainStatus {
|
||||
return (
|
||||
this.pkg.entry.status.main || {
|
||||
status: 'stopped',
|
||||
|
||||
@@ -25,7 +25,7 @@ import {
|
||||
isRestoring,
|
||||
isUpdating,
|
||||
} from 'src/app/util/get-package-data'
|
||||
import { Manifest } from '../../../../../../../../core/startos/bindings/Manifest'
|
||||
import { T } from '@start9labs/start-sdk'
|
||||
|
||||
export interface DependencyInfo {
|
||||
id: string
|
||||
@@ -91,7 +91,7 @@ export class AppShowPage {
|
||||
|
||||
private getDepValues(
|
||||
pkg: PackageDataEntry,
|
||||
manifest: Manifest,
|
||||
manifest: T.Manifest,
|
||||
depId: string,
|
||||
depErrors: PkgDependencyErrors,
|
||||
): DependencyInfo {
|
||||
@@ -120,7 +120,7 @@ export class AppShowPage {
|
||||
|
||||
private getDepErrors(
|
||||
pkg: PackageDataEntry,
|
||||
manifest: Manifest,
|
||||
manifest: T.Manifest,
|
||||
depId: string,
|
||||
depErrors: PkgDependencyErrors,
|
||||
) {
|
||||
@@ -162,7 +162,7 @@ export class AppShowPage {
|
||||
|
||||
private async fixDep(
|
||||
pkg: PackageDataEntry,
|
||||
pkgManifest: Manifest,
|
||||
pkgManifest: T.Manifest,
|
||||
action: 'install' | 'update' | 'configure',
|
||||
id: string,
|
||||
): Promise<void> {
|
||||
@@ -177,7 +177,7 @@ export class AppShowPage {
|
||||
|
||||
private async installDep(
|
||||
pkg: PackageDataEntry,
|
||||
pkgManifest: Manifest,
|
||||
pkgManifest: T.Manifest,
|
||||
depId: string,
|
||||
): Promise<void> {
|
||||
const dependentInfo: DependentInfo = {
|
||||
@@ -196,7 +196,7 @@ export class AppShowPage {
|
||||
}
|
||||
|
||||
private async configureDep(
|
||||
pkgManifest: Manifest,
|
||||
pkgManifest: T.Manifest,
|
||||
dependencyId: string,
|
||||
): Promise<void> {
|
||||
const dependentInfo: DependentInfo = {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { ChangeDetectionStrategy, Component, Input } from '@angular/core'
|
||||
import { ModalController, ToastController } from '@ionic/angular'
|
||||
import { copyToClipboard, MarkdownComponent } from '@start9labs/shared'
|
||||
import { T } from '@start9labs/start-sdk'
|
||||
import { from } from 'rxjs'
|
||||
import { ApiService } from 'src/app/services/api/embassy-api.service'
|
||||
import { Manifest } from '../../../../../../../../../../core/startos/bindings/Manifest'
|
||||
|
||||
@Component({
|
||||
selector: 'app-show-additional',
|
||||
@@ -12,7 +12,7 @@ import { Manifest } from '../../../../../../../../../../core/startos/bindings/Ma
|
||||
})
|
||||
export class AppShowAdditionalComponent {
|
||||
@Input()
|
||||
manifest!: Manifest
|
||||
manifest!: T.Manifest
|
||||
|
||||
constructor(
|
||||
private readonly modalCtrl: ModalController,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ChangeDetectionStrategy, Component, Input } from '@angular/core'
|
||||
import { T } from '@start9labs/start-sdk'
|
||||
import { ConnectionService } from 'src/app/services/connection.service'
|
||||
import { HealthCheckResult } from '../../../../../../../../../../core/startos/bindings/HealthCheckResult'
|
||||
|
||||
@Component({
|
||||
selector: 'app-show-health-checks',
|
||||
@@ -10,17 +10,17 @@ import { HealthCheckResult } from '../../../../../../../../../../core/startos/bi
|
||||
})
|
||||
export class AppShowHealthChecksComponent {
|
||||
@Input()
|
||||
healthChecks!: Record<string, HealthCheckResult>
|
||||
healthChecks!: Record<string, T.HealthCheckResult>
|
||||
|
||||
readonly connected$ = this.connectionService.connected$
|
||||
|
||||
constructor(private readonly connectionService: ConnectionService) {}
|
||||
|
||||
isLoading(result: HealthCheckResult['result']): boolean {
|
||||
isLoading(result: T.HealthCheckResult['result']): boolean {
|
||||
return result === 'starting' || result === 'loading'
|
||||
}
|
||||
|
||||
isReady(result: HealthCheckResult['result']): boolean {
|
||||
isReady(result: T.HealthCheckResult['result']): boolean {
|
||||
return result !== 'failure' && result !== 'loading'
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ChangeDetectionStrategy, Component, Input } from '@angular/core'
|
||||
import { FullProgress } from '../../../../../../../../../../core/startos/bindings/FullProgress'
|
||||
import { T } from '@start9labs/start-sdk'
|
||||
|
||||
@Component({
|
||||
selector: 'app-show-progress',
|
||||
@@ -9,5 +9,5 @@ import { FullProgress } from '../../../../../../../../../../core/startos/binding
|
||||
})
|
||||
export class AppShowProgressComponent {
|
||||
@Input()
|
||||
phases!: FullProgress['phases']
|
||||
phases!: T.FullProgress['phases']
|
||||
}
|
||||
|
||||
@@ -20,8 +20,7 @@ import {
|
||||
getAllPackages,
|
||||
} from 'src/app/util/get-package-data'
|
||||
import { PatchDB } from 'patch-db-client'
|
||||
import { Status } from '../../../../../../../../../../core/startos/bindings/Status'
|
||||
import { Manifest } from '../../../../../../../../../../core/startos/bindings/Manifest'
|
||||
import { T } from '@start9labs/start-sdk'
|
||||
|
||||
@Component({
|
||||
selector: 'app-show-status',
|
||||
@@ -57,11 +56,11 @@ export class AppShowStatusComponent {
|
||||
return this.pkg.serviceInterfaces
|
||||
}
|
||||
|
||||
get pkgStatus(): Status {
|
||||
get pkgStatus(): T.Status {
|
||||
return this.pkg.status
|
||||
}
|
||||
|
||||
get manifest(): Manifest {
|
||||
get manifest(): T.Manifest {
|
||||
return getManifest(this.pkg)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core'
|
||||
import { HealthCheckResult } from '../../../../../../../../../core/startos/bindings/HealthCheckResult'
|
||||
import { T } from '@start9labs/start-sdk'
|
||||
|
||||
@Pipe({
|
||||
name: 'healthColor',
|
||||
})
|
||||
export class HealthColorPipe implements PipeTransform {
|
||||
transform(val: HealthCheckResult['result']): string {
|
||||
transform(val: T.HealthCheckResult['result']): string {
|
||||
switch (val) {
|
||||
case 'success':
|
||||
return 'success'
|
||||
|
||||
@@ -11,7 +11,7 @@ import { ModalService } from 'src/app/services/modal.service'
|
||||
import { ApiService } from 'src/app/services/api/embassy-api.service'
|
||||
import { from, map, Observable } from 'rxjs'
|
||||
import { PatchDB } from 'patch-db-client'
|
||||
import { Manifest } from '../../../../../../../../../core/startos/bindings/Manifest'
|
||||
import { T } from '@start9labs/start-sdk'
|
||||
|
||||
export interface Button {
|
||||
title: string
|
||||
@@ -99,7 +99,7 @@ export class ToButtonsPipe implements PipeTransform {
|
||||
]
|
||||
}
|
||||
|
||||
private async presentModalInstructions(manifest: Manifest) {
|
||||
private async presentModalInstructions(manifest: T.Manifest) {
|
||||
this.apiService
|
||||
.setDbValue<boolean>(['ack-instructions', manifest.id], true)
|
||||
.catch(e => console.error('Failed to mark instructions as seen', e))
|
||||
|
||||
@@ -4,8 +4,7 @@ import { isEmptyObject } from '@start9labs/shared'
|
||||
import { map, startWith } from 'rxjs/operators'
|
||||
import { PatchDB } from 'patch-db-client'
|
||||
import { Observable } from 'rxjs'
|
||||
import { HealthCheckResult } from '../../../../../../../../../core/startos/bindings/HealthCheckResult'
|
||||
import { Manifest } from '../../../../../../../../../core/startos/bindings/Manifest'
|
||||
import { T } from '@start9labs/start-sdk'
|
||||
|
||||
@Pipe({
|
||||
name: 'toHealthChecks',
|
||||
@@ -14,8 +13,8 @@ export class ToHealthChecksPipe implements PipeTransform {
|
||||
constructor(private readonly patch: PatchDB<DataModel>) {}
|
||||
|
||||
transform(
|
||||
manifest: Manifest,
|
||||
): Observable<Record<string, HealthCheckResult | null> | null> {
|
||||
manifest: T.Manifest,
|
||||
): Observable<Record<string, T.HealthCheckResult | null> | null> {
|
||||
return this.patch.watch$('packageData', manifest.id, 'status', 'main').pipe(
|
||||
map(main => {
|
||||
return main.status === 'running' && !isEmptyObject(main.health)
|
||||
|
||||
@@ -8,7 +8,7 @@ import { PatchDB } from 'patch-db-client'
|
||||
import { take } from 'rxjs/operators'
|
||||
import { DataModel } from 'src/app/services/patch-db/data-model'
|
||||
import { Observable } from 'rxjs'
|
||||
import { MainStatus } from '../../../../../../../../../core/startos/bindings/MainStatus'
|
||||
import { T } from '@start9labs/start-sdk'
|
||||
|
||||
@Component({
|
||||
selector: 'backing-up',
|
||||
@@ -30,7 +30,7 @@ export class BackingUpComponent {
|
||||
name: 'pkgMainStatus',
|
||||
})
|
||||
export class PkgMainStatusPipe implements PipeTransform {
|
||||
transform(pkgId: string): Observable<MainStatus['status']> {
|
||||
transform(pkgId: string): Observable<T.MainStatus['status']> {
|
||||
return this.patch.watch$('packageData', pkgId, 'status', 'main', 'status')
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import { ApiService } from 'src/app/services/api/embassy-api.service'
|
||||
import { ConfigService } from 'src/app/services/config.service'
|
||||
import cbor from 'cbor'
|
||||
import { ErrorToastService } from '@start9labs/shared'
|
||||
import { Manifest } from '../../../../../../../../core/startos/bindings/Manifest'
|
||||
import { T } from '@start9labs/start-sdk'
|
||||
|
||||
interface Positions {
|
||||
[key: string]: [bigint, bigint] // [position, length]
|
||||
@@ -21,7 +21,7 @@ const VERSION = new Uint8Array([1])
|
||||
export class SideloadPage {
|
||||
isMobile = isPlatform(window, 'ios') || isPlatform(window, 'android')
|
||||
toUpload: {
|
||||
manifest: Manifest | null
|
||||
manifest: T.Manifest | null
|
||||
icon: string | null
|
||||
file: File | null
|
||||
} = {
|
||||
|
||||
@@ -24,7 +24,7 @@ import {
|
||||
isUpdating,
|
||||
} from 'src/app/util/get-package-data'
|
||||
import { dryUpdate } from 'src/app/util/dry-update'
|
||||
import { Manifest } from '../../../../../../../core/startos/bindings/Manifest'
|
||||
import { T } from '@start9labs/start-sdk'
|
||||
|
||||
interface UpdatesData {
|
||||
hosts: StoreIdentity[]
|
||||
@@ -70,7 +70,7 @@ export class UpdatesPage {
|
||||
})
|
||||
}
|
||||
|
||||
async tryUpdate(manifest: Manifest, url: string, e: Event): Promise<void> {
|
||||
async tryUpdate(manifest: T.Manifest, url: string, e: Event): Promise<void> {
|
||||
e.stopPropagation()
|
||||
|
||||
const { id, version } = manifest
|
||||
@@ -86,7 +86,7 @@ export class UpdatesPage {
|
||||
}
|
||||
}
|
||||
|
||||
private async dryInstall(manifest: Manifest, url: string) {
|
||||
private async dryInstall(manifest: T.Manifest, url: string) {
|
||||
const { id, version, title } = manifest
|
||||
|
||||
const breakages = dryUpdate(
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core'
|
||||
import { Progress } from '../../../../../../../core/startos/bindings/Progress'
|
||||
import { T } from '@start9labs/start-sdk'
|
||||
|
||||
@Pipe({
|
||||
name: 'installingProgressString',
|
||||
})
|
||||
export class InstallingProgressDisplayPipe implements PipeTransform {
|
||||
transform(progress: Progress): string {
|
||||
transform(progress: T.Progress): string {
|
||||
if (progress === true) return 'finalizing'
|
||||
if (progress === false || !progress.total) return 'unknown %'
|
||||
const percentage = Math.round((100 * progress.done) / progress.total)
|
||||
@@ -18,7 +18,7 @@ export class InstallingProgressDisplayPipe implements PipeTransform {
|
||||
name: 'installingProgress',
|
||||
})
|
||||
export class InstallingProgressPipe implements PipeTransform {
|
||||
transform(progress: Progress): number | null {
|
||||
transform(progress: T.Progress): number | null {
|
||||
if (progress === true) return 1
|
||||
if (progress === false || !progress.total) return null
|
||||
return Number((progress.done / progress.total).toFixed(2))
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core'
|
||||
import { ConfigService } from '../../services/config.service'
|
||||
import { PackageState } from '../../../../../../../core/startos/bindings/PackageState'
|
||||
import { MainStatus } from '../../../../../../../core/startos/bindings/MainStatus'
|
||||
import { T } from '@start9labs/start-sdk'
|
||||
|
||||
@Pipe({
|
||||
name: 'isLaunchable',
|
||||
@@ -10,8 +9,8 @@ export class LaunchablePipe implements PipeTransform {
|
||||
constructor(private configService: ConfigService) {}
|
||||
|
||||
transform(
|
||||
state: PackageState['state'],
|
||||
status: MainStatus['status'],
|
||||
state: T.PackageState['state'],
|
||||
status: T.MainStatus['status'],
|
||||
): boolean {
|
||||
return this.configService.isLaunchable(state, status)
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Pipe, PipeTransform } from '@angular/core'
|
||||
import { PackageDataEntry } from '../../services/patch-db/data-model'
|
||||
import { hasUi } from '../../services/config.service'
|
||||
import { getManifest } from 'src/app/util/get-package-data'
|
||||
import { Manifest } from '../../../../../../../core/startos/bindings/Manifest'
|
||||
import { T } from '@start9labs/start-sdk'
|
||||
|
||||
@Pipe({
|
||||
name: 'hasUi',
|
||||
@@ -17,7 +17,7 @@ export class UiPipe implements PipeTransform {
|
||||
name: 'toManifest',
|
||||
})
|
||||
export class ToManifestPipe implements PipeTransform {
|
||||
transform(pkg: PackageDataEntry): Manifest {
|
||||
transform(pkg: PackageDataEntry): T.Manifest {
|
||||
return getManifest(pkg)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,11 +6,10 @@ import { Metric, NotificationLevel, RR, ServerNotifications } from './api.types'
|
||||
import { BTC_ICON, LND_ICON, PROXY_ICON } from './api-icons'
|
||||
import { DependencyMetadata, MarketplacePkg } from '@start9labs/marketplace'
|
||||
import { Log } from '@start9labs/shared'
|
||||
import { ServerStatus } from '../../../../../../../core/startos/bindings/ServerStatus'
|
||||
import { Manifest } from '../../../../../../../core/startos/bindings/Manifest'
|
||||
import { T } from '@start9labs/start-sdk'
|
||||
|
||||
export module Mock {
|
||||
export const ServerUpdated: ServerStatus = {
|
||||
export const ServerUpdated: T.ServerStatus = {
|
||||
backupProgress: null,
|
||||
updateProgress: null,
|
||||
updated: true,
|
||||
@@ -43,7 +42,7 @@ export module Mock {
|
||||
'0.19.0': 'release notes for Bitcoin 0.19.0',
|
||||
}
|
||||
|
||||
export const MockManifestBitcoind: Manifest = {
|
||||
export const MockManifestBitcoind: T.Manifest = {
|
||||
id: 'bitcoind',
|
||||
title: 'Bitcoin Core',
|
||||
version: '0.21.0',
|
||||
@@ -81,7 +80,7 @@ export module Mock {
|
||||
},
|
||||
}
|
||||
|
||||
export const MockManifestLnd: Manifest = {
|
||||
export const MockManifestLnd: T.Manifest = {
|
||||
id: 'lnd',
|
||||
title: 'Lightning Network Daemon',
|
||||
version: '0.11.1',
|
||||
@@ -129,7 +128,7 @@ export module Mock {
|
||||
},
|
||||
}
|
||||
|
||||
export const MockManifestBitcoinProxy: Manifest = {
|
||||
export const MockManifestBitcoinProxy: T.Manifest = {
|
||||
id: 'btc-rpc-proxy',
|
||||
title: 'Bitcoin Proxy',
|
||||
version: '0.2.2',
|
||||
|
||||
@@ -4,8 +4,7 @@ import { PackagePropertiesVersioned } from 'src/app/util/properties.util'
|
||||
import { ConfigSpec } from 'src/app/pkg-config/config-types'
|
||||
import { DataModel } from 'src/app/services/patch-db/data-model'
|
||||
import { StartOSDiskInfo, LogsRes, ServerLogsReq } from '@start9labs/shared'
|
||||
import { HealthCheckResult } from '../../../../../../../core/startos/bindings/HealthCheckResult'
|
||||
import { Manifest } from '../../../../../../../core/startos/bindings/Manifest'
|
||||
import { T } from '@start9labs/start-sdk'
|
||||
|
||||
export module RR {
|
||||
// DB
|
||||
@@ -245,7 +244,7 @@ export module RR {
|
||||
}
|
||||
|
||||
export type SideloadPackageReq = {
|
||||
manifest: Manifest
|
||||
manifest: T.Manifest
|
||||
icon: string // base64
|
||||
}
|
||||
export type SideloadPacakgeRes = string //guid
|
||||
@@ -515,7 +514,7 @@ export interface DependencyErrorConfigUnsatisfied {
|
||||
|
||||
export interface DependencyErrorHealthChecksFailed {
|
||||
type: 'healthChecksFailed'
|
||||
check: HealthCheckResult
|
||||
check: T.HealthCheckResult
|
||||
}
|
||||
|
||||
export interface DependencyErrorTransitive {
|
||||
|
||||
@@ -37,10 +37,9 @@ import { WebSocketSubjectConfig } from 'rxjs/webSocket'
|
||||
import { AuthService } from '../auth.service'
|
||||
import { ConnectionService } from '../connection.service'
|
||||
import { StoreInfo } from '@start9labs/marketplace'
|
||||
import { FullProgress } from '../../../../../../../core/startos/bindings/FullProgress'
|
||||
import { ServerStatus } from '../../../../../../../core/startos/bindings/ServerStatus'
|
||||
import { T } from '@start9labs/start-sdk'
|
||||
|
||||
const PROGRESS: FullProgress = {
|
||||
const PROGRESS: T.FullProgress = {
|
||||
overall: {
|
||||
done: 0,
|
||||
total: 120,
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
import { DOCUMENT } from '@angular/common'
|
||||
import { Inject, Injectable } from '@angular/core'
|
||||
import { WorkspaceConfig } from '@start9labs/shared'
|
||||
import { types } from '@start9labs/start-sdk'
|
||||
import { PackageDataEntry } from 'src/app/services/patch-db/data-model'
|
||||
import { PackageState } from '../../../../../../core/startos/bindings/PackageState'
|
||||
import { MainStatus } from '../../../../../../core/startos/bindings/MainStatus'
|
||||
import { ExportedOnionHostname } from '../../../../../../core/startos/bindings/ExportedOnionHostname'
|
||||
import { ExportedIpHostname } from '../../../../../../core/startos/bindings/ExportedIpHostname'
|
||||
import { ExportedHostnameInfo } from '../../../../../../core/startos/bindings/ExportedHostnameInfo'
|
||||
import { T } from '@start9labs/start-sdk'
|
||||
import { PackageDataEntry } from './patch-db/data-model'
|
||||
|
||||
const {
|
||||
gitHash,
|
||||
@@ -55,8 +50,8 @@ export class ConfigService {
|
||||
}
|
||||
|
||||
isLaunchable(
|
||||
state: PackageState['state'],
|
||||
status: MainStatus['status'],
|
||||
state: T.PackageState['state'],
|
||||
status: T.MainStatus['status'],
|
||||
): boolean {
|
||||
return state === 'installed' && status === 'running'
|
||||
}
|
||||
@@ -76,13 +71,13 @@ export class ConfigService {
|
||||
|
||||
if (host.kind === 'multi') {
|
||||
const onionHostname = host.hostnames.find(h => h.kind === 'onion')
|
||||
?.hostname as ExportedOnionHostname
|
||||
?.hostname as T.ExportedOnionHostname
|
||||
|
||||
if (this.isTor() && onionHostname) {
|
||||
url.hostname = onionHostname.value
|
||||
} else {
|
||||
const ipHostname = host.hostnames.find(h => h.kind === 'ip')
|
||||
?.hostname as ExportedIpHostname
|
||||
?.hostname as T.ExportedIpHostname
|
||||
|
||||
if (!ipHostname) return ''
|
||||
|
||||
@@ -91,16 +86,16 @@ export class ConfigService {
|
||||
}
|
||||
} else {
|
||||
throw new Error('unimplemented')
|
||||
const hostname = {} as ExportedHostnameInfo // host.hostname
|
||||
// const hostname = {} as T.ExportedHostnameInfo // host.hostname
|
||||
|
||||
if (!hostname) return ''
|
||||
// if (!hostname) return ''
|
||||
|
||||
if (this.isTor() && hostname.kind === 'onion') {
|
||||
url.hostname = (hostname.hostname as ExportedOnionHostname).value
|
||||
} else {
|
||||
url.hostname = this.hostname
|
||||
url.port = String(hostname.hostname.sslPort || hostname.hostname.port)
|
||||
}
|
||||
// if (this.isTor() && hostname.kind === 'onion') {
|
||||
// url.hostname = (hostname.hostname as T.ExportedOnionHostname).value
|
||||
// } else {
|
||||
// url.hostname = this.hostname
|
||||
// url.port = String(hostname.hostname.sslPort || hostname.hostname.port)
|
||||
// }
|
||||
}
|
||||
|
||||
return url.href
|
||||
|
||||
@@ -1,13 +1,6 @@
|
||||
import { Url } from '@start9labs/shared'
|
||||
import { types } from '@start9labs/start-sdk'
|
||||
import { ActionMetadata } from '@start9labs/start-sdk/cjs/sdk/lib/types'
|
||||
import { Public } from '../../../../../../../core/startos/bindings/Public'
|
||||
import { PackageDataEntry as PDE } from '../../../../../../../core/startos/bindings/PackageDataEntry'
|
||||
import { FullProgress } from '../../../../../../../core/startos/bindings/FullProgress'
|
||||
import { Manifest } from '../../../../../../../core/startos/bindings/Manifest'
|
||||
type ServiceInterfaceWithHostInfo = types.ServiceInterfaceWithHostInfo
|
||||
import { T } from '@start9labs/start-sdk'
|
||||
|
||||
export type DataModel = Public & {
|
||||
export type DataModel = T.Public & {
|
||||
ui: UIData
|
||||
packageData: Record<string, PackageDataEntry>
|
||||
}
|
||||
@@ -52,15 +45,16 @@ export interface UIStore {
|
||||
name?: string
|
||||
}
|
||||
|
||||
export type PackageDataEntry<T extends StateInfo = StateInfo> = PDE & {
|
||||
stateInfo: T
|
||||
}
|
||||
export type PackageDataEntry<T extends StateInfo = StateInfo> =
|
||||
T.PackageDataEntry & {
|
||||
stateInfo: T
|
||||
}
|
||||
|
||||
export type StateInfo = InstalledState | InstallingState | UpdatingState
|
||||
|
||||
export type InstalledState = {
|
||||
state: 'installed' | 'removing'
|
||||
manifest: Manifest
|
||||
manifest: T.Manifest
|
||||
installingInfo?: undefined
|
||||
}
|
||||
|
||||
@@ -73,10 +67,10 @@ export type InstallingState = {
|
||||
export type UpdatingState = {
|
||||
state: 'updating'
|
||||
installingInfo: InstallingInfo
|
||||
manifest: Manifest
|
||||
manifest: T.Manifest
|
||||
}
|
||||
|
||||
export type InstallingInfo = {
|
||||
progress: FullProgress
|
||||
newManifest: Manifest
|
||||
progress: T.FullProgress
|
||||
newManifest: T.Manifest
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { PackageDataEntry } from 'src/app/services/patch-db/data-model'
|
||||
import { PkgDependencyErrors } from './dep-error.service'
|
||||
import { Status } from '../../../../../../core/startos/bindings/Status'
|
||||
import { T } from '@start9labs/start-sdk'
|
||||
|
||||
export interface PackageStatus {
|
||||
@@ -28,7 +27,7 @@ export function renderPkgStatus(
|
||||
return { primary, dependency, health }
|
||||
}
|
||||
|
||||
function getInstalledPrimaryStatus(status: Status): PrimaryStatus {
|
||||
function getInstalledPrimaryStatus(status: T.Status): PrimaryStatus {
|
||||
if (!status.configured) {
|
||||
return 'needsConfig'
|
||||
} else {
|
||||
@@ -40,7 +39,7 @@ function getDependencyStatus(depErrors: PkgDependencyErrors): DependencyStatus {
|
||||
return Object.values(depErrors).some(err => !!err) ? 'warning' : 'satisfied'
|
||||
}
|
||||
|
||||
function getHealthStatus(status: Status): T.HealthStatus | null {
|
||||
function getHealthStatus(status: T.Status): T.HealthStatus | null {
|
||||
if (status.main.status !== 'running' || !status.main.health) {
|
||||
return null
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
UpdatingState,
|
||||
} from 'src/app/services/patch-db/data-model'
|
||||
import { firstValueFrom } from 'rxjs'
|
||||
import { Manifest } from '../../../../../../core/startos/bindings/Manifest'
|
||||
import { T } from '@start9labs/start-sdk'
|
||||
|
||||
export async function getPackage(
|
||||
patch: PatchDB<DataModel>,
|
||||
@@ -22,7 +22,7 @@ export async function getAllPackages(
|
||||
return firstValueFrom(patch.watch$('packageData'))
|
||||
}
|
||||
|
||||
export function getManifest(pkg: PackageDataEntry): Manifest {
|
||||
export function getManifest(pkg: PackageDataEntry): T.Manifest {
|
||||
if (isInstalled(pkg) || isRemoving(pkg)) return pkg.stateInfo.manifest
|
||||
|
||||
return (pkg.stateInfo as InstallingState).installingInfo.newManifest
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { PatchDB } from 'patch-db-client'
|
||||
import { DataModel } from 'src/app/services/patch-db/data-model'
|
||||
import { firstValueFrom } from 'rxjs'
|
||||
import { ServerInfo } from '../../../../../../core/startos/bindings/ServerInfo'
|
||||
import { T } from '@start9labs/start-sdk'
|
||||
|
||||
export async function getServerInfo(
|
||||
patch: PatchDB<DataModel>,
|
||||
): Promise<ServerInfo> {
|
||||
): Promise<T.ServerInfo> {
|
||||
return firstValueFrom(patch.watch$('serverInfo'))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user